HTBasic Help
×
Menu
Index

Bitmap Widget

 
______________________________________________________________________
 
BITMAP Widget
Displays pixmap files in "xwd" or "*.BMP" format
______________________________________________________________________
 
Legal Usage                Level-0 Widget:                Yes
                 Parent to:                None
                 Child of:                        PANEL
 
Example Image
 
     
 
Example Program
 
See the BITMAP Widget program for an example program that allows you to read in and display a bitmap file similar to that shown above, and to store elements back to a file. It also demonstrates the PANEL widget's SCROLLABLE attribute.
 
The BITMAP Widget program creates a PANEL for the BITMAP widget. The SCROLL WIDTH and HEIGHT are set to a small value so that scroll bars will not appear initially. The actual heights are set later to fit the bitmap that has been loaded.
 
To demonstrate the SCROLLABLE attribute, load a bitmap file and then reduce the size of the panel until the bitmap does not fit in the panel's work area. At that point, scrollbars on the panel's right side or bottom, or both, will appear to allow you to scroll the bitmap in and out of the work area.
 
NOTE
 
See the following program for another example using the BITMAP widget:
 
 
Attributes
 
See BITMAP Widget Attributes for the BITMAP widget attribute list.
 
Remarks
 
The BITMAP widget displays pixmap files in .BMP format. The widget can also create an XWD or BMP file from an entire window in either X11 Window Dump (XWD) or a user-defined area of the screen.
 
The BITMAP widget detects mouse clicks in the displayed pixmap and generates an event from which you can determine the mouse coordinates at the time of the click. BITMAP can create files from an entire window or from a user-defined area of the screen.
 
After you create a pixmap file, the file is read into the widget using the BITMAP FILE attribute:
 
         ASSIGN @Bitmap TO WIDGET "BITMAP"
         CONTROL @Bitmap;SET ("BITMAP FILE":"COVER.BMP")
 
If you set the DUMP WINDOW attribute to a filename (as shown) and then click on the user interface, the user interface will be saved in the file (with a .BMP format).
 
   CONTROL @Bitmap;SET ("DUMP FORMAT":"BMP","DUMP WINDOW":  "BITSAVE.BMP")
 
DUMP AREA allows you to store a region of the user interface (as defined by a mouse click-and-drag operation) to a file.
 
You can set a MOUSE CLICKED event to trap a mouse click on a bitmap, and then use the MOUSE CLICK attribute to return the X,Y coordinates of the pixel clicked on. For an example of this, see the Wing Stress/Vibration Analysis program.
 
When the BITMAP widget is used to view bitmaps with a large number of colors, color changes may occur in the display. For example, color bitmaps usually have 16 or 256 colors. You can display a color bitmap of 16 colors on a display that supports 256 colors. However, if you try to display a color bitmap of 256 colors on one that only supports 16 colors, some unexpected colorations may occur.
 
Two bitmap files with 256 colors may not have the same 256 colors. Since the display can be reprogrammed to select the 256 colors from a much larger set of colors, this "color mapping" may change from bitmap file to bitmap file.
 
For example, suppose you load two bitmap files consecutively that have different color mappings (such as "BMAZTEC" and "BMASTRO"). In this case, the second file loaded will change the display's color map to the colors it requires, regardless of the first file's colors. The colors of the first bitmap may then change to a set of unexpected colors.
 
Events
 
Events for the BITMAP widget are:
 
·
MOUSE CLICKED
 
·
SYSTEM MENU
 
MOUSE CLICKED
 
The MOUSE CLICKED event is generated when the left-mouse button is released over the bitmap. If there is no bitmap, this event cannot be generated.
 
SYSTEM MENU
 
This event is generated when the operator selects items from the SYSTEM MENU.