04.04.2013 Views

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

Processing: Creative Coding and Computational Art

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The image() function has an extra feature that I think makes it more useful than set() for<br />

loading images: the ability to resize the image as you load it. The next example, shown in<br />

Figure 10-25, tiles images in the display window using image(img, x, y, w, h). I recommend<br />

using an image approximately 400 (width) ✕ 300 pixels to try the example.<br />

//Image Tiling<br />

size(650, 450);<br />

PImage img2 = loadImage("heidi.jpg");<br />

int cols = 8;<br />

int rows = 8;<br />

int w = width/cols;<br />

int h = height/rows;<br />

for (int i=0; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!