|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.geotools.image.palette.CustomPaletteBuilder
public final class CustomPaletteBuilder
This class implements the octree quantization method as it is described in the "Graphics Gems" (ISBN 0-12-286166-3, Chapter 4, pages 297-293)
Nested Class Summary | |
---|---|
protected class |
CustomPaletteBuilder.ColorNode
The node of color tree. |
Field Summary | |
---|---|
protected int |
alphaThreshold
|
protected int |
currLevel
|
protected int |
currSize
|
static int |
DEFAULT_ALPHA_TH
Default value for the threshold to decide whether a pixel is opaque (>=) or transparent (<). |
protected int |
maxLevel
maximum of tree depth |
protected int |
maxNodes
|
protected int |
numBands
|
protected int |
numNodes
|
protected CustomPaletteBuilder.ColorNode[] |
palette
|
protected CustomPaletteBuilder.ColorNode[] |
reduceList
|
protected int |
requiredSize
|
protected CustomPaletteBuilder.ColorNode |
root
|
protected java.awt.image.RenderedImage |
src
|
protected java.awt.image.ColorModel |
srcColorModel
|
protected int |
subsampleX
|
protected int |
subsampley
|
protected CustomPaletteBuilder.ColorNode |
transColor
|
protected int |
transparency
|
Constructor Summary | |
---|---|
CustomPaletteBuilder(java.awt.image.RenderedImage src)
|
|
CustomPaletteBuilder(java.awt.image.RenderedImage src,
int size,
int subsx,
int subsy,
int alpha_th)
|
Method Summary | |
---|---|
CustomPaletteBuilder |
buildPalette()
|
static boolean |
canCreatePalette(javax.imageio.ImageTypeSpecifier type)
Returns true if PaletteBuilder is able to create palette
for given image type. |
static boolean |
canCreatePalette(java.awt.image.RenderedImage image)
Returns true if PaletteBuilder is able to create palette
for given rendered image. |
protected int |
findColorIndex(CustomPaletteBuilder.ColorNode aNode,
int[] rgba,
int transpBand)
|
int |
findNearestColorIndex(int[] rgba,
int transparentBand)
|
protected int |
findPaletteEntry(CustomPaletteBuilder.ColorNode aNode,
int index,
byte[] red,
byte[] green,
byte[] blue)
|
protected CustomPaletteBuilder.ColorNode |
freeTree(CustomPaletteBuilder.ColorNode aNode)
|
protected int |
getBranchIndex(int[] rgba,
int aLevel)
|
java.awt.image.IndexColorModel |
getIndexColorModel()
|
java.awt.image.RenderedImage |
getIndexedImage()
|
protected CustomPaletteBuilder.ColorNode |
insertNode(CustomPaletteBuilder.ColorNode aNode,
int[] rgba,
int aLevel)
|
protected void |
reduceTree()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_ALPHA_TH
protected int maxLevel
protected java.awt.image.RenderedImage src
protected java.awt.image.ColorModel srcColorModel
protected int requiredSize
protected CustomPaletteBuilder.ColorNode root
protected int numNodes
protected int maxNodes
protected int currLevel
protected int currSize
protected CustomPaletteBuilder.ColorNode[] reduceList
protected CustomPaletteBuilder.ColorNode[] palette
protected int transparency
protected CustomPaletteBuilder.ColorNode transColor
protected int subsampleX
protected int subsampley
protected int numBands
protected int alphaThreshold
Constructor Detail |
---|
public CustomPaletteBuilder(java.awt.image.RenderedImage src)
public CustomPaletteBuilder(java.awt.image.RenderedImage src, int size, int subsx, int subsy, int alpha_th)
Method Detail |
---|
public static boolean canCreatePalette(javax.imageio.ImageTypeSpecifier type)
true
if PaletteBuilder is able to create palette
for given image type.
type
- an instance of ImageTypeSpecifier
to be
indexed.
true
if the PaletteBuilder
is
likely to be able to create palette for this image type.
java.lang.IllegalArgumentException
- if type
is null
.public static boolean canCreatePalette(java.awt.image.RenderedImage image)
true
if PaletteBuilder is able to create palette
for given rendered image.
image
- an instance of RenderedImage
to be indexed.
true
if the PaletteBuilder
is
likely to be able to create palette for this image type.
java.lang.IllegalArgumentException
- if image
is null
.public java.awt.image.RenderedImage getIndexedImage()
protected int findColorIndex(CustomPaletteBuilder.ColorNode aNode, int[] rgba, int transpBand)
public CustomPaletteBuilder buildPalette()
protected CustomPaletteBuilder.ColorNode insertNode(CustomPaletteBuilder.ColorNode aNode, int[] rgba, int aLevel)
public java.awt.image.IndexColorModel getIndexColorModel()
protected int findPaletteEntry(CustomPaletteBuilder.ColorNode aNode, int index, byte[] red, byte[] green, byte[] blue)
protected int getBranchIndex(int[] rgba, int aLevel)
protected void reduceTree()
protected CustomPaletteBuilder.ColorNode freeTree(CustomPaletteBuilder.ColorNode aNode)
public int findNearestColorIndex(int[] rgba, int transparentBand)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |