net.sourceforge.toscanaj.util.gradients
Class CombinedGradient

java.lang.Object
  extended bynet.sourceforge.toscanaj.util.gradients.CombinedGradient
All Implemented Interfaces:
Gradient

public class CombinedGradient
extends java.lang.Object
implements Gradient

This class combines different gradients into a single one. Each gradient gets a weight assigned, which defines the relative lengths of the gradients. For example a gradient with the weight 2 will have twice the length of a gradient with weight 1. Since the final interval will be the normed [0,1] interval again, each gradient's length in the final result will be its weight divided by the sum of all weights.


Constructor Summary
CombinedGradient(Gradient firstGradient, double weight)
           
 
Method Summary
 void addGradientPart(Gradient gradient, double weight)
           
 java.awt.Color getColor(double position)
          Returns the color at a certain position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CombinedGradient

public CombinedGradient(Gradient firstGradient,
                        double weight)
Method Detail

addGradientPart

public void addGradientPart(Gradient gradient,
                            double weight)

getColor

public java.awt.Color getColor(double position)
Description copied from interface: Gradient
Returns the color at a certain position.

Specified by:
getColor in interface Gradient
Parameters:
position - value in [0,1] giving the position within the gradient
Returns:
the color at the position


The ToscanaJ project