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.
Since:
1.6
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The color space in which to perform the gradient interpolation.
    static enum 
    The method to use when painting outside the gradient bounds.
  • Field Summary

    Fields declared in interface Transparency

    BITMASK, OPAQUE, TRANSLUCENT
    Modifier and Type
    Field
    Description
    static final int
    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.
    static final int
    Represents image data that is guaranteed to be completely opaque, meaning that all pixels have an alpha value of 1.0.
    static final int
    Represents image data that contains or might contain arbitrary alpha values between and including 0.0 and 1.0.
  • Method Summary

    Modifier and Type
    Method
    Description
    final 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.
    Returns a copy of the transform applied to the gradient.
    final int
    Returns the transparency mode for this Paint object.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.

    Methods declared in interface Paint

    createContext
    Modifier and Type
    Method
    Description
    createContext(ColorModel cm, Rectangle deviceBounds, Rectangle2D userBounds, AffineTransform xform, RenderingHints hints)
    Creates and returns a PaintContext used 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

      public final Color[] 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

      public final MultipleGradientPaint.CycleMethod getCycleMethod()
      Returns the enumerated type which specifies cycling behavior.
      Returns:
      the enumerated type which specifies cycling behavior
    • getColorSpace

      public final MultipleGradientPaint.ColorSpaceType getColorSpace()
      Returns the enumerated type which specifies color space for interpolation.
      Returns:
      the enumerated type which specifies color space for interpolation
    • getTransform

      public final AffineTransform 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 this Paint object.
      Specified by:
      getTransparency in interface Transparency
      Returns:
      OPAQUE if all colors used by this Paint object are opaque, TRANSLUCENT if at least one of the colors used by this Paint object is not opaque.
      See Also: