Reference Manual - Table of Contents .
.
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 ResourceIDFunction 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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the x coordinate of the window.
y - This is a numeric expression designating the y coordinate of the window.
text$ - This is a string expression of the text that will be drawn.
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 .
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
fontNum - This is a numeric value designating the font that is to be used. You can use the predefined as specified by the table below or use the FontNum function to use other fonts.
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 .
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
fontNum - This is a numeric value designating the font size that is to be used.
.
DrawStyle windowID, fontStyle
This command specifies the font style that will be used in following DrawText commands in the designated window .
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
fontStyle - This is a numeric value designating the font style that is to be used. Values assigned to different font attributes can be added together to create a font style.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the left x coordinate of the boxs bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the boxs bounding rectangle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the x coordinate of the window.
y - This is a numeric expression designating the y coordinate of the window.
.
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 windows 0, 0 xy coordinates.
The LineTo command draws from a last point specified from a previous MoveTo, Point, Line, or LineTo command.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the x coordinate of the endpoint of the line.
y - This is a numeric expression designating the y coordinate of the endpoint of the line.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x1 - This is a numeric expression designating the x coordinate of the startpoint of the line.
y1 - This is a numeric expression designating the y coordinate of the startpoint of the line.
x2 - This is a numeric expression designating the x coordinate of the endpoint of the line.
y2 - This is a numeric expression designating the y coordinate of the endpoint of the line.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the left x coordinate of the boxs bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the boxs bounding rectangle.
width - This is a numeric expression designating the width of the boxs bounding rectangle.
height - This is a numeric expression designating the height of the boxs bounding rectangle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the left x coordinate of the boxs bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the boxs bounding rectangle.
width - This is a numeric expression designating the width of the boxs bounding rectangle.
height - This is a numeric expression designating the height of the boxs bounding rectangle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the x coordinate of the center of the circle.
y - This is a numeric expression designating the y coordinate of the center of the circle.
radius - This is a numeric expression designating the radius in pixels of the circle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the x coordinate of the center of the circle.
y - This is a numeric expression designating the y coordinate of the center of the circle.
radius - This is a numeric expression designating the radius in pixels of the circle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the left x coordinate of the ellipses bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the ellipses bounding rectangle.
width - This is a numeric expression designating the width of the ellipses bounding rectangle.
height - This is a numeric expression designating the height of the ellipses bounding rectangle.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
x - This is a numeric expression designating the left x coordinate of the ellipses bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the ellipses bounding rectangle.
width - This is a numeric expression designating the width of the ellipses bounding rectangle.
height - This is a numeric expression designating the height of the ellipses bounding rectangle.
.
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.
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 of the startpoint of the line.
y - This is a numeric expression designating the y coordinate of the startpoint of the line.
var1 - This is a numeric variable that will contain the x coordinate of the endpoint of the line when the user releases the mouse button.
var2 - This is a numeric variable that will contain the y coordinate of the endpoint of the line when the user releases the mouse button.
.
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.
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 left x coordinate of the boxs bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the boxs bounding rectangle.
var1 - This is a numeric variable that will contain the width of the boxs bounding rectangle when the user releases the mouse button.
var2 - This is a numeric variable that will contain the height of the boxs bounding rectangle when the user releases the mouse button.
.
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.
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 centerpoint x coordinate of the circle to be drawn.
y - This is a numeric expression designating the centerpoint y coordinate of the circle to be drawn.
var - This is a numeric expression that will contain the radius of the circle when the user releases the mouse button.
.
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 ellipses 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.
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 left x coordinate of the ellipses bounding rectangle.
y - This is a numeric expression designating the top y coordinate of the ellipses bounding rectangle.
var1 - This is a numeric variable that will contain the width of the ellipses bounding rectangle when the user releases the mouse button.
var2 - This is a numeric variable that will contain the height of the ellipses bounding rectangle when the user releases the mouse button.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
left - This is a numeric expression designating the left x window coordinate for this picture.
top - This is a numeric expression designating the top y window coordinate for this picture.
width - This is a numeric expression designating the width for this picture.
height - This is a numeric expression designating the height for this picture.
ResourceID - This is a numeric expression designating the PICT resource ID for this picture.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
color - This is a numeric value designating the basic that is to be used. Values other than 1 thru eight will be ignored.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
redValue - This is a numeric value designating the value of the RED component of the color.
greenValue - This is a numeric value designating the value of the GREEN component of the color.
blueValue - This is a numeric value designating the value of the BLUE component of the color.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
color - This is a numeric value designating the basic that is to be used. Values other than 1 thru eight will be ignored.
Basic Colors
1 = Black
2 = Yellow
3 = Magenta
4 = Red
5 = Cyan
6 = Green
7 = Blue
8 = White
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
redValue - This is a numeric value designating the value of the RED component of the color.
greenValue - This is a numeric value designating the value of the GREEN component of the color.
blueValue - This is a numeric value designating the value of the BLUE component of the 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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
width - This is a numeric value designating the width of the current graphic pen of the specified window.
height - This is a numeric value designating the height of the current graphic pen of the specified window.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
pattern - This is a numeric value designating the pattern of the current graphic pen of the specified window.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
mode - This is a numeric value designating the mode of the current graphic pen of the specified window.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
.
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.
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.
Use the constant PRN to send output to the printer instead of a window.
You can use a SpriteID or FrameBufferID to draw to a sprite buffer.
status - This is a TRUE (1) /FALSE (0) numeric value indicating whether the graphic draw commands used with the specified window will be redrawn.
.
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.
width - This is a numeric expression designating the width of the picture to be created.
height - This is a numeric expression designating the height of the picture to be created.
.
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.
pathname$ - This should be a string expression that contains the name of the file that is to be used. If the file is not located in the current default directory then you must specify the directory path specification. For example:
Harddisk:MyFolder:MyFile
.
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.
pathname$ - This should be a string expression that contains the name of the file that is to be used. If the file is not located in the current default directory then you must specify the directory path specification. For example:
Harddisk:MyFolder:MyFile
.
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.
redValue - This is a numeric value designating the value of the RED component of the color.
greenValue - This is a numeric value designating the value of the GREEN component of the color.
blueValue - This is a numeric value designating the value of the BLUE component of the color.
.