public class LinearShader extends Shader
This class inherits from Shader. You can use the methods in this class to configure the direction of
the shading colors, for example, from left to right, from top to bottom, or from the upper left corner to the lower
right corner.
Shader.TileMode| 限定符和类型 | 字段 | 说明 |
|---|---|---|
Point[] |
points |
Indicates the coordinates of the start and end points of the shading line.
|
float[] |
stops |
Indicates the positions corresponding the shading colors in the
Shader#shaderColors array. |
intColors, mTileMode, shaderColors| 构造器 | 说明 |
|---|---|
LinearShader() |
Default constructor used to create a
LinearShader. |
LinearShader(Point[] newPoints,
float[] newStops,
Color[] newColors,
Shader.TileMode newTileMode) |
A constructor used to create a
LinearShader based on the specified points, color positions,
colors, and tile mode. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
protected Point[] |
getShaderPoints() |
Obtains the coordinates of the shading points of this
LinearShader. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetShaderColors, getTileMode, setShaderMatrixpublic Point[] points
The points array contains two elements, representing the coordinates of the start and end points of
the shading line respectively. For example. If the points value is {(200,200), (400, 500)}, the shading
area is defined by the enclosing rectangle of these two coordinates, and the colors will be shaded along the
line from the start point to the end point.
public float[] stops
Shader#shaderColors array.
The positions of colors in stops increase monotonically from 0 to 1.0. When stops is null,
the colors are evenly shaded.
public LinearShader()
LinearShader.
Calling this constructor will automatically invoke
LinearShader#LinearShader(Point[], float[], Color[], TileMode) to create a linear shader.
public LinearShader(Point[] newPoints, float[] newStops, Color[] newColors, Shader.TileMode newTileMode)
LinearShader based on the specified points, color positions,
colors, and tile mode.newPoints - Indicates the points that specify the shading line, along which the colors are shaded.
The shading area is specified by the enclosing rectangle with this shading line as its diagonal.newStops - Indicates the positions of all colors in the shading color array.newColors - Indicates the array of linear shading colors.newTileMode - Indicates the tile mode used to shade colors when the drawn object exceeds the shading area
defined by the linear shader.protected Point[] getShaderPoints()
LinearShader.LinearShader#points of the LinearShader.