jewl
Class Color

java.lang.Object
  extended byjava.awt.Color
      extended byjewl.Colour
          extended byjewl.Color
All Implemented Interfaces:
java.awt.Paint, java.io.Serializable, java.awt.Transparency

public class Color
extends Colour

A convenience class which is identical to java.awt.Color. If you have imported all JEWL classes using "import jewl.*", you can use a Color wherever a java.awt.Color is needed. This avoids having to import extra class names from java.awt.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jewl.Colour
darkGrey, grey, lightGrey
 
Fields inherited from class java.awt.Color
black, BLACK, blue, BLUE, cyan, CYAN, DARK_GRAY, darkGray, gray, GRAY, green, GREEN, LIGHT_GRAY, lightGray, magenta, MAGENTA, orange, ORANGE, pink, PINK, red, RED, white, WHITE, yellow, YELLOW
 
Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
 
Constructor Summary
Color(java.awt.Color color)
          Create a colour which is a copy of an existing colour.
Color(java.awt.color.ColorSpace cspace, float[] components, float alpha)
          Creates a colour in the specified ColorSpace with the colour components specified in the float array and the specified alpha.
Color(float red, float green, float blue)
          Create an opaque sRGB colour with the specified red, green, and blue values in the range 0.0 - 1.0.
Color(float red, float green, float blue, float alpha)
          Create an sRGB colour with the specified red, green, blue, and alpha values in the range 0.0 - 1.0.
Color(int rgb)
          Create an opaque sRGB colour 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.
Color(int rgba, boolean hasAlpha)
          Create an sRGB colour with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7.
Color(int red, int green, int blue)
          Create an opaque sRGB colour with the specified red, green, and blue values in the range 0 - 255.
Color(int red, int green, int blue, int alpha)
          Create an sRGB colour with the specified red, green, blue, and alpha values in the range 0 - 255.
 
Methods inherited from class java.awt.Color
brighter, createContext, darker, decode, equals, getAlpha, getBlue, getColor, getColor, getColor, getColorComponents, getColorComponents, getColorSpace, getComponents, getComponents, getGreen, getHSBColor, getRed, getRGB, getRGBColorComponents, getRGBComponents, getTransparency, hashCode, HSBtoRGB, RGBtoHSB, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Color

public Color(java.awt.Color color)
Create a colour which is a copy of an existing colour. This can be used to convert a java.awt.Color to a Color.

Parameters:
color - the colour to be copied.

Color

public Color(java.awt.color.ColorSpace cspace,
             float[] components,
             float alpha)
Creates a colour in the specified ColorSpace with the colour components specified in the float array and the specified alpha. The number of components is determined by the type of the ColorSpace. For example, RGB requires 3 components, but CMYK requires 4 components.

Parameters:
cspace - the ColorSpace to be used to interpret the components.
components - an arbitrary number of color components that is compatible with the alpha parameter.
alpha - the alpha value.

Color

public Color(float red,
             float green,
             float blue)
Create an opaque sRGB colour with the specified red, green, and blue values in the range 0.0 - 1.0. The actual colour used in rendering depends on finding the best match given the colour space available for a given output device. Alpha is defaulted to 1.0.

Parameters:
red - the red component of the colour.
green - the green component of the colour.
blue - the blue component of the colour.

Color

public Color(float red,
             float green,
             float blue,
             float alpha)
Create an sRGB colour with the specified red, green, blue, and alpha values in the range 0.0 - 1.0.

Parameters:
red - the red component of the colour.
green - the green component of the colour.
blue - the blue component of the colour.
alpha - the alpha component of the colour.

Color

public Color(int rgb)
Create an opaque sRGB colour 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. The actual colour used in rendering depends on finding the best match given the colour space available for a particular output device. Alpha is defaulted to 255.

Parameters:
rgb - the combined RGB components.

Color

public Color(int rgba,
             boolean hasAlpha)
Create an sRGB colour with the specified combined RGBA value consisting of the alpha component in bits 24-31, the red component in bits 16-23, the green component in bits 8-15, and the blue component in bits 0-7. If the hasalpha argument is false, alpha is defaulted to 255.

Parameters:
rgba - the combined RGBA components.
hasAlpha - true if the alpha bits are valid; false otherwise.

Color

public Color(int red,
             int green,
             int blue)
Create an opaque sRGB colour with the specified red, green, and blue values in the range 0 - 255. The actual colour used in rendering depends on finding the best match given the colour space available for a given output device. Alpha is defaulted to 255.

Parameters:
red - the red component of the colour.
green - the green component of the colour.
blue - the blue component of the colour.

Color

public Color(int red,
             int green,
             int blue,
             int alpha)
Create an sRGB colour with the specified red, green, blue, and alpha values in the range 0 - 255.

Parameters:
red - the red component of the colour.
green - the green component of the colour.
blue - the blue component of the colour.
alpha - the alpha component of the colour.