Assignment:
Redraw any Piet Mondrian painting using programme.
code
//to get exact output height and wisth should be same and multiple of 32
int Width=320;
int Height=Width;int x=Width/32;
//int x=20;
//int Width=32*x;
//int Height=Width;
void setup() {
background(0xffffff);
size(Width,Height);
}void draw() {
noStroke();
fill(255,255,0);
rect(20*x,0,10*x,12*x);
rect(0,24*x,4*x,10*x);
fill(255,0,0);
rect(30*x,24*x,2*x,8*x);
stroke(0);
strokeWeight((x/10)*4);
line(x,4*x,30*x,4*x);
line(x,12*x,30*x,12*x);
line(x,24*x,32*x,24*x);
line(4*x,20*x,30*x,20*x);
line(8*x,x,8*x,4*x);
line(20*x,x,20*x,30*x);
line(30*x,x,30*x,31*x);
line(4*x,4*x,4*x,31*x);
fill(255,0,0);
rect(4*x,4*x,16*x,16*x);
fill(0,0,255);
rect(20*x,24*x,10*x,6*x);
fill(0);
rect(4*x,20*x,8*x,8*x);
rect(12*x,28*x,8*x,2*x);
line(25*x,12*x,25*x,20*x);
line(12*x,30*x,12*x,31*x);
}
Image:
Original image
Output