bool SaveToBMP(Bitmap* pbmp, CString strFilename)
{
UINT num, size;
Gdiplus::GetImageEncodersSize(&num, &size);
Gdiplus::ImageCodecInfo* pImageCodecInfo = (Gdiplus::ImageCodecInfo*)(malloc(size));
Gdiplus::GetImageEncoders(num, size, pImageCodecInfo);
bool found = false;
for (UINT ix = 0; !found && ix < num; ++ix)
{
if (0 == _wcsicmp(pImageCodecInfo[ix].MimeType, L"mime/bmp") == 0)
{
CLSID encoder = pImageCodecInfo[ix].Clsid;
free(pImageCodecInfo);
Status st = pbmp->Save(strFilename.AllocSysString(), &encoder, NULL);
return sr == OK ? ture : false;
}
}
free(pImageCodecInfo);
return false;
}
Bitmap保存成bmp文件
最新推荐文章于 2023-12-20 20:45:01 发布