mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

I wrote another copy of paint_element_into_displaylist using this new technology. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1129353010
29 lines
907 B
Plaintext
29 lines
907 B
Plaintext
<script>
|
|
import "dart:sky";
|
|
|
|
void main() {
|
|
var root = document.createElement('div');
|
|
root.style['display'] = 'paragraph';
|
|
root.appendChild(new Text('Hello World'));
|
|
document.appendChild(root);
|
|
root.offsetWidth; // force layout.
|
|
|
|
double width = window.innerWidth.toDouble();
|
|
double height = window.innerHeight.toDouble();
|
|
PictureRecorder stampRecorder = new PictureRecorder(width, height);
|
|
root.paint(stampRecorder);
|
|
Picture stamp = stampRecorder.endRecording();
|
|
|
|
PictureRecorder recorder = new PictureRecorder(width, height);
|
|
Paint paint = new Paint()..setARGB(255, 0, 255, 0);
|
|
recorder.drawCircle(50.0, 50.0, 50.0, paint);
|
|
recorder.translate(10.0, 10.0);
|
|
recorder.drawPicture(stamp);
|
|
recorder.translate(10.0, 10.0);
|
|
recorder.drawPicture(stamp);
|
|
recorder.translate(10.0, 10.0);
|
|
recorder.drawPicture(stamp);
|
|
document.rootPicture = recorder.endRecording();
|
|
}
|
|
</script>
|