Draw

The Draw component allows the NewBASIC programmer access to the lowest level of graphics functionality in the New Deal operating system. The underlying implementation of this component is the same human optimized assembly code in the kernel that powers drawing of the user interface. Draw components write internally stored and manipulated gstring structures.

Draw Properties

data complex
This value stors the actual graphics string as a complex. This value can be passed to other components when setting their .graphic properties.

Draw Events

None.

Draw Actions

start()

start() AS integer

This action begins defining a graphic string object to draw. This must be the first action sent to a draw component. All subsequent actions are stored within the draw component until a stop() action is recieved. This action instructs the New Deal subsystem to create an initial gstring.

Pass:

Nothing.

stop()

stop() AS integer

This action stops defining a draw component.

Pass:

Nothing.

rectangle()

rectangle(left AS integer, top AS integer, right AS integer, bottom AS integer)
AS integer

This action draws the passed rectangle into the draw component. This rectangle is filled, according to the currently stored color.

Pass:

left
The left boundry of the rectangle.

top
The top boundry of the rectangle.

right
The right boundry of the rectangle.

bottom
The bottom boundry of the rectangle.

ellipse()

ellipse(left as integer, top as integer, right as integer, bottom as integer) as integer

This action adds the given ellipse to the draw component.

polygon()

polygon(points as array[][], count as integer) as integer

This action adds the given polygon to the draw component. This action passes a set of count points within a two dimensional array passed in the points data.

areacolor()

areacolor(color as integer) as integer

This action sets the current area color for a draw component. Future filled components will be drawn using this color.

linecolor()

linecolor(color as integer) as integer

Thsi action sets the current line color for a draw component. Future drawn components will be drawn using this color.

moveto()

moveto(x as integer, y as integer) as integer

This action moves the current cursor position of the draw component to the given point, based on the upper left corner as the origin (0,0).

lineto()

drawlineto(x as integer, y as integer) as integer

This action adds a line from the current cursor position to the given point to the draw component.

text()

text(text as string) as integer

This action adds text at the current cursor position to the draw component.

font()

font(font as string, size as integer) as integer

This action sets the current font and point size of the draw component. Fonts are passed as strings containing their New Deal names. For example. "URW Roman", etc.

rotate()

rotate(angle as integer) as integer

This action rotates subsequent operations sent to the draw component by the given angle.