Package org.apache.fop.pdf
Class PDFDeviceColorSpace
- java.lang.Object
-
- org.apache.fop.pdf.PDFDeviceColorSpace
-
- All Implemented Interfaces:
PDFColorSpace
public class PDFDeviceColorSpace extends java.lang.Object implements PDFColorSpace
Represents a device-specific color space. Used for mapping DeviceRGB, DeviceCMYK and DeviceGray.
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentColorSpace
Current color space value.static int
DEVICE_CMYK
CMYK colorspacestatic int
DEVICE_GRAY
Gray colorspacestatic int
DEVICE_RGB
RGB colorspacestatic int
DEVICE_UNKNOWN
Unknown colorspace
-
Constructor Summary
Constructors Constructor Description PDFDeviceColorSpace(int theColorSpace)
Create a PDF colorspace object.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getColorSpace()
Get the colorspace valuejava.lang.String
getName()
int
getNumComponents()
Get the number of color components for this colorspaceboolean
isCMYKColorSpace()
boolean
isDeviceColorSpace()
boolean
isGrayColorSpace()
boolean
isRGBColorSpace()
void
setColorSpace(int theColorSpace)
Set the current colorspace.static PDFDeviceColorSpace
toPDFColorSpace(java.awt.color.ColorSpace cs)
Returns a suitablePDFDeviceColorSpace
object given aColorSpace
object.
-
-
-
Field Detail
-
DEVICE_UNKNOWN
public static final int DEVICE_UNKNOWN
Unknown colorspace- See Also:
- Constant Field Values
-
DEVICE_GRAY
public static final int DEVICE_GRAY
Gray colorspace- See Also:
- Constant Field Values
-
DEVICE_RGB
public static final int DEVICE_RGB
RGB colorspace- See Also:
- Constant Field Values
-
DEVICE_CMYK
public static final int DEVICE_CMYK
CMYK colorspace- See Also:
- Constant Field Values
-
currentColorSpace
protected int currentColorSpace
Current color space value.
-
-
Method Detail
-
setColorSpace
public void setColorSpace(int theColorSpace)
Set the current colorspace.- Parameters:
theColorSpace
- the new color space value
-
getColorSpace
public int getColorSpace()
Get the colorspace value- Returns:
- the colorspace value
-
getNumComponents
public int getNumComponents()
Get the number of color components for this colorspace- Specified by:
getNumComponents
in interfacePDFColorSpace
- Returns:
- the number of components
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfacePDFColorSpace
- Returns:
- the name of the color space
-
isDeviceColorSpace
public boolean isDeviceColorSpace()
- Specified by:
isDeviceColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is a device-dependent color space (like DeviceRGB, DeviceCMYK and DeviceGray)
-
isRGBColorSpace
public boolean isRGBColorSpace()
- Specified by:
isRGBColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an RGB color space
-
isCMYKColorSpace
public boolean isCMYKColorSpace()
- Specified by:
isCMYKColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an CMYK color space
-
isGrayColorSpace
public boolean isGrayColorSpace()
- Specified by:
isGrayColorSpace
in interfacePDFColorSpace
- Returns:
- true if the color space is an Gray color space
-
toPDFColorSpace
public static PDFDeviceColorSpace toPDFColorSpace(java.awt.color.ColorSpace cs)
Returns a suitablePDFDeviceColorSpace
object given aColorSpace
object.- Parameters:
cs
- ColorSpace instance- Returns:
- a PDF-based color space
-
-