GdiPlus
Posted: Tue Sep 07, 2004 2:04 pm
Does there exist a GdiPlus lib for PureBasic ?
I noticed on the GDI+ Flat Api reference that it has a lot of nice features.
Here's a little example.
GdiPlus comes with WindowsXP or the Microsoft .Net framework and is available as a download for Windows 98, Windows NT, Windows 2000 and Windows ME .
The GDI+ Flat Api reference
http://msdn.microsoft.com/library/defau ... latapi.asp
I noticed on the GDI+ Flat Api reference that it has a lot of nice features.
Here's a little example.
Code: Select all
#HatchStyleDottedDiamond = 44
#SmoothingModeAntiAlias = 4
#UnitPixel = 2
Structure GdiplusStartupInput
GdiplusVersion.l
DebugEventCallback.l
SuppressBackgroundThread.l
SuppressExternalCodecs.l
EndStructure
Procedure.l ARGB(alpha.b, r.b, g.b, b.b)
ProcedureReturn alpha << 24 + r << 16 + g << 8 + b
EndProcedure
GdiPlus.l = OpenLibrary(#PB_Any, "gdiplus.dll")
If GdiPlus
GSI.GdiplusStartupInput\GdiplusVersion = 1
If CallFunction(GdiPlus, "GdiplusStartup", @token.l, GSI) = 0
OpenWindow(0, 0, 0, 300, 200, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "GdiPlus demo")
CreateImage(0, 300, 200)
hDC = StartDrawing(ImageOutput())
If hDC
CallFunction(GdiPlus, "GdipCreateFromHDC", hDC, @graphics.l)
CallFunction(GdiPlus, "GdipSetSmoothingMode", graphics, #SmoothingModeAntiAlias)
CallFunction(GdiPlus, "GdipCreatePen1", ARGB(255, 255, 255, 0), 8, #UnitPixel, @pen1.l)
CallFunction(GdiPlus, "GdipCreatePen1", ARGB(255, 255, 0, 0), 8, #UnitPixel, @pen2.l)
CallFunction(GdiPlus, "GdipCreateHatchBrush", #HatchStyleDottedDiamond, ARGB(255, 0, 255, 0),ARGB(128, 0, 255, 0), @brush1.l)
CallFunction(GdiPlus, "GdipDrawLineI", graphics, pen1, 50, 10, 40, 40)
CallFunction(GdiPlus, "GdipDrawEllipseI", graphics, pen2, 60, 60, 200, 100)
CallFunction(GdiPlus, "GdipFillEllipseI", graphics, brush1, 50, 50, 70, 70)
CallFunction(GdiPlus, "GdipDeleteGraphics", graphics)
StopDrawing()
EndIf
CreateGadgetList(WindowID())
ImageGadget(0, 0, 0, 300, 300, UseImage(0))
Repeat
EventID = WaitWindowEvent()
Until EventID = #PB_EventCloseWindow
CallFunction(GdiPlus, "GdiplusShutdown", token)
EndIf
EndIf
The GDI+ Flat Api reference
http://msdn.microsoft.com/library/defau ... latapi.asp