Class RGBColor
- java.lang.Object
-
- net.sourceforge.jiu.color.quantization.RGBColor
-
-
Field Summary
Fields Modifier and Type Field 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.-
Fields inherited from interface net.sourceforge.jiu.data.RGBIndex
INDEX_BLUE, INDEX_GREEN, INDEX_RED
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method 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 inRGBIndex
.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(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)
String
toString()
-
-
-
Constructor Detail
-
RGBColor
public RGBColor(int red, int green, int blue)
Creates an instance of this class and initializes it to the given intensity values. The internal color counter is set to zero.
-
RGBColor
public RGBColor(int red, int green, int blue, int counter)
Creates an instance of this class and initializes it to the given intensity values. Also sets the internal color counter to the given parameter.
-
-
Method Detail
-
compareTo
public 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 inRGBIndex
. That way, the two sample values for one component (e.g. red if sortOrder == INDEX_RED) are compared.- Parameters:
c
- the color to which this color is comparedsortOrder
- the component used for the comparison- Returns:
- relation between this color and the argument color
-
computeDistance
public 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.
-
equals
public boolean equals(Object obj)
Compares this color with another instance of RGBColor and returns true if all intensity values are equal, false otherwise.
-
getCounter
public int getCounter()
-
getSample
public int getSample(int index)
-
-