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

Unified Diff: experimental/SkV8Example/path.js

Issue 121303004: Fleshed out a lot of the Path interfac (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused imports Created 6 years, 11 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
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | experimental/SkV8Example/sample.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/path.js
diff --git a/experimental/SkV8Example/path.js b/experimental/SkV8Example/path.js
new file mode 100644
index 0000000000000000000000000000000000000000..a7b2c28d46078acd2c779c381c75b0b8d11d1b38
--- /dev/null
+++ b/experimental/SkV8Example/path.js
@@ -0,0 +1,34 @@
+/**
+ * @fileoverview Sample onDraw script for use with SkV8Example.
+ */
+var onDraw = function(){
+ var p = new Path();
+ p.moveTo(0, 0);
+ p.bezierCurveTo(0, 100, 100, 0, 200, 200);
+ p.close();
+ p.moveTo(0, 300);
+ p.arc(0, 300, 40, Math.PI/2, 3/2*Math.PI);
+ function f(context) {
+ context.translate(10, 10);
+ for (var i=0; i<256; i++) {
+ context.fillStyle = '#0000' + toHex(i);
+ context.stroke(p);
+ context.translate(1, 0);
+ }
+ context.fillStyle = '#ff0000';
+ print(context.width, context.height);
+ context.resetTransform();
+ context.fillRect(context.width/2, context.height/2, 20, 20);
+
+ };
+ return f;
+}();
+
+
+function toHex(n) {
+ var s = n.toString(16);
+ if (s.length == 1) {
+ s = "0" + s;
+ }
+ return s;
+}
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | experimental/SkV8Example/sample.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698