home/ atoms/ processing-stroke-fill-attributes

Processing separates fill, stroke, and strokeWeight into independent state settings

In Processing, visual style is managed through global state. fill() sets the interior color of shapes; stroke() sets the outline color; strokeWeight() sets the outline thickness; noFill() and noStroke() disable the respective attribute. These settings persist and affect all shapes drawn after the call until changed. The sequence matters: set attributes before drawing. smooth() enables antialiasing on all subsequent shapes. strokeCap() and strokeJoin() control endpoint and corner styles for lines and shapes.

Examples

fill(200, 0, 0); // red fill stroke(0); // black outline strokeWeight(4); rect(10, 10, 80, 80);

Assessment

Write the code sequence needed to draw a circle with a red interior, no outline, and then a rectangle with no fill and a blue 3px outline, in that order.

“Thefill() function sets the fill value of shapes, and the stroke() function sets the outline value of the drawn shapes.”
corpus · processing-handbook-no-login-mirror-pdf-reas-and-fry · chunk 14