Skip to content

Commit 565bca6

Browse files
authored
Merge pull request jdf#121 from villares/patch-1
Update beginContour() documentation example in the site reference
2 parents 867d770 + 573c3c1 commit 565bca6

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎Reference/api_en/PShape_beginContour.xml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ def setup():
2121
s = createShape()
2222
s.beginShape()
2323
s.noStroke()
24-
# Exterior part of shape
24+
# Exterior part of shape, clockwise winding
2525
s.vertex(-50, -50)
2626
s.vertex(50, -50)
2727
s.vertex(50, 50)
2828
s.vertex(-50, 50)
29-
# Interior part of shape
29+
# Interior part of shape, counter-clockwise winding
3030
s.beginContour()
3131
s.vertex(-20, -20)
32-
s.vertex(20, -20)
33-
s.vertex(20, 20)
3432
s.vertex(-20, 20)
33+
s.vertex(20, 20)
34+
s.vertex(20, -20)
3535
s.endContour()
3636
# Finish off shape
3737
s.endShape()
@@ -45,7 +45,9 @@ def draw():
4545
</example>
4646

4747
<description><![CDATA[
48-
The <b>beginContour()</b> and <b>endContour()</b> methods make it possible to define shapes with other shapes cut out of them. For example, the inside of a letter 'O'. These two functions are always used together, you'll never use one without the other. Between them, define the geometry you want to create. As you'll see when you run the example above, the second smaller shape is cut out of the first larger shape.
48+
Use the <b>beginContour()</b> and <b>endContour()</b> function to create negative shapes within shapes such as the center of the letter 'O'. <b>beginContour()</b> begins recording vertices for the shape and <b>endContour()</b> 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.<br>
49+
<br>
50+
These functions can only be used within a <b>beginShape()</b>/<b>endShape()</b> pair and transformations such as <b>translate()</b>, <b>rotate()</b>, and <b>scale()</b> do not work within a <b>beginContour()</b>/<b>endContour()</b> pair. It is also not possible to use other shapes, such as <b>ellipse()</b> or <b>rect()</b> within.
4951
]]></description>
5052

5153
<syntax><c>sh</c>.beginContour()</syntax>

0 commit comments

Comments
 (0)