|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttwaver.shader.Gradient
public class Gradient
渐变着色器
Field Summary | |
---|---|
protected float |
angle
渐变旋转角度 |
protected int[] |
colors
渐变颜色数组 |
static java.lang.String |
LINEAR
线性渐变类型 |
static Gradient |
LINEAR_GRADIENT_HORIZONTAL
线性水平方向渐变 |
static Gradient |
LINEAR_GRADIENT_VERTICAL
线性垂直方向渐变 |
static Gradient |
NONE
空渐变 |
protected float[] |
positions
渐变颜色位置数组 |
static java.lang.String |
RADIAL
径向渐变类型 |
protected float |
scaleX
x缩放比例 |
protected float |
scaleY
y缩放比例 |
static java.lang.String |
SWEEP
sweep渐变类型 |
protected TileMode |
tile
渐变图块模式,默认为: TileMode#CLAMP |
protected float |
translateX
x偏移量 |
protected float |
translateY
y偏移量 |
protected java.lang.String |
type
渐变类型 |
Constructor Summary | |
---|---|
Gradient()
构造函数,渐变 |
|
Gradient(java.lang.String type,
int[] colors)
构造函数,指定渐变类型,渐变颜色,渐变位置将平均分布 |
|
Gradient(java.lang.String type,
int[] colors,
float[] positions)
构造函数,指定渐变类型,颜色以及位置 |
|
Gradient(java.lang.String type,
int[] colors,
float[] positions,
float angle)
构造函数,指定渐变类型,颜色,位置以及角度 |
|
Gradient(java.lang.String type,
int[] colors,
float[] positions,
float angle,
float xscale,
float yscale)
构造函数,指定渐变类型,颜色,位置,角度以及缩放比例 |
Method Summary | |
---|---|
void |
deserialize(java.lang.String s)
反序列化属性,根据字符串生成对象的属性 |
boolean |
equals(java.lang.Object o)
|
Shader |
getShader(float tx,
float ty,
Size size)
生成指定偏移量和大小区域的着色器 |
Shader |
getShader(Size size)
生成指定大小区域的着色器,比如渐变的作用范围 |
boolean |
isEmpty()
空渐变 |
java.lang.String |
serialize()
序列化该对象 |
void |
setAngle(float angle)
设置旋转角度 |
void |
setColors(int[] colors)
设置渐变颜色 |
void |
setPositions(float[] positions)
设置渐变颜色位置,数量应该与渐变颜色数量一致 |
void |
setScaleX(float scaleX)
设置x缩放比例 |
void |
setScaleY(float scaleY)
设置y方向缩放比例 |
void |
setTranslateX(float translateX)
设置x偏移量 |
void |
setTranslateY(float translateY)
设置y偏移量 |
void |
setType(java.lang.String type)
设置渐变类型 |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Gradient NONE
public static final Gradient LINEAR_GRADIENT_VERTICAL
public static final Gradient LINEAR_GRADIENT_HORIZONTAL
public static final java.lang.String RADIAL
public static final java.lang.String LINEAR
public static final java.lang.String SWEEP
protected java.lang.String type
protected float angle
protected float scaleX
protected float scaleY
protected float translateX
protected float translateY
protected int[] colors
protected float[] positions
protected TileMode tile
TileMode#CLAMP
Constructor Detail |
---|
public Gradient()
public Gradient(java.lang.String type, int[] colors)
type
- 渐变类型colors
- 渐变颜色,渐变位置将平均分布public Gradient(java.lang.String type, int[] colors, float[] positions)
type
- 渐变类型colors
- 渐变颜色positions
- 渐变位置,数组与渐变颜色数组保持相同个数public Gradient(java.lang.String type, int[] colors, float[] positions, float angle)
type
- 渐变类型colors
- 渐变颜色positions
- 渐变位置,数组与渐变颜色数组保持相同个数angle
- 渐变旋转角度public Gradient(java.lang.String type, int[] colors, float[] positions, float angle, float xscale, float yscale)
type
- 渐变类型colors
- 渐变颜色positions
- 渐变位置,数组与渐变颜色数组保持相同个数angle
- 渐变旋转角度xscale
- x方向缩放比例yscale
- y方向缩放比例Method Detail |
---|
public void setType(java.lang.String type)
type
- public void setColors(int[] colors)
colors
- 渐变颜色public void setPositions(float[] positions)
positions
- 渐变颜色位置public void setAngle(float angle)
angle
- 旋转角度public void setScaleX(float scaleX)
scaleX
- x缩放比例public void setScaleY(float scaleY)
scaleY
- y方向缩放比例public void setTranslateX(float translateX)
translateX
- x偏移量public void setTranslateY(float translateY)
translateY
- y偏移量public Shader getShader(float tx, float ty, Size size)
IShader
getShader
in interface IShader
tx
- 着色器偏移量ty
- 着色器偏移量size
- 着色器作用范围
Gradient
,
Shader
,
Shader#setLocalMatrix(android.graphics.Matrix)
public Shader getShader(Size size)
IShader
getShader
in interface IShader
size
- 着色器作用范围
Gradient
,
Shader
public boolean isEmpty()
isEmpty
in interface IShader
public java.lang.String serialize()
ISerializable
serialize
in interface ISerializable
public void deserialize(java.lang.String s)
ISerializable
deserialize
in interface ISerializable
s
- 字符串public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |