it.geosolutions.imageio.plugins.jp2k.box
Class PaletteBox

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by it.geosolutions.imageio.plugins.jp2k.box.BaseJP2KBox
          extended by it.geosolutions.imageio.plugins.jp2k.box.PaletteBox
All Implemented Interfaces:
JP2KBox, JP2KBoxMetadata, Serializable, Cloneable, MutableTreeNode, TreeNode

public class PaletteBox
extends BaseJP2KBox

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.

See Also:
Serialized Form

Field Summary
static int BOX_TYPE
           
static String JP2K_MD_NAME
           
static String NAME
           
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
PaletteBox(byte[] data)
          Constructs a PaletteBox from the provided byte array.
PaletteBox(IndexColorModel icm)
          Constructs a PaletteBox from an IndexColorModel.
PaletteBox(int length, byte[] comp, byte[][] lut)
          Constructs a PaletteBox from the provided length, bit depths of the color components and the LUT.
PaletteBox(Node node)
          Constructs a PlatteBox from a org.w3c.dom.Node.
 
Method Summary
protected  byte[] 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 an IIOMetadataNode 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 it.geosolutions.imageio.plugins.jp2k.box.BaseJP2KBox
clone, getContent, getExtraLength, getLength, getNativeNodeForSimpleBox, getType, setDefaultAttributes, setExtraLength, setLength, setType, toString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.MutableTreeNode
insert, remove, remove, removeFromParent, setParent, setUserObject
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Field Detail

BOX_TYPE

public static final int BOX_TYPE
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

JP2K_MD_NAME

public static final String JP2K_MD_NAME
See Also:
Constant Field Values
Constructor Detail

PaletteBox

public PaletteBox(IndexColorModel icm)
Constructs a PaletteBox from an IndexColorModel.


PaletteBox

public PaletteBox(Node node)
           throws IIOInvalidTreeException
Constructs a PlatteBox from a org.w3c.dom.Node.

Throws:
IIOInvalidTreeException

PaletteBox

public PaletteBox(int length,
                  byte[] comp,
                  byte[][] lut)
Constructs a PaletteBox from the provided length, bit depths of the color components and the LUT.


PaletteBox

public PaletteBox(byte[] data)
Constructs a PaletteBox 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 an IIOMetadataNode from this palette box. The format of this node is defined in the XML dtd and xsd for the JP2 image file.

Specified by:
getNativeNode in interface JP2KBoxMetadata
Overrides:
getNativeNode in class BaseJP2KBox

parse

protected void parse(byte[] data)
Description copied from class: BaseJP2KBox
Parses the data elements from the byte array. The subclasses should override this method and implement the proper behvaior.

Specified by:
parse in class BaseJP2KBox

compose

protected byte[] compose()
Description copied from class: BaseJP2KBox
Composes the content byte array from the data elements.

Specified by:
compose in class BaseJP2KBox


Copyright © 2006–2013 GeoSolutions. All rights reserved.