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

public Class PDDeviceN

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

DeviceN colour spaces may contain an arbitrary number of colour components. DeviceN represents a colour space containing multiple components that correspond to colorants of some target device. As with Separation colour spaces, readers are able to approximate the colorants if they are not available on the current output device, such as a display
Authors
John Hewson, Ben Litchfield

Field Summary

Modifier and TypeField and Description
private static final int
private PDColorSpace
private PDDeviceNAttributes
private static final int
private int[]
private static final int
private PDColor
private int
private PDColorSpace
private PDSeparation[]
private static final int
private PDFunction

Constructor Summary

AccessConstructor and Description
public
PDDeviceN()

Creates a new DeviceN color space.

public
PDDeviceN(COSArray
an array containing the color space information
deviceN
)

Creates a new DeviceN color space from the given COS array.

Method Summary

Modifier and TypeMethod and Description
public PDColorSpace

Returns:

The alternate color space.
getAlternateColorSpace
()

This will get the alternate color space for this separation.

public PDDeviceNAttributes

Returns:

the DeviceN attributes
getAttributes
()

Returns the attributes associated with the DeviceN color space.

public List<String>

Returns:

the list of colorants
getColorantNames
()

Returns the list of colorants.

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 final int
getNumberOfComponents()

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

Returns the number of components in this color space

public PDFunction

Returns:

The tint transform function.
getTintTransform
()

This will get the tint transform function.

private void
public boolean

Returns:

true if subtype is NChannel
isNChannel
()

Returns true if this color space has the NChannel subtype.

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

This will set the alternate color space.

public void
setAttributes(PDDeviceNAttributes
the color space attributes, or null
attributes
)

Sets the color space attributes.

public void
setColorantNames(List<String>
the list of colorants
names
)

Sets the list of colorants

public void
setTintTransform(PDFunction
The tint transform function.
tint
)

This will set the tint transform function.

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
private float[]
toRGBWithAttributes(float[] value)

private BufferedImage
private float[]
toRGBWithTintTransform(float[] value)

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
attributesback to summary
private PDDeviceNAttributes attributes
COLORANT_NAMESback to summary
private static final int COLORANT_NAMES
colorantToComponentback to summary
private int[] colorantToComponent
DEVICEN_ATTRIBUTESback to summary
private static final int DEVICEN_ATTRIBUTES
initialColorback to summary
private PDColor initialColor
numColorantsback to summary
private int numColorants
processColorSpaceback to summary
private PDColorSpace processColorSpace
spotColorSpacesback to summary
private PDSeparation[] spotColorSpaces
TINT_TRANSFORMback to summary
private static final int TINT_TRANSFORM
tintTransformback to summary
private PDFunction tintTransform

Constructor Detail

PDDeviceNback to summary
public PDDeviceN()

Creates a new DeviceN color space.

PDDeviceNback to summary
public PDDeviceN(COSArray deviceN) throws IOException

Creates a new DeviceN color space from the given COS array.

Parameters
deviceN:COSArray

an array containing the color space information

Exceptions
IOException:
if the colorspace could not be created

Method Detail

getAlternateColorSpaceback to summary
public PDColorSpace getAlternateColorSpace() throws IOException

This will get the alternate color space for this separation.

Returns:PDColorSpace

The alternate color space.

Exceptions
IOException:
If there is an error getting the alternate color space.
getAttributesback to summary
public PDDeviceNAttributes getAttributes()

Returns the attributes associated with the DeviceN color space.

Returns:PDDeviceNAttributes

the DeviceN attributes

getColorantNamesback to summary
public List<String> getColorantNames()

Returns the list of colorants.

Returns:List<String>

the list of colorants

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 final 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
getTintTransformback to summary
public PDFunction getTintTransform() throws IOException

This will get the tint transform function.

Returns:PDFunction

The tint transform function.

Exceptions
IOException:
if there is an error creating the function.
initColorConversionCacheback to summary
private void initColorConversionCache() throws IOException
isNChannelback to summary
public boolean isNChannel()

Returns true if this color space has the NChannel subtype.

Returns:boolean

true if subtype is NChannel

setAlternateColorSpaceback to summary
public void setAlternateColorSpace(PDColorSpace cs)

This will set the alternate color space.

Parameters
cs:PDColorSpace

The alternate color space.

setAttributesback to summary
public void setAttributes(PDDeviceNAttributes attributes)

Sets the color space attributes. If null is passed in then all attribute will be removed.

Parameters
attributes:PDDeviceNAttributes

the color space attributes, or null

setColorantNamesback to summary
public void setColorantNames(List<String> names)

Sets the list of colorants

Parameters
names:List<String>

the list of colorants

setTintTransformback to summary
public void setTintTransform(PDFunction tint)

This will set the tint transform function.

Parameters
tint:PDFunction

The tint transform function.

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
toRGBWithAttributesback to summary
private BufferedImage toRGBWithAttributes(WritableRaster raster) throws IOException
toRGBWithAttributesback to summary
private float[] toRGBWithAttributes(float[] value) throws IOException
toRGBWithTintTransformback to summary
private BufferedImage toRGBWithTintTransform(WritableRaster raster) throws IOException
toRGBWithTintTransformback to summary
private float[] toRGBWithTintTransform(float[] value) 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