Class RadialGradient

java.lang.Object
com.codename1.ui.Gradient
com.codename1.ui.RadialGradient
All Implemented Interfaces:
Paint

public final class RadialGradient extends Gradient

Multi-stop radial gradient with CSS shape / extent / center / radius support. Mirrors CSS radial-gradient([shape] [extent] [at <pos>], <stops>).

Since

8.1

  • Field Details

    • SHAPE_CIRCLE

      public static final byte SHAPE_CIRCLE
      Radial shape: circular (single radius).
      See Also:
    • SHAPE_ELLIPSE

      public static final byte SHAPE_ELLIPSE
      Radial shape: elliptical (separate x/y radii).
      See Also:
    • EXTENT_CLOSEST_SIDE

      public static final byte EXTENT_CLOSEST_SIDE
      CSS radial extents.
      See Also:
    • EXTENT_CLOSEST_CORNER

      public static final byte EXTENT_CLOSEST_CORNER
      See Also:
    • EXTENT_FARTHEST_SIDE

      public static final byte EXTENT_FARTHEST_SIDE
      See Also:
    • EXTENT_FARTHEST_CORNER

      public static final byte EXTENT_FARTHEST_CORNER
      See Also:
    • EXTENT_EXPLICIT

      public static final byte EXTENT_EXPLICIT
      Use the configured relativeRadiusX/Y verbatim (times the rectangle's larger dimension).
      See Also:
  • Constructor Details

    • RadialGradient

      public RadialGradient(int[] colors, float[] positions)
  • Method Details

    • getKind

      public byte getKind()
      Description copied from class: Gradient
      Returns one of KIND_LINEAR, KIND_RADIAL, KIND_CONIC.
      Specified by:
      getKind in class Gradient
    • getShape

      public byte getShape()
    • setShape

      public RadialGradient setShape(byte shape)
    • getExtent

      public byte getExtent()
    • setExtent

      public RadialGradient setExtent(byte extent)
    • getRelativeCenterX

      public float getRelativeCenterX()
    • setRelativeCenterX

      public RadialGradient setRelativeCenterX(float relativeCenterX)
    • getRelativeCenterY

      public float getRelativeCenterY()
    • setRelativeCenterY

      public RadialGradient setRelativeCenterY(float relativeCenterY)
    • getRelativeRadiusX

      public float getRelativeRadiusX()
    • setRelativeRadiusX

      public RadialGradient setRelativeRadiusX(float relativeRadiusX)
    • getRelativeRadiusY

      public float getRelativeRadiusY()
    • setRelativeRadiusY

      public RadialGradient setRelativeRadiusY(float relativeRadiusY)
    • computeRadii

      public void computeRadii(int width, int height, float[] out)
      Computes (cx, cy, rx, ry) in pixel coordinates for a rectangle of the given width / height, applying the configured CSS extent.
    • sampleArgb

      public int sampleArgb(int px, int py, int width, int height)
      Description copied from class: Gradient
      Software-rasterizer hook used by the default port implementation when no native gradient shader is available. Samples an ARGB color for the pixel at (px, py) within a rectangle of the given width / height. Ports overriding fillGradient directly do not call this.
      Specified by:
      sampleArgb in class Gradient
    • copy

      public RadialGradient copy()
      Description copied from class: Gradient
      Returns a defensive deep copy. Implemented by each concrete subclass so async-paint queues can capture an immutable snapshot.
      Specified by:
      copy in class Gradient