GCC使用GDI+ (转贴参考)

来源:互联网 发布:淘宝20万关键词 编辑:程序博客网 时间:2024/06/08 04:01
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 headersProviding these steps for comment and further testing by others1) 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 changeii. 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 modificationiv. 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 -mwindowswhere includeXXX and libXXX points to the include directory where thegdiplus headers and libgdiplus.a reside respectively.More feedback on success or failure compiling more complex gdiplusprograms needed.-------------------------------------------------------SF.Net email is sponsored by: Discover Easy Linux Migration Strategiesfrom IBM. Find simple to follow Roadmaps, straightforward articles,informative Webcasts and more! Get everything you need to get up tospeed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click_______________________________________________MinGW-users mailing listMinGW-users@xxxxxxxxxxxxxxxxxxxxxYou may change your MinGW Account Options or unsubscribe at:https://lists.sourceforge.net/lists/listinfo/mingw-users2008-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/testpath C:/Dev-Cpp/bin;C:/Dev-Cpp/mingw-utils-0.3.tar/bin;%path%f:cd F:/GdiPlus/testreimp 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库,运行通过。
原创粉丝点击