We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello,
I'm having a problem in processing, I want load 20 elements (images and svgs), place them randomly in the canvas and then save it as a pdf or svg.. I'm new in processing, but I found this code underneath which place elements (not images or svgs) random in the canvas.. I don't know if I'm totally wrong but isn't possible to loadImage instead of rect, triangles and ellipse?
I hope someone can help me..
void setup () {
size(800, 1200);
noLoop();
smooth(4);
noStroke();
}
void mousePressed() {
redraw();
}
void keyPressed() {
redraw();
}
void draw() {
clear();
for (int i=0; i!=10; ++i)
skull((int) random(width), (int) random(height));
}
void skull(int x, int y) {
translate(x, y);
fill(-1);
ellipse(35, 35, 70, 70);
rect(17, 65, 36, 15);
fill(0);
ellipse(18, 35, 17, 25);
ellipse(52, 35, 17, 25);
triangle(27, 51, 32, 51, 32, 61);
triangle(38, 51, 43, 51, 38, 61);
rect(23, 65, 3, 15);
rect(33, 65, 3, 15);
rect(43, 65, 3, 15);
resetMatrix();
}
Answers
We can draw them in a PGraphics and get() a PImage from them:
Thank you for you reply.. I'm not quiet sure what the examples has to do with what I want to archieve.. Sorry..
Is it possible in this example to add an array with PImage and then call it in void skull()..
Sorry I'm new in this..
I thought you wanted the skull() turned into a PImage? :-/
Anyways, I've made it. Now you got a PImage skull: :-bd
http://studio.processingtogether.com/sp/pad/export/ro.9D3bN1ux8U67I/latest
Thank you so much for your help.. That was really helpful..