Statement for sequenced pixel plotting
Syntax
Draw [target,] cmd
Parameters
target
the buffer to draw on
cmd
a string containing the sequence of commands
Description
Drawing will take place onto the current work page set via
ScreenSet or onto the
target Get/
Put buffer if specified.
The
Draw statement can be used to issue several drawing commands all at once; it is useful to quickly draw figures. The command string accepts the following commands:
Commands to plot pixels:
Command | Description |
| Commands to plot pixels: |
B | Optional prefix: move but do not draw. |
N | Optional prefix: draw but do not move. |
Mx,y | Move to specified screen location. if + or - precedes x, movement is relative to current cursor position. |
U[n] | Move n units up. If n is omitted, 1 is assumed. |
D[n] | Move n units down. If n is omitted, 1 is assumed. |
L[n] | Move n units left. If n is omitted, 1 is assumed. |
R[n] | Move n units right. If n is omitted, 1 is assumed. |
E[n] | Move n units up and right. If n is omitted, 1 is assumed. |
F[n] | Move n units down and right. If n is omitted, 1 is assumed. |
G[n] | Move n units down and left. If n is omitted, 1 is assumed. |
H[n] | Move n units up and left. If n is omitted, 1 is assumed. |
| Commands to color: |
Cn | Changes current foreground color to n. |
Pp,b | Flood fills region with border color b with color p. |
| Commands to scale and rotate: |
Sn | Sets the current unit length, default is 4. A unit length of 4 is equal to 1 pixel. |
An | Rotate n*90 degrees (n ranges 0-3). |
TAn | Rotate n degrees (n ranges 0-359) |
| Extra commands: |
Xp | Executes commands at address p. |
Example
'' set the screen mode to 320 * 200, 256 color
Screen 13
'' start in the center of the screen
Draw "BM160,100"
'' Draw a box
Draw "U10 R5 D10 L5"
Sleep
Screen 13
Draw "BM160,100"
'' Draw a box
Dim As String drawbox = "U10R5D10L5"
Draw "X" & VarPtr(drawbox)
Sleep
Differences from QB
- QB used the special pointer keyword VARPTR$ with the Xp command.
See also