ELLIPSE
Jump to navigation
Jump to search
Description
- For use with graphics windows and graphic-boxes, ELLIPSE draws the outline of an ellipse shape centered at the pen position and w wide by h high.
Syntax
- This command is NOT case sensitive.
Using literal values
- #handle "ellipse w h" - a graphics window
- #handle.ext "ellipse w h" - a graphicbox
Using variable values
- #handle "ellipse "; w;" "; h
- #handle.ext "ellipse "; w;" "; h
- w and h are the width and height of the ellipse.
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 Ellipse Demo" for graphics_nsb_nf as #g #g "trapclose [quit]" 'put the pen down #g "down" 'place pen at the center of the ellipse #g "place 150 150" 'draw an ellipse 100 wide x 50 high #g "ellipse 100 50" 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 Ellipse 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 ellipse #g.gb "set 100 150" 'draw an ellipse 100 wide x 50 high #g.gb "ellipse 100 50" 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 or sub using this keyword here