Commit 20459183 authored by Eric Seidel's avatar Eric Seidel

Make it possible to Paint elements into a display list.

Currently said elements need to be in the DOM and have
already been laid out for this to work, but follow-up patches
will remove these restrictions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1144673002
parent 57ec759e
<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 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);
root.paint(recorder);
recorder.translate(10.0, 10.0);
root.paint(recorder);
recorder.translate(10.0, 10.0);
root.paint(recorder);
document.rootPicture = recorder.endRecording();
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment