Class RtfColorTable
java.lang.Object
org.apache.fop.render.rtf.rtflib.rtfdoc.RtfColorTable
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private Hashtable
Index table for the colorsprivate Vector
Used colors to this vectorprivate static final int
private static RtfColorTable
Singelton instanceprivate Hashtable
Map of color names to color numbersprivate static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Adds a color to the table.private void
addNamedColor
(String name, int colorNumber) define a named color for getColorNumber(String)private int
determineColorLevel
(int identifier, int color) Determines the color level from the identifier.private int
determineIdentifier
(int red, int green, int blue) Determines a identifier for the color.getColorNumber
(int red, int green, int blue) Gets the number of color in the color tablegetColorNumber
(String name) static RtfColorTable
Singelton.private void
init()
Initialize the color table.void
writeColors
(RtfHeader header) Writes the color table in the header.
-
Field Details
-
RED
private static final int RED- See Also:
-
GREEN
private static final int GREEN- See Also:
-
BLUE
private static final int BLUE- See Also:
-
instance
Singelton instance -
colorIndex
Index table for the colors -
colorTable
Used colors to this vector -
namedColors
Map of color names to color numbers
-
-
Constructor Details
-
RtfColorTable
private RtfColorTable()Constructor.
-
-
Method Details
-
getInstance
Singelton.- Returns:
- The instance of RTFColorTable
-
init
private void init()Initialize the color table. -
addNamedColor
define a named color for getColorNumber(String) -
getColorNumber
- Parameters:
name
- a named color- Returns:
- the RTF number of a named color, or null if name not found
-
getColorNumber
Gets the number of color in the color table- Parameters:
red
- Color level redgreen
- Color level greenblue
- Color level blue- Returns:
- The number of the color in the table
-
writeColors
Writes the color table in the header.- Parameters:
header
- The header container to write in- Throws:
IOException
- On error
-
addColor
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 redgreen
- Color level greenblue
- 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 identifiercolor
- One of the bit moving constants- Returns:
- Color level in byte size
-