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.

eally shines. And remember, as you progress in <strong>Processing</strong>, you have the freedom <strong>and</strong><br />

flexibility to utilize Java classes such as BufferedImage, or even work in pure Java in the<br />

<strong>Processing</strong> environment.<br />

Graphic formats<br />

Those of you with lots of computer graphics application experience can probably skim this<br />

section. I do cover a little of the inner workings of both raster <strong>and</strong> vector graphics, which<br />

might be new or of interest, however. In computer graphics, graphic image types are generally<br />

broken down into two basic categories: raster graphics <strong>and</strong> vector graphics. Raster<br />

graphics are usually continuous tone images, like photographs, that are not delineated<br />

into precise shapes with smooth edges, but are built up as a series of pixels, like a painting.<br />

The pixels blend together to form the illusion of a single image. The BufferedImage class<br />

is a structure designed to h<strong>and</strong>le raster graphics. Vector graphics are usually simpler<br />

images, in terms of number of colors <strong>and</strong> detail. They have distinct parts, each delineated<br />

with a concise edge. While raster graphics are a matrix of the actual pixels displayed on the<br />

screen (or an approximation), vector graphics are mathematically described shapes, with<br />

color fills, strokes, <strong>and</strong> other rendering attributes. Vector graphics can require much less<br />

memory compared to raster graphics, as they represent the plots of mathematical expressions.<br />

Since the computer is really a glorified calculator, it grooves on equations, but having<br />

to keep track of millions of pixels in real time is more dem<strong>and</strong>ing. Ultimately though,<br />

in the rendering process to the screen, eventually everything must be converted to screen<br />

pixels. However, before the screen rendering, vector graphics are able to be stored as simple<br />

expressions, rather than large arrays of RGBA color values, as with raster graphics.<br />

Raster <strong>and</strong> vector graphics each have their strengths <strong>and</strong> weaknesses, <strong>and</strong> are generally<br />

utilized for different purposes.<br />

Raster graphics<br />

COMPUTER GRAPHICS, THE FUN, EASY WAY<br />

Raster graphics are typically utilized for photographic or other highly detailed continuous<br />

tone images, where edges are not distinct <strong>and</strong> there is a large variation in color or value.<br />

Common raster graphic image file formats include TIF, BMP, <strong>and</strong> JPG. Raster formats also<br />

generally utilize some compression algorithms to ease their memory storage requirements.<br />

Compression can be lossy, in which the image quality is actually degraded with<br />

compression, like in JPG; or lossless, with no image loss, as in LZW compression, used commonly<br />

with the TIF file format. Raster images have variable resolution, meaning that you<br />

can specify how many dots of image information you want to pack into each inch. The<br />

more dots per inch (dpi), the finer the image detail or resolution, but also the higher the<br />

memory requirements. Monitor screen resolution is 72 dpi (Mac) <strong>and</strong> 96 dpi (Windows).<br />

That means that it is only possible to see 72 dpi on the screen on a Mac; any higher will not<br />

improve the quality of the screen image. So why would you want more resolution if you<br />

can’t see it? Well, if you are only working on the Web, then you don’t need any additional<br />

resolution—you’re done (assuming the image is the size you want it). However, if you ever<br />

need to print your images, then you need more resolution; how much more is dependent<br />

upon how you’re going to print. Offset printers that print magazines, posters, this book,<br />

115<br />

4

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

Saved successfully!

Ooh no, something went wrong!