Package com.sun.pdfview.colorspace
Class IndexedColor
java.lang.Object
com.sun.pdfview.colorspace.PDFColorSpace
com.sun.pdfview.colorspace.IndexedColor
A PDFColorSpace for an IndexedColor model
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) int
size of the color tableprotected byte[]
r,g,and b components of the color table as a single array, for Java's IndexColorModel(package private) int
number of channels in the base Color Space (unused)(package private) Color[]
the color tableFields inherited from class com.sun.pdfview.colorspace.PDFColorSpace
COLORSPACE_CMYK, COLORSPACE_GRAY, COLORSPACE_PATTERN, COLORSPACE_RGB, cs
-
Constructor Summary
ConstructorsConstructorDescriptionIndexedColor
(PDFColorSpace base, int count, PDFObject stream) create a new IndexColor PDFColorSpace based on another PDFColorSpace, a count of colors, and a stream of values.IndexedColor
(Color[] table) create a new IndexColor PDFColorSpace based on a table of colors. -
Method Summary
Methods inherited from class com.sun.pdfview.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:
getNumComponents
in classPDFColorSpace
-
getPaint
get the color represented by the index.- Overrides:
getPaint
in 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.
-