## com.lowagie.text.rtf.style
Class RtfColor

    java.lang.Object
      com.lowagie.text.rtf.RtfElement
          com.lowagie.text.rtf.style.RtfColor

All Implemented Interfaces:
  RtfBasicElement, RtfExtendedElement

    public class RtfColor

extends RtfElement
implements RtfExtendedElement

The RtfColor stores one rtf color value for a rtf document

Version:
  $Version:$
Author:
  Mark Hall (mhall@edu.uni-klu.ac.at)

Field Summary
`private int` `blue` The blue value
`private static byte` `COLON` Constant for the end of one color entry
`private static byte[]` `COLOR_BLUE` Constant for BLUE value
`private static byte[]` `COLOR_GREEN` Constant for GREEN value
`private static byte[]` `COLOR_NUMBER` Constant for the number of the colour in the list of colours
`private static byte[]` `COLOR_RED` Constant for RED value
`private int` `colorNumber` The number of the colour in the list of colours
`private int` `green` The green value
`private int` `red` The red value

Fields inherited from class com.lowagie.text.rtf.RtfElement
`document, inHeader, inTable`

Fields inherited from interface com.lowagie.text.rtf.RtfBasicElement
`CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR`

Constructor Summary
`` `RtfColor(RtfDocument doc, java.awt.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
`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

Method Summary
`boolean` `equals(java.lang.Object obj)` Tests if this RtfColor is equal to another RtfColor.
`int` `getBlue()` Get the blue value of this RtfColor
`int` `getColorNumber()` Gets the number of this RtfColor in the list of colours
`int` `getGreen()` Get the green value of this RtfColor
`int` `getRed()` Get the red value of this RtfColor
`int` `hashCode()` Returns the hash code of this RtfColor.
`void` `setRtfDocument(RtfDocument doc)` Sets the RtfDocument this RtfColor belongs to
`byte[]` `writeBegin()` Writes the beginning of this RtfColor
`byte[]` `writeDefinition()` Write the definition part of this RtfColor.
`byte[]` `writeEnd()` Unused

Methods inherited from class com.lowagie.text.rtf.RtfElement
`intToByteArray, isInTable, setInHeader, setInTable, write`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.lowagie.text.rtf.RtfBasicElement
`setInHeader, setInTable, write`

Field Detail

### COLOR_RED

    private static final byte[] COLOR_RED

  Constant for RED value

### COLOR_GREEN

    private static final byte[] COLOR_GREEN

  Constant for GREEN value

### COLOR_BLUE

    private static final byte[] COLOR_BLUE

  Constant for BLUE value

### COLON

    private static final byte COLON

  Constant for the end of one color entry

  See Also:
    Constant Field Values

### COLOR_NUMBER

    private static final byte[] COLOR_NUMBER

  Constant for the number of the colour in the list of colours

### colorNumber

    private int colorNumber

  The number of the colour in the list of colours

### red

    private int red

  The red value

### green

    private int green

  The green value

### blue

    private int blue

  The blue 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,
                    java.awt.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

### writeDefinition

    public byte[] writeDefinition()

  Write the definition part of this RtfColor.

  Specified by:
    `writeDefinition` in interface `RtfExtendedElement`
  Returns:
    A byte array with the definition of this colour

### writeBegin

    public byte[] writeBegin()

  Writes the beginning of this RtfColor

  Returns:
    A byte array with the colour start data

### writeEnd

    public byte[] writeEnd()

  Unused

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

### equals

    public boolean equals(java.lang.Object obj)

  Tests if this RtfColor is equal to another RtfColor.

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - another RtfColor
  Returns:
    `True` if red, green and blue values of the two colours match, `false` otherwise.

### 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.

  Overrides:
    `hashCode` in class `java.lang.Object`
  Returns:
    The hash code of this RtfColor

### getBlue

    public int getBlue()

  Get the blue value of this RtfColor

  Returns:
    The blue value

### 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

### getColorNumber

    public int getColorNumber()

  Gets the number of this RtfColor in the list of colours

  Returns:
    Returns the colorNumber.

### setRtfDocument

    public void setRtfDocument(RtfDocument doc)

  Sets the RtfDocument this RtfColor belongs to

  Specified by:
    `setRtfDocument` in interface `RtfBasicElement`
  Overrides:
    `setRtfDocument` in class `RtfElement`
  Parameters:
    `doc` - The RtfDocument to use