|
|
|
|
MGL_savePNGFromDCExt
Save a portion of a device context to a PNG file on disk.
Declaration
ibool MGLAPI MGL_savePNGFromDCExt(
MGLDC *dc,
const char *PNGName,
int left,
int top,
int right,
int bottom,
ibool savePalette)
Prototype In
mgraph.h
Parameters
dc |
Device context to save |
PNGName |
Name of bitmap file to save |
left |
Left coordinate of bitmap to save |
top |
Top coordinate of bitmap to save |
right |
Right coordinate of bitmap to save |
bottom |
Bottom coordinate of bitmap to save |
savePalette |
True to save palette, false to skip it |
Return Value
True on success, false on error.
Description
This function saves a portion of a device context as a PNG format bitmap file to disk. If this function fails for some reason, it will return false and you can get the error code from the MGL_result function.
This function supports saving in native formats of 1, 4, 8, 24, and 32 bits. Images with bit depths of 15 or 16 bits will be expanded to 24 bits. It also supports saving 8-bit + alpha bitmaps as 8-bit grayscale + alpha PNG files. The PNG specification itself does not support saving the palette information, however in practice you can save a palette to this bitmap format and have the bitmap load and display correctly in most PNG viewers. MGL can also load those bitmaps properly from disk as well. If you pass a value of false to 'savePalette' the palette will not be saved in the PNG image (ie: resulting image is grayscale).
Note that the source rectangle for the bitmap to be saved is not clipped to the current clipping rectangle for the device context, but it is mapped to the current viewport. If you specify dimensions that are larger than the current device context, you will get garbage in the bitmap file as a result.
See Also
Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com