Package org.openpdf.renderer.colorspace
Class IndexedColor
java.lang.Object
org.openpdf.renderer.colorspace.PDFColorSpace
org.openpdf.renderer.colorspace.IndexedColor
A PDFColorSpace for an IndexedColor model
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) intsize of the color tableprotected byte[]r,g,and b components of the color table as a single array, for Java's IndexColorModel(package private) intnumber of channels in the base Color Space (unused)(package private) Color[]the color tableFields inherited from class org.openpdf.renderer.colorspace.PDFColorSpace
COLORSPACE_CMYK, COLORSPACE_GRAY, COLORSPACE_PATTERN, COLORSPACE_RGB, cs -
Constructor Summary
ConstructorsConstructorDescriptionIndexedColor(Color[] table) create a new IndexColor PDFColorSpace based on a table of colors.IndexedColor(PDFColorSpace base, int count, PDFObject stream) create a new IndexColor PDFColorSpace based on another PDFColorSpace, a count of colors, and a stream of values. -
Method Summary
Methods inherited from class org.openpdf.renderer.colorspace.PDFColorSpace
getColorSpace, getColorSpace, getColorSpace
-
Field Details
-
finalcolors
protected byte[] finalcolorsr,g,and b components of the color table as a single array, for Java's IndexColorModel -
table
Color[] tablethe color table -
count
int countsize of the color table -
nchannels
int nchannelsnumber of channels in the base Color Space (unused)
-
-
Constructor Details
-
IndexedColor
create a new IndexColor PDFColorSpace based on another PDFColorSpace, a count of colors, and a stream of values. Every consecutive n bytes of the stream is interpreted as a color in the base ColorSpace, where n is the number of components in that color space.- Parameters:
base- the color space in which the data is interpretedcount- the number of colors in the tablestream- a stream of bytes. The number of bytes must be count*n, where n is the number of components in the base colorspace.- Throws:
IOException
-
IndexedColor
create a new IndexColor PDFColorSpace based on a table of colors.- Parameters:
table- an array of colors- Throws:
IOException
-
-
Method Details
-
getCount
public int getCount()Get the number of indices -
getColorComponents
public byte[] getColorComponents()Get the table of color components -
getNumComponents
public int getNumComponents()get the number of components of this colorspace (1)- Overrides:
getNumComponentsin classPDFColorSpace
-
getPaint
get the color represented by the index.- Overrides:
getPaintin classPDFColorSpace- Parameters:
components- an array of exactly one integer number whose value is between 0 and the size of the color table - 1.- Returns:
- a PDFPaint object representing the closest Color to the given components.
-