The DRAW command allows you to draw line segments and rectangles
on the screen, forming one of the basic building blocks for creating
simple graphics. This command can be used to draw coordinate axes
and data points, to create characters, environments, and objects,
to draw windows, buttons, and other interface elements.
It starts drawing from the coordinates (x1, y1)
to arrive at the coordinates (x2, y2), using the color c.
The start or the final coordinates can be omitted: in this case, ugBASIC
will draw, respectively, starting from the last drawn position and
arriving at the last drawn position. If the color is omitted, the
last color selected with the INK or PEN command will be used.
The DRAW command offers several additional options to customize
the drawing. After the color, that is optinal, you can put the letter
B to draw a rectangle. The letters BF means that the
rectangle must be filled, too. Finally, the default line style is normally
"complete" but a 16 bit bitmask can be set with the SET LINE command.
You can also select the mode that can be PSET or PRESET. If
PSET is used the line is drawn in the current foreground colour.
If PRESET, the line is drawn in the background colour.
The accuracy of the drawings is limited by the resolution of the screen,
and drawing many lines can slow down the program, especially on 8-bit computers.
DRAW (x1,y1)-(x2,y2),c[,B[F]] DRAW (x1,y1)-(x2,y2),c[,[mode]][,B[F]] DRAW [x1], [y1] TO x2, y2[, c] DRAW TO [y2],[y2][,c]
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
DRAW (instruction) ↔ Dr
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS