Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.graphics.color

public Class PDDeviceCMYK

extends PDDeviceColorSpace
Class Inheritance
Imports
java.util.Arrays, org.apache.pdfbox.cos.COSName, java.awt.color.ColorSpace, .ICC_ColorSpace, .ICC_Profile, java.awt.image.BufferedImage, .WritableRaster, java.io.BufferedInputStream, .IOException, .InputStream

Allows colors to be specified according to the subtractive CMYK (cyan, magenta, yellow, black) model typical of printers and other paper-based output devices.
Authors
John Hewson, Ben Litchfield

Field Summary

Modifier and TypeField and Description
private ICC_ColorSpace
private volatile boolean
private final PDColor
public static PDDeviceCMYK
INSTANCE

The single instance of this class.

private boolean

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public float[]
getDefaultDecode(int
the number of bits per component.
bitsPerComponent
)

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getDefaultDecode.

Returns the default decode array for this color space.

protected ICC_Profile
public PDColor
getInitialColor()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getInitialColor.

Returns the initial color value for this color space.

public String
getName()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getName.

Returns the name of the color space.

public int
getNumberOfComponents()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getNumberOfComponents.

Returns the number of components in this color space

protected void
init()

Lazy load the ICC profile, because it's slow.

public BufferedImage
toRawImage(WritableRaster
the source raster
raster
)

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRawImage.

Returns the image in this colorspace or null.

public float[]
toRGB(float[]
a color value with component values between 0 and 1
value
)

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGB.

Returns the RGB equivalent of the given color value.

public BufferedImage
toRGBImage(WritableRaster
the source raster
raster
)

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImage.

Returns the (A)RGB equivalent of the given raster.

protected BufferedImage
toRGBImageAWT(WritableRaster
the source raster
raster
,
ColorSpace
the AWT
colorSpace
)

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImageAWT.

Returns the (A)RGB equivalent of the given raster, using the given AWT color space to perform the conversion.

Inherited from org.apache.pdfbox.pdmodel.graphics.color.PDDeviceColorSpace:
getCOSObjecttoString

Field Detail

awtColorSpaceback to summary
private ICC_ColorSpace awtColorSpace
initDoneback to summary
private volatile boolean initDone
initialColorback to summary
private final PDColor initialColor
INSTANCEback to summary
public static PDDeviceCMYK INSTANCE

The single instance of this class.

usePureJavaCMYKConversionback to summary
private boolean usePureJavaCMYKConversion

Constructor Detail

PDDeviceCMYKback to summary
protected PDDeviceCMYK()

Method Detail

getDefaultDecodeback to summary
public float[] getDefaultDecode(int bitsPerComponent)

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getDefaultDecode.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getDefaultDecode.

Returns the default decode array for this color space.

Parameters
bitsPerComponent:int

the number of bits per component.

Returns:float[]

the default decode array

Annotations
@Override
getICCProfileback to summary
protected ICC_Profile getICCProfile() throws IOException
getInitialColorback to summary
public PDColor getInitialColor()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getInitialColor.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getInitialColor.

Returns the initial color value for this color space.

Returns:PDColor

the initial color value for this color space

Annotations
@Override
getNameback to summary
public String getName()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getName.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getName.

Returns the name of the color space.

Returns:String

the name of the color space

Annotations
@Override
getNumberOfComponentsback to summary
public int getNumberOfComponents()

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getNumberOfComponents.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.getNumberOfComponents.

Returns the number of components in this color space

Returns:int

the number of components in this color space

Annotations
@Override
initback to summary
protected void init() throws IOException

Lazy load the ICC profile, because it's slow.

Exceptions
IOException:
if the ICC profile could not be initialized
toRawImageback to summary
public BufferedImage toRawImage(WritableRaster raster) throws IOException

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRawImage.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRawImage.

Returns the image in this colorspace or null. No conversion is performed. For special colorspaces like PDSeparation the image is returned in the gray colorspace. For undefined colorspaces like DeviceCMYK/DeviceRGB and DeviceGray null is returned. You can always fallback to toRGBImage(WritableRaster) if this returns null.

Parameters
raster:WritableRaster

the source raster

Returns:BufferedImage

an buffered image in this colorspace. Or null if it is not possible to extract that image with the original colorspace without conversion.

Annotations
@Override
Exceptions
IOException:
if the image conversion fails
toRGBback to summary
public float[] toRGB(float[] value) throws IOException

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGB.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGB.

Returns the RGB equivalent of the given color value.

Parameters
value:float[]

a color value with component values between 0 and 1

Returns:float[]

an array of R,G,B value between 0 and 255

Annotations
@Override
Exceptions
IOException:
if the color conversion fails
toRGBImageback to summary
public BufferedImage toRGBImage(WritableRaster raster) throws IOException

Implements abstract org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImage.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImage.

Returns the (A)RGB equivalent of the given raster.

Parameters
raster:WritableRaster

the source raster

Returns:BufferedImage

an (A)RGB buffered image

Annotations
@Override
Exceptions
IOException:
if the color conversion fails
toRGBImageAWTback to summary
protected BufferedImage toRGBImageAWT(WritableRaster raster, ColorSpace colorSpace)

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImageAWT.

Doc from org.apache.pdfbox.pdmodel.graphics.color.PDColorSpace.toRGBImageAWT.

Returns the (A)RGB equivalent of the given raster, using the given AWT color space to perform the conversion.

Parameters
raster:WritableRaster

the source raster

colorSpace:ColorSpace

the AWT

Returns:BufferedImage

an (A)RGB buffered image

Annotations
@Override