获取图像的方法,获取指定的图像类型CLSID

1:
2:
3: //获取指定的图像CLSID
4: RESULTTYPE CDrawBase::GetEncoderClsid( const wchar_t *lpcszFormat,CLSID* lpClsid) const
5: {
6: UINT num (0); // number of image encoders
7: UINT size(0); // size of the image encoder array in bytes
8: Gdiplus::ImageCodecInfo* lpImageCodecInfo( NULL );
9:
10: Gdiplus::GetImageEncodersSize(&num, &size);
11: if(size == 0)
12: return ERR_UNKNOWN; // Failure
13:
14: lpImageCodecInfo = (Gdiplus::ImageCodecInfo*)(malloc(size));
15: if( NULL == lpImageCodecInfo)
16: return ERR_MALLOC_FAIL; // Failure
17:
18: Gdiplus::GetImageEncoders(num, size, lpImageCodecInfo);
19:
20: for(UINT j = 0; j < num; ++j)
21: {
22: if( 0 == ::wcscmp(lpImageCodecInfo[j].MimeType, lpcszFormat))
23: {
24: *lpClsid = lpImageCodecInfo[j].Clsid;
25: free(lpImageCodecInfo);
26: lpImageCodecInfo = NULL;
27: return RC_SUCCESS; // Success
28: }
29: }
30:
31: free(lpImageCodecInfo);
32: lpImageCodecInfo = NULL;
33: return ERR_UNKNOWN; // Failure
34: }
Tags:  获取图像坐标 图像的获取 获取图像 获取图像教学设计 获取图像的方法

延伸阅读

最新评论

发表评论