Draws a rectangle to the screen. A rectangle is a four-sided shape with every angle at ninety degrees. By default, the first two parameters set the location of the upper-left corner, the third sets the width, and the fourth sets the height. The way these parameters are interpreted, however, may be changed with the PrectMode function.

To draw a rounded rectangle, add a fifth parameter, which is used as the radius value for all four corners.

To use a different radius value for each corner, include eight parameters. When using eight parameters, the latter four set the radius of the arc at each corner separately, starting with the top-left corner and moving clockwise around the rectangle.

Link to original Processing doc

Prect is available since version 1.0.0.

See also



// @preview image 200 200 '2D2' PGraphics 255 Pbackground 0xff0000ff Pstroke //blue 0x2fff0000 Pfill //red transparent 80 20 50 70 Prect 30 120 50 50 10 Prect 130 120 50 50 0 6 20 8 Prect Pencode