Using GDIPlus With MinGW
From BB4Win Wiki
[edit] Using GDI+ with MinGW
[edit] 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.
(Snatched from http://lists.zerezo.com/mingw-users/msg00862.html)
