MGL_loadBitmapIntoDC

Loads a bitmap file directly into an existing device context.

Declaration

ibool MGLAPI MGL_loadBitmapIntoDC(
    MGLDC *dc,
    const char *bitmapName,
    int dstLeft,
    int dstTop,
    ibool loadPalette)

Prototype In

mgraph.h

Parameters

dc

Device context to load bitmap into

bitmapName

Name of bitmap file to load

dstLeft

Left coordinate to load bitmap at

dstTop

Top coordinate to load bitmap at

loadPalette

True if the palette should also be loaded

 

Return Value

True if the bitmap was loaded, false on error.

Description

Locates the specified bitmap file and loads it into the specified device context at the specified destination coordinates. If the bitmap is of a different pixel depth then the device context that it is being loaded into, the bitmap will be converted as it is loaded to the pixel format of the device context it is being loaded into. MGL can load any Windows 3.x style bitmap files, including new format bitmap files with colors depths of 15/16 and 32 bits per pixel. Consult the Windows SDK documentation for the format of Windows bitmap files.

If loadPalette is true, the palette values for the bitmap will be loaded and stored in the device context's palette. If the device context being loaded into is the currently active display device, the palette will also be realized before the bits in the bitmap are loaded.

When MGL is searching for bitmap files it will first attempt to find the files just by using the filename itself. Hence if you wish to look for a specific bitmap file, you should pass the full pathname to the file that you are interested in. If the filename is a simple relative filename (i.e. “MYBMP.BMP”), MGL will then search in the BITMAPS directory relative to the path specified in mglpath variable that was passed to MGL_init. As a final resort MGL will also look for the files in the BITMAPS directory relative to the MGL_ROOT environment variable.

If the bitmap file was not found, or an error occurred while reading the bitmap file, this function will return false. You can check the MGL_result error code to determine the cause.

See Also

MGL_availableBitmap, MGL_getBitmapSize, MGL_loadBitmap, MGL_saveBitmapFromDC, MGL_loadBitmapIntoDCExt

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com