public class RGBColor extends java.lang.Object implements RGBIndex
Modifier and Type | Field and Description |
---|---|
private int |
counter
Stores how many times this colors appears in a certain image.
|
private int[] |
samples
The intensity values that make up the color.
|
INDEX_BLUE, INDEX_GREEN, INDEX_RED
Constructor and Description |
---|
RGBColor(int red,
int green,
int blue)
Creates an instance of this class and initializes it to the given
intensity values.
|
RGBColor(int red,
int green,
int blue,
int counter)
Creates an instance of this class and initializes it to the given
intensity values.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(RGBColor c,
int sortOrder)
Compares this color to the argument color, using the sortOrder argument (which is one of the
three index values defined in
RGBIndex . |
static double |
computeDistance(int r1,
int g1,
int b1,
int r2,
int g2,
int b2)
For two RGB triplets (r1, g1, b1) and (r2, g2, b2) this will return
the distance between those colors in RGB color space.
|
boolean |
equals(java.lang.Object obj)
Compares this color with another instance of RGBColor and returns true
if all intensity values are equal, false otherwise.
|
int |
getCounter() |
int |
getSample(int index) |
java.lang.String |
toString() |
private int[] samples
private int counter
public RGBColor(int red, int green, int blue)
public RGBColor(int red, int green, int blue, int counter)
public int compareTo(RGBColor c, int sortOrder)
RGBIndex
.
That way, the two sample values for one component (e.g. red if sortOrder == INDEX_RED) are
compared.c
- the color to which this color is comparedsortOrder
- the component used for the comparisonpublic static double computeDistance(int r1, int g1, int b1, int r2, int g2, int b2)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int getCounter()
public int getSample(int index)
public java.lang.String toString()
toString
in class java.lang.Object