Class IndexedColor
java.lang.Object
org.loboevolution.pdfview.colorspace.PDFColorSpace
org.loboevolution.pdfview.colorspace.IndexedColor
A PDFColorSpace for an IndexedColor model
Author Mike Wessler
-
Field Summary
Modifier and TypeFieldDescriptionprotected byte[]
r,g,and b components of the color table as a single array, for Java's IndexColorModelFields inherited from class org.loboevolution.pdfview.colorspace.PDFColorSpace
COLORSPACE_CMYK, COLORSPACE_GRAY, COLORSPACE_PATTERN, COLORSPACE_RGB
-
Constructor Summary
ConstructorDescriptionIndexedColor
(Color[] table) create a new IndexColor PDFColorSpace based on a table of colors.IndexedColor
(PDFColorSpace base, int cnt, PDFObject stream) create a new IndexColor PDFColorSpace based on another PDFColorSpace, a count of colors, and a stream of values. -
Method Summary
Modifier and TypeMethodDescriptionint
get the number of components expected in the getPaint commandgetPaint
(float[] components) get the PDFPaint representing the color described by the given color componentsMethods inherited from class org.loboevolution.pdfview.colorspace.PDFColorSpace
getColorSpace, getColorSpace, getColorSpace
-
Field Details
-
colorComponents
protected byte[] colorComponentsr,g,and b components of the color table as a single array, for Java's IndexColorModel
-
-
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 interpretedcnt
- 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
- if any.
-
IndexedColor
create a new IndexColor PDFColorSpace based on a table of colors.- Parameters:
table
- an array of colors- Throws:
IOException
- if any.
-
-
Method Details
-
getNumComponents
public int getNumComponents()get the number of components expected in the getPaint commandget the number of components of this colorspace (1)
- Overrides:
getNumComponents
in classPDFColorSpace
- Returns:
- a
Integer
object.
-
getPaint
get the PDFPaint representing the color described by the given color componentsget the color represented by the index.
- Overrides:
getPaint
in classPDFColorSpace
- Parameters:
components
- the color components corresponding to the given colorspace- Returns:
- a PDFPaint object representing the closest Color to the given components.
-