LinearGradient
bookmark_borderbookmark
Stay organized with collections
Save and categorize content based on your preferences.
open class LinearGradient : Shader
Summary
Public constructors |
Create a shader that draws a linear gradient along a line.
|
Create a shader that draws a linear gradient along a line.
|
Create a shader that draws a linear gradient along a line.
|
Create a shader that draws a linear gradient along a line.
|
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
LinearGradient
LinearGradient(
x0: Float,
y0: Float,
x1: Float,
y1: Float,
color0: Int,
color1: Int,
tile: Shader.TileMode)
Create a shader that draws a linear gradient along a line.
Parameters |
x0 |
Float: The x-coordinate for the start of the gradient line |
y0 |
Float: The y-coordinate for the start of the gradient line |
x1 |
Float: The x-coordinate for the end of the gradient line |
y1 |
Float: The y-coordinate for the end of the gradient line |
color0 |
Int: The sRGB color at the start of the gradient line. |
color1 |
Int: The sRGB color at the end of the gradient line. |
tile |
Shader.TileMode: The Shader tiling mode This value cannot be null . |
LinearGradient
LinearGradient(
x0: Float,
y0: Float,
x1: Float,
y1: Float,
colors: IntArray,
positions: FloatArray?,
tile: Shader.TileMode)
Create a shader that draws a linear gradient along a line.
Parameters |
x0 |
Float: The x-coordinate for the start of the gradient line |
y0 |
Float: The y-coordinate for the start of the gradient line |
x1 |
Float: The x-coordinate for the end of the gradient line |
y1 |
Float: The y-coordinate for the end of the gradient line |
colors |
IntArray: The sRGB colors to be distributed along the gradient line This value cannot be null . |
positions |
FloatArray?: May be null. The relative positions [0..1] of each corresponding color in the colors array. If this is null, the colors are distributed evenly along the gradient line. |
tile |
Shader.TileMode: The Shader tiling mode This value cannot be null . |
LinearGradient
LinearGradient(
x0: Float,
y0: Float,
x1: Float,
y1: Float,
color0: Long,
color1: Long,
tile: Shader.TileMode)
Create a shader that draws a linear gradient along a line.
Parameters |
x0 |
Float: The x-coordinate for the start of the gradient line |
y0 |
Float: The y-coordinate for the start of the gradient line |
x1 |
Float: The x-coordinate for the end of the gradient line |
y1 |
Float: The y-coordinate for the end of the gradient line |
color0 |
Long: The color at the start of the gradient line. |
color1 |
Long: The color at the end of the gradient line. |
tile |
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. |
LinearGradient
LinearGradient(
x0: Float,
y0: Float,
x1: Float,
y1: Float,
colors: LongArray,
positions: FloatArray?,
tile: Shader.TileMode)
Create a shader that draws a linear gradient along a line.
Parameters |
x0 |
Float: The x-coordinate for the start of the gradient line |
y0 |
Float: The y-coordinate for the start of the gradient line |
x1 |
Float: The x-coordinate for the end of the gradient line |
y1 |
Float: The y-coordinate for the end of the gradient line |
colors |
LongArray: The colors to be distributed along the gradient line This value cannot be null . |
positions |
FloatArray?: May be null. The relative positions [0..1] of each corresponding color in the colors array. If this is null, the colors are distributed evenly along the gradient line. |
tile |
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 positions is not null and has a different length from colors . |
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 2024-12-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-18 UTC."],[],[]]