Draw
 
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:
CommandDescription
 Commands to plot pixels:
BOptional prefix: move but do not draw.
NOptional prefix: draw but do not move.
M x,yMove to specified screen location. if a '+' or '-' sign precedes x, movement is relative to current cursor position. x's sign has no effect on the sign of y.
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:
C nChanges current foreground color to n.
P p,bPAINTs (flood fills) region of border color b with color p.
 Commands to scale and rotate:
S nSets the current unit length, default is 4. A unit length of 4 is equal to 1 pixel.
A nRotate n*90 degrees (n ranges 0-3).
TA nRotate n degrees (n ranges 0-359).
 Extra commands:
X pExecutes commands at p, where p is a STRING PTR.


Commands to set the color, size and angle will take affect all subsequent Draw operations.

Example

Screen 13

'Move to (50,50) without drawing
Draw "BM 50,50"

'Set drawing color to 2 (green)
Draw "C2"

'Draw a box
Draw "R50 D30 L50 U30"

'Move inside the box
Draw "BM +1,1"

'Flood fill with color 1 (blue) up to 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 String petal = _
    _
    ("X" & VarPtr(setangle)) _ '' link to angle-setting string
    _
    & "C15" _       '' 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-fill petal (by linking to fill string)
    & "BM-100,0"                '' move back out



'' 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 filling command strings
    setangle = "TA" & a
    fill = "P" & c & ",15"

    '' draw the petal pattern, which links to angle-setting and filling strings
    Draw petal
    
    '' short delay
    Sleep 100

    '' increment angle and color number
    a += 15: c += 1

Next i

Sleep



Differences 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

Сайт ПДСНПСР. Если ты патриот России - жми сюда!


Знаете ли Вы, в чем фокус эксперимента Майкельсона?

Эксперимент А. Майкельсона, Майкельсона - Морли - действительно является цирковым фокусом, загипнотизировавшим физиков на 120 лет.

Дело в том, что в его постановке и выводах произведена подмена, аналогичная подмене в школьной шуточной задачке на сообразительность, в которой спрашивается:
- Cколько яблок на березе, если на одной ветке их 5, на другой ветке - 10 и так далее
При этом внимание учеников намеренно отвлекается от того основополагающего факта, что на березе яблоки не растут, в принципе.

В эксперименте Майкельсона ставится вопрос о движении эфира относительно покоящегося в лабораторной системе интерферометра. Однако, если мы ищем эфир, как базовую материю, из которой состоит всё вещество интерферометра, лаборатории, да и Земли в целом, то, естественно, эфир тоже будет неподвижен, так как земное вещество есть всего навсего определенным образом структурированный эфир, и никак не может двигаться относительно самого себя.

Удивительно, что этот цирковой трюк овладел на 120 лет умами физиков на полном серьезе, хотя его прототипы есть в сказках-небылицах всех народов всех времен, включая барона Мюнхаузена, вытащившего себя за волосы из болота, и призванных показать детям возможные жульничества и тем защитить их во взрослой жизни. Подробнее читайте в FAQ по эфирной физике.

НОВОСТИ ФОРУМАФорум Рыцари теории эфира
Рыцари теории эфира
 10.11.2021 - 12:37: ПЕРСОНАЛИИ - Personalias -> WHO IS WHO - КТО ЕСТЬ КТО - Карим_Хайдаров.
10.11.2021 - 12:36: СОВЕСТЬ - Conscience -> РАСЧЕЛОВЕЧИВАНИЕ ЧЕЛОВЕКА. КОМУ ЭТО НАДО? - Карим_Хайдаров.
10.11.2021 - 12:36: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от д.м.н. Александра Алексеевича Редько - Карим_Хайдаров.
10.11.2021 - 12:35: ЭКОЛОГИЯ - Ecology -> Биологическая безопасность населения - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> Проблема государственного терроризма - Карим_Хайдаров.
10.11.2021 - 12:34: ВОЙНА, ПОЛИТИКА И НАУКА - War, Politics and Science -> ПРАВОСУДИЯ.НЕТ - Карим_Хайдаров.
10.11.2021 - 12:34: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вадима Глогера, США - Карим_Хайдаров.
10.11.2021 - 09:18: НОВЫЕ ТЕХНОЛОГИИ - New Technologies -> Волновая генетика Петра Гаряева, 5G-контроль и управление - Карим_Хайдаров.
10.11.2021 - 09:18: ЭКОЛОГИЯ - Ecology -> ЭКОЛОГИЯ ДЛЯ ВСЕХ - Карим_Хайдаров.
10.11.2021 - 09:16: ЭКОЛОГИЯ - Ecology -> ПРОБЛЕМЫ МЕДИЦИНЫ - Карим_Хайдаров.
10.11.2021 - 09:15: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Екатерины Коваленко - Карим_Хайдаров.
10.11.2021 - 09:13: ВОСПИТАНИЕ, ПРОСВЕЩЕНИЕ, ОБРАЗОВАНИЕ - Upbringing, Inlightening, Education -> Просвещение от Вильгельма Варкентина - Карим_Хайдаров.
Bourabai Research Institution home page

Боровское исследовательское учреждение - Bourabai Research Bourabai Research Institution