Designing Bitmaps

A bitmap is rectangular area of dots or pixels. Bitmaps may be used as icons in labels, pushbuttons and togglebuttons or as graphics in Window widgets. To design a bitmap you simply specify which pixels are to be on or off in the bitmap.

To design a new bitmap, first create the bitmap by clicking on the Add button on the Master Directory ToolBar. Then double click on the new bitmap to edit it. You should see the display below.

.

Note: It is recommended that you store your bitmaps in the Bitmaps folder. If you have created your bitmap in another folder, just drag and drop it in the Bitmaps folder after you have edited it.

The process of editing a bitmap involves turning on bits in the drawing window to represent the bitmap you are designing. You can do this in one of two modes: drawing mode represented by the pencil where you click and drag in the drawing window to turn on and off individual dots; and area mode represented by the fleur where you manipulate a rectangular region of the drawing window by erase, filling etc. Initially, you will be placed in drawing mode.

To turn on dots in drawing mode, click on a white bit and drag the pencil over the dots you want to turn black. To turn dots off, click on a black bit and drag over the dots you want to turn off.

To enter area mode, click on the Area button in the Bitmap ToolBar. A rectangle will appear in the drawing window. To move the rectangle, click and drag the upper left corner of the rectangle. To resize the rectangle, click and drag the lower right corner. Once the rectangle surrounds the area you want to change, click on an icon described below and follow the instructions to carry out the associated operation:

Move
drag the rectangle to the new area and the bits will be moved from the old area to the new.
Copy(overlay)
drag the rectangle to the new area and the on bits will be copied to the new area
Copy(replace)
drag the rectangle to the new area and both the on and off bits will be copied to the new area
Fill
turns all the bits in the rectangle on
Erase
turns all the bits in the rectangle off
Invert
inverts all the bits in the rectangle
Flood
fills an enclosed polygon
Crop
reduces the bitmap to the size of the rectangle
Rotate
rotates the bitmap 90 degrees

You may also File a source copy of the bitmap or Resize it. Finally, clicking on Exit leaves the editor. You will be asked whether you want to save or ignore your changes.

Using Bitmaps

Once you have edited and saved a bitmap, you can use it in place of text in a pushbutton, togglebutton or label. In the View Manager, the bitmap can be displayed in any of these widgets by setting the attribute 'isIcon' to TRUE and the 'label' to the name of the bitmap. If the widget is defined textually, then the keyword 'ICON' should be used in place of 'TITLE'. For example,

PUSHBUTTON trashcan AT 20,20 ICON 'trash'

Bitmaps may also be displayed as graphics in a Window widget. Try the method below to display a bitmap. The first line creates the icon object which is used to display bitmaps and determines which bitmap to use. The second line moves the icon to the desired location. The third line informs the compiler that we know that the receiver is actually the Progman manager which is controlling Main Window. The fourth line actually draws the icon.

  newMethod
    { anIcon -> (Icon new) bitmap "Edit".
      anIcon movex 200 movey 200.
      man -> me:Progman.
      anIcon drawIn man's progWin.
    }

Compiling Bitmaps Externally

Like widgets, you can compile bitmaps externally using the view compiler. Below is an example of the bitmap format.

    BITMAP
    {"XXXXXX"
     "X    X"
     "X    X"
     "XXXXXX"
    }

To compile a bitmap, enter it into a file and then compile it with the

     abcwcomp box.bitmap

The view compiler will produce an .asm file which can then be imported like any other object.

If a bitmap file is in XBM format, the widget compiler can also convert it to an ABC bitmap with the command:

     abcwcomp -x circle.xbm