Reference Manual - Table of Contents

.

Execution Control
Forms and Windows
Controls
Menus
System and Desktop
Graphic Drawing Commands

Animation
QuickTime Movies
Speech
Sound
File I/O
Printing
Serial Ports

Math Functions
String Functions
Date and Time
Memory Buffers
Error Handling
Console Text Window

Events

Direct Memory Access
Direct Mouse Access
Direct Keyboard Access
Code Resource Modules

A - Runtime Error Messages
B - Compiler Error Messages

.

Graphic Drawing Commands

This section describes commands for creating graphic elements such as lines, boxes, and ellipses in Macintosh forms/windows, animation frame buffers, or when printing hardcopy output.

The terms Form and Window can be used interchangeably. A Form is just a Window that was created in the Visual Development Environment. You can use the Window command to create a Window (during runtime)without creating interactively in Visual MacStandardBasic's Visual Development Environment (design time).

When you see the parameter windowID in this manual you can give the FormName or the variable( var parameter) you used in the Window command. The WindowID can also be the reserved keyword PRN which used for sending output to a printer. It can also be a spriteGfxID for drawing in an animation frame buffer (See the Animation section for more info).

Command Summary:
DrawText windowID, x, y, text$
DrawFont
windowID, fontNum
DrawSize
windowID, fontSize
DrawStyle
windowID, fontStyle
Point
windowID, x, y
MoveTo
windowID, x, y
LineTo
windowID, x, y
Line
windowID, x1, y1, x2, y2
Box
windowID, x, y, width, height
BoxFill
windowID, x, y, width, height
Circle
windowID, x, y, radius
CircleFill
windowID, x, y, radius
Ellipse
windowID, x, y, width, height
EllipseFill
windowID, x, y, width, height
StretchLine
windowID, x, y, var1, var2
StretchBox
windowID, x, y, var1, var2
StretchCircle
windowID, x, y, var
StretchEllipse
windowID, x, y, var1, var2
DrawPicture
windowID, left, top, width, height, ResourceID
SetColor windowID, color
SetColorRGB
windowID, redValue, greenValue, blueValue
BackColor
windowID, color
BackColorRGB
windowID, redValue, greenValue, blueValue
PenSize
windowID, width, height
PenPattern
windowID, pattern
PenMode windowID, mode
PenNormal windowID
DrawUpdate windowID, status
PictureBegin width, height
PictureDone
PictureSave
ResourceID

Function Summary:
var = PictureLoad ( pathname$ )
var = FontNum ( fontName$ )
var = GetPixel ( fontName$ )
var = RGB ( fontName$ )

 

DrawText windowID, x, y, text$

This command draws text in the designated window to the specified x, y coordinates. The upper left corner of the content area of the window is 0,0.

Examples:
Dim WinNum

Window WinNum, 100, 100, 400, 300, 4, "Sample Window, None
DrawText WinNum, 25, 30, "Hello World"

DrawText Form1, 25, 30, "Hello World"

.

DrawFont windowID, fontNum

This command specifies the font that will be used in following DrawText commands in the designated window .

Fonts (Predefined)
0 = Chicago
1 = Default Application Font (initially Geneva)
2 = New York
3 = Geneva
4 = Monaco
5 = Venice
6 = London
7 = Athens
8 = SanFran
9 = Toronto
11 = Cairo
12 = LosAngeles
20 = Times
21 = Helvetica
22 = Courier
23 = Symbol
24 = Mobile

 

DrawSize windowID, fontSize

This command specifies the font size that will be used in following DrawText commands in the designated window .

DrawStyle windowID, fontStyle

This command specifies the font style that will be used in following DrawText commands in the designated window .

Font Styles
0 = Normal
1 = Bold
2 = Italic
4 = Underlined
8 = Outline
16 = Shadow
32 = Condensed character spacing
64 = Extended character spacing

 

Point windowID, x, y

This command draws a pixel at the x, y coordinates in the designated window.

MoveTo windowID, x, y

This command moves the position of the designated window graphic cursor to the specified x, y coordinates. The upper left corner of the content area of the window is 0,0.

LineTo windowID, x, y

This command draws a line from the current position designated window graphic cursor to the specified x, y coordinate. If there have not been any other graphic relevant commands direct at the window, then the line will start from the window’s 0, 0 xy coordinates.

The LineTo command draws from a last point specified from a previous MoveTo, Point, Line, or LineTo command.

Line windowID, x1, y1, x2, y2

This command draws a line from the position specified by x1, y2 to the endpoint represented by x2, y2.

.

Example:

Line Form1, 30, 30, 100, 100

.

Box windowID, x, y, width, height

This command draws a rectangle created by the x, y, width, height parameters in the designated window.

BoxFill windowID, x, y, width, height

This command draws a rectangle filled with current color created by the x, y, width, height parameters in the designated window.

Circle windowID, x, y, radius

This command draws a circle in the designated window with the center of the circle being x, y with the specified radius in pixels.

CircleFill windowID, x, y, radius

This command draws a circle filled with the current color in the designated window with the center of the circle being x, y with the specified radius in pixels.

Ellipse windowID, x, y, width, height

This command draws the largest ellipse that will fit in the bounding rectangle created by the x1, y1, width, height parameters.

EllipseFill windowID, x, y, width, height

This command draws the largest ellipse filled with the current color that will fit in the bounding rectangle created by the x1, y1, width, height parameters.

StretchLine windowID, x, y, var1, var2

This command draws a dynamic line from the x, y position to a point selected by interaction with the user. Upon mouse button release, the endpoint coordinates are store in the numeric variables var1 and var2 (the x and y position). This command is usually with a mouse down event to create a ‘rubberband’ line that allows the user to hold the mouse button down to create lines in a window.

Important Note: When the user releases the button the line will disappear from the screen, the program will need to use the LINE command create an actual line in the window.

StretchBox windowID, x, y, var1, var2

This command draws a dynamic box from the x, y position to a point selected by interaction with the user. Upon mouse button release, the width and height of the box are store in the numeric variables var1and var2. This command is usually with a mouse down event to create a ‘rubberband’ box that allows the user to hold the mouse button down to create boxes in a window.

Important Note: When the user releases the button the box will disappear from the screen, the program will need to use the BOX or BOXFILL commands create an actual box in the window. By not drawing a box, this command can also be used to create a dynamic graphic object selection box.

StretchCircle windowID, x, y, var

This command draws a dynamic circle from the centerpoint x, y position with a radius selected by interaction with the user. Upon mouse button release, the radius of the circle is store in the numeric variable var1. This command is usually with a mouse down event to create a ‘rubberband’ circle that allows the user to hold the mouse button down to create circles in a window.

Important Note: When the user releases the button the circle will disappear from the screen, the program will need to use the CIRCLE or CIRCLEFILL commands to create an actual circle in the window. By not drawing a circle, this command can also be used to create a dynamic graphic object selection circle.

StretchEllipse windowID, x, y, var1, var2

This command draws a dynamic ellipse from the x, y position to a point selected by interaction with the user. Upon mouse button release, the width and height of the ellipse’s bounding rectangle are store in the numeric variables var1 and var2. This command is usually with a mouse down event to create a ‘rubberband’ ellipse that allows the user to hold the mouse button down to create ellipses in a window.

Important Note: When the user releases the button the ellipse will disappear from the screen, the program will need to use the ELLIPSE or ELLIPSE FILL commands create an actual ellipse in the window. By not drawing an ellipse, this command can also be used to create a dynamic graphic object selection ellipse.

DrawPicture windowID, left, top, width, height, ResourceID

The DrawPicture displays a picture in the window specified. This command is different from a Picture control in that it is not resizable as a control is and does not generate an event. Though as with other graphic commands you can draw a picture on a sprite or to printer output.

The location and size specified for the picture are local coordinates to that window. The upper left corner of the window content area is designated as 0,0. If the width and height parameters equal 0 (zero) then the picture will not be scaled but drawn it's original size.

SetColor windowID, color

This command sets the foreground color of the specified window. SetColor allows you to choose one of eight basic colors. For more exact color control use the SetColorRGB command.

The foreground color is used for all of the graphic drawing commands.

Basic Colors
1 = Black
2 = Yellow
3 = Magenta
4 = Red
5 = Cyan
6 = Green
7 = Blue
8 = White

.

SetColorRGB windowID, redValue, greenValue, blueValue

This command sets the foreground color of the specified window to the closest color from the indicated red, green, and blue components. The SetColor command limits you to choose one of eight basic colors. The foreground color is used for all of the graphic drawing commands.

BackColor windowID, color

This command sets the background color of the specified window. BackColor allows you to choose one of eight basic colors. For more exact color control use the BackColorRGB command.

This command will cause the window to be redrawn with the new background color.

.

BackColorRGB windowID, redValue, greenValue, blueValue

This command sets the background color of the specified window to the closest color from the indicated red, green, and blue components. The BackColor command limits you to choose one of eight basic colors. This command will cause the window to be redrawn with the new background color.

PenSize windowID, width, height

This command sets the width and height of the graphics pen of the specified window. This affects all the graphics drawing commands that follow this command.

PenPattern windowID, pattern

This command sets the draw pattern of the graphics pen of the specified window. This affects all the graphics drawing commands that follow this command.

PenMode windowID, mode

This command sets the draw mode of the graphics pen of the specified window. This affects all the graphics drawing commands that follow this command.

PenNormal windowID

This command resets the attributes of the graphics pen of the specified window. This affects all the graphics drawing commands that follow this command. The pen attributes will be reset to the following: Pen width and height are sets to 1, pattern is set to black, and mode is set to 1.

DrawUpdate windowID, status

This command can alter the status of whether graphic drawing commands that follow this command will be redrawn when the window is updated.

PictureBegin width, height

This command is used with the PictureDone command to create a new picture. All graphic commands this command will be used in creating a picture until the PictureDone command is executed. You can use the PictureSave command to save the picture.

PictureDone

This command is used with the PictureBegin command to create a new picture.

.

PictureSave pathname$

This command is used to save a picture to a PICT file that was created with the PictureBegin and PictureDone commands.

var = PictureLoad ( pathname$ )

This command is used to load a picture from a PICT file into a picture resource for use with the Picture control. The value returned in the var should be used in ResourceID parameter of the Picture command.

var# = GetPixel( windowID, x, y )

This function returns a double (numeric variable type) that represents the the RGB value of the pixel specified from the x, y coordinates.

windowID - This should be a Form name or a variable, used in the WINDOW command, that contains a value that is used to reference the window.

x - This is a numeric expression designating the x coordinate.

y - This is a numeric expression designating the y coordinate.

 

var# = RGB( redValue, greenValue, blueValue )

This function returns a double (numeric variable type) that represents the the RGB value of the 3 specified color components. This returned value can only be stored in a double type variable.