Class RadialGradient
java.lang.Object
com.codename1.ui.Gradient
com.codename1.ui.RadialGradient
- All Implemented Interfaces:
Paint
Multi-stop radial gradient with CSS shape / extent / center / radius
support. Mirrors CSS radial-gradient([shape] [extent] [at <pos>], <stops>).
Since
8.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final bytestatic final byteCSS radial extents.static final byteUse the configured relativeRadiusX/Y verbatim (times the rectangle's larger dimension).static final bytestatic final bytestatic final byteRadial shape: circular (single radius).static final byteRadial shape: elliptical (separate x/y radii).Fields inherited from class Gradient
CYCLE_NONE, CYCLE_REFLECT, CYCLE_REPEAT, KIND_CONIC, KIND_LINEAR, KIND_RADIAL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeRadii(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.copy()Returns a defensive deep copy.bytebytegetKind()Returns one ofKIND_LINEAR,KIND_RADIAL,KIND_CONIC.floatfloatfloatfloatbytegetShape()intsampleArgb(int px, int py, int width, int height) Software-rasterizer hook used by the default port implementation when no native gradient shader is available.setExtent(byte extent) setRelativeCenterX(float relativeCenterX) setRelativeCenterY(float relativeCenterY) setRelativeRadiusX(float relativeRadiusX) setRelativeRadiusY(float relativeRadiusY) setShape(byte shape) Methods inherited from class Gradient
getColors, getCycleMethod, getPositions, paint, paint, sampleStops, setCycleMethod
-
Field Details
-
SHAPE_CIRCLE
public static final byte SHAPE_CIRCLERadial shape: circular (single radius).- See Also:
-
SHAPE_ELLIPSE
public static final byte SHAPE_ELLIPSERadial shape: elliptical (separate x/y radii).- See Also:
-
EXTENT_CLOSEST_SIDE
public static final byte EXTENT_CLOSEST_SIDECSS 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_EXPLICITUse 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
-
getShape
public byte getShape() -
setShape
-
getExtent
public byte getExtent() -
setExtent
-
getRelativeCenterX
public float getRelativeCenterX() -
setRelativeCenterX
-
getRelativeCenterY
public float getRelativeCenterY() -
setRelativeCenterY
-
getRelativeRadiusX
public float getRelativeRadiusX() -
setRelativeRadiusX
-
getRelativeRadiusY
public float getRelativeRadiusY() -
setRelativeRadiusY
-
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:GradientSoftware-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 overridingfillGradientdirectly do not call this.- Specified by:
sampleArgbin classGradient
-
copy
Description copied from class:GradientReturns a defensive deep copy. Implemented by each concrete subclass so async-paint queues can capture an immutable snapshot.
-