java.lang.Object
org.sejda.sambox.pdmodel.graphics.color.PDColorSpace
org.sejda.sambox.pdmodel.graphics.color.PDCIEBasedColorSpace
org.sejda.sambox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace
org.sejda.sambox.pdmodel.graphics.color.PDLab
- All Implemented Interfaces:
COSObjectable
A Lab colour space is a CIE-based ABC colour space with two transformation stages.
- Author:
- Ben Litchfield, John Hewson
-
Field Summary
Fields inherited from class org.sejda.sambox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace
dictionary, wpX, wpY, wpZFields inherited from class org.sejda.sambox.pdmodel.graphics.color.PDColorSpace
array -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis will get the valid range for the "a" component.This will get the valid range for the "b" component.float[]getDefaultDecode(int bitsPerComponent) Returns the default decode array for this color space.Returns the initial color value for this color space.getName()Returns the name of the color space.intReturns the number of components in this color spacevoidThis will set the a range for the "a" component.voidThis will set the "b" range for this color space.toRawImage(WritableRaster raster) Returns the image in this colorspace or null.float[]toRGB(float[] value) Returns the RGB equivalent of the given color value.toRGBImage(WritableRaster raster) Returns the (A)RGB equivalent of the given raster.Methods inherited from class org.sejda.sambox.pdmodel.graphics.color.PDCIEDictionaryBasedColorSpace
convXYZtoRGB, getBlackPoint, getWhitepoint, setBlackPoint, setWhitePointMethods inherited from class org.sejda.sambox.pdmodel.graphics.color.PDCIEBasedColorSpace
toStringMethods inherited from class org.sejda.sambox.pdmodel.graphics.color.PDColorSpace
create, create, create, getCOSObject, isAllowedCache, toRawImage, toRGBImageAWT
-
Constructor Details
-
PDLab
public PDLab()Creates a new Lab color space. -
PDLab
Creates a new Lab color space from a PDF array.- Parameters:
lab- the color space array
-
-
Method Details
-
getName
Description copied from class:PDColorSpaceReturns the name of the color space.- Specified by:
getNamein classPDColorSpace- Returns:
- the name of the color space
-
toRGBImage
Description copied from class:PDColorSpaceReturns the (A)RGB equivalent of the given raster.- Overrides:
toRGBImagein classPDCIEBasedColorSpace- Parameters:
raster- the source raster- Returns:
- an (A)RGB buffered image
- Throws:
IOException- if the color conversion fails
-
toRawImage
Description copied from class:PDColorSpaceReturns 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
PDColorSpace.toRGBImage(WritableRaster)if this returns null.- Overrides:
toRawImagein classPDCIEBasedColorSpace- Parameters:
raster- the source raster- Returns:
- an buffered image in this colorspace. Or null if it is not possible to extract that image with the original colorspace without conversion.
-
toRGB
public float[] toRGB(float[] value) Description copied from class:PDColorSpaceReturns the RGB equivalent of the given color value.- Specified by:
toRGBin classPDColorSpace- Parameters:
value- a color value with component values between 0 and 1- Returns:
- an array of R,G,B value between 0 and 255
-
getNumberOfComponents
public int getNumberOfComponents()Description copied from class:PDColorSpaceReturns the number of components in this color space- Specified by:
getNumberOfComponentsin classPDColorSpace- Returns:
- the number of components in this color space
-
getDefaultDecode
public float[] getDefaultDecode(int bitsPerComponent) Description copied from class:PDColorSpaceReturns the default decode array for this color space.- Specified by:
getDefaultDecodein classPDColorSpace- Parameters:
bitsPerComponent- the number of bits per component.- Returns:
- the default decode array
-
getInitialColor
Description copied from class:PDColorSpaceReturns the initial color value for this color space.- Specified by:
getInitialColorin classPDColorSpace- Returns:
- the initial color value for this color space
-
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:
- the "a" range.
-
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:
- the "b" range.
-
setARange
This will set the a range for the "a" component.- Parameters:
range- the new range for the "a" component, or null if defaults (-100..100) are to be set.
-
setBRange
This will set the "b" range for this color space.- Parameters:
range- the new range for the "b" component, or null if defaults (-100..100) are to be set.
-