Added in API level 1

RadialGradient

public class RadialGradient
extends Shader

java.lang.Object
   ↳ android.graphics.Shader
     ↳ android.graphics.RadialGradient


Summary

Public constructors

RadialGradient(float centerX, float centerY, float radius, int[] colors, float[] stops, Shader.TileMode tileMode)

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

RadialGradient(float centerX, float centerY, float radius, long[] colors, float[] stops, Shader.TileMode tileMode)

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

RadialGradient(float startX, float startY, float startRadius, float endX, float endY, float endRadius, long[] colors, float[] stops, Shader.TileMode tileMode)

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

RadialGradient(float centerX, float centerY, float radius, int centerColor, int edgeColor, Shader.TileMode tileMode)

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

RadialGradient(float centerX, float centerY, float radius, long centerColor, long edgeColor, Shader.TileMode tileMode)

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

Inherited methods

Public constructors

RadialGradient

Added in API level 1
public RadialGradient (float centerX, 
                float centerY, 
                float radius, 
                int[] colors, 
                float[] stops, 
                Shader.TileMode 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 int: The sRGB colors to be distributed between the center and edge of the circle This value cannot be null.

stops float: 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 1
public RadialGradient (float centerX, 
                float centerY, 
                float radius, 
                long[] colors, 
                float[] stops, 
                Shader.TileMode 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 long: The colors to be distributed between the center and edge of the circle This value cannot be null.

stops float: 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.

Throws
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.

RadialGradient

Added in API level 1
public RadialGradient (float startX, 
                float startY, 
                float startRadius, 
                float endX, 
                float endY, 
                float endRadius, 
                long[] colors, 
                float[] stops, 
                Shader.TileMode 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 long: The colors to be distributed between the center and edge of the circle This value cannot be null.

stops float: 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.

Throws
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
public RadialGradient (float centerX, 
                float centerY, 
                float radius, 
                int centerColor, 
                int edgeColor, 
                Shader.TileMode 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
public RadialGradient (float centerX, 
                float centerY, 
                float radius, 
                long centerColor, 
                long edgeColor, 
                Shader.TileMode 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.

Throws
IllegalArgumentException if the colors do not share the same ColorSpace or do not use a valid one.