Class Color149

java.lang.Object
  extended by Color149

public class Color149
extends java.lang.Object

This class implements a color object. Colors are defined by three component colors: red, green, blue. Each of these three components has a value betwen 0 and 255.


Field Summary
static Color149 BLACK
           
static Color149 BLUE
           
static Color149 CYAN
           
static Color149 GREEN
           
static Color149 MAGENTA
           
static Color149 RED
           
static Color149 WHITE
           
static Color149 YELLOW
           
 
Constructor Summary
Color149(int redComponent, int greenComponent, int blueComponent)
          This constructor creates a Color149 object with the specified RGB component values.
 
Method Summary
 Color149 add(Color149 other)
          The method returns a new Color149 value that is the sum of this color and the other color.
 Color149 brighten()
          The method returns a brighter new Color149 value.
 Color149 darken()
          The method returns a darker new Color149 value.
 Color149 dim()
          The method returns a dimmer new Color149 value.
 boolean equals(Color149 other)
          This method returns true if this color is equal to the other color and returns false if it is not equal.
 Color149 lighten()
          The method returns a lighter new Color149 value.
 Color149 sub(Color149 other)
          The method returns a new Color149 value that is the difference between this color and the other color.
 java.lang.String toString()
          This method returns a string representation of the color in the form "#RRGGBB" where RR, GG, and BB are the red, green and blue component values expressed as hexidecimal digits.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLACK

public static final Color149 BLACK

RED

public static final Color149 RED

GREEN

public static final Color149 GREEN

YELLOW

public static final Color149 YELLOW

BLUE

public static final Color149 BLUE

MAGENTA

public static final Color149 MAGENTA

CYAN

public static final Color149 CYAN

WHITE

public static final Color149 WHITE
Constructor Detail

Color149

public Color149(int redComponent,
                int greenComponent,
                int blueComponent)
This constructor creates a Color149 object with the specified RGB component values. If a component value less than 0 is specified, that component value is set to 0. If a component value greater than 255 is specified, that component's value is set to 255.

Parameters:
redComponent - The color's red component as a value 0-255
greenComponent - The color's green component as a value 0-255
blueComponent - The color's blue component as a value 0-255
Method Detail

toString

public java.lang.String toString()
This method returns a string representation of the color in the form "#RRGGBB" where RR, GG, and BB are the red, green and blue component values expressed as hexidecimal digits.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of the color

equals

public boolean equals(Color149 other)
This method returns true if this color is equal to the other color and returns false if it is not equal.

Parameters:
other - The color to be compared to this color
Returns:
Whether or not the two colors are equal

lighten

public Color149 lighten()
The method returns a lighter new Color149 value. Each of the red, green, and blue components is increased by 32 up to a maximum of 255.

Returns:
The lighter color

darken

public Color149 darken()
The method returns a darker new Color149 value. Each of the red, green, and blue components is decreased by 32 down to a minimum of 0.

Returns:
The darker color

brighten

public Color149 brighten()
The method returns a brighter new Color149 value. Each of the red, green, and blue components is increased by 20%.

Returns:
The brighter color

dim

public Color149 dim()
The method returns a dimmer new Color149 value. Each of the red, green, and blue components is decreased by 20%. by 2.

Returns:
The dimmer color

add

public Color149 add(Color149 other)
The method returns a new Color149 value that is the sum of this color and the other color. The value of the red components of the two colors are added, as are the green and blue components. Any result greater than 255 is set to 255.

Parameters:
other - The color to be added to this color
Returns:
The sum of the two colors

sub

public Color149 sub(Color149 other)
The method returns a new Color149 value that is the difference between this color and the other color. The value of the red components of the other color is subtracted from the red component of this color. The green and blue components are calculated similarly. Any result less than 0 is set to 0.

Parameters:
other - The color to be subtracted from this color
Returns:
The difference of the two colors