public class HSBColor extends Object implements Serializable, Cloneable
Modifier and Type | Field and Description |
---|---|
protected double |
m_alpha
The unused alpha channel between 0 and 255: stored here for allow
java.awt.Color instances to be transformed to instances of this class and
be re - transformed with preserving their alpha setting.
|
protected double |
m_hue
Hue value between 0.0 and 1.0.
|
protected double |
m_lum
Luminance value between 0.0 and 1.0.
|
protected double |
m_sat
Saturation value between 0.0 and 1.0.
|
Constructor and Description |
---|
HSBColor(Color rgbcolor)
Creates an instance transformed from the rgb color.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Clone implementation.
|
boolean |
equals(Object obj) |
Color |
getRGBColor()
Returns the transformation of this color to the rgb color.
|
int |
hashCode() |
static HSBColor |
rgbToHSB(Color color)
Inspired by
float[] java.awt.Color.RGBtoHSB(int r,int g, int b, float[]hsbvals)
except that algorithm is tuned Testing results showed about 25% speed up. |
protected double m_hue
protected double m_lum
protected double m_sat
protected double m_alpha
public HSBColor(Color rgbcolor)
rgbcolor
- standard java rgb color.public static HSBColor rgbToHSB(Color color)
float[] java.awt.Color.RGBtoHSB(int r,int g, int b, float[]hsbvals)
except that algorithm is tuned color
- the java.awt.Color
(that follows the RGB model) and
should be transformed to a color instance in the
hue-saturation-luminance model.public Object clone()
Following statements are true:
x.clone() != x
x.clone().getClass() == x.getClass()
x.clone().equals(x)
A deep copy of this HSBColor is returned.
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public Color getRGBColor()
public int hashCode()
hashCode
in class Object
Object.hashCode()
Copyright © 2017. All rights reserved.