Class PaletteBox
- java.lang.Object
-
- com.sun.media.imageioimpl.plugins.jpeg2000.Box
-
- com.sun.media.imageioimpl.plugins.jpeg2000.PaletteBox
-
public class PaletteBox extends Box
This class is designed to represent a palette box for JPEG 2000 JP2 file format. A palette box has a length, and a fixed type of "pclr". Its content contains the number of palette entry, the number of color components, the bit depths of the output components, the LUT. Currently, only 8-bit color index is supported.
-
-
Field Summary
-
Fields inherited from class com.sun.media.imageioimpl.plugins.jpeg2000.Box
data, extraLength, length, type
-
-
Constructor Summary
Constructors Constructor Description PaletteBox(byte[] data)
Constructs aPlatteBox
from the provided byte array.PaletteBox(int length, byte[] comp, byte[][] lut)
Constructs aPlatteBox
from the provided length, bit depths of the color components and the LUT.PaletteBox(IndexColorModel icm)
Constructs aPlatteBox
from anIndexColorModel
.PaletteBox(Node node)
Constructs aPlatteBox
from anorg.w3c.dom.Node
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
compose()
Composes the content byte array from the data elements.byte[]
getBitDepths()
Return the bit depths for all the color components.byte[][]
getLUT()
Return the LUT.IIOMetadataNode
getNativeNode()
creates anIIOMetadataNode
from this palette box.int
getNumComp()
Return the number of color components.int
getNumEntries()
Return the number of palette entries.protected void
parse(byte[] data)
Parses the data elements from the byte array.-
Methods inherited from class com.sun.media.imageioimpl.plugins.jpeg2000.Box
copyInt, createBox, getAttribute, getBoxClass, getByteArrayElementValue, getByteElementValue, getContent, getExtraLength, getIntArrayElementValue, getIntElementValue, getLength, getName, getNativeNodeForSimpleBox, getShortElementValue, getStringElementValue, getType, getTypeByName, getTypeInt, getTypeString, parseByteArray, parseIntArray, read, setContent, setDefaultAttributes, setExtraLength, setLength, write
-
-
-
-
Constructor Detail
-
PaletteBox
public PaletteBox(IndexColorModel icm)
Constructs aPlatteBox
from anIndexColorModel
.
-
PaletteBox
public PaletteBox(Node node) throws IIOInvalidTreeException
Constructs aPlatteBox
from anorg.w3c.dom.Node
.- Throws:
IIOInvalidTreeException
-
PaletteBox
public PaletteBox(int length, byte[] comp, byte[][] lut)
Constructs aPlatteBox
from the provided length, bit depths of the color components and the LUT.
-
PaletteBox
public PaletteBox(byte[] data)
Constructs aPlatteBox
from the provided byte array.
-
-
Method Detail
-
getNumEntries
public int getNumEntries()
Return the number of palette entries.
-
getNumComp
public int getNumComp()
Return the number of color components.
-
getBitDepths
public byte[] getBitDepths()
Return the bit depths for all the color components.
-
getLUT
public byte[][] getLUT()
Return the LUT.
-
getNativeNode
public IIOMetadataNode getNativeNode()
creates anIIOMetadataNode
from this palette box. The format of this node is defined in the XML dtd and xsd for the JP2 image file.- Overrides:
getNativeNode
in classBox
-
parse
protected void parse(byte[] data)
Description copied from class:Box
Parses the data elements from the byte array. The subclasses should override this method.
-
-