emailconfirmed
1,824
edits
No edit summary |
No edit summary |
||
Line 172: | Line 172: | ||
== Cut-Ups, Pixels, Stripes, Collages == | == Cut-Ups, Pixels, Stripes, Collages == | ||
---- | |||
<source lang="java"> | |||
PImage img; | |||
PImage[] parts = new PImage[9]; | |||
int d; | |||
void setup() { | |||
size(300, 300); | |||
d = width / 3; | |||
img = loadImage("photo.jpg"); | |||
image(img, 0, 0, 300, 300); | |||
// get first part | |||
for(int i=0; i<9; i++) { | |||
int x = (i % 3) * d; | |||
int y = (i / 3) * d; | |||
parts[i] = get(x, y, d, d); | |||
} | |||
} | |||
void draw() { | |||
background(0); | |||
for(int i=0; i<9; i++) { | |||
int x = (i % 3) * d; | |||
int y = (i / 3) * d; | |||
image(parts[8-i], x, y); | |||
} | |||
} | |||
</source> | |||
---- |