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

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

Issue 1179913002: Fix up constructor naming style for MaskFilter and ColorFilter. (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/MaskFilter.dart ('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 Sprite extends NodeWithSize { 5 class Sprite extends NodeWithSize {
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 scaleX = scaleY; 48 scaleX = scaleY;
49 } 49 }
50 } 50 }
51 51
52 canvas.scale(scaleX, scaleY); 52 canvas.scale(scaleX, scaleY);
53 53
54 // Setup paint object for opacity and transfer mode 54 // Setup paint object for opacity and transfer mode
55 Paint paint = new Paint(); 55 Paint paint = new Paint();
56 paint.setARGB((255.0*_opacity).toInt(), 255, 255, 255); 56 paint.setARGB((255.0*_opacity).toInt(), 255, 255, 255);
57 if (colorOverlay != null) { 57 if (colorOverlay != null) {
58 paint.setColorFilter(new ColorFilter.Mode(colorOverlay, TransferMode.src ATopMode)); 58 paint.setColorFilter(new ColorFilter.mode(colorOverlay, TransferMode.src ATopMode));
59 } 59 }
60 if (transferMode != null) { 60 if (transferMode != null) {
61 paint.setTransferMode(transferMode); 61 paint.setTransferMode(transferMode);
62 } 62 }
63 63
64 canvas.drawImage(_image, 0.0, 0.0, paint); 64 canvas.drawImage(_image, 0.0, 0.0, paint);
65 } 65 }
66 else { 66 else {
67 // Paint a red square for missing texture 67 // Paint a red square for missing texture
68 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, size.width, size.height), 68 canvas.drawRect(new Rect.fromLTRB(0.0, 0.0, size.width, size.height),
69 new Paint()..setARGB(255, 255, 0, 0)); 69 new Paint()..setARGB(255, 255, 0, 0));
70 } 70 }
71 canvas.restore(); 71 canvas.restore();
72 } 72 }
73 } 73 }
OLDNEW
« no previous file with comments | « sky/engine/core/painting/MaskFilter.dart ('k') | sky/examples/raw/painting.sky » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698