Package org.apache.batik.ext.awt
Class MultipleGradientPaint
java.lang.Object
org.apache.batik.ext.awt.MultipleGradientPaint
- All Implemented Interfaces:
Paint
,Transparency
- Direct Known Subclasses:
LinearGradientPaint
,RadialGradientPaint
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.
- Version:
- $Id: MultipleGradientPaint.java 1804130 2017-08-04 14:41:11Z ssteiner $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Inner class to allow for typesafe enumerated ColorSpace values.static class
Inner class to allow for typesafe enumerated CycleMethod values. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Color[]
Gradient colors.protected MultipleGradientPaint.ColorSpaceEnum
The colorSpace in which to perform the interpolation.protected MultipleGradientPaint.CycleMethodEnum
The method to use when painting out of the gradient bounds.protected float[]
Gradient keyframe values in the range 0 to 1.protected AffineTransform
Transform to apply to gradient.static final MultipleGradientPaint.ColorSpaceEnum
Indicates that the color interpolation should occur in linearized RGB space.static final MultipleGradientPaint.CycleMethodEnum
Indicates (if the gradient starts or ends inside the target region) to use the terminal colors to fill the remaining area.static final MultipleGradientPaint.CycleMethodEnum
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 final MultipleGradientPaint.CycleMethodEnum
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 final MultipleGradientPaint.ColorSpaceEnum
Indicates that the color interpolation should occur in sRGB space.protected int
Transparency.Fields inherited from interface java.awt.Transparency
BITMASK, OPAQUE, TRANSLUCENT
-
Constructor Summary
ConstructorsConstructorDescriptionMultipleGradientPaint
(float[] fractions, Color[] colors, MultipleGradientPaint.CycleMethodEnum cycleMethod, MultipleGradientPaint.ColorSpaceEnum colorSpace, AffineTransform gradientTransform) Superclass constructor, typical user should never have to call this. -
Method Summary
Modifier and TypeMethodDescriptionColor[]
Returns a copy of the array of colors used by this gradient.Returns the enumerated type which specifies color space for interpolation.Returns the enumerated type which specifies cycling behavior.float[]
Returns a copy of the array of floats used by this gradient to calculate color distribution.Returns a copy of the transform applied to the gradient.int
Returns the transparency mode for this LinearGradientPaint.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.awt.Paint
createContext
-
Field Details
-
transparency
protected int transparencyTransparency. -
fractions
protected float[] fractionsGradient keyframe values in the range 0 to 1. -
colors
Gradient colors. -
gradientTransform
Transform to apply to gradient. -
cycleMethod
The method to use when painting out of the gradient bounds. -
colorSpace
The colorSpace in which to perform the interpolation. -
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
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
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
Indicates that the color interpolation should occur in sRGB space. (default) -
LINEAR_RGB
Indicates that the color interpolation should occur in linearized RGB space.
-
-
Constructor Details
-
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 gradientcolors
- array of colors corresponding to each fractional valuecycleMethod
- either NO_CYCLE, REFLECT, or REPEATcolorSpace
- which colorspace to use for interpolation, either SRGB or LINEAR_RGBgradientTransform
- transform to apply to the gradient- Throws:
NullPointerException
- if arrays are null, or gradientTransform is nullIllegalArgumentException
- if fractions.length != colors.length, or if colors is less than 2 in size, or if an enumerated value is bad.
-
-
Method Details
-
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
-
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
-
getTransparency
public int getTransparency()Returns the transparency mode for this LinearGradientPaint.- Specified by:
getTransparency
in interfaceTransparency
- Returns:
- an integer value representing this LinearGradientPaint object's transparency mode.
-
getCycleMethod
Returns the enumerated type which specifies cycling behavior.- Returns:
- the enumerated type which specifies cycling behavior
-
getColorSpace
Returns the enumerated type which specifies color space for interpolation.- Returns:
- the enumerated type which specifies color space for interpolation
-
getTransform
Returns a copy of the transform applied to the gradient.- Returns:
- a copy of the transform applied to the gradient.
-