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

Unified Diff: sky/examples/raw/spinning_doge.dart

Issue 1151753009: Add Sky framework support for drawing images (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 side-by-side diff with in-line comments
Download patch
Index: sky/examples/raw/spinning_doge.dart
diff --git a/sky/examples/raw/spinning_square.dart b/sky/examples/raw/spinning_doge.dart
similarity index 70%
copy from sky/examples/raw/spinning_square.dart
copy to sky/examples/raw/spinning_doge.dart
index 17072330d56a229ea035b708aba5d86df568c8ef..c6161dd123a89e372624a51e4bd8892380438447 100644
--- a/sky/examples/raw/spinning_square.dart
+++ b/sky/examples/raw/spinning_doge.dart
@@ -6,6 +6,8 @@ import 'dart:sky';
double timeBase = null;
+Image image;
+
void beginFrame(double timeStamp) {
if (timeBase == null)
timeBase = timeStamp;
@@ -13,13 +15,16 @@ void beginFrame(double timeStamp) {
PictureRecorder canvas = new PictureRecorder(view.width, view.height);
canvas.translate(view.width / 2.0, view.height / 2.0);
canvas.rotateDegrees(delta / 10);
- canvas.drawRect(new Rect.fromLTRB(-100.0, -100.0, 100.0, 100.0),
- new Paint()..setARGB(255, 0, 255, 0));
+ 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 = "http://i2.kym-cdn.com/photos/images/facebook/000/581/296/c09.jpg";
view.setBeginFrameCallback(beginFrame);
view.scheduleFrame();
}
« sky/engine/platform/graphics/Image.h ('K') | « sky/engine/platform/graphics/Image.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698