org.minueto
Class MinuetoColor

java.lang.Object
  extended by org.minueto.MinuetoColor
All Implemented Interfaces:
java.io.Serializable

public class MinuetoColor
extends java.lang.Object
implements java.io.Serializable

The MinuetoColor class is used to store information describing a color. Several prefined colors defined as constants can also be found in this class.

Note: Minueto defines a color as a RGB value (red/green/blue). If you are new to computer graphics, please note that this color scheme is significantly different from the one used for paper (cyan, blue, yellow, black, also known as CMYK).

Since:
Minueto 0.4
See Also:
Serialized Form

Field Summary
static MinuetoColor BLACK
          The color Black.
static MinuetoColor BLUE
          The color Blue.
static MinuetoColor GREEN
          The color Green.
static MinuetoColor RED
          The color Red.
static MinuetoColor WHITE
          The color White
static MinuetoColor YELLOW
          The color Yellow.
 
Constructor Summary
MinuetoColor(java.awt.Color color)
          Creates a new RGBA color from a Java AWT Color object
MinuetoColor(double red, double green, double blue)
          Creates a new RGB color.
MinuetoColor(double red, double green, double blue, double alpha)
          Creates a new RGBA color.
MinuetoColor(int color)
          Creates a MinuetoColor object from a single int value just as java.awt.Color: Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
MinuetoColor(int red, int green, int blue)
          Creates a new RGB color.
MinuetoColor(int red, int green, int blue, int alpha)
          Creates a new RGBA color.
 
Method Summary
 MinuetoColor darken(double factor)
          Returns a darker color.
 MinuetoColor darken(int factor)
          Returns a darker color.
 int getAlpha()
          Returns the alpha value of this color.
 int getARGBColorValue()
          Returns the sRGB color code for this color as an integer.
 java.awt.Color getAWTColor()
          Returns the equivalent AWT color object.
 int getBlue()
          Returns the blue value of this color.
 int getGreen()
          Returns the green value of this color.
 int getRed()
          Returns the red value of this color.
 MinuetoColor lighten(double factor)
          Returns a lighter color.
 MinuetoColor lighten(int factor)
          Returns a lighter color.
 java.lang.String toString()
          Returns a string representation of the color.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RED

public static final MinuetoColor RED
The color Red.


GREEN

public static final MinuetoColor GREEN
The color Green.


BLUE

public static final MinuetoColor BLUE
The color Blue.


YELLOW

public static final MinuetoColor YELLOW
The color Yellow.


BLACK

public static final MinuetoColor BLACK
The color Black.


WHITE

public static final MinuetoColor WHITE
The color White

Constructor Detail

MinuetoColor

public MinuetoColor(int red,
                    int green,
                    int blue)
Creates a new RGB color. Colors are defined as three integer values ranging from 0 to 255.

Parameters:
red - int denoting the red color value.
green - int denoting the green color value.
blue - int denoting the blue color value.
Throws:
MinuetoInvalidColorValueException - if an invalid color value is passed.

MinuetoColor

public MinuetoColor(java.awt.Color color)
Creates a new RGBA color from a Java AWT Color object

Parameters:
color - java.awt.Color ths color value
See Also:
Color

MinuetoColor

public MinuetoColor(int color)
Creates a MinuetoColor object from a single int value just as java.awt.Color: Creates an opaque sRGB color with the specified combined RGB value consisting of the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.

Parameters:
color - int

MinuetoColor

public MinuetoColor(int red,
                    int green,
                    int blue,
                    int alpha)
Creates a new RGBA color. Colors are defined as four integers values ranging from 0 to 255.

Parameters:
red - int denoting the red color value.
green - int denoting the green color value.
blue - int denoting the blue color value.
alpha - int denothing the alpha color value.
Throws:
MinuetoInvalidColorValueException - if an invalid color value is passed.

MinuetoColor

public MinuetoColor(double red,
                    double green,
                    double blue)
Creates a new RGB color. Colors are defined as three floating-point values ranging from 0.0 to 1.0.

Parameters:
red - double denoting the red color value.
green - double denoting the green color value.
blue - Double double the blue color value.
Throws:
MinuetoInvalidColorValueException - if an invalid color value is passed.

MinuetoColor

public MinuetoColor(double red,
                    double green,
                    double blue,
                    double alpha)
Creates a new RGBA color. Colors are defined as four floating-point values ranging from 0.0 to 1.0.

Parameters:
red - double denoting the red color value.
green - double denoting the green color value.
blue - double denoting the blue color value.
alpha - double denoting the alpha color value.
Throws:
MinuetoInvalidColorValueException - if an invalid color value is passed.
Method Detail

darken

public MinuetoColor darken(double factor)
Returns a darker color. The darkness factor is determined by the double value, whose value should be between 0.0 and 1.0.

Parameters:
factor - double that determines how darker the color will be.
Returns:
MinuetoColor darker color.

darken

public MinuetoColor darken(int factor)
Returns a darker color. The darkness factor is determined by the integer value, whose value should be between 0 and 255.

Parameters:
factor - double that determines how darker the color will be.
Returns:
MinuetoColor darker color.

lighten

public MinuetoColor lighten(double factor)
Returns a lighter color. The lightness factor is determined by the double value, whose value should be between 0.0 and 1.0.

Parameters:
factor - double that determines how lighter the color will be.
Returns:
MinuetoColor lighter color.

lighten

public MinuetoColor lighten(int factor)
Returns a lighter color. The lightness factor is determined by the double value, whose value should be between 0.0 and 1.0.

Parameters:
factor - double that determines how lighter the color will be.
Returns:
MinuetoColor lighter color.

getBlue

public int getBlue()
Returns the blue value of this color. The returned value is an integer whose value is between 0 and 255.

Returns:
int denoting the blue value of this color.

getRed

public int getRed()
Returns the red value of this color. The returned value is an integer whose value is between 0 and 255.

Returns:
int denoting the red value of this color.

getGreen

public int getGreen()
Returns the green value of this color. The returned value is an integer whose value is between 0 and 255.

Returns:
int denoting the green value of this color.

getAlpha

public int getAlpha()
Returns the alpha value of this color. The returned value is an integer whose value is between 0 and 255.

Returns:
int denoting the alpha value of this color.

getAWTColor

public java.awt.Color getAWTColor()
Returns the equivalent AWT color object.

Returns:
Color Color code of the object.

getARGBColorValue

public int getARGBColorValue()
Returns the sRGB color code for this color as an integer.

Returns:
int of the sRGB color code.

toString

public java.lang.String toString()
Returns a string representation of the color.

Overrides:
toString in class java.lang.Object
Returns:
String containing the color information.