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

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

Issue 1129353010: Add Canvas.drawPicture (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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/Canvas.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <script> 1 <script>
2 import "dart:sky"; 2 import "dart:sky";
3 3
4 void main() { 4 void main() {
5 var root = document.createElement('div'); 5 var root = document.createElement('div');
6 root.style['display'] = 'paragraph'; 6 root.style['display'] = 'paragraph';
7 root.appendChild(new Text('Hello World')); 7 root.appendChild(new Text('Hello World'));
8 document.appendChild(root); 8 document.appendChild(root);
9 root.offsetWidth; // force layout. 9 root.offsetWidth; // force layout.
10 10
11 double width = window.innerWidth.toDouble(); 11 double width = window.innerWidth.toDouble();
12 double height = window.innerHeight.toDouble(); 12 double height = window.innerHeight.toDouble();
13 PictureRecorder stampRecorder = new PictureRecorder(width, height);
14 root.paint(stampRecorder);
15 Picture stamp = stampRecorder.endRecording();
16
13 PictureRecorder recorder = new PictureRecorder(width, height); 17 PictureRecorder recorder = new PictureRecorder(width, height);
14 Paint paint = new Paint()..setARGB(255, 0, 255, 0); 18 Paint paint = new Paint()..setARGB(255, 0, 255, 0);
15 recorder.drawCircle(50.0, 50.0, 50.0, paint); 19 recorder.drawCircle(50.0, 50.0, 50.0, paint);
16 recorder.translate(10.0, 10.0); 20 recorder.translate(10.0, 10.0);
17 root.paint(recorder); 21 recorder.drawPicture(stamp);
18 recorder.translate(10.0, 10.0); 22 recorder.translate(10.0, 10.0);
19 root.paint(recorder); 23 recorder.drawPicture(stamp);
20 recorder.translate(10.0, 10.0); 24 recorder.translate(10.0, 10.0);
21 root.paint(recorder); 25 recorder.drawPicture(stamp);
22 document.rootPicture = recorder.endRecording(); 26 document.rootPicture = recorder.endRecording();
23 } 27 }
24 </script> 28 </script>
OLDNEW
« no previous file with comments | « sky/engine/core/painting/Canvas.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698