|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.generation5.util.Gradient
This class provides a method of creating a smooth gradient between up to 10
evenly distributed colour points. To create a gradient, add up to 10 colours
and call createGradient. getColour or
getGradient can be used to retrieve the resultant colours.
| Constructor Summary | |
Gradient()
Creates a new instance of Gradient. |
|
| Method Summary | |
void |
addPoint(java.awt.Color gradientColour)
Add a colour to the gradient list. |
void |
createGradient()
Create the gradient using the current gradient list. |
void |
createGradient(int numSteps)
Create the gradient using the current gradient list. |
java.awt.Color |
getColour(int i)
Return the ith colour in the gradient. |
java.awt.Color[] |
getGradient()
Return the entire gradient as a Color array. |
protected double[] |
getRGBDeltas(java.awt.Color start,
java.awt.Color end,
int steps)
Calculate the RGB deltas between two different colour values and over a given number of timesteps. |
static void |
main(java.lang.String[] args)
Test function. |
void |
reset()
Reset the gradient. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Gradient()
| Method Detail |
public void addPoint(java.awt.Color gradientColour)
gradientColour - the next colour in the gradient.public void reset()
protected double[] getRGBDeltas(java.awt.Color start,
java.awt.Color end,
int steps)
createGradient uses this function
to connect the gradient points together.
start - the starting colour.end - the ending colour.steps - the number of steps required to get from start
to endReturns:- a
double[3] array returning the red, green and blue
delta values. public void createGradient()
public void createGradient(int numSteps)
numSteps - the number of steps to take from the first colour to
the last.public java.awt.Color getColour(int i)
i - the index of gradient array to return.
Color value in the gradient.public java.awt.Color[] getGradient()
Color[256] containing the gradient colours.public static void main(java.lang.String[] args)
args - command-line arguments (ignored).
|
This documentation is part of the Generation5 JDK.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||