|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objecteu.hansolo.gradients.ContourGradientPaint
public final class ContourGradientPaint extends Object
A paint class that creates a gradient that is a combination of four linear gradient paints. Each of the gradients start at one of the four sides of the given bounds rectangle and fill stop in the center of the boundary rectangle. You could use it like the other gradient paints in the jdk (LinearGradientPaint and RadialGradientPaint). You simply have to pass the boundary box of your element, a array of floats for the fractions and a array of colors to the ContourGradientPaint. If you would like to create a diamond like gradient you have to pass a boundary rectangle that is square (width == height). Even if the name implies that it uses the contour of a shape it will always use the rectangular boundary box of your shape!
| Nested Class Summary | |
|---|---|
private class |
ContourGradientPaint.DiamondGradientPaintContext
|
| Field Summary | |
|---|---|
private Rectangle2D |
BOUNDS
|
private Color[] |
COLORS
|
private List |
COLOR_LOOKUP
|
private Float[] |
FRACTIONS
|
private static float |
INT_TO_FLOAT_CONST
|
| Constructor Summary | |
ContourGradientPaint(Rectangle2D GIVEN_BOUNDS, float[] GIVEN_FRACTIONS, Color[] GIVEN_COLORS)
Enhanced constructor which takes the FRACTIONS in degress from 0.0f to 360.0f and also an GIVEN_OFFSET in degrees around the rotation CENTER |
|
| Method Summary | |
|---|---|
PaintContext
|
createContext(ColorModel COLOR_MODEL, Rectangle DEVICE_BOUNDS, Rectangle2D USER_BOUNDS, AffineTransform TRANSFORM, RenderingHints HINTS)
|
private Color
|
getColorFromFraction(Color SOURCE_COLOR, Color DESTINATION_COLOR, int RANGE, int CURRENT_FRACTION)
Returns the color that equals the value from CURRENT_FRACTION in a RANGE of values where the start of the RANGE equals the SOURCE_COLOR and the end of the RANGE equals the DESTINATION_COLOR. |
int
|
getTransparency()
|
private List
|
prepareColorLookup()
|
String
|
toString()
|
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
private final Rectangle2D BOUNDS
private final Color[] COLORS
private final List COLOR_LOOKUP
private final Float[] FRACTIONS
private static final float INT_TO_FLOAT_CONST
| Constructor Detail |
|---|
public ContourGradientPaint(Rectangle2D GIVEN_BOUNDS, float[] GIVEN_FRACTIONS, Color[] GIVEN_COLORS)
| Method Detail |
|---|
@Override public PaintContext createContext(ColorModel COLOR_MODEL, Rectangle DEVICE_BOUNDS, Rectangle2D USER_BOUNDS, AffineTransform TRANSFORM, RenderingHints HINTS)
private Color getColorFromFraction(Color SOURCE_COLOR, Color DESTINATION_COLOR, int RANGE, int CURRENT_FRACTION)
@Override public int getTransparency()
private List prepareColorLookup()
@Override public String toString()
Groovy Documentation