Added in API level 1

RadialGradient


open class RadialGradient : Shader
kotlin.Any
   ↳ android.graphics.Shader
   ↳ android.graphics.RadialGradient

Summary

Public constructors
RadialGradient(startX: Float, startY: Float, startRadius: Float, endX: Float, endY: Float, endRadius: Float, colors: LongArray, stops: FloatArray?, tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the start and end points as well as starting and ending radii.

RadialGradient(centerX: Float, centerY: Float, radius: Float, centerColor: Int, edgeColor: Int, tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

RadialGradient(centerX: Float, centerY: Float, radius: Float, colors: IntArray, stops: FloatArray?, tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

RadialGradient(centerX: Float, centerY: Float, radius: Float, centerColor: Long, edgeColor: Long, tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

RadialGradient(centerX: Float, centerY: Float, radius: Float, colors: LongArray, stops: FloatArray?, tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

Inherited functions

Public constructors

RadialGradient

Added in API level 31
RadialGradient(
    startX: Float,
    startY: Float,
    startRadius: Float,
    endX: Float,
    endY: Float,
    endRadius: Float,
    colors: LongArray,
    stops: FloatArray?,
    tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the start and end points as well as starting and ending radii. The starting point is often referred to as the focal center and represents the starting circle of the radial gradient.

Parameters
startX Float: The x-coordinate of the center of the starting circle of the radial gradient, often referred to as the focal point.
startY Float: The y-coordinate of the center of the starting circle of the radial gradient, often referred to as the focal point.
startRadius Float: The radius of the starting circle of the radial gradient, often referred to as the focal radius. Must be greater than or equal to zero. Value is 0.0f or greater
endX Float: The x-coordinate of the center of the radius for the end circle of the radial gradient
endY Float: The y-coordinate of the center of the radius for the end circle of the radial gradient
endRadius Float: The radius of the ending circle for this gradient. This must be strictly greater than zero. A radius value equal to zero is not allowed. Value is 0.0f or greater
colors LongArray: The colors to be distributed between the center and edge of the circle This value cannot be null.
stops FloatArray?: May be null. Valid values are between 0.0f and 1.0f. The relative position of each corresponding color in the colors array. If null, colors are distributed evenly between the center and edge of the circle.
tileMode Shader.TileMode: The Shader tiling mode This value cannot be null.
Exceptions
java.lang.IllegalArgumentException In one of the following circumstances:
  • There are less than two colors
  • The colors do not share the same ColorSpace
  • The colors do not use a valid ColorSpace
  • The stops parameter is not null and has a different length from colors.
  • The startRadius is negative
  • The endRadius is less than or equal to zero

RadialGradient

Added in API level 1
RadialGradient(
    centerX: Float,
    centerY: Float,
    radius: Float,
    centerColor: Int,
    edgeColor: Int,
    tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

Parameters
centerX Float: The x-coordinate of the center of the radius
centerY Float: The y-coordinate of the center of the radius
radius Float: Must be positive. The radius of the circle for this gradient
centerColor Int: The sRGB color at the center of the circle.
edgeColor Int: The sRGB color at the edge of the circle.
tileMode Shader.TileMode: The Shader tiling mode This value cannot be null.

RadialGradient

Added in API level 1
RadialGradient(
    centerX: Float,
    centerY: Float,
    radius: Float,
    colors: IntArray,
    stops: FloatArray?,
    tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

Parameters
centerX Float: The x-coordinate of the center of the radius
centerY Float: The y-coordinate of the center of the radius
radius Float: Must be positive. The radius of the circle for this gradient.
colors IntArray: The sRGB colors to be distributed between the center and edge of the circle This value cannot be null.
stops FloatArray?: May be null. Valid values are between 0.0f and 1.0f. The relative position of each corresponding color in the colors array. If null, colors are distributed evenly between the center and edge of the circle.
tileMode Shader.TileMode: The Shader tiling mode This value cannot be null.

RadialGradient

Added in API level 29
RadialGradient(
    centerX: Float,
    centerY: Float,
    radius: Float,
    centerColor: Long,
    edgeColor: Long,
    tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

Parameters
centerX Float: The x-coordinate of the center of the radius
centerY Float: The y-coordinate of the center of the radius
radius Float: Must be positive. The radius of the circle for this gradient
centerColor Long: The color at the center of the circle.
edgeColor Long: The color at the edge of the circle.
tileMode Shader.TileMode: The Shader tiling mode This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if the colors do not share the same ColorSpace or do not use a valid one.

RadialGradient

Added in API level 29
RadialGradient(
    centerX: Float,
    centerY: Float,
    radius: Float,
    colors: LongArray,
    stops: FloatArray?,
    tileMode: Shader.TileMode)

Create a shader that draws a radial gradient given the center and radius.

Parameters
centerX Float: The x-coordinate of the center of the radius
centerY Float: The y-coordinate of the center of the radius
radius Float: Must be positive. The radius of the circle for this gradient.
colors LongArray: The colors to be distributed between the center and edge of the circle This value cannot be null.
stops FloatArray?: May be null. Valid values are between 0.0f and 1.0f. The relative position of each corresponding color in the colors array. If null, colors are distributed evenly between the center and edge of the circle.
tileMode Shader.TileMode: The Shader tiling mode This value cannot be null.
Exceptions
java.lang.IllegalArgumentException if there are less than two colors, the colors do not share the same ColorSpace or do not use a valid one, or stops is not null and has a different length from colors.