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

Side by Side Diff: sky/examples/game/lib/sprite_node.dart

Issue 1163373007: Change the ColorFilter constructor to ColorFilter.Mode, in case we want to add (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
« no previous file with comments | « sky/engine/core/painting/ColorFilter.idl ('k') | sky/examples/raw/painting.sky » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 part of sprites; 1 part of sprites;
2 2
3 // TODO: Actually draw images 3 // TODO: Actually draw images
4 4
5 class SpriteNode extends TransformNode { 5 class SpriteNode extends TransformNode {
6 6
7 Image _image; 7 Image _image;
8 bool constrainProportions = false; 8 bool constrainProportions = false;
9 double _opacity = 1.0; 9 double _opacity = 1.0;
10 Color colorOverlay; 10 Color colorOverlay;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 scaleX = scaleY; 45 scaleX = scaleY;
46 } 46 }
47 } 47 }
48 48
49 canvas.scale(scaleX, scaleY); 49 canvas.scale(scaleX, scaleY);
50 50
51 // Setup paint object for opacity and transfer mode 51 // Setup paint object for opacity and transfer mode
52 Paint paint = new Paint(); 52 Paint paint = new Paint();
53 paint.setARGB((255.0*_opacity).toInt(), 255, 255, 255); 53 paint.setARGB((255.0*_opacity).toInt(), 255, 255, 255);
54 if (colorOverlay != null) { 54 if (colorOverlay != null) {
55 paint.setColorFilter(new ColorFilter(colorOverlay, TransferMode.srcATopM ode)); 55 paint.setColorFilter(new ColorFilter.Mode(colorOverlay, TransferMode.src ATopMode));
56 } 56 }
57 if (transferMode != null) { 57 if (transferMode != null) {
58 paint.setTransferMode(transferMode); 58 paint.setTransferMode(transferMode);
59 } 59 }
60 60
61 canvas.drawImage(_image, 0.0, 0.0, paint); 61 canvas.drawImage(_image, 0.0, 0.0, paint);
62 canvas.restore(); 62 canvas.restore();
63 } 63 }
64 else { 64 else {
65 // Paint a red square for missing texture 65 // Paint a red square for missing texture
66 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, this.width, this.height), 66 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, this.width, this.height),
67 new Paint()..setARGB(255, 255, 0, 0)); 67 new Paint()..setARGB(255, 255, 0, 0));
68 } 68 }
69 } 69 }
70 70
71 } 71 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/ColorFilter.idl ('k') | sky/examples/raw/painting.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698