public class RGBColor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
float |
blue |
static float[] |
ERGB_EXP_SCALE |
float |
green |
float |
red |
Constructor and Description |
---|
RGBColor()
Construct a new RGBColor object with components 0,0,0.
|
RGBColor(java.io.DataInputStream in)
Reconstruct an RGBColor based on its serialized representation.
|
RGBColor(double r,
double g,
double b)
Construct a new RGBColor object with components r,g,b.
|
RGBColor(float r,
float g,
float b)
Construct a new RGBColor object with components r,g,b.
|
Modifier and Type | Method and Description |
---|---|
void |
add(float r,
float g,
float b)
Add the specified values to the components of this color.
|
void |
add(RGBColor color)
Add another color to this one.
|
void |
clip()
Clip the components of this color so they lie between 0 and 1.
|
void |
copy(RGBColor color)
Make this object identical to another one.
|
RGBColor |
duplicate()
Create an exact duplicate of this object.
|
boolean |
equals(java.lang.Object c)
Determine whether two colors are identical.
|
int |
getARGB()
Get a representation of this color in the default Java color model.
|
float |
getBlue()
Get the value of the blue component.
|
float |
getBrightness()
Get the perceptual brightness of this color.
|
java.awt.Color |
getColor()
Get a java.awt.Color object representing this color.
|
int |
getERGB()
Calculate the ERGB representation of this color.
|
float |
getGreen()
Get the value of the green component.
|
float[] |
getHLS()
Get a representation of this color in the HLS color model.
|
float[] |
getHSV()
Get a representation of this color in the HSV color model.
|
float |
getMaxComponent()
Get the maximum value which any of the color components has.
|
float |
getRed()
Get the value of the red component.
|
float[] |
getYCrCb()
Get a representation of this color in the YCrCb color model.
|
int |
hashCode() |
void |
multiply(float r,
float g,
float b)
Multiply the components of this color by the specified values.
|
void |
multiply(RGBColor color)
Multiply this color by another one.
|
void |
scale(double s)
Scale each component of this color by the specified amount.
|
void |
scale(float s)
Scale each component of this color by the specified amount.
|
void |
setARGB(int color)
Set the color based on a 32 bit ARGB value (the default Java color model).
|
void |
setERGB(byte r,
byte g,
byte b,
byte e)
Set this color based on its representation in Greg Ward's ERGB format.
|
void |
setERGB(int ergb)
Set this color based on its representation in Greg Ward's ERGB format.
|
void |
setHLS(float h,
float l,
float s)
Set this color based on values in the HLS color model.
|
void |
setHSV(float h,
float s,
float v)
Set this color based on values in the HSV color model.
|
void |
setRGB(double r,
double g,
double b)
Set the red, green, and blue components to the specified values.
|
void |
setRGB(float r,
float g,
float b)
Set the red, green, and blue components to the specified values.
|
void |
setYCrCb(float Y,
float Cr,
float Cb)
Set this color based on values in the YCrCb color model.
|
void |
subtract(float r,
float g,
float b)
Subtract the specified values from the components of this color.
|
void |
subtract(RGBColor color)
Subtract another color from this one.
|
java.lang.String |
toString()
Create a string describing the color.
|
void |
writeToFile(java.io.DataOutputStream out)
Serialize this object to an output stream.
|
public float red
public float green
public float blue
public static final float[] ERGB_EXP_SCALE
public RGBColor()
public RGBColor(float r, float g, float b)
public RGBColor(double r, double g, double b)
public RGBColor(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
public final void setRGB(float r, float g, float b)
public final void setRGB(double r, double g, double b)
public final float getRed()
public final float getGreen()
public final float getBlue()
public boolean equals(java.lang.Object c)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public final RGBColor duplicate()
public final void copy(RGBColor color)
public final java.awt.Color getColor()
public final int getARGB()
public final void setARGB(int color)
public final void add(RGBColor color)
public final void subtract(RGBColor color)
public final void multiply(RGBColor color)
public final void add(float r, float g, float b)
public final void subtract(float r, float g, float b)
public final void multiply(float r, float g, float b)
public final void scale(float s)
public final void scale(double s)
public final void clip()
public final float getBrightness()
public final float getMaxComponent()
public final void setHSV(float h, float s, float v)
public final float[] getHSV()
public final void setHLS(float h, float l, float s)
public final float[] getHLS()
public final int getERGB()
public final void setERGB(int ergb)
public final void setERGB(byte r, byte g, byte b, byte e)
public final float[] getYCrCb()
public final void setYCrCb(float Y, float Cr, float Cb)
public void writeToFile(java.io.DataOutputStream out) throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object