CIRCLE
Jump to navigation
Jump to search
Description
- For use with graphics windows and graphicboxes, CIRCLE draws the outline of a circle shape with a radius r at the current pen position.
Syntax
- This command is NOT case sensitive.
Using literal values
- #handle "circle r" - a graphics window
- #handle.ext "circle r" - a graphic box
Using variable values
- #handle "circle "; r
- #handle.ext "circle "; r
- r is the radius of the circle.
Hints
- Color & Size. Shapes are drawn with a pen color set by the color command and a line thickness set by the size command.
- Filled Shapes. You cannot draw a shape and then fill it with color. (The fill command is used to fill the graphics window with color). Instead, to make a shape filled with color, use the complimentary shapefilled commands:
Example
An example of the command using a graphics window
nomainwin
WindowWidth=400
WindowHeight=300
open "Draw Circle Demo" for graphics_nsb_nf as #g
#g "trapclose [quit]"
'put the pen down
#g "down"
'place pen at the center of the circle
#g "place 100 150"
'draw a circle with a radius of 63 pixels
#g "circle 63"
wait
[quit]
close #g
end
An example of the command using a graphicbox
nomainwin
WindowWidth=400
WindowHeight=300
graphicbox #g.gb, 2, 2, 390, 270
open "Draw Circle Demo" for graphics_nsb_nf as #g
#g "trapclose [quit]"
'put the pen down
#g.gb "down"
'set pen color and size for shape
#g.gb "color blue; size 3"
'set a point at the center of the circle
#g.gb "set 100 150"
'draw a circle with a radius of 63 pixels
#g.gb "circle 63"
wait
[quit]
close #g
end
An example combining four shape commands in a graphics window
nomainwin
WindowWidth=400
WindowHeight=300
open "All Shapes Demo" for graphics_nsb_nf as #g
#g "trapclose [quit]"
'put the pen down
#g "down"
'set the pen color and size
#g "color blue; size 2"
'place and draw a box
#g "place 10 10; box 150 150"
'place and draw a circle
#g "place 80 80; circle 40"
'place and draw an ellipse
#g "place 200 200; ellipse 100 50"
'change pen color and size
#g "color red; size 1"
'draw a line
#g "line 10 10 200 200"
#g "flush" 'make graphics stick
wait
[quit]
close #g
end
Useful Procedures
' Place a useful function using this keyword here