Fill with random color
authorAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Mon, 11 May 2015 16:40:41 +0000 (12:40 -0400)
committerAlyssa Rosenzweig <bobbybee@users.noreply.github.com>
Mon, 11 May 2015 16:40:41 +0000 (12:40 -0400)
main.js

diff --git a/main.js b/main.js
index 048e49f..41877ec 100644 (file)
--- a/main.js
+++ b/main.js
@@ -20,6 +20,14 @@ var buffer = new Buffer(width * height * 4);
 // bare calculations are offset to DynImage
 var dynimage = new DynImage(width, height, buffer);
 
 // bare calculations are offset to DynImage
 var dynimage = new DynImage(width, height, buffer);
 
+// fill the image with a random, opaque color to start with
+dynimage.fillColor(
+               Math.floor(Math.random() * 255),
+               Math.floor(Math.random() * 255),
+               Math.floor(Math.random() * 255),
+               0       
+               );
+
 var png = new Png(buffer, width, height, 'rgba');
 png.encode(function(image) {
                        fs.writeFile("output.png", image);
 var png = new Png(buffer, width, height, 'rgba');
 png.encode(function(image) {
                        fs.writeFile("output.png", image);
This page took 0.023417 seconds and 4 git commands to generate.