Skip to content
Browse files

Autobuild

  • Loading branch information...
1 parent dbae548 commit 5011cfc71406937e6504f74cc4ec01028dd129fd @o3builder o3builder committed
Showing with 78 additions and 0 deletions.
  1. +77 −0 example/nodecanvas.js
  2. BIN lib/o3-canvas/o3-osx64.node
  3. +1 −0 test/test.js
View
77 example/nodecanvas.js
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2010 Javeline BV
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this library; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+var canvasFactory = require('../lib/o3-canvas')
+
+function drawtocontext(ctx)
+{
+ ctx.fillStyle = "rgb(200,0,0)";
+ ctx.fillRect (10, 10, 55, 50);
+
+ ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
+ ctx.fillRect (30, 30, 55, 50);
+
+ ctx.moveTo(20,40);
+ ctx.lineTo(260,280);
+ ctx.lineTo(20,280);
+ ctx.closePath();
+
+ ctx.moveTo(10,10);
+ ctx.lineTo(300,300);
+ ctx.lineTo(10,300);
+ ctx.closePath();
+
+
+ ctx.fill();
+ ctx.stroke();
+
+ ctx.strokeStyle= "rgb(255,128,0)";
+ ctx.beginPath();
+ ctx.moveTo(75,25);
+ ctx.quadraticCurveTo(25,25,25,62.5);
+ ctx.quadraticCurveTo(25,100,50,100);
+ ctx.quadraticCurveTo(50,120,30,125);
+ ctx.quadraticCurveTo(60,120,65,100);
+ ctx.quadraticCurveTo(125,100,125,62.5);
+ ctx.quadraticCurveTo(125,25,75,25);
+ ctx.stroke();
+
+}
+/*
+function draw()
+{
+ var canvas = document.getElementById("canvas");
+ var ctx = canvas.getContext("2d");
+ drawtocontext(ctx);
+}
+*/
+
+var ctx = canvasFactory(300,300, "argb");
+
+
+var http = require('http');
+http.createServer(function (req, res) {
+ drawtocontext(ctx);
+ var buf = ctx.pngBuffer();
+ res.writeHead(200, {'Content-Type': 'text/html'});
+ res.end('<img alt="Embedded Image" src="data:image/png;base64,'+buf.toBase64()+'">');
+}).listen(8124, "127.0.0.1");
+console.log('Server running at http://127.0.0.1:8124/');
+
+
+
View
BIN lib/o3-canvas/o3-osx64.node
Binary file not shown.
View
1 test/test.js
@@ -88,5 +88,6 @@ if(check != buf.toBase64()){
console.log("TEST FAILED");
process.exit(-1)
}
+console.log("TEST SUCCEEDED");

0 comments on commit 5011cfc

Please sign in to comment.
Something went wrong with that request. Please try again.