43
edits
Line 29: | Line 29: | ||
== Homework 2 == | == Homework 2 == | ||
In this homework we were supposed to do a collage. Mine was in the style of david hockney. | |||
<source lang = "java"> | |||
PImage[] images = new PImage[25]; // Array für Bildvariablen erstellt | |||
PImage[] parts = new PImage[25]; // Array für die Teile der Bilder erstellt | |||
int x; | |||
int y; | |||
void setup() { | |||
size(500, 500); | |||
for (int i = 0 ; i < images.length; i++) | |||
{ | |||
images [i] = loadImage("b" + (i+1) + ".JPG"); | |||
} | |||
for (int o=0 ; o < parts.length; o++) | |||
{ | |||
images [o].resize(width,height); | |||
image(images [o], 0, 0, 500, 500); | |||
x = (o % 5) * 100; | |||
y = (o / 5) * 100; | |||
parts[o] = get(x,y,100,100); //Aus jedem Bild wird nur der Teil entnommen der benötigt wird | |||
} | |||
} | |||
void draw() { | |||
background(0); | |||
for (int i = 0; i < parts.length; i++){ | |||
int x = (i % 5) * 100; | |||
int y = (i / 5) * 100; | |||
image(parts[i], x, y, 100, 100); //Zusammensetzung aller Teile aus den verschiedenen Bildern zu einem Bild | |||
} | |||
for( int p = 0; p < 4;p++){ | |||
rect((p*100)+98, 0, 4, 500); | |||
rect(0, (p*100)+98 , 500, 4); | |||
noStroke(); | |||
} | |||
saveFrame("hockney.JPG"); | |||
} | |||
</source> | |||
the result: | |||
[[File:Hockney.JPG]] | |||
== Homework 3 == | == Homework 3 == |
edits