|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.color.HSB
public class HSB
Class HSB provides a color represented as floating point hue, saturation, and brightness components.
The hue component gives the basic color. A hue of 0 = red; 1/6 = yellow; 2/6 = green; 3/6 = cyan; 4/6 = blue; 5/6 = magenta; 1 = red again. Intermediate hue values yield intermediate colors.
The saturation component specifies how gray or colored the color is. A saturation of 0 yields fully gray; a saturation of 1 yields fully colored. Intermediate saturation values yield mixtures of gray and colored.
The brightness component specifies how dark or light the color is. A brightness of 0 yields fully dark (black); a brightness of 1 yields fully light (somewhere between white and colored depending on the saturation). Intermediate brightness values yield somewhere between a gray shade and a darkened color (depending on the saturation).
Class HSB includes methods for packing and unpacking a floating point HSB color object into and from an integer. The packed color representation uses 8 bits for each component, with the red component in bits 23-16, the green component in bits 15-8, and the blue component in bits 7-0.
| Field Summary | |
|---|---|
float |
bri
The brightness component in the range 0.0 through 1.0. |
float |
hue
The hue component in the range 0.0 through 1.0. |
float |
sat
The saturation component in the range 0.0 through 1.0. |
| Constructor Summary | |
|---|---|
HSB()
Construct a new floating point HSB color. |
|
HSB(float hue,
float sat,
float bri)
Construct a new floating point HSB color with the given hue, saturation, and brightness components. |
|
HSB(int color)
Construct a new floating point HSB color from the given packed color. |
|
| Method Summary | |
|---|---|
int |
pack()
Pack this floating point HSB color into a packed color. |
static int |
pack(float hue,
float sat,
float bri)
Pack the given hue, saturation, and brightness components into a packed color. |
void |
unpack(int color)
Unpack this floating point HSB color from a packed color. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public float hue
public float sat
public float bri
| Constructor Detail |
|---|
public HSB()
public HSB(float hue,
float sat,
float bri)
hue - Hue component.sat - Saturation component.bri - Brightness component.public HSB(int color)
color - Packed color.| Method Detail |
|---|
public int pack()
public static int pack(float hue,
float sat,
float bri)
hue - Hue component.sat - Saturation component.bri - Brightness component.
public void unpack(int color)
color - Packed color.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||