Package 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,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 $
- Author:
- Mark Hall (Mark.Hall@mail.room3b.eu), Thomas Bickel (tmb99@inode.at)
-
-
Field Summary
-
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
Constructors Modifier Constructor Description RtfColor(RtfDocument doc, int red, int green, int blue)Constructs a RtfColor based on the red/green/blue valuesprotectedRtfColor(RtfDocument doc, int red, int green, int blue, int colorNumber)Constructor only for use when initializing the RtfColorListRtfColor(RtfDocument doc, RtfColor col)Constructs a RtfColor as a clone of an existing RtfColorRtfColor(RtfDocument doc, java.awt.Color col)Constructs a RtfColor based on the Color
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Tests if this RtfColor is equal to another RtfColor.intgetBlue()Get the blue value of this RtfColorintgetColorNumber()Gets the number of this RtfColor in the list of colorsintgetGreen()Get the green value of this RtfColorintgetRed()Get the red value of this RtfColorinthashCode()Returns the hash code of this RtfColor.voidsetRtfDocument(RtfDocument doc)Sets the RtfDocument this RtfColor belongs tovoidwriteBegin(java.io.OutputStream result)Writes the beginning of this RtfColorvoidwriteContent(java.io.OutputStream out)unusedvoidwriteDefinition(java.io.OutputStream result)Write the definition part of this RtfColor.voidwriteEnd(java.io.OutputStream result)Unused-
Methods inherited from class com.lowagie.text.rtf.RtfElement
intToByteArray, isInTable, setInHeader, setInTable
-
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
-
-
-
-
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 tored- The red value to usegreen- The green value to useblue- The blue value to usecolorNumber- 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 tocol- 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 tocol- 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 tored- The red value to usegreen- The green value to useblue- The blue value to use
-
-
Method Detail
-
writeContent
public void writeContent(java.io.OutputStream out) throws java.io.IOExceptionunused- Specified by:
writeContentin interfaceRtfBasicElement- Specified by:
writeContentin classRtfElement- Parameters:
out- TheOutputStreamto write the content to- Throws:
java.io.IOException
-
writeDefinition
public void writeDefinition(java.io.OutputStream result) throws java.io.IOExceptionWrite the definition part of this RtfColor.- Specified by:
writeDefinitionin interfaceRtfExtendedElement- Parameters:
result- TheOutputStreamto write the element definition to- Throws:
java.io.IOException
-
writeBegin
public void writeBegin(java.io.OutputStream result)
Writes the beginning of this RtfColor
-
writeEnd
public void writeEnd(java.io.OutputStream result)
Unused- Parameters:
result- TheOutputStreamto which nothing will be written
-
equals
public boolean equals(java.lang.Object obj)
Tests if this RtfColor is equal to another RtfColor.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- another RtfColor- Returns:
Trueif red, green and blue values of the two colors match,falseotherwise.
-
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:
hashCodein classjava.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 colors- Returns:
- Returns the colorNumber.
-
setRtfDocument
public void setRtfDocument(RtfDocument doc)
Sets the RtfDocument this RtfColor belongs to- Specified by:
setRtfDocumentin interfaceRtfBasicElement- Overrides:
setRtfDocumentin classRtfElement- Parameters:
doc- The RtfDocument to use
-
-