Class MultipleGradientPaint
java.lang.Object
java.awt.MultipleGradientPaint
- All Implemented Interfaces:
Paint, Transparency
- Direct Known Subclasses:
LinearGradientPaint, RadialGradientPaint
public abstract sealed class MultipleGradientPaint
extends Object
implements Paint
permits 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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe color space in which to perform the gradient interpolation.static enumThe method to use when painting outside the gradient bounds. -
Field Summary
Fields declared in interface Transparency
BITMASK, OPAQUE, TRANSLUCENTModifier and TypeFieldDescriptionstatic final intRepresents 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.static final intRepresents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.static final intRepresents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0. -
Method Summary
Modifier and TypeMethodDescriptionfinal Color[]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.final float[]Returns a copy of the array of floats used by this gradient to calculate color distribution.final AffineTransformReturns a copy of the transform applied to the gradient.final intReturns the transparency mode for thisPaintobject.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Creates and returns a copy of this object.booleanIndicates whether some other object is "equal to" this one.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.Finalization is deprecated and subject to removal in a future release.final Class<?> getClass()Returns the runtime class of thisObject.inthashCode()Returns a hash code value for this object.final voidnotify()Wakes up a single thread that is waiting on this object's monitor.final voidWakes up all threads that are waiting on this object's monitor.toString()Returns a string representation of the object.final voidwait()Causes the current thread to wait until it is awakened, typically by being notified or interrupted.final voidwait(long timeoutMillis) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.final voidwait(long timeoutMillis, int nanos) Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.Methods declared in interface Paint
createContextModifier and TypeMethodDescriptioncreateContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints) Creates and returns aPaintContextused to generate the color pattern.
-
Method Details
-
getFractions
public final float[] getFractions()Returns a copy of the array of floats used by this gradient to calculate color distribution. The returned array always has 0 as its first value and 1 as its last value, with increasing values in between.- Returns:
- a copy of the array of floats used by this gradient to calculate color distribution
-
getColors
Returns a copy of the array of colors used by this gradient. The first color maps to the first value in the fractions array, and the last color maps to the last value in the fractions array.- Returns:
- a copy of the array of colors used by this gradient
-
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.Note that if no transform is applied to the gradient when it is created, the identity transform is used.
- Returns:
- a copy of the transform applied to the gradient
-
getTransparency
public final int getTransparency()Returns the transparency mode for thisPaintobject.- Specified by:
getTransparencyin interfaceTransparency- Returns:
OPAQUEif all colors used by thisPaintobject are opaque,TRANSLUCENTif at least one of the colors used by thisPaintobject is not opaque.- See Also:
-