Class RtfColorTable

java.lang.Object
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable

public final class RtfColorTable extends Object
Singelton of the RTF color table. This class was created for fo:basic-link tag processing. This work was originally authored by Andreas Putz
  • Field Details

  • Constructor Details

    • RtfColorTable

      private RtfColorTable()
      Constructor.
  • Method Details

    • getInstance

      public static RtfColorTable getInstance()
      Singelton.
      Returns:
      The instance of RTFColorTable
    • init

      private void init()
      Initialize the color table.
    • addNamedColor

      private void addNamedColor(String name, int colorNumber)
      define a named color for getColorNumber(String)
    • getColorNumber

      public Integer getColorNumber(String name)
      Parameters:
      name - a named color
      Returns:
      the RTF number of a named color, or null if name not found
    • getColorNumber

      public Integer getColorNumber(int red, int green, int blue)
      Gets the number of color in the color table
      Parameters:
      red - Color level red
      green - Color level green
      blue - Color level blue
      Returns:
      The number of the color in the table
    • writeColors

      public void writeColors(RtfHeader header) throws IOException
      Writes the color table in the header.
      Parameters:
      header - The header container to write in
      Throws:
      IOException - On error
    • addColor

      private void addColor(Integer i)
      Adds a color to the table.
      Parameters:
      i - Identifier of color
    • determineIdentifier

      private int determineIdentifier(int red, int green, int blue)
      Determines a identifier for the color.
      Parameters:
      red - Color level red
      green - Color level green
      blue - Color level blue
      Returns:
      Unique identifier of color
    • determineColorLevel

      private int determineColorLevel(int identifier, int color)
      Determines the color level from the identifier.
      Parameters:
      identifier - Unique color identifier
      color - One of the bit moving constants
      Returns:
      Color level in byte size