BASIC Draw
by Colin Faller
Colin Faller is 21 years old and lives in the Northeast of England about a half mile from the coast. He has been programming with Atari computers for 3½ years.
High Resolution Only
Many people complain about ST BASIC, saying that it's impossible to use it to create a full-fledged GEM-style program. BASIC Draw is an example of just what can be accomplished with ST BASIC if you're willing to apply yourself to the task. Programmers will find the menu system used in BASIC Draw to be of special interest.
Note that owners of either the 1040 ST or a one-megabyte 520 ST will have to alter the program slightly. This is due to a difference in the location of screen memory. All you have to do is change the statement MEM1 = 494560 in Line 8 to MEM1 = 1018848. The progam should then work with your machine.
Unfortunately, this program runs only in high resolution; so if you've been thinking about getting a monochrome monitor, now would be a great time to do it.
The program
When you run BASIC Draw, it'll take about three seconds to initialize, after which the main screen will be drawn and the mouse pointer will appear (in the form of a pointing finger). The screen is divided into three areas. The large area to the left is the drawing screen. The area on the right is for the menu and selected functions. The third area, located at the top of the screen, contains four boxes and a Busy box.
The first box is used for the Circle, Box, Ellipse and Polygon functions. When BASIC Draw is the first run the box will be white. But after selecting one of the fill styles, the pattern selected will automatically show in this box. The second box is used only in Airbrush mode. It shades in with a combination of white and black. The third and fourth boxes are used for the Erase, Line 1, Airbrush, Mirror, Circle, Box, Ellipse, Line 2 and Polygon functions. The Busy box lights when you can't use the mouse pointer.
The following is a quick overview of the functions available in BASIC Draw. To activate the menu, simply move the mouse pointer over it.
REVERSE | Reverses the screen from black to white or white to black |
FILL 1 | Fills in an area with one of the 36 GEM styles |
FILL 2 | Fills in an area with one of 15 Customized styles |
ERASE | Used to erase small sections of your drawing |
LINE 1 | Lets you draw freehand in any of three-line thicknesses |
AIRBRUSH | Used to shade areas of your picture |
MIRROR | Turns on the mirroring option |
TEXT | Allows you to put text on the drawing screen |
CIRCLE | Draws a hollow or solid circle of any size |
BOX | Draws a hollow or solid box of any size |
ELLIPSE | Draws a hollow or solid ellipse of any size |
LINE 2 | Draws a straight line between two points |
POLYGON | Draws a filled, multiple-sided shape |
CLEAR | Clears the screen |
EXIT | Returns to BASIC |
LOAD/SAVE | Loads or saves a picture to disk |
Now that you've got a nodding acquaintance with the program, let's look at some of the features in more detail. To select a function from the menu, move the mouse pointer over your selection, and press the left mouse button (LMB).
Fills
When you select FILL 1 function you're given a choice of 36 different fill styles. To select a style, move the mouse pointer over the one you want and press the LMB. The style you have selected will be displayed in a box above the different styles and also in the top corner of the screen. To fill a part of your drawing, move the mouse pointer to the part to be filled and press the LMB. The Busy box will go on while the fill is working.
FILL 2 is the same as FILL 1, except you can choose from 15 custom fill styles.
Erase
When you choose this function, you'll first need to choose one of the eight "size boxes" at the bottom of the screen. To select an erase size, move the mouse pointer to the required size and press the LMB. Then select the color (black or white) the same way. To erase part of your drawing, move the mouse pointer to the area you want to erase and move the mouse over the area, holding down the LMB. This function can also be used as a thick drawing line.
Line 1
There are three different line thicknesses to select from. To select a line thickness move the mouse pointer to one of the three choices and press the LMB. Also select one of the two colors—black or white—in the same way. To draw with the mouse, move the mouse pointer onto the drawing screen, and when you want to draw, press the LMB. To stop drawing, release the button.
Airbrush
This function is used for shading in parts of the screen. Select one of the three different shades and press the LMB. To "spray" an area, move the mouse pointer over the area while holding down the LMB.
Mirror
You are given three different types of mirror styles. Style 1 gives you horizontal mirroring, Style 2 gives you vertical mirroring, and Style 3 gives you both. To select a mirroring style, place the mouse pointer on one of the mirror icons and press the LMB. Colors are selected in the same way. To draw, place the mouse pointer on the drawing screen and hold down the LMB. Whatever you draw will be "mirrored" in whatever manner you selected.
Text
Text is the most complicated of all of the functions. Instead of using just one menu area, it requires two: one for selecting characters and the other for selecting the size and type of characters. To switch between the two menus, press the RMB.
To select the character size and type, first press the RMB. You will then be able to choose between five character sizes and five character types. At the top of the function screen, there will be a square containing the letters "ABC." The letters show you the currently selected text style. In the middle of the menu area, there are five boxes numbered 1 to 5. These are used to select your character size, where 1 is the smallest and 5 is the largest. To select a character size or type move the mouse pointer over the one you've selected and press the LMB. The styles available include bold, grayed, skewed, underlined and outlined. To turn off an option, just "re-select" it.
At the bottom of the menu, you can select either black characters on a white background or white characters on a black background. To select the color, move the mouse pointer over the one you want and press the LMB.
To print the characters to the screen, return to the original menu by pressing the RMB; then move the mouse pointer onto the drawing screen. The mouse pointer will be replaced with a square cursor the size of which will depend upon the character size you selected. Place the cursor where you want the text to begin and press the LMB. The computer will calculate the number of characters that will fit on the screen from your selected position. The number will vary, of course, according to the size and style of the characters, and the location of the cursor. The maximum number of characters will be displayed at the top of the screen. To cancel the text location and choose another, move the mouse pointer over the letters ABC and press the LMB.
Now you can select the characters to print with the mouse. To display a different "page" of characters, click on one of the boxes numbered 1 to 4 with the LMB. To select a character, move the mouse pointer to the character you want and press the LMB. The character is then displayed at the top of the screen. When you have finished "typing" the characters, print them to the screen by moving the mouse pointer to the text line at the top of the screen (where the characters appeared as you selected them) and press the LMB.
Circle
You can choose between a solid or hollow circle. Move the mouse pointer to the style you want and press the LMB. If you select a solid circle, you can use any one of the three fill styles, the colors black or white or your own style. Select a fill style by moving the mouse pointer to the style you want and press the LMB.
There are three boxes at the bottom of the screen which are labeled "Plot," "Radius" and "Mouse Pos." The latter is the position of the mouse pointer. Plot is used to plot the center point of the circle. Move the mouse pointer to the center point of the circle and press the LMB. The Radius will set itself to zero. To draw the circle, move the mouse pointer to the right of the center point if you've selected a solid circle, or left or right if you've selected a hollow circle, and then press the RMB.
Box
This function works similarly to the circle function. The only difference is a change in the three boxes at the bottom of the function menu. Instead of Radius, you have a Size, and the Plot function now plots the upper left corner of the box.
Ellipse
This function is also similar to Circle, but now the radius has two values. To draw the ellipse, you can move the mouse pointer in any direction you need to get the proper size.
LINE 2
This function is used to draw a straight line between two points. This requires two operations: Plot (P) and Draw (D). First plot the starting point of your line by pressing the LMB. Select the line's endpoint with the RMB, and a line will be drawn between the two points.
Notice that, on the function menu, there are two boxes labeled P and D. When you first enter this menu, the P function will be activated (it'll be underlined). When you draw lines in this mode, the point you first plotted is always used as the beginning point of your line. Each time you press the RMB, a line will be drawn from the original plot point to the position of the mouse cursor. This allows you to draw multiple lines, all with the same starting point (sometimes this type of line is called a ray). When D is selected, repeated presses of the RMB will cause a line to be drawn from the previous line's ending point to the position of the mouse cursor. Using this function, you can draw complicated shapes.
Polygon
This is similar to Line 2 with the D option set, except it allows you to draw a filled shape made up of up to 63 lines. The fill style is selected in the same manner discussed previously. To fill a shape, move the mouse pointer to the box below the word "Polygon" and press the LMB.
Load and Save
To load a picture, move the mouse pointer over the Load menu selection and press the LMB. You must then choose one of the 12 files to load. Move the mouse pointer over the file you want and again press the LMB. To cancel, press the RMB.
The save function works the same way.