com.sun.pdfview.colorspace

Class PDFColorSpace

public class PDFColorSpace extends Object

A color space that can convert a set of color components into PDFPaint.
Field Summary
static intCOLORSPACE_CMYK
the name of the device-dependent CMYK color space
static intCOLORSPACE_GRAY
the name of the device-dependent gray color space
static intCOLORSPACE_PATTERN
the name of the pattern color space
static intCOLORSPACE_RGB
the name of the device-dependent RGB color space
Constructor Summary
protected PDFColorSpace(ColorSpace cs)
create a PDFColorSpace based on a Java ColorSpace
Method Summary
static PDFColorSpacegetColorSpace(int name)
Get a color space by name
static PDFColorSpacegetColorSpace(PDFObject csobj, Map resources)
Get a color space specified in a PDFObject
ColorSpacegetColorSpace()
get the original Java ColorSpace.
intgetNumComponents()
get the number of components expected in the getPaint command
PDFPaintgetPaint(float[] components)
get the PDFPaint representing the color described by the given color components

Field Detail

COLORSPACE_CMYK

public static final int COLORSPACE_CMYK
the name of the device-dependent CMYK color space

COLORSPACE_GRAY

public static final int COLORSPACE_GRAY
the name of the device-dependent gray color space

COLORSPACE_PATTERN

public static final int COLORSPACE_PATTERN
the name of the pattern color space

COLORSPACE_RGB

public static final int COLORSPACE_RGB
the name of the device-dependent RGB color space

Constructor Detail

PDFColorSpace

protected PDFColorSpace(ColorSpace cs)
create a PDFColorSpace based on a Java ColorSpace

Parameters: cs the Java ColorSpace

Method Detail

getColorSpace

public static PDFColorSpace getColorSpace(int name)
Get a color space by name

Parameters: name the name of one of the device-dependent color spaces

getColorSpace

public static PDFColorSpace getColorSpace(PDFObject csobj, Map resources)
Get a color space specified in a PDFObject

Parameters: csobj the PDFObject with the colorspace information

getColorSpace

public ColorSpace getColorSpace()
get the original Java ColorSpace.

getNumComponents

public int getNumComponents()
get the number of components expected in the getPaint command

getPaint

public PDFPaint getPaint(float[] components)
get the PDFPaint representing the color described by the given color components

Parameters: components the color components corresponding to the given colorspace

Returns: a PDFPaint object representing the closest Color to the given components.