The image I choose is the one from Mondrian:
this is a very famous abstract painting and I’m pretty impressed by how the three primary colors and the very simple rectangles can convey the power of shapes and color. Also, I found it pretty suitable to mimic by processing: first, all the colors are plane, there’s no textures in those fills. Second, the shapes are really simple: rectangles. When we were asked to mimic a picture by processing, this one immediately come to my mind.
step one: measure and choose
I just eyeball it and set up the canvas as 800×800. At first I thought that no matter how big or small we set the canvas to be, we can always rescale it by our mouse. But as I started drawing, I found out that as long as you set a value to the canvas size, it is fixed and could not be changed. So then I adjust the canvas size to fit my screen: 650×650.
step two: colors
I use a online color picker https://imagecolorpicker.com/to grab the RGB values of the blue, red and yellow.
step three: functions
Then I use rectangle functions to draw is piece because compared to lines, it’s easier to fill in with colors with rectangles. I also modify the stroke weight using strokeWeight function and fill the shapes with colors using fill. One thing to notice is that there’s no stroke on the border of the canvas, so for the (x,y) position, I set them into negative value.
this is my final work and the code: