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.

adius is set high, the blurring can be severe. For example, here’s a very blurry image of my<br />

dog Heidi (please note that this sketch can take some time to render—<strong>and</strong> of course, no<br />

harm came to Heidi during the blurring process):<br />

// Severe BLUR Filter<br />

// image should be 600 x 400 pixels<br />

size(600, 400);<br />

background(255);<br />

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

image(img, 0, 0);<br />

filter(BLUR, 10);<br />

Figure 10-42. Severe BLUR Filter sketch<br />

One final word of caution about the BLUR argument: it takes progressively more time to<br />

render as you increase the radius argument, <strong>and</strong> no exception (compiler error) is thrown<br />

for ridiculously large numbers, so be careful.<br />

The final filter mode is OPAQUE, which I won’t bother covering as it simply ensures that the<br />

alpha component of each of the pixels is at 100 percent.<br />

blend()<br />

<strong>Processing</strong>’s blend() function, similarly to filter(), is chock-full of features. One point of<br />

potential confusion to beginning coders (as well as some more experienced folks, including<br />

myself at one point) is that there are two blend() comm<strong>and</strong>s within <strong>Processing</strong>. One<br />

lives as a PImage method <strong>and</strong> the other as a display window function; both also work<br />

similarly.<br />

COLOR AND IMAGING<br />

459<br />

10

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

Saved successfully!

Ooh no, something went wrong!