canvas
Class AnyColor

java.lang.Object
  |
  +--canvas.BaseColor
        |
        +--canvas.AnyColor

public class AnyColor
extends BaseColor

Will hold and return any 24-bit RGB color. You should use this if you are not concerned about displaying your colors on an 8-bit display.


Field Summary
 
Fields inherited from class canvas.BaseColor
color
 
Constructor Summary
AnyColor(canvas.AnyColor ac)
          Extracts the color from the AnyColor object.
AnyColor(Color c)
          Takes the color to be held as the argument.
AnyColor(int n)
          Takes the single integer that gets piped into the Color() constructor.
AnyColor(int r, int g, int b)
          Takes the red, green,and blue components.
AnyColor(canvas.WebSafeColor wsc)
          Extracts the color from the WebSafeColor object.
 
Method Summary
 Color brighter()
          Returns a brighter version of the held color.
 Color darker()
          Returns a darker version ofthe held color.
 Color desaturate()
          Returns a less saturated version of the color.
 Color hueshift(int degrees)
          Returns a color with a different hue than the one held.
 Color saturate()
          Returns a more saturated version of the color.
static void SelfTest()
          This method demonstrates the supported methods.
 
Methods inherited from class canvas.BaseColor
getColor, in_range, in_range, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnyColor

public AnyColor(int r,
                int g,
                int b)
Takes the red, green,and blue components.

Parameters:
r - Red component, 0-255
g - Green component, 0-255
b - Bluecomponent, 0-255

AnyColor

public AnyColor(int n)
Takes the single integer that gets piped into the Color() constructor. Use hex values between 0x000000 and 0xFFFFFF. The first two digits represent red, the second pair represent green and the third pair represent blue.


AnyColor

public AnyColor(Color c)
Takes the color to be held as the argument.


AnyColor

public AnyColor(canvas.AnyColor ac)
Extracts the color from the AnyColor object.


AnyColor

public AnyColor(canvas.WebSafeColor wsc)
Extracts the color from the WebSafeColor object.

Method Detail

brighter

public Color brighter()
Returns a brighter version of the held color. This is acomplished by adding the same number to each of the RGB components and returning a new color with those properties.

Specified by:
brighter in class BaseColor

darker

public Color darker()
Returns a darker version ofthe held color. Does the same thing as brighter(), but instead of adding to the components, this method subtracts.

Specified by:
darker in class BaseColor

saturate

public Color saturate()
Returns a more saturated version of the color. Consult superclass for details.

Specified by:
saturate in class BaseColor

desaturate

public Color desaturate()
Returns a less saturated version of the color. Consult superclass for details.

Specified by:
desaturate in class BaseColor

hueshift

public Color hueshift(int degrees)
Returns a color with a different hue than the one held. Consult superclass for details.

Specified by:
hueshift in class BaseColor
Parameters:
degrees - The number of degrees out of 360 to shift the color.

SelfTest

public static void SelfTest()
This method demonstrates the supported methods.