This command displays on the screen an image from an integer array. The image in the array is most frequently one saved from the screen into the array with the GSTORE command. The device-selector specifies the destination device, which must be a bit-mapped device. The CRT is assumed if no device selector is specified.
Two forms of the GLOAD statement are supported. The first form is compatible with the GLOAD statement in HP BASIC and displays an image which fills the entire screen.
The second form displays an image which fills an arbitrary sized rectangular portion of the screen. For users porting programs from HP BASIC which use the Bstore()/Bload() CSUBs supplied with HP BASIC, the "Porting HP BASIC Programs to the PC" section of the Users Guide, presents Bstore()/Bload() SUBs which call GSTORE and GLOAD using the integrated syntax.
Full Screen GLOAD
The size of the array necessary to store a complete screen image for each display depends on the resolution and on the number of colors the display supports. GESCAPECRT,3 can be used in a program to determine the size necessary. The following table gives the sizes for some display adaptors. The array may be declared larger or smaller than the size given. If the array is not large enough to contain a full screen image, GLOAD stops when all the array contents have been transferred to the screen. If the array is too large, only part of the array will be used. If an attempt is made to GLOAD an image to a display that is different from the GSTORE display, unpredictable results will occur. If the color map has different values than when the image was GSTOREd, the colors will not match the original image.
Display
Array Size
SVGA16;640x480
Image(1:160,1:480)
SVGA16;800x600
Image(1:200,1:600)
SVGA16;1024x768
Image(1:256,1:768)
SVGA256;640x480
Image(1:320,1:480)
SVGA256;800x600
Image(1:400,1:600)
SVGA256;1024x768
Image(1:512,1:768)
The format of the image data within the array is documented for most displays in the Users Guide.
Rectangular Blocks
When a Width and Height are specified after the image array, only a rectangular block is loaded from the array onto the display. Width and Height are specified in pixels. Optionally, a Rule can be specified which instructs GLOAD how to combine the contents of the array with the contents of the screen. Presently, only a value of 3 is supported, which causes the contents of the array to totally overwrite the specified block on the display. The block will be located with the upper left corner at the current graphic position. Alternately, a position can be specified with the Xorigin, Yorigin parameters. These parameters should be specified in the current WINDOW units, not pixels or VIEWPORT units (GDUs).
The image is stored with one byte per pixel. This makes images somewhat transportable among different displays. It also means that the number of elements necessary to store the image is equal to Width*Height/2. If the width is even, the array could be declared as
INTEGER Image( 1:Width/2,1:Height)
If the array is too small, an error is given. If the array is too large, the extra elements are ignored. If GLOADis used to display an image on a display with less colors than the GSTORE display, the results are undefined. If the color map is different than the color map in effect when the image was GSTOREd, the colors will not match the original image.
Windows Version Usage Notes
Not all windows CRT drivers support GLOAD/GSTORE. Full screen GLOAD/GSTORE uses BMP format. The contents of the array can be saved in a file and modified by most Windows draw/paint programs. The array contains both palette and image information.
graphics_buffer off. If the graphics_buffer command line switch is off and another window overlaps the HTBasic window, the overlapping portion of the window will be included in the stored image. If the window is iconified, the stored image will be the HTBasic icon. If part of the HTBasic window is offscreen, only the part on screen is stored. To avoid these side-effects, use the "-gr on" command line switch.
COLOR LOSS. If a BMP file is loaded into an array and GLOADed to the screen, some color information may be lost. Any color in the image that doesn't exist in the destination palette are changed to similar colors that do exist in the palette.