ilog.views.util.java2d
Class IlvLinearGradientPaint

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

public class IlvLinearGradientPaint
extends IlvMultipleGradientPaint

This class defines a multiple linear 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.

The user may also select what action the IlvLinearGradientPaint 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.

Sample drawing produced by a linear gradient:



CSS example:

ilvLinearGradientPaint {
    class : "ilog.views.util.java2d.IlvLinearGradientPaint(start,end,stops,colors,spreadMethod,colorSpace,transform,adapting)";
    adapting : "false";
    colors[0] : "green";
    colors[1] : "red";
    colorSpace : "SRGB";
    end : "@#rectangle2D";
    spreadMethod : "PAD";
    start : "@#rectangle2D";
    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.lang.String class
          
Builds an IlvLinearGradientPaint.
 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 end
          
Sets the end point for the gradient.
 short spreadMethod
          
Sets the spread method of the gradient.
 java.awt.geom.Point2D start
          
Sets the start point for 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 an IlvLinearGradientPaint.

CSS example:     class : "ilog.views.util.java2d.IlvLinearGradientPaint(start,end,stops,colors,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";


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.


end

public java.awt.geom.Point2D end

Sets the end point for the gradient.

CSS example:     end : "@#rectangle2D";

See implementing class Rectangle2D for an example of implementing an end.


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.


start

public java.awt.geom.Point2D start

Sets the start point for the gradient.

CSS example:     start : "@#rectangle2D";

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


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.