Browse Source

ray example using toBuffer()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
0312b1c97f
  1. 10
      examples/ray.js

10
examples/ray.js

@ -79,9 +79,7 @@ ctx.translate(243,0);
render(1); render(1);
console.log('Rendered in %s seconds', (new Date - start) / 1000); console.log('Rendered in %s seconds', (new Date - start) / 1000);
var out = fs.createWriteStream(__dirname + '/ray.png') canvas.toBuffer(function(err, buf){
, stream = canvas.createPNGStream(); if (err) throw err;
fs.writeFile(__dirname + '/ray.png', buf);
stream.on('data', function(chunk){ });
out.write(chunk);
});

Loading…
Cancel
Save