org.apache.batik.ext.awt

Class MultipleGradientPaint

public abstract class MultipleGradientPaint extends Object implements Paint

This is the superclass for Paints which use a multiple color gradient to fill in their raster. It provides storage for variables and enumerated values common to LinearGradientPaint and RadialGradientPaint.
Nested Class Summary
static classMultipleGradientPaint.ColorSpaceEnum
Inner class to allow for typesafe enumerated ColorSpace values.
static classMultipleGradientPaint.CycleMethodEnum
Inner class to allow for typesafe enumerated CycleMethod values.
Field Summary
protected Color[]colors
Gradient colors.
protected MultipleGradientPaint.ColorSpaceEnumcolorSpace
The colorSpace in which to perform the interpolation.
protected MultipleGradientPaint.CycleMethodEnumcycleMethod
The method to use when painting out of the gradient bounds.
protected float[]fractions
Gradient keyframe values in the range 0 to 1.
protected AffineTransformgradientTransform
Transform to apply to gradient.
static MultipleGradientPaint.ColorSpaceEnumLINEAR_RGB
Indicates that the color interpolation should occur in linearized RGB space.
static MultipleGradientPaint.CycleMethodEnumNO_CYCLE
Indicates (if the gradient starts or ends inside the target region) to use the terminal colors to fill the remaining area. (default)
static MultipleGradientPaint.CycleMethodEnumREFLECT
Indicates (if the gradient starts or ends inside the target region), to cycle the gradient colors start-to-end, end-to-start to fill the remaining area.
static MultipleGradientPaint.CycleMethodEnumREPEAT
Indicates (if the gradient starts or ends inside the target region), to cycle the gradient colors start-to-end, start-to-end to fill the remaining area.
static MultipleGradientPaint.ColorSpaceEnumSRGB
Indicates that the color interpolation should occur in sRGB space. (default)
protected inttransparency
Transparency.
Constructor Summary
MultipleGradientPaint(float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethodEnum cycleMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace, AffineTransform gradientTransform)
Superclass constructor, typical user should never have to call this.
Method Summary
Color[]getColors()
Returns a copy of the array of colors used by this gradient.
MultipleGradientPaint.ColorSpaceEnumgetColorSpace()
Returns the enumerated type which specifies color space for interpolation.
MultipleGradientPaint.CycleMethodEnumgetCycleMethod()
Returns the enumerated type which specifies cycling behavior.
float[]getFractions()
Returns a copy of the array of floats used by this gradient to calculate color distribution.
AffineTransformgetTransform()
Returns a copy of the transform applied to the gradient.
intgetTransparency()
Returns the transparency mode for this LinearGradientPaint.

Field Detail

colors

protected Color[] colors
Gradient colors.

colorSpace

protected MultipleGradientPaint.ColorSpaceEnum colorSpace
The colorSpace in which to perform the interpolation.

cycleMethod

protected MultipleGradientPaint.CycleMethodEnum cycleMethod
The method to use when painting out of the gradient bounds.

fractions

protected float[] fractions
Gradient keyframe values in the range 0 to 1.

gradientTransform

protected AffineTransform gradientTransform
Transform to apply to gradient.

LINEAR_RGB

public static final MultipleGradientPaint.ColorSpaceEnum LINEAR_RGB
Indicates that the color interpolation should occur in linearized RGB space.

NO_CYCLE

public static final MultipleGradientPaint.CycleMethodEnum NO_CYCLE
Indicates (if the gradient starts or ends inside the target region) to use the terminal colors to fill the remaining area. (default)

REFLECT

public static final MultipleGradientPaint.CycleMethodEnum REFLECT
Indicates (if the gradient starts or ends inside the target region), to cycle the gradient colors start-to-end, end-to-start to fill the remaining area.

REPEAT

public static final MultipleGradientPaint.CycleMethodEnum REPEAT
Indicates (if the gradient starts or ends inside the target region), to cycle the gradient colors start-to-end, start-to-end to fill the remaining area.

SRGB

public static final MultipleGradientPaint.ColorSpaceEnum SRGB
Indicates that the color interpolation should occur in sRGB space. (default)

transparency

protected int transparency
Transparency.

Constructor Detail

MultipleGradientPaint

public MultipleGradientPaint(float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethodEnum cycleMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace, AffineTransform gradientTransform)
Superclass constructor, typical user should never have to call this.

Parameters: fractions numbers ranging from 0.0 to 1.0 specifying the distribution of colors along the gradient colors array of colors corresponding to each fractional value cycleMethod either NO_CYCLE, REFLECT, or REPEAT colorSpace which colorspace to use for interpolation, either SRGB or LINEAR_RGB gradientTransform transform to apply to the gradient

Throws: NullPointerException if arrays are null, or gradientTransform is null IllegalArgumentException if fractions.length != colors.length, or if colors is less than 2 in size, or if an enumerated value is bad.

Method Detail

getColors

public Color[] getColors()
Returns a copy of the array of colors used by this gradient.

Returns: a copy of the array of colors used by this gradient

getColorSpace

public MultipleGradientPaint.ColorSpaceEnum getColorSpace()
Returns the enumerated type which specifies color space for interpolation.

Returns: the enumerated type which specifies color space for interpolation

getCycleMethod

public MultipleGradientPaint.CycleMethodEnum getCycleMethod()
Returns the enumerated type which specifies cycling behavior.

Returns: the enumerated type which specifies cycling behavior

getFractions

public float[] getFractions()
Returns a copy of the array of floats used by this gradient to calculate color distribution.

Returns: a copy of the array of floats used by this gradient to calculate color distribution

getTransform

public AffineTransform getTransform()
Returns a copy of the transform applied to the gradient.

Returns: a copy of the transform applied to the gradient.

getTransparency

public int getTransparency()
Returns the transparency mode for this LinearGradientPaint.

Returns: an integer value representing this LinearGradientPaint object's transparency mode.

Copyright B) 2008 Apache Software Foundation. All Rights Reserved.