#javascript-processing-example-basic-image-createimage.htm / htm
<!DOCTYPE html> <html><head> <script src="javascript-processing-example-processing.js"></script> <script src="javascript-processing-example-init.js"></script> <link rel="stylesheet" href="javascript-processing-example-style.css"> </head><body><h1><a href="http://ejohn.org/blog/processingjs/">Processing.js</a></h1> <h2>CreateImage</h2> <p>The createImage() function provides a fresh buffer of pixels to play with. This example creates an image gradient.</p> <p><a href="http://processing.org/learning/basics/createimage.html"><b>Original Processing.org Example:</b> CreateImage</a><br> <script type="application/processing"> PImage img; void setup() { size(200, 200); img = createImage(120, 120, RGB); for(int i=0; i < img.pixels.length; i++) { img.pixels[i] = color(0, 90, 102, i\ %img.width * 2); } } void draw() { background(204); image(img, 33, 33); image(img, mouseX-60, mouseY-60); } </script><canvas width="200" height="200"></canvas></p> <div style="overflow: hidden; height: 0px; width: 0px;"><img src="javascript-processing-example-mask.jpg" id="mask.jpg"><img src="javascript-processing-example-test.jpg" id="test.jpg"></div> <pre><b>// All Examples Written by <a href="http://reas.com/">Casey Reas</a> and <a href="http://benfry.com/">Ben Fry</a> // unless otherwise stated.</b> PImage img; void setup() { size(200, 200); img = createImage(120, 120, RGB); for(int i=0; i < img.pixels.length; i++) { img.pixels[i] = color(0, 90, 102, i\ %img.width * 2); } } void draw() { background(204); image(img, 33, 33); image(img, mouseX-60, mouseY-60); }</pre> </body></html>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.