Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: sky/examples/raw/painting.sky

Issue 1158693005: Add an API to set the ColorFilter on a Paint object. (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <sky> 1 <sky>
2 <style> 2 <style>
3 div { 3 div {
4 height: 200px; 4 height: 200px;
5 background-color: lightblue; 5 background-color: lightblue;
6 } 6 }
7 </style> 7 </style>
8 <div id="canvas" /> 8 <div id="canvas" />
9 <script> 9 <script>
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 22 matching lines...) Expand all
33 0.5, 0.0, 0.0, 33 0.5, 0.0, 0.0,
34 0.0, 0.5, 0.0, 34 0.0, 0.5, 0.0,
35 0.0, 0.0, 1.0 35 0.0, 0.0, 1.0
36 ]; 36 ];
37 context.concat(scaleMatrix); 37 context.concat(scaleMatrix);
38 paint.setARGB(128, 0, 255, 0); 38 paint.setARGB(128, 0, 255, 0);
39 context.drawCircle(0.0, 0.0, radius, paint); 39 context.drawCircle(0.0, 0.0, radius, paint);
40 40
41 context.restore(); 41 context.restore();
42 42
43 context.translate(0.0, 50.0);
43 var builder = new LayerDrawLooperBuilder() 44 var builder = new LayerDrawLooperBuilder()
44 ..addLayerOnTop( 45 ..addLayerOnTop(
45 new DrawLooperLayerInfo()..setOffset(150.0, 0.0)..setPaintBits(-1), 46 new DrawLooperLayerInfo()
47 ..setOffset(150.0, 0.0)..setPaintBits(-1)..setColorMode(1),
46 (Paint layerPaint) { 48 (Paint layerPaint) {
47 // TODO(mpcomplete): This won't do anything until we add support for 49 layerPaint.setARGB(128, 255, 255, 0);
48 // setting the color filter. 50 layerPaint.setColorFilter(new ColorFilter(0x770000ff, 5));
49 layerPaint.setARGB(128, 0, 0, 255);
50 }) 51 })
51 ..addLayerOnTop( 52 ..addLayerOnTop(
52 new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setPaintBits(0), 53 new DrawLooperLayerInfo()..setOffset(75.0, 75.0)..setColorMode(1),
53 (Paint layerPaint) { 54 (Paint layerPaint) {
54 layerPaint.setARGB(128, 255, 0, 0); 55 layerPaint.setARGB(128, 255, 0, 0);
56 })
57 ..addLayerOnTop(
58 new DrawLooperLayerInfo()..setOffset(225.0, 75.0),
59 (Paint layerPaint) {
60 // Since this layer uses a DST color mode, this has no effect.
61 layerPaint.setARGB(128, 255, 0, 0);
55 }); 62 });
56 paint.setDrawLooper(builder.build()); 63 paint.setDrawLooper(builder.build());
57 context.drawCircle(0.0, 0.0, radius, paint); 64 context.drawCircle(0.0, 0.0, radius, paint);
58 65
59 context.commit(); 66 context.commit();
60 }); 67 });
61 } 68 }
62 </script> 69 </script>
63 </sky> 70 </sky>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698