Class Color139

java.lang.Object
  extended by Color139

public class Color139
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 Color139 BLACK
           
static Color139 BLUE
           
static Color139 CYAN
           
static Color139 GREEN
           
static Color139 MAGENTA
           
static Color139 RED
           
static Color139 WHITE
           
static Color139 YELLOW
           
 
Constructor Summary
Color139(int redComponent, int greenComponent, int blueComponent)
          This constructor creates a Color139 object with the specified RGB component values.
 
Method Summary
 Color139 add(Color139 other)
          The method returns a new Color139 value that is the sum of this color and the other color.
 Color139 brighten()
          The method returns a brighter new Color139 value.
 Color139 darken()
          The method returns a darker new Color139 value.
 Color139 dim()
          The method returns a dimmer new Color139 value.
 boolean equals(Color139 other)
          This method returns true if this color is equal to the other color and returns false if it is not equal.
 Color139 lighten()
          The method returns a lighter new Color139 value.
 Color139 sub(Color139 other)
          The method returns a new Color139 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 Color139 BLACK

RED

public static final Color139 RED

GREEN

public static final Color139 GREEN

YELLOW

public static final Color139 YELLOW

BLUE

public static final Color139 BLUE

MAGENTA

public static final Color139 MAGENTA

CYAN

public static final Color139 CYAN

WHITE

public static final Color139 WHITE
Constructor Detail

Color139

public Color139(int redComponent,
                int greenComponent,
                int blueComponent)
This constructor creates a Color139 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(Color139 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 Color139 lighten()
The method returns a lighter new Color139 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 Color139 darken()
The method returns a darker new Color139 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 Color139 brighten()
The method returns a brighter new Color139 value. Each of the red, green, and blue components is increased by 20%.

Returns:
The brighter color

dim

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

Returns:
The dimmer color

add

public Color139 add(Color139 other)
The method returns a new Color139 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 Color139 sub(Color139 other)
The method returns a new Color139 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 sum of the two colors