Class RtfColor

java.lang.Object
com.lowagie.text.rtf.RtfElement
com.lowagie.text.rtf.style.RtfColor
All Implemented Interfaces:
RtfBasicElement, RtfExtendedElement, com.lowagie.text.RtfElementInterface

public class RtfColor extends RtfElement implements RtfExtendedElement
The RtfColor stores one rtf color value for a rtf document
Version:
$Id: RtfColor.java 3580 2008-08-06 15:52:00Z howard_s $
  • Field Details

    • 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:
    • COLOR_NUMBER

      private static final byte[] COLOR_NUMBER
      Constant for the number of the color in the list of colors
    • colorNumber

      private int colorNumber
      The number of the color in the list of colors
    • red

      private int red
      The red value
    • green

      private int green
      The green value
    • blue

      private int blue
      The blue value
  • Constructor Details

    • 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 color in the color 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 Details

    • writeContent

      public void writeContent(OutputStream out) throws IOException
      unused
      Specified by:
      writeContent in interface RtfBasicElement
      Specified by:
      writeContent in class RtfElement
      Parameters:
      out - The OutputStream to write the content to
      Throws:
      IOException
    • writeDefinition

      public void writeDefinition(OutputStream result) throws IOException
      Write the definition part of this RtfColor.
      Specified by:
      writeDefinition in interface RtfExtendedElement
      Parameters:
      result - The OutputStream to write the element definition to
      Throws:
      IOException
    • writeBegin

      public void writeBegin(OutputStream result)
      Writes the beginning of this RtfColor
    • writeEnd

      public void writeEnd(OutputStream result)
      Unused
      Parameters:
      result - The OutputStream to which nothing will be written
    • equals

      public boolean equals(Object obj)
      Tests if this RtfColor is equal to another RtfColor.
      Overrides:
      equals in class Object
      Parameters:
      obj - another RtfColor
      Returns:
      True if red, green and blue values of the two colors 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 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 colors
      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