|
|
|
|
|
|
public static Gradient linear( |
|
|
|
Offset start, Offset end, List<Color> colors, |
|
|
|
List<float> colorStops = null, TileMode tileMode = TileMode.clamp, |
|
|
|
uiMatrix3 matrix = null) { |
|
|
|
uiMatrix3? matrix = null) { |
|
|
|
D.assert(PaintingUtils._offsetIsValid(start)); |
|
|
|
D.assert(PaintingUtils._offsetIsValid(end)); |
|
|
|
D.assert(colors != null && colors.Count >= 2); |
|
|
|
|
|
|
public static Gradient radial( |
|
|
|
Offset center, float radius, List<Color> colors, |
|
|
|
List<float> colorStops = null, TileMode tileMode = TileMode.clamp, |
|
|
|
uiMatrix3 matrix = null) { |
|
|
|
uiMatrix3? matrix = null) { |
|
|
|
D.assert(PaintingUtils._offsetIsValid(center)); |
|
|
|
D.assert(colors != null && colors.Count >= 2); |
|
|
|
|
|
|
|
|
|
|
Offset center, List<Color> colors, |
|
|
|
List<float> colorStops = null, TileMode tileMode = TileMode.clamp, |
|
|
|
float startAngle = 0.0f, float endAngle = Mathf.PI * 2, |
|
|
|
uiMatrix3 matrix = null) { |
|
|
|
uiMatrix3? matrix = null) { |
|
|
|
D.assert(PaintingUtils._offsetIsValid(center)); |
|
|
|
D.assert(colors != null && colors.Count >= 2); |
|
|
|
D.assert(startAngle < endAngle); |
|
|
|
|
|
|
public _LinearGradient( |
|
|
|
Offset start, Offset end, List<Color> colors, |
|
|
|
List<float> colorStops, TileMode tileMode, |
|
|
|
uiMatrix3 matrix = null) { |
|
|
|
uiMatrix3? matrix = null) { |
|
|
|
this.start = start; |
|
|
|
this.end = end; |
|
|
|
this.colors = colors; |
|
|
|
|
|
|
public readonly List<Color> colors; |
|
|
|
public readonly List<float> colorStops; |
|
|
|
public readonly TileMode tileMode; |
|
|
|
public readonly uiMatrix3 matrix; |
|
|
|
public readonly uiMatrix3? matrix; |
|
|
|
public readonly uiMatrix3 ptsToUnit; |
|
|
|
public readonly Image gradientTex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public uiMatrix3 getGradientMat(uiMatrix3 mat) { |
|
|
|
if (this.matrix != null) { |
|
|
|
mat.postConcat(this.matrix); |
|
|
|
mat.postConcat(this.matrix.Value); |
|
|
|
} |
|
|
|
|
|
|
|
mat.postConcat(this.ptsToUnit); |
|
|
|
|
|
|
public _RadialGradient( |
|
|
|
Offset center, float radius, List<Color> colors, |
|
|
|
List<float> colorStops = null, TileMode tileMode = TileMode.clamp, |
|
|
|
uiMatrix3 matrix = null |
|
|
|
uiMatrix3? matrix = null |
|
|
|
) { |
|
|
|
this.center = center; |
|
|
|
this.radius = radius; |
|
|
|
|
|
|
public readonly List<Color> colors; |
|
|
|
public readonly List<float> colorStops; |
|
|
|
public readonly TileMode tileMode; |
|
|
|
public readonly uiMatrix3 matrix; |
|
|
|
public readonly uiMatrix3? matrix; |
|
|
|
public readonly uiMatrix3 ptsToUnit; |
|
|
|
public readonly Image gradientTex; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public uiMatrix3 getGradientMat(uiMatrix3 mat) { |
|
|
|
if (this.matrix != null) { |
|
|
|
mat.postConcat(this.matrix); |
|
|
|
mat.postConcat(this.matrix.Value); |
|
|
|
} |
|
|
|
|
|
|
|
mat.postConcat(this.ptsToUnit); |
|
|
|
|
|
|
Offset center, List<Color> colors, |
|
|
|
List<float> colorStops = null, TileMode tileMode = TileMode.clamp, |
|
|
|
float startAngle = 0.0f, float endAngle = Mathf.PI * 2, |
|
|
|
uiMatrix3 matrix = null |
|
|
|
uiMatrix3? matrix = null |
|
|
|
) { |
|
|
|
this.center = center; |
|
|
|
this.colors = colors; |
|
|
|
|
|
|
public readonly TileMode tileMode; |
|
|
|
public readonly float startAngle; |
|
|
|
public readonly float endAngle; |
|
|
|
public readonly uiMatrix3 matrix; |
|
|
|
public readonly uiMatrix3? matrix; |
|
|
|
public readonly uiMatrix3 ptsToUnit; |
|
|
|
public readonly Image gradientTex; |
|
|
|
public readonly float bias; |
|
|
|
|
|
|
|
|
|
|
public uiMatrix3 getGradientMat(uiMatrix3 mat) { |
|
|
|
if (this.matrix != null) { |
|
|
|
mat.postConcat(this.matrix); |
|
|
|
mat.postConcat(this.matrix.Value); |
|
|
|
} |
|
|
|
|
|
|
|
mat.postConcat(this.ptsToUnit); |
|
|
|
|
|
|
|
|
|
|
public class ImageShader : PaintShader { |
|
|
|
public ImageShader(Image image, |
|
|
|
TileMode tileMode = TileMode.clamp, uiMatrix3 matrix = null) { |
|
|
|
TileMode tileMode = TileMode.clamp, uiMatrix3? matrix = null) { |
|
|
|
this.image = image; |
|
|
|
this.tileMode = tileMode; |
|
|
|
this.matrix = matrix; |
|
|
|
|
|
|
public readonly TileMode tileMode; |
|
|
|
public readonly uiMatrix3 matrix; |
|
|
|
public readonly uiMatrix3? matrix; |
|
|
|
mat.postConcat(this.matrix); |
|
|
|
mat.postConcat(this.matrix.Value); |
|
|
|
} |
|
|
|
|
|
|
|
mat.postScale(1f / this.image.width, 1f / this.image.height); |
|
|
|