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

public final Class PDLab

extends PDCIEDictionaryBasedColorSpace
Class Inheritance
Imports
org.apache.pdfbox.cos.COSArray, .COSFloat, .COSName, org.apache.pdfbox.pdmodel.common.PDRange, java.awt.image.BufferedImage, .WritableRaster, java.io.IOException

A Lab colour space is a CIE-based ABC colour space with two transformation stages.
Authors
Ben Litchfield, John Hewson

Field Summary

Modifier and TypeField and Description
private PDColor
Inherited from org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace:
dictionarywpXwpYwpZ

Constructor Summary

AccessConstructor and Description
public
PDLab()

Creates a new Lab color space.

public
PDLab(COSArray
the color space array
lab
)

Creates a new Lab color space from a PDF array.

Method Summary

Modifier and TypeMethod and Description
public PDRange

Returns:

the "a" range.
getARange
()

This will get the valid range for the "a" component.

public PDRange

Returns:

the "b" range.
getBRange
()

This will get the valid range for the "b" component.

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.

private COSArray

Returns:

the new range array.
getDefaultRangeArray
()

creates a range array with default values (-100..100 -100..100).

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

private float
inverse(float x)

public void
setARange(PDRange
the new range for the "a" component, or null if defaults (-100..100) are to be set.
range
)

This will set the a range for the "a" component.

public void
setBRange(PDRange
the new range for the "b" component, or null if defaults (-100..100) are to be set.
range
)

This will set the "b" range for this color space.

private void
setComponentRangeArray(PDRange range, int index)

public BufferedImage
toRawImage(WritableRaster
the source raster
raster
)

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace.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
)

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace.toRGBImage.

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

Inherited from org.apache.pdfbox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace:
convXYZtoRGBgetBlackPointgetWhitepointisWhitePointsetBlackPointsetWhitePoint

Field Detail

initialColorback to summary
private PDColor initialColor

Constructor Detail

PDLabback to summary
public PDLab()

Creates a new Lab color space.

PDLabback to summary
public PDLab(COSArray lab)

Creates a new Lab color space from a PDF array.

Parameters
lab:COSArray

the color space array

Method Detail

getARangeback to summary
public PDRange getARange()

This will get the valid range for the "a" component. If none is found then the default will be returned, which is -100..100.

Returns:PDRange

the "a" range.

getBRangeback to summary
public PDRange getBRange()

This will get the valid range for the "b" component. If none is found then the default will be returned, which is -100..100.

Returns:PDRange

the "b" range.

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
getDefaultRangeArrayback to summary
private COSArray getDefaultRangeArray()

creates a range array with default values (-100..100 -100..100).

Returns:COSArray

the new range array.

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
inverseback to summary
private float inverse(float x)
setARangeback to summary
public void setARange(PDRange range)

This will set the a range for the "a" component.

Parameters
range:PDRange

the new range for the "a" component, or null if defaults (-100..100) are to be set.

setBRangeback to summary
public void setBRange(PDRange range)

This will set the "b" range for this color space.

Parameters
range:PDRange

the new range for the "b" component, or null if defaults (-100..100) are to be set.

setComponentRangeArrayback to summary
private void setComponentRangeArray(PDRange range, int index)
toRawImageback to summary
public BufferedImage toRawImage(WritableRaster raster)

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace.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)

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
toRGBImageback to summary
public BufferedImage toRGBImage(WritableRaster raster) throws IOException

Overrides org.apache.pdfbox.pdmodel.graphics.color.PDCIEBasedColorSpace.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