From 1f26d65757fda0aa86b51421f8fe34da472119e5 Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Mon, 8 Jun 2015 13:49:10 -0400 Subject: [PATCH] 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, which C++ thinks is Vector, and we'd use the wrong converter. So I added some template grease to force it to use a Vector converter. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/1152963009 --- examples/raw/painting.sky | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/raw/painting.sky b/examples/raw/painting.sky index 075867a8c6..b0731a9559 100644 --- a/examples/raw/painting.sky +++ b/examples/raw/painting.sky @@ -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([