Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
  
  
    
    
    
    RadialGradient
    open class RadialGradient : Shader
    
    Summary
    
      
        
          | Public constructors | 
        
          | Create a shader that draws a radial gradient given the start and end points as well as starting and ending radii. | 
        
          | Create a shader that draws a radial gradient given the center and radius. | 
        
          | Create a shader that draws a radial gradient given the center and radius. | 
        
          | Create a shader that draws a radial gradient given the center and radius. | 
        
          | Create a shader that draws a radial gradient given the center and radius. | 
      
    
    
      
        
          | Inherited functions | 
        
          | From class Shader
                
                  
                    | Boolean | getLocalMatrix(localM: Matrix)
                         Return true if the shader has a non-identity local matrix. |  
                    | Unit | setLocalMatrix(localM: Matrix?)
                         Set the shader's local matrix. Passing null will reset the shader's matrix to identity. If the matrix has scale value as 0, the drawing result is undefined. |  | 
      
    
    Public constructors
    
      RadialGradient
      
      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 between0.0fand1.0f. The relative position of each corresponding color in the colors array. Ifnull, 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 colorsThe colors do not share the same ColorSpaceThe colors do not use a valid ColorSpace The stopsparameter is notnulland has a different length fromcolors.The startRadiusis negativeThe endRadiusis less than or equal to zero | 
        
      
     
    
      RadialGradient
      
      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
      
      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 between0.0fand1.0f. The relative position of each corresponding color in the colors array. Ifnull, 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
      
      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 ColorSpaceor do not use a valid one. | 
        
      
     
    
      RadialGradient
      
      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 between0.0fand1.0f. The relative position of each corresponding color in the colors array. Ifnull, 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 ColorSpaceor do not use a valid one, orstopsis notnulland has a different length fromcolors. | 
        
      
     
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [null,null,["Last updated 2025-02-10 UTC."],[],[]]