transparent background Erase
in
Programming Questions
•
6 months ago
Hey people,
I m a very beginner and have a question. my code now generates a picture using basic elements like circles, lines etc.
Now i want to have a copy of the original picture within the original, for that i m using the get() function which works pretty well. now i have two questions
question 1
But i don t want that ugly white frame which comes from the background. how do i make that transparent?
question 2
I would also like to erase some of that picture i copy in. how do i do that?
there are probably answers to my problem out there, i have been looking for it for long and cannot find it!
to make sure i give all relevant information, i send all my code:
(it gets relevant at the very bottom
//x5
import processing.pdf.*;
//CODES
int a=1;
int b=a+1;
int c=a+2;
int d=a+3;
int e=a+4;
int f=a+5;
int g=a+6;
int h=a+7;
int i=a+8;
int j=a+9;
int k=a+10;
int l=a+11;
int m=a+12;
int n=a+13;
int o=a+14;
int p=a+15;
int q=a+16;
int r=a+17;
int s=a+18;
int t=a+19;
int u=a+20;
int v=a+21;
int w=a+22;
int x=a+23;
int y=a+24;
int z=a+25;
//TYPE WORD
int x1=f;
int x2=a;
int x3=c;
int x4=e;
int x5=s;
int x6=1;
int x7=1;
int x8=1;
int x9=1;
int x10=1;
void setup() {
size(594, 841);
noLoop();
beginRecord(PDF, "filename2.pdf");
colorMode(RGB);
background(255);
smooth();
}
void draw() {
translate(width/2, height/2);
strokeWeight(0.094488189);
noFill();
//x1
//blue cirlce
if ((x1+x2)>=x5) {
stroke(0, 0, 255);
fill(0, 0, 255);
int y2=x1*10;
ellipse(width/4/(x1+x2*(x1*20)), height/(x2*-2), 10*(x1+x4), 10*(x1+x4));
}
//black circles
if ((height/(x2*-2))<=height/2) {
stroke(0);
noFill();
if (x3>5) {
for (int y3 =10; y3<500; y3=y3+100) {
ellipse(width/4/(x1+x2*(x1*20))+(-2*(y3/2)), height/(x2*-2)+(y3/2), 100, 100);
}
}
if (x3<=5) {
for (int y3 =5; y3<500; y3=y3+(x2+x3+x4+x5)) {
ellipse(width/4/(x1+x2*(x1*20))+(-2*(3/2)), height/(x2*-2)+(3/2), 200+y3, 200+y3);
ellipse(width/4/(x1+x2*(x1*20))+(-2*(3/2)), height/(x2*-2)+(3/2), 300+y3, 300+y3);
}
}
}
//stroke color decision
if (x1+x2+x3>12) {
stroke(255, 0, 0);
}
if (x1+x2+x3<=12) {
stroke(0, 0, 255);
}
//red lines horizontal
for (int y1 = x1*10; y1 <= 400; y1 = y1+5) {
line(-10*x1, y1, (width/x1), y1);
}
//Red lines diagonal
if ((x1)<=x4) {
stroke(255, 0, 0);
for (int y2 = x1*1; y2<=400; y2= y2+x1*3) {
line(-300, -410+y2, x1*(y2*9), (2)*y2*9);
}
}
//x5
PImage cross= get();
image(cross, -300,0);
endRecord();
}
1