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

public Class PDSeparation

extends PDSpecialColorSpace
Class Inheritance
Imports
java.awt.Point, java.awt.color.ColorSpace, java.awt.image.BufferedImage, .DataBuffer, .Raster, .WritableRaster, java.io.IOException, java.util.HashMap, .Map, org.apache.pdfbox.cos.COSArray, .COSBase, .COSName, .COSNull, org.apache.pdfbox.pdmodel.common.function.PDFunction

A Separation color space used to specify either additional colorants or for isolating the control of individual colour components of a device colour space for a subtractive device. When such a space is the current colour space, the current colour shall be a single-component value, called a tint, that controls the given colorant or colour components only.
Authors
Ben Litchfield, John Hewson

Field Summary

Modifier and TypeField and Description
private static final int
private PDColorSpace
private static final int
private final PDColor
private static final int
private PDFunction
private Map<Integer, float[]>
toRGBMap

Map used to speed up toRGB(float[]).

Constructor Summary

AccessConstructor and Description
public
PDSeparation()

Creates a new Separation color space.

public
PDSeparation(COSArray
an array containing all separation information.
separation
)

Creates a new Separation color space from a PDF color space array.

Method Summary

Modifier and TypeMethod and Description
public PDColorSpace

Returns:

the name of the colorant
getAlternateColorSpace
()

Returns the colorant name.

public String

Returns:

the name of the colorant
getColorantName
()

Returns the colorant name.

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.

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

public void
setAlternateColorSpace(PDColorSpace
The alternate color space.
colorSpace
)

Sets the alternate color space.

public void
setColorantName(String
the name of the colorant
name
)

Sets the colorant name.

public void
setTintTransform(PDFunction
the tint transform function
tint
)

Sets the tint transform function.

protected void
tintTransform(float[] samples, int[] alt)

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.

private BufferedImage
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Field Detail

ALTERNATE_CSback to summary
private static final int ALTERNATE_CS
alternateColorSpaceback to summary
private PDColorSpace alternateColorSpace
COLORANT_NAMESback to summary
private static final int COLORANT_NAMES
initialColorback to summary
private final PDColor initialColor
TINT_TRANSFORMback to summary
private static final int TINT_TRANSFORM
tintTransformback to summary
private PDFunction tintTransform
toRGBMapback to summary
private Map<Integer, float[]> toRGBMap

Map used to speed up toRGB(float[]). Note that this class contains three maps (this and the two in toRGBImage(java.awt.image.WritableRaster) and toRGBImage2(java.awt.image.WritableRaster). The maps use different key intervals. This map here is needed for shading, which produce more than 256 different float values, which we cast to int so that the map can work.

Constructor Detail

PDSeparationback to summary
public PDSeparation()

Creates a new Separation color space.

PDSeparationback to summary
public PDSeparation(COSArray separation) throws IOException

Creates a new Separation color space from a PDF color space array.

Parameters
separation:COSArray

an array containing all separation information.

Exceptions
IOException:
if the color space or the function could not be created.

Method Detail

getAlternateColorSpaceback to summary
public PDColorSpace getAlternateColorSpace()

Returns the colorant name.

Returns:PDColorSpace

the name of the colorant

getColorantNameback to summary
public String getColorantName()

Returns the colorant name.

Returns:String

the name of the colorant

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
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
setAlternateColorSpaceback to summary
public void setAlternateColorSpace(PDColorSpace colorSpace)

Sets the alternate color space.

Parameters
colorSpace:PDColorSpace

The alternate color space.

setColorantNameback to summary
public void setColorantName(String name)

Sets the colorant name.

Parameters
name:String

the name of the colorant

setTintTransformback to summary
public void setTintTransform(PDFunction tint)

Sets the tint transform function.

Parameters
tint:PDFunction

the tint transform function

tintTransformback to summary
protected void tintTransform(float[] samples, int[] alt) throws IOException
toRawImageback to summary
public BufferedImage toRawImage(WritableRaster raster)

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
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
toRGBImage2back to summary
private BufferedImage toRGBImage2(WritableRaster raster) throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override