public class PDFColor extends PDFPathPaint
Use of this class is discouraged. PDFColorHandler
is now used for in-content color
selection. For masked bitmaps, it may be wiser to switch to Color
in the long run.
colorSpace
Constructor and Description |
---|
PDFColor(java.awt.Color col)
Create a PDF color from a java.awt.Color object.
|
PDFColor(double theRed,
double theGreen,
double theBlue)
Create a PDF color with double values ranging from 0 to 1.
|
PDFColor(double theCyan,
double theMagenta,
double theYellow,
double theBlack)
Create a PDF color with CMYK values.
|
PDFColor(int theRed,
int theGreen,
int theBlue)
Create a PDF color with int values ranging from 0 to 255
|
Modifier and Type | Method and Description |
---|---|
double |
black()
Get the black component.
|
double |
blue()
Get the blue component.
|
int |
blue255()
Get the blue integer component.
|
protected boolean |
contentEquals(PDFObject obj)
Check if the other PDFObject has the same content as the current object.
|
protected void |
convertCMYKtoGRAY()
Convert the color from CMYK to Gray.
|
protected void |
convertCMYKtoRGB()
Convert the color from CMYK to RGB.
|
protected void |
convertGRAYtoCMYK()
Convert the color from Gray to CMYK.
|
protected void |
convertGRAYtoRGB()
Convert the color from Gray to RGB.
|
protected void |
convertRGBtoCMYK()
Convert the color from RGB to CMYK.
|
protected void |
convertRGBtoGRAY()
Convert the color from RGB to Gray.
|
double |
cyan()
Get the cyan component.
|
java.lang.String |
getColorSpaceOut(boolean fillNotStroke)
Get the PDF output string for this color.
|
java.util.List |
getVector()
Return a vector representation of the color
in the appropriate colorspace.
|
double |
green()
Get the green component.
|
int |
green255()
Get the green integer component.
|
double |
magenta()
Get the magenta component.
|
double |
red()
Get the red component.
|
int |
red255()
Get the red integer component.
|
void |
setColorSpace(int theColorSpace)
Set the color space for this color.
|
byte[] |
toPDF()
Create pdf.
|
double |
yellow()
Get the yellow component.
|
getColorSpace
encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, output, outputInline, referencePDF, setDocument, setObjectNumber, setParent, toPDFString
public PDFColor(double theRed, double theGreen, double theBlue)
theRed
- the red double valuetheGreen
- the green double valuetheBlue
- the blue double valuepublic PDFColor(java.awt.Color col)
col
- the java.awt.Color object for which to create a PDFColor objectpublic PDFColor(int theRed, int theGreen, int theBlue)
theRed
- the red integer valuetheGreen
- the green integer valuetheBlue
- the blue integer valuepublic PDFColor(double theCyan, double theMagenta, double theYellow, double theBlack)
theCyan
- the cyan valuetheMagenta
- the magenta valuetheYellow
- the yellow valuetheBlack
- the black valuepublic java.util.List getVector()
public double red()
public double green()
public double blue()
public int red255()
public int green255()
public int blue255()
public double cyan()
public double magenta()
public double yellow()
public double black()
public void setColorSpace(int theColorSpace)
setColorSpace
in class PDFPathPaint
theColorSpace
- the new color spacepublic java.lang.String getColorSpaceOut(boolean fillNotStroke)
getColorSpaceOut
in class PDFPathPaint
fillNotStroke
- whether to return fill or stroke commandprotected void convertCMYKtoRGB()
protected void convertRGBtoCMYK()
protected void convertGRAYtoRGB()
protected void convertGRAYtoCMYK()
protected void convertCMYKtoGRAY()
protected void convertRGBtoGRAY()
public byte[] toPDF()
protected boolean contentEquals(PDFObject obj)
Note: This function has a contract which is less binding than
Object.equals(Object)
. Whereas equals would require all values to be
identical, this method is not required to check everything. In the case
of PDFObjects, this means that the overriding function does not have to
check for PDFObject.getObjectID()
.
contentEquals
in class PDFObject
obj
- object to compare to.Copyright 1999-2012 The Apache Software Foundation. All Rights Reserved.