|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--canvas.BaseColor
Provides an abstract structure and general services for Colors.
It provides methods that are common to the subclasses.
For example, all color classes will have to return the
color they hold, so getColor() is provided here.
Also, each of the subclasses will have some common
mathematical operations to carry out, so they are
provided here as protected methods.
| Field Summary | |
protected Color |
color
This is the color the object holds and operates on. |
| Constructor Summary | |
BaseColor(Color c)
Takes the color that is to be held. |
|
BaseColor(int n)
Takes the single integer that gets piped into the Color() constructor. |
|
BaseColor(int r,
int g,
int b)
Creates new color with specified red, green, and blue components. |
|
| Method Summary | |
abstract Color |
brighter()
Return a brighter version of the color. |
abstract Color |
darker()
Returns a darker version of the color. |
abstract Color |
desaturate()
Returns a less saturated version of the color. |
Color |
getColor()
Returns the color. |
abstract Color |
hueshift(int degrees)
Returns a color shifted around the color wheel. |
protected static float |
in_range(float f)
Returns a float between 0 and 1. |
protected static int |
in_range(int i)
Makes sure the integer passed in is between 0 and 255 and returns it. |
abstract Color |
saturate()
Returns a more saturated version of the color. |
String |
toString()
Returns a string with the color's RGB components. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected final Color color
| Constructor Detail |
public BaseColor(int r,
int g,
int b)
r - Red component, 0-255g - Green component, 0-255b - Blue component, 0-255public BaseColor(Color c)
public BaseColor(int n)
| Method Detail |
public Color getColor()
public abstract Color brighter()
public abstract Color darker()
public abstract Color saturate()
public abstract Color desaturate()
public abstract Color hueshift(int degrees)
degrees - The number of degrees out of 360
to shift the color.public String toString()
toString in class Objectprotected static int in_range(int i)
protected static float in_range(float f)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||