RGBIndex
public class MedianCutNode extends Object implements RGBIndex
MedianCutQuantizer
Modifier and Type | Field | Description |
---|---|---|
private int |
axis |
|
private boolean |
axisDetermined |
|
private int |
diff |
|
private int |
index1 |
|
private int |
index2 |
|
private MedianCutNode |
leftSuccessor |
|
private int[] |
max |
|
private int |
medianValue |
|
private int |
middleIndex |
|
private int[] |
min |
|
private int |
paletteIndex |
|
private MedianCutNode |
parent |
|
private int[] |
reprColor |
|
private MedianCutNode |
rightSuccessor |
INDEX_BLUE, INDEX_GREEN, INDEX_RED
Constructor | Description |
---|---|
MedianCutNode(MedianCutNode parent,
int index1,
int index2) |
Creates a node for a Median Cut tree of nodes with index values for
some external color array and the parent node.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
canBeSplit() |
Returns if this node can be split into two.
|
double |
computeRgbDistance(MedianCutNode node) |
Computes the distance in RGB color space between the representative color of this node and the
argument node and returns it as non-negative value.
|
private void |
determineMiddleIndex() |
Computes the middle index value of this node.
|
int |
getAxisOfLargestDistribution() |
Returns the axis of the channel whose samples are most widely
distributed among the colors that belong to this node.
|
int |
getDifferenceOfLargestDistribution() |
|
int |
getLeftIndex() |
|
MedianCutNode |
getLeftSuccessor() |
Returns left successor node (or null if this node is a leaf).
|
int |
getMaxColorSample(int index) |
|
int |
getMedianValue() |
|
int |
getMiddleIndex() |
|
int |
getMinColorSample(int index) |
|
int |
getNumColors() |
|
int |
getPaletteIndex() |
|
MedianCutNode |
getParentNode() |
Returns parent node (or null if this node is the root node).
|
int[] |
getRepresentativeColor() |
|
int |
getRightIndex() |
|
MedianCutNode |
getRightSuccessor() |
Returns right successor node (or null if this node is a leaf).
|
MedianCutNode |
getSuccessor(int[] rgb) |
|
boolean |
isAxisDetermined() |
|
boolean |
isLeaf() |
Returns if this node is a leaf by checking if both successors are null.
|
void |
setLargestDistribution(int newAxis,
int newDifference) |
|
void |
setMaxColor(int red,
int green,
int blue) |
|
void |
setMaxColorSample(int index,
int value) |
|
void |
setMedianValue(int newMedianValue) |
|
void |
setMinColor(int red,
int green,
int blue) |
|
void |
setMinColorSample(int index,
int value) |
|
void |
setPaletteIndex(int newPaletteIndex) |
|
void |
setRepresentativeColor(int[] aRepresentativeColor) |
|
void |
setSuccessors(MedianCutNode left,
MedianCutNode right) |
Sets the successor nodes for this node.
|
private int axis
private boolean axisDetermined
private int diff
private int index1
private int index2
private MedianCutNode leftSuccessor
private int[] max
private int medianValue
private int middleIndex
private int[] min
private int paletteIndex
private MedianCutNode parent
private int[] reprColor
private MedianCutNode rightSuccessor
public MedianCutNode(MedianCutNode parent, int index1, int index2)
parent
- the parent node of this new node, should be null only for the root nodeindex1
- the index value of the first element of colors in the color listindex2
- the index value of the last element of colors in the color list; must be larger than or equal to index1IllegalArgumentException
- if index1 is larger than index2public boolean canBeSplit()
public double computeRgbDistance(MedianCutNode node)
private void determineMiddleIndex()
public int getAxisOfLargestDistribution()
RGBIndex
constantsIllegalArgumentException
- if that axis has not been determinedpublic int getDifferenceOfLargestDistribution()
public int getLeftIndex()
public MedianCutNode getLeftSuccessor()
public int getMaxColorSample(int index)
public int getMedianValue()
public int getMiddleIndex()
public int getMinColorSample(int index)
public int getNumColors()
public int getPaletteIndex()
public MedianCutNode getParentNode()
public int[] getRepresentativeColor()
public int getRightIndex()
public MedianCutNode getRightSuccessor()
public MedianCutNode getSuccessor(int[] rgb)
public boolean isAxisDetermined()
public boolean isLeaf()
public void setLargestDistribution(int newAxis, int newDifference)
public void setMaxColor(int red, int green, int blue)
public void setMaxColorSample(int index, int value)
public void setMedianValue(int newMedianValue)
public void setMinColor(int red, int green, int blue)
public void setMinColorSample(int index, int value)
public void setPaletteIndex(int newPaletteIndex)
public void setRepresentativeColor(int[] aRepresentativeColor)
public void setSuccessors(MedianCutNode left, MedianCutNode right)
left
- the left successor noderight
- the left successor node