| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |