Use the PbeginContour and PendContour function to create negative shapes within shapes such as the center of the letter 'O'. PbeginContour begins recording vertices for the shape and PendContour stops recording. The vertices that define a negative shape must "wind" in the opposite direction from the exterior shape. First draw vertices for the exterior shape in clockwise order, then for internal shapes, draw vertices counterclockwise.

These functions can only be used within a PbeginShape/PendShape pair and transformations such as Ptranslate, Protate, and Pscale do not work within a PbeginContour/PendContour pair. It is also not possible to use other shapes, such as Pellipse or Prect within.

Link to original Processing doc

PbeginContour is available since version 1.0.0.

See also



// @preview image 100 100 '2D' PGraphics 50 50 Ptranslate 0xffff0000 Pstroke 2 PstrokeWeight PbeginShape -40 -40 Pvertex 40 -40 Pvertex 40 40 Pvertex -40 40 Pvertex PbeginContour -20 -20 Pvertex -20 20 Pvertex 20 20 Pvertex 20 -20 Pvertex PendContour 'CLOSE' PendShape Pencode