Add support for linear gradients, implemented as skia shaders.
I had to complicate the IDL bindings generation to allow passing an array of colors. Without these changes, we'd try to convert the dart object to Vector<SkColor>, which C++ thinks is Vector<unsigned>, and we'd use the wrong converter. So I added some template grease to force it to use a Vector<CanvasColor> converter. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1152963009
This commit is contained in:
@@ -26,8 +26,12 @@ void main() {
|
||||
paint.color = const Color.fromARGB(128, 255, 0, 255);
|
||||
context.rotateDegrees(45.0);
|
||||
|
||||
Gradient yellowBlue = new Gradient.Linear(
|
||||
[new Point(-radius, -radius), new Point(0.0, 0.0)],
|
||||
[const Color(0xFFFFFF00), const Color(0xFF0000FF)],
|
||||
null);
|
||||
context.drawRect(new Rect.fromLTRB(-radius, -radius, radius, radius),
|
||||
paint);
|
||||
new Paint()..setShader(yellowBlue));
|
||||
|
||||
// Scale x and y by 0.5.
|
||||
var scaleMatrix = new Float32List.fromList([
|
||||
|
||||
Reference in New Issue
Block a user