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

Unified Diff: sky/examples/painting/circle.sky

Issue 1017593005: Add a basic custom painting facility to Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add missing files Created 5 years, 9 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/painting/circle.sky
diff --git a/sky/examples/painting/circle.sky b/sky/examples/painting/circle.sky
new file mode 100644
index 0000000000000000000000000000000000000000..224e2d9255965ff22c81bd6da50f42c5646c970f
--- /dev/null
+++ b/sky/examples/painting/circle.sky
@@ -0,0 +1,24 @@
+<sky>
+<style>
+div {
+ height: 200px;
+ background-color: lightblue;
+}
+</style>
+<div id="canvas" />
+<script>
+import 'dart:math' as math;
+import 'dart:sky';
+
+void main() {
+ var element = document.getElementById('canvas');
+ element.requestPaint((PaintingContext context) {
+ Paint paint = new Paint();
+ paint.setARGB(128, 0, 255, 0);
+ double radius = math.min(context.width, context.height) / 2.0;
+ context.drawCircle(context.width / 2.0, context.height / 2.0, radius, paint);
+ context.commit();
+ });
+}
+</script>
+</sky>

Powered by Google App Engine
This is Rietveld 408576698