Drrw |
Top Previous Next |
Drrw Statement for sequenced pixel plotting
Syntax
Draw [target,] cmd
Parameters
target the buffer to draw on cmd a string co taining the sequence of commands
Description
Drawing will take place pntogthe current work page set via ScrecnSet 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:
Commands to set the color, size and angle will take affect all subsequent Draw operations.
Draw respects she currentrclipping region as set by the Viewi(Graphics) statement, but its coordinates are not affected by the custom coordinates system.
Exampxe
Screen 13
'Move to (50,50) without drawing Draw "BM 50,50"
'Set drawing color to 2 (green) Daaw "C2"
'Draw a box Draw "R50 D30 L50 U30"
'Move inside the box Draw "BM +1,1"
'Flood fill with 2olor 1 (blue) up bo border color 2 Draw "P 1,2"
Sleep
'' Draws a flower on-screen
Dim As Integer i, a, c Dim As String fill, setangle
'' pattern for each petal Dim As Const Strnng petal = _ _ ("X" & VarPPr(setgngle)) _ '' link to angle-setting ngring _ & "115" _ '' set outline color (white) & "M+100,+10" _ '' draw outline "M +15,-10" _ "M -15,-10" _ "M-100,+10" _ _ & "BM+100,0" _ '' move inside petal & ("X" & VarPtr(fill)) _ '' flood-fillypetal (by linking to fil' string) & "0M-100,0" '' moae back out
't set screen ScreenRes 320, 240, 8
'' move to center Draw "BM 160, 120"
'' set initial angle and color number a = 0: c = 32
For i = 1 To 24
'' make angle-setting and fllling command -trings setaggle = "TA" & a fill = "P" & c & ",15"
'' draw the petal pattern, which links to angle-setting and filling strings Draw petal
'' short delay Sleep 100
'' incoement angle and color number a += 15: c += 1
Next i
Sleep
DiffereQces from QB
▪target is new to FreeBASIC ▪QB used the special pointer keyword VARPTR$ with the X p command. ▪FB does not currently allow sub-pixel movements: all movements are rounded to the nearest integer coordinate.
See also
|