Mingw-users] Successful compile of simple GDI+ program using modified headers · Date: Fri, 15 Jul 2005 11:35:17 +0800 · From: Andy Sy
· Subject: [Mingw-users] Successful compile of simple GDI+ program using modified headers Providing these steps for comment and further testing by others 1) First download the following GDIplus headers http://www.codeguru.com/code/legacy/gdi/GDIPlus.zip *** These may have come from the Platform SDK. 2) Then make the following mods: i. In GdiPlusEnums.h: Comment out enum EmfPlusRecordType; and change #define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE)) to #define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((n) | GDIP_WMF_RECORD_BASE) *** This looks like a harmless change ii. In GdiPlusImaging.h Change PixelFormat PixelFormat; to PixelFormat PixelFormat1; *** I'm almost certain this will break stuff, but at least it will let you compile successfully. A better solution needs to be discovered. iii. In GdiPlusimageAttributes.h Change return SetStatus(DllExports::GdipSetImageAttributesColorKeys( nativeImageAttr,type,FALSE,NULL,NULL)); to return SetStatus(DllExports::GdipSetImageAttributesColorKeys( nativeImageAttr,type,FALSE,0,0)); *** This just eliminates your pesky pointer to int conversion warning, so I believe this is a benign modification iv. In GdiPlusHeaders.h Change friend Graphics; to friend class Graphics; *** This also looks like a benign modification, is it? 3) Create libgdiplus.a using 'reimp' from mingw-utils Get the gdiplus.dll under /windows/WinSxS/... and do: reimp gdiplus.dll That's it! The linedraw.cpp GDI plus sample program compiles successfully using: gcc -IincludeXXX -LlibXXX linedraw.cpp -lstdc++ -lgdiplus -mwindows where includeXXX and libXXX points to the include directory where the gdiplus headers and libgdiplus.a reside respectively. More feedback on success or failure compiling more complex gdiplus programs needed. ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ MinGW-users mailing list MinGW-users@xxxxxxxxxxxxxxxxxxxxx You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users 2008-01-15:怎用由GdiPlus.lib生成g++可用的libGdiPlus.a?以下是我做成功的一个步骤: 假设devcpp安装于C:/Dev-Cpp 下载mingw-utils 假设mingw-utils目录存放于C:/Dev-Cpp/mingw-utils-0.3.tar/bin 假设GdiPlus.lib存放于F:/GdiPlus/test path C:/Dev-Cpp/bin;C:/Dev-Cpp/mingw-utils-0.3.tar/bin;%path% f: cd F:/GdiPlus/test reimp gdiplus.lib 此时生成 0, gdiplus.def, libgdiplus.a 三个文件 然后修改GdiplusEnums.h等 1. In GdiPlusEnums.h: enum EmfPlusRecordType; 改为 //enum EmfPlusRecordType; #define GDIP_WMF_RECORD_TO_EMFPLUS(n) ((EmfPlusRecordType)((n) | GDIP_WMF_RECORD_BASE)) 改为 #define GDIP_WMF_RECORD_TO_EMFPLUS(n) (/*(EmfPlusRecordType)*/((n) | GDIP_WMF_RECORD_BASE)) 2. In GdiPlusImaging.h PixelFormat PixelFormat; 改为 PixelFormat aPixelFormat; 3. In GdiPlusimageAttributes.h return SetStatus(DllExports::GdipSetImageAttributesColorKeys(nativeImageAttr,type,FALSE,NULL,NULL)); 改为 return SetStatus(DllExports::GdipSetImageAttributesColorKeys(nativeImageAttr,type,FALSE,0,0)); 4. In GdiPlusHeaders.h friend Graphics; 改为 friend class Graphics; 最后将一开始的代码中的中文字符删除,并加入libGdiPlus.a库,运行通过。
GCC使用GDI+ (转贴参考)
最新推荐文章于 2022-02-21 01:07:38 发布