有个这样的东东ImgViewer 能够处理GIF, JPEG, BMP,ICO, WMF and EMF 可以到网上搜一下,有源码的是不是GDI+我就没在意了
提供一个思路,用BOOL PlayEnhMetaFile( HDC hdc, // handle to DC HENHMETAFILE hemf, // handle to an enhanced metafile CONST RECT *lpRect // bounding rectangle ); 先画,然后用BitBlt转到内存描述表,然后从DDB转为DIB就可以了,有时间我自己写一个 也不知道有没有现存的库可以用
回复人: jiangsheng(蒋晟.Net) ( ) 信誉:100 2003-5-10 12:07:29 得分:0 #include <windows.h> #include <gdiplus.h> #include <stdio.h> using namespace Gdiplus;int GetEncoderClsid(const WCHAR* format, CLSID* pClsid) { UINT num = 0; // number of image encoders UINT size = 0; // size of the image encoder array in bytes ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size); if(size == 0) return -1; // Failure pImageCodecInfo = (ImageCodecInfo*)(malloc(size)); if(pImageCodecInfo == NULL) return -1; // Failure GetImageEncoders(num, size, pImageCodecInfo); for(UINT j = 0; j < num; ++j) { if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 ) { *pClsid = pImageCodecInfo[j].Clsid; free(pImageCodecInfo); return j; // Success } } free(pImageCodecInfo); return -1; // Failure } INT main() { // Initialize GDI+. GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); CLSID encoderClsid; Status stat; Image* image = new Image(L"Bird.emf"); // Get the CLSID of the BMP encoder. GetEncoderClsid(L"image/bmp", &encoderClsid); stat = image->Save(L"Bird.bmp", &encoderClsid, NULL); if(stat == Ok) printf("Bird.bmpwas saved successfully\n"); else printf("Failure: stat = %d\n", stat); delete image; GdiplusShutdown(gdiplusToken); return 0; } 回复人: icedot(小雨) ( ) 信誉:100 2003-5-12 17:28:00 得分:0
能够处理GIF, JPEG, BMP,ICO, WMF and EMF
可以到网上搜一下,有源码的是不是GDI+我就没在意了
HDC hdc, // handle to DC
HENHMETAFILE hemf, // handle to an enhanced metafile
CONST RECT *lpRect // bounding rectangle
);
先画,然后用BitBlt转到内存描述表,然后从DDB转为DIB就可以了,有时间我自己写一个
也不知道有没有现存的库可以用
#include <windows.h>
#include <gdiplus.h>
#include <stdio.h>
using namespace Gdiplus;int GetEncoderClsid(const WCHAR* format, CLSID* pClsid)
{
UINT num = 0; // number of image encoders
UINT size = 0; // size of the image encoder array in bytes ImageCodecInfo* pImageCodecInfo = NULL; GetImageEncodersSize(&num, &size);
if(size == 0)
return -1; // Failure pImageCodecInfo = (ImageCodecInfo*)(malloc(size));
if(pImageCodecInfo == NULL)
return -1; // Failure GetImageEncoders(num, size, pImageCodecInfo); for(UINT j = 0; j < num; ++j)
{
if( wcscmp(pImageCodecInfo[j].MimeType, format) == 0 )
{
*pClsid = pImageCodecInfo[j].Clsid;
free(pImageCodecInfo);
return j; // Success
}
} free(pImageCodecInfo);
return -1; // Failure
}
INT main()
{
// Initialize GDI+.
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); CLSID encoderClsid;
Status stat;
Image* image = new Image(L"Bird.emf"); // Get the CLSID of the BMP encoder.
GetEncoderClsid(L"image/bmp", &encoderClsid); stat = image->Save(L"Bird.bmp", &encoderClsid, NULL); if(stat == Ok)
printf("Bird.bmpwas saved successfully\n");
else
printf("Failure: stat = %d\n", stat); delete image;
GdiplusShutdown(gdiplusToken);
return 0;
}
回复人: icedot(小雨) ( ) 信誉:100 2003-5-12 17:28:00 得分:0
哈哈,大哥,我试过了。那个gdiplus.h是个什么东西呀。
系统提示我找不到这个东西呀。它是不是另外的。我用的是VC6.0呀。
Top
回复人: jiangsheng(蒋晟.Net) ( ) 信誉:100 2003-5-12 18:38:00 得分:0
goto http://www.microsoft.com/msdownload/platformsdk/sdkupdate/ to update your sdk header files
Top
回复人: icedot(小雨) ( ) 信誉:100 2003-5-13 10:55:14 得分:0
谢谢呀。大哥。哈哈,我去试一下先。我是新手,要怎样给分呀。哈哈,不好意思哦。问这个幼稚的问题。
Top
回复人: jiangsheng(蒋晟.Net) ( ) 信誉:100 2003-5-14 12:51:05 得分:0
see help