ilog.views.util.java2d
Class IlvRadialGradientPaint

ilog.views.util.java2d.IlvMultipleGradientPaint
      extended by ilog.views.util.java2d.IlvRadialGradientPaint

public class IlvRadialGradientPaint
extends IlvMultipleGradientPaint

This class defines a multiple radial color gradient paint that will be used to fill Java 2 Shape objects.

You can, for example, set it on an IlvGeneralPath to fill it.

The user must provide an array of floats in an increasing order specifying how to distribute the colors along the gradient. These values should range from 0.0 to 1.0 and act like keyframes along the gradient (they mark where the gradient should be exactly a particular color).

In the event that the user does not set the first keyframe value equal to 0 and the last keyframe value equal to 1, keyframes will be created at these positions, and the first and last colors will be replicated there.

This paint will map the first color of the gradient to a focal point within the circle and the last color to the perimeter of the circle, interpolating smoothly for any in-between colors specified by the user. Any line drawn from the focal point to the circumference will span all the gradient colors. By default, the focus is set to be the center of the circle.

Specifying a focal point outside of the circle's radius will result in the focus being set to the intersection point of the focus-center line and the perimeter of the circle.

The user may also select what action the IlvRadialGradientPaint should take when filling color outside the start and end points. If no spread method is specified, SPREAD_PAD will be chosen by default, so the endpoint colors will be used to fill the remaining area.

Here is a sample drawing produced by a radial gradient:



CSS example:

ilvRadialGradientPaint {
    class : "ilog.views.util.java2d.IlvRadialGradientPaint(center,radius,stops,colors,focal,spreadMethod,colorSpace,transform,adapting)";
    adapting : "false";
    center : "@#rectangle2D";
    colors[0] : "green";
    colors[1] : "red";
    colorSpace : "SRGB";
    focal : "@#rectangle2D";
    radius : "2.0";
    spreadMethod : "PAD";
    stops[0] : "2.0";
    stops[1] : "2.0";
    transparency : "OPAQUE";
}


Property Summary
 boolean adapting
          
Sets true if the gradient is adapting itself on the shape it is drawn.
 java.awt.geom.Point2D center
          
Sets the gradient center.
 java.lang.String class
          
Builds a circular IlvRadialGradientPaint instance.
 java.awt.Color[] colors
          
Sets a copy of the array of colors used by this gradient.
 short colorSpace
          
Sets the interpolation color space of this gradient.
 java.awt.geom.Point2D focal
          
Sets the gradient focus.
 float radius
          
Sets the gradient radius.
 short spreadMethod
          
Sets the spread method of the gradient.
 float[] stops
          
Sets a copy of the array of floats used by this gradient to calculate color distribution.
 int transparency
          
Sets the transparency mode for this gradient.
 

Property Detail

class

public java.lang.String class

Builds a circular IlvRadialGradientPaint instance.

CSS example:     class : "ilog.views.util.java2d.IlvRadialGradientPaint(center,radius,stops,colors,focal,spreadMethod,colorSpace,transform,adapting)";


adapting

public boolean adapting

Sets true if the gradient is adapting itself on the shape it is drawn.

CSS example:     adapting : "false";


center

public java.awt.geom.Point2D center

Sets the gradient center.

CSS example:     center : "@#rectangle2D";

See implementing class Rectangle2D for an example of implementing a center.


colors

public java.awt.Color[] colors

Sets a copy of the array of colors used by this gradient.

CSS example:    

colors[0] : "green";
colors[1] : "red";

A color can either be a string representing a color or else an octal or hexadecimal string that starts with the character "#" or else a comma separated "RGB" value where the integer values are in the range 0..255.


colorSpace

public short colorSpace

Sets the interpolation color space of this gradient.

CSS example:     colorSpace : "SRGB";

Allowed values:
SRGB    Indicates that the color interpolation should occur in sRGB space. (default)
LINEAR_RGB    Indicates that the color interpolation should occur in linearized RGB space.


focal

public java.awt.geom.Point2D focal

Sets the gradient focus.

CSS example:     focal : "@#rectangle2D";

See implementing class Rectangle2D for an example of implementing a focal.


radius

public float radius

Sets the gradient radius.

CSS example:     radius : "2.0";


spreadMethod

public short spreadMethod

Sets the spread method of the gradient.

CSS example:     spreadMethod : "PAD";

Allowed values:
PAD    Indicates that if the gradient starts or ends inside the target region, the remainder region is filled with the terminal color of the gradient.
REFLECT    Indicates that if the gradient starts or ends inside the target region, the gradient is reflected continuously until the remainder region is filled.
REPEAT    Indicates that if the gradient starts or ends inside the target region, the gradient is repeated continuously until the remainder region is filled.


stops

public float[] stops

Sets a copy of the array of floats used by this gradient to calculate color distribution.

CSS example:    

stops[0] : "2.0";
stops[1] : "2.0";


transparency

public int transparency

Sets the transparency mode for this gradient.

CSS example:     transparency : "OPAQUE";

Allowed values:
OPAQUE    Represents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.
BITMASK    Represents image data that is guaranteed to be either completely opaque, with an alpha value of 1.0, or completely transparent, with an alpha value of 0.0.
TRANSLUCENT    Represents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0.



Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.