//added by GMcD void SaveBitMapFile(void) { char title[256], filename[256], directory[256]; OPENFILENAME ofn; void *bits; BITMAPINFO *info; /* * Grab the screen bitmap... */ bits = ReadDIBitmap(&info); if (bits == NULL) { // DisplayErrorMessage("Unable to get OpenGL bitmap from screen!"); return; }; /* * Pop up a filename dialog... */ strcpy(directory, "."); strcpy(filename, "untitled.bmp"); strcpy(title, ""); memset(&ofn, 0, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = ViewWindow; ofn.lpstrFilter = "Models\0*.bmp\0\0"; ofn.nFilterIndex = 1; ofn.lpstrFile = filename; ofn.nMaxFile = sizeof(filename) - 1; ofn.lpstrFileTitle = title; ofn.nMaxFileTitle = sizeof(title) - 1; ofn.lpstrInitialDir = directory; ofn.lpstrTitle = "Save BitMap File"; ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NONETWORKBUTTON; if (GetSaveFileName(&ofn)) { /* * Save the named model to disk... */ SaveDIBitmap(filename,info,bits); }; }
//************************************************************ // write a BMP file //************************************************************ void writeBmapFile(char *fullpath) { void *bits; BITMAPINFO *info; bits = ReadDIBitmap(&info); if (!bits) return; SaveDIBitmap(fullpath, info, bits); FREE(info); FREE(bits); }