com.lowagie.text.rtf.style

Class RtfColor

public class RtfColor extends RtfElement implements RtfExtendedElement

The RtfColor stores one rtf color value for a rtf document

Version: $Id: RtfColor.java 2776 2007-05-23 20:01:40Z hallm $

Author: Mark Hall (mhall@edu.uni-klu.ac.at) Thomas Bickel (tmb99@inode.at)

Field Summary
intblue
The blue value
intcolorNumber
The number of the colour in the list of colours
static byteCOLON
Constant for the end of one color entry
static byte[]COLOR_BLUE
Constant for BLUE value
static byte[]COLOR_GREEN
Constant for GREEN value
static byte[]COLOR_NUMBER
Constant for the number of the colour in the list of colours
static byte[]COLOR_RED
Constant for RED value
intgreen
The green value
intred
The red value
Constructor Summary
protected RtfColor(RtfDocument doc, int red, int green, int blue, int colorNumber)
Constructor only for use when initializing the RtfColorList
RtfColor(RtfDocument doc, RtfColor col)
Constructs a RtfColor as a clone of an existing RtfColor
RtfColor(RtfDocument doc, Color col)
Constructs a RtfColor based on the Color
RtfColor(RtfDocument doc, int red, int green, int blue)
Constructs a RtfColor based on the red/green/blue values
Method Summary
booleanequals(Object obj)
Tests if this RtfColor is equal to another RtfColor.
intgetBlue()
Get the blue value of this RtfColor
intgetColorNumber()
Gets the number of this RtfColor in the list of colours
intgetGreen()
Get the green value of this RtfColor
intgetRed()
Get the red value of this RtfColor
inthashCode()
Returns the hash code of this RtfColor.
voidsetRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfColor belongs to
byte[]write()
unused
byte[]writeBegin()
Writes the beginning of this RtfColor
voidwriteContent(OutputStream out)
unused
byte[]writeDefinition()
Write the definition part of this RtfColor.
voidwriteDefinition(OutputStream result)
Write the definition part of this RtfColor.
byte[]writeEnd()
Unused

Field Detail

blue

private int blue
The blue value

colorNumber

private int colorNumber
The number of the colour in the list of colours

COLON

private static final byte COLON
Constant for the end of one color entry

COLOR_BLUE

private static final byte[] COLOR_BLUE
Constant for BLUE value

COLOR_GREEN

private static final byte[] COLOR_GREEN
Constant for GREEN value

COLOR_NUMBER

private static final byte[] COLOR_NUMBER
Constant for the number of the colour in the list of colours

COLOR_RED

private static final byte[] COLOR_RED
Constant for RED value

green

private int green
The green value

red

private int red
The red value

Constructor Detail

RtfColor

protected RtfColor(RtfDocument doc, int red, int green, int blue, int colorNumber)
Constructor only for use when initializing the RtfColorList

Parameters: doc The RtfDocument this RtfColor belongs to red The red value to use green The green value to use blue The blue value to use colorNumber The number of the colour in the colour list

RtfColor

public RtfColor(RtfDocument doc, RtfColor col)
Constructs a RtfColor as a clone of an existing RtfColor

Parameters: doc The RtfDocument this RtfColor belongs to col The RtfColor to use as a base

RtfColor

public RtfColor(RtfDocument doc, Color col)
Constructs a RtfColor based on the Color

Parameters: doc The RtfDocument this RtfColor belongs to col The Color to base this RtfColor on

RtfColor

public RtfColor(RtfDocument doc, int red, int green, int blue)
Constructs a RtfColor based on the red/green/blue values

Parameters: doc The RtfDocument this RtfColor belongs to red The red value to use green The green value to use blue The blue value to use

Method Detail

equals

public boolean equals(Object obj)
Tests if this RtfColor is equal to another RtfColor.

Parameters: obj another RtfColor

Returns: True if red, green and blue values of the two colours match, false otherwise.

getBlue

public int getBlue()
Get the blue value of this RtfColor

Returns: The blue value

getColorNumber

public int getColorNumber()
Gets the number of this RtfColor in the list of colours

Returns: Returns the colorNumber.

getGreen

public int getGreen()
Get the green value of this RtfColor

Returns: The green value

getRed

public int getRed()
Get the red value of this RtfColor

Returns: The red value

hashCode

public int hashCode()
Returns the hash code of this RtfColor. The hash code is an integer with the lowest three bytes containing the values of red, green and blue.

Returns: The hash code of this RtfColor

setRtfDocument

public void setRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfColor belongs to

Parameters: doc The RtfDocument to use

write

public byte[] write()

Deprecated: replaced by writeContent

unused

writeBegin

public byte[] writeBegin()
Writes the beginning of this RtfColor

Returns: A byte array with the colour start data

writeContent

public void writeContent(OutputStream out)
unused

writeDefinition

public byte[] writeDefinition()

Deprecated: replaced by writeDefinition

Write the definition part of this RtfColor.

Returns: A byte array with the definition of this colour

writeDefinition

public void writeDefinition(OutputStream result)
Write the definition part of this RtfColor.

writeEnd

public byte[] writeEnd()
Unused

Returns: An empty (byte[0]) byte array