GRAPHIC BITMAP LOAD statement

Purpose

Create a memory bitmap and load an image into it.

Syntax

GRAPHIC BITMAP LOAD BitName$, nWidth&, nHeight& TO hBmp???

Remarks

GRAPHIC BITMAP LOAD creates a new memory bitmap, loading a bitmap image from a resource or a disk file.  This bitmap works just like a GRAPHIC WINDOW or GRAPHIC CONTROL, except that it is not visible.  The parameter BitName$ specifies the name of the image to be loaded.  If BitName$ contains a period, it is presumed to be the name of a disk file. Otherwise, an attempt is made to load it from a resource -- if not found, it is then presumed to be a disk file.  The parameters nWidth& and nHeight& specify the width and height of the bitmap, in pixels. If the bitmap creation is successful, the bitmap handle is assigned to the variable hbmp???. If not successful, hbmp??? is set to zero. When you are finished using this memory bitmap, you must delete it with GRAPHIC BITMAP END.

The following code will retrieve the natural size of an image in a bitmap file, in pixels:

nFile& = FREEFILE

OPEN "myimage.bmp" FOR BINARY AS nFile&

GET #nFile&, 19, nWidth&

GET #nFile&, 23, nHeight&

CLOSE nFile&

BitName$

The name of the bitmap image to load.

nWidth&

The width of the bitmap, in pixels.

nHeight&

The height of the bitmap, in pixels.

hBmp???

The bitmap handle.

See also

CONTROL ADD GRAPHIC, GRAPHIC ATTACH, GRAPHIC BITMAP END, GRAPHIC BITMAP NEW, GRAPHIC WINDOW