|
|
|
|
MGL_loadPNGIntoDC
Loads a PNG file directly into an existing device context.
Declaration
ibool MGLAPI MGL_loadPNGIntoDC(
MGLDC *dc,
const char *PNGName,
int dstLeft,
int dstTop,
ibool loadPalette)
Prototype In
mgraph.h
Parameters
dc |
Device context to load bitmap into |
PNGName |
Name of PNG file to load |
dstLeft |
Left coordinate to load PNG at |
dstTop |
Top coordinate to load PNG at |
loadPalette |
True if you would like to replace the dc's palette with PNG file's |
Return Value
True if the PNG file was loaded, false on error.
Description
Locates the specified PNG file and loads it into the specified device context at the specified destination coordinates. If the PNG is of a different pixel depth than the device context that it is being loaded into, the PNG will be converted as it is loaded to the pixel format of the device context it is being loaded into.
If the PNG file has a higher bit depth than the surface the pixel values will be dithered to the correct color depth. This will use the currently selected palette if loadPalette is false, or the HalfTone palette if true.
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. “MYFILE.PNG”), 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.
If the PNG file has interlacing enabled MGL must create a memory buffer internally to render the image into before blitting to the dc. Therefore using non-interlaced images will reduce memory overhead and speed performance.
See Also
MGL_availablePNG, MGL_getPNGSize,MGL_loadPNG, MGL_savePNGFromDC
Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com