Skip to content

Commit dde163c

Browse files
authored
Update 613-graphics-circle.markdown
1 parent 1f5e0e9 commit dde163c

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

_build/reference/613-graphics-circle.markdown

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,26 @@
11
# CIRCLE
22

3-
> CIRCLE [STEP] x,y,r [,aspect [, color]] [COLOR color] [FILLED]
3+
> CIRCLE [STEP] x, y, r [, aspect [, color]] [COLOR color] [FILLED]
44
5-
Draws a circle (or an ellipse if the aspect is specified).
5+
Draws a circle (or an ellipse if the aspect is specified). The point `[x, y]` defines the center and `r` the radius of the circle in pixel. To set the aspect ration use `aspect`. An aspect ratio of `1` will draw a circle. `color` defines the line color of the circle. If `FILLED` is used, the circle will be filled with the color `color`. If STEP is used `x, y` are a step in pixel from the actual graphics cursor position.
66

7-
Example 1: Draw a filled white circle
7+
By default CIRCLE draws with anti-aliasing. For details, see: [Fast, Antialiased Circles and Ellipses](https://yellowsplash.wordpress.com/2009/10/23/fast-antialiased-circles-and-ellipses-from-xiaolin-wus-concepts/) To turn off anti-aliasing use `option predef antialias off`
8+
9+
### Example 1: Draw a filled white circle
810

911
```
1012
circle 200, 200, 150 COLOR 15 FILLED
1113
```
1214

13-
Example 2: Draw a ellipse with aspect ration 1:2
15+
### Example 2: Draw a ellipse with aspect ration 1:2
1416

1517
```
1618
circle 200, 200, 150, 0.5
1719
```
1820

19-
Example 3: Draw a flower
20-
21-
~~~
21+
### Example 3: Draw a flower
2222

23+
```
2324
' Aspect ratio is relation between width-height of a circle,
2425
' for example:
2526
' aspect = 1 = Perfect circle;
@@ -63,33 +64,36 @@ Circle CENTER, RADIUS, ASPECT_RATIO Color 14
6364
' print text in the middle of main circle:
6465
At CENTER(0) - (Txtw(TEXT) \ 2), CENTER(1) - (Txth(TEXT) \ 2)
6566
Color 15: Print TEXT;
66-
~~~
67+
```
6768

68-
Example 4: Smiley Face
69+
### Example 4: Smiley Face
6970

70-
~~~
71+
```
7172
' SmallBASIC 0.12.2 [B+=MGA] 2016-03-16
7273
' Smiley Face
73-
cx=xmax/2:cy=ymax/2:rface=250:reye=50:xle=cx-100:xre=cx+100:dir=1
74+
cx = xmax/2
75+
cy = ymax/2
76+
rface = 250
77+
reye = 50
78+
xle = cx - 100
79+
xre = cx + 100
80+
dir = 1
7481
while 1
7582
cls
76-
circle cx,cy,rface,1,14 filled
77-
circle xle,cy,reye,1-a,9 filled
78-
circle xre,cy,reye,1-a,9 filled
79-
circle cx,cy+130-a*50,100+a*50,.21+2*a,12 filled
80-
circle cx,cy+100-a*50,100+a*50,.21+a,14 filled
81-
at 0,0 :?a
83+
circle cx, cy, rface, 1, 14 filled
84+
circle xle, cy, reye, 1 - a, 9 filled
85+
circle xre, cy, reye, 1 - a, 9 filled
86+
circle cx, cy + 130 - a * 50, 100 + a * 50, .21 + 2 * a, 12 filled
87+
circle cx, cy + 100 - a * 50, 100 + a * 50, .21 + a, 14 filled
8288
showpage
8389
delay 1
84-
a+=.002*dir
85-
if a=.26 then dir=dir*-1
86-
if a=-.1 then dir=dir*-1
90+
a+= .002 * dir
91+
if a = .26 then dir = dir * -1
92+
if a = -.1 then dir = dir *-1
8793
wend
88-
~~~
89-
90-
By default CIRCLE draws with anti-aliasing. For details, see: [Fast, Antialiased Circles and Ellipses](https://yellowsplash.wordpress.com/2009/10/23/fast-antialiased-circles-and-ellipses-from-xiaolin-wus-concepts/)
94+
```
9195

92-
To turn off anti-aliasing, add this to the start of your program:
96+
### Example 5: Turn off anti-aliasing
9397

9498
```
9599
option predef antialias off

0 commit comments

Comments
 (0)