Gradient
public Gradient(int[] colors,
float[] startPoints)
构造函数,color和statPoints不能为null,长度不能为0,两数组长度须一致,startPoints数据必须递增。
包含颜色的数组 和 指示每种颜色的起点的浮点数组
例如
colors {Color.rgb(0, 0, 255), Color.rgb(0, 225, 0), Color.rgb(255, 0, 0) }
startPoints { 0f, 0.3f, 0.7f }
表示 从热力为0开始(0~0.3)使用第一个颜色,热力为0.3开始(0.3~0.7)使用第二个颜色,热力从0.7开始(0.7~1)使用第三个颜色。
startPoints建议首位设置成0,如果首位不是0,内部也会当成0来处理。
Constructor: color and statPoints cannot be null, their lengths cannot be 0, the lengths of both arrays must match, and startPoints data must be in ascending order.
Includes an array of colors and a floating-point array indicating the starting point of each color.
For example:
colors {Color.rgb(0, 0, 255), Color.rgb(0, 225, 0), Color.rgb(255, 0, 0) }
startPoints { 0f, 0.3f, 0.7f }
This means: from heat intensity 0 (0~0.3) use the first color, from heat intensity 0.3 (0.3~0.7) use the second color, and from heat intensity 0.7 (0.7~1) use the third color.
It is recommended to set the first value of startPoints to 0. If it is not 0, it will be treated as 0 internally.
- 参数:
colors - - 渐变色可以是所有颜色数组 [0x000000, 0xFFFFFF]。例如:{Color.rgb(0, 225, 0), Color.rgb(255, 0, 0) }, 按声明的顺序由冷色到热色。
- The gradient colors can be any color array [0x000000, 0xFFFFFF]. For example: {Color.rgb(0, 225, 0), Color.rgb(255, 0, 0) }, declared in order from cool to hot colors.
startPoints - - 每一个颜色对应的起始点数组[0.0f, 1.0f],例如:{ 0.2f, 1f },与colors 数组一一对应。
- Each color corresponds to a start point array [0.0f, 1.0f], for example: { 0.2f, 1f }, which maps one-to-one with the colors array.
- 从以下版本开始:
- 2.4.1