#include <gdiplus.h>
"image/bmp",
"image/jpeg",
"image/png",
"image/gif"
using namespace Gdiplus;
saveImage
{
CLSID pngClsid;
GetFormatClsid("image/jpeg", &pngClsid);
HPALETTE hpal;
///팔레트 설정
hpal = (HPALETTE)GetStockObject(DEFAULT_PALETTE);
Bitmap bitmap(hbitmap,hpal);
/// image 저장
Gdiplus::Status status = bitmap.Save(path, &pngClsid, NULL);
}
/// 저장 데이터의 format 설정
int GetFormatClsid(const WCHAR* format, CLSID* pClsid)
{
UINT unImageNumber = 0;
UINT unImageSize = 0;
ImageCodecInfo* pImageCodecInfo = NULL;
/// Image 크기
GetImageEncodersSize(&unImageNumber, &unImageSize);
if(unImageSize == 0)
return -1;
/// Image 속성
pImageCodecInfo = (ImageCodecInfo*)(malloc(unImageSize));
if(pImageCodecInfo == NULL)
return -1;
GetImageEncoders(unImageNumber, unImageSize, pImageCodecInfo);
for(UINT uCount = 0; uCount < unImageNumber; ++uCount)
{
if( wcscmp(pImageCodecInfo[uCount].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[uCount].Clsid;
free(pImageCodecInfo);
return uCount;
}
}
free(pImageCodecInfo);
return -1;
}
댓글 없음:
댓글 쓰기