Commit 205bd144 authored by Collin Jackson's avatar Collin Jackson

Add Sky framework support for drawing images

R=abarth@chromium.org, abarth

Review URL: https://codereview.chromium.org/1151753009
parent 04169c4c
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:sky';
double timeBase = null;
Image image;
void beginFrame(double timeStamp) {
if (timeBase == null) timeBase = timeStamp;
double delta = timeStamp - timeBase;
PictureRecorder canvas = new PictureRecorder(view.width, view.height);
canvas.translate(view.width / 2.0, view.height / 2.0);
canvas.rotateDegrees(delta / 10);
canvas.scale(0.2, 0.2);
Paint paint = new Paint()..setARGB(255, 0, 255, 0);
canvas.drawImage(image, -image.width / 2.0, -image.height / 2.0, paint);
view.picture = canvas.endRecording();
view.scheduleFrame();
}
void main() {
image = new Image();
image.src = "https://www.dartlang.org/logos/dart-logo.png";
view.setBeginFrameCallback(beginFrame);
view.scheduleFrame();
}
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