Du brauchst nur 2 Funktionen:
Code: Alles auswählen
GdipGetPointCount(GpPath* path, INT* count);
GdipGetPathPoints(GpPath*, GpPointF* points, INT count);
Kleines Beispiel:
Code: Alles auswählen
EnableExplicit
XIncludeFile "gDrawing.pbi"
CompilerIf #PB_Compiler_Processor = #PB_Processor_x64
;Import #PB_Compiler_FilePath + "gdiplus_x64.lib"
Import "gdiplus_x64.lib"
CompilerElse
;Import #PB_Compiler_FilePath + "gdiplus_x86.lib"
Import "gdiplus_x86.lib"
CompilerEndIf
GdipGetPointCount(*Path, *count.Long)
GdipGetPathPoints(*Path, *points.PointF, count.l)
EndImport
Procedure Draw(image)
Protected i, path, numPoints
Protected Dim points.POINTF(0)
If gStartDrawing( ImageOutput(image) )
gClear(RGBA($80,$80,$80,$FF))
gSetPenSize(3)
;
; draw path
;
gDrawingMode(#PB_2DDrawing_Path)
gSetFont("Arial",150)
gDrawText(10,10,"PureBasic")
gDrawingMode(#PB_2DDrawing_Default)
gDrawPath(#PB_Default,RGBA($FF,$FF,$00,$FF)) ; draw current path with yellow color
gDrawingMode(#PB_2DDrawing_Outlined)
gDrawPath(#PB_Default,RGBA($00,$00,$00,$FF)) ; draw current path outlined with black color
gDrawingMode(#PB_2DDrawing_Default)
gSetPenSize(3)
path = gGetPath() ; get path
GdipGetPointCount(path, @numPoints) ; get number of points in path
Dim points(numPoints)
GdipGetPathPoints(path,@points(),numPoints) ; get the points
If numPoints > 1
numPoints - 1
For i = 0 To numPoints
gPlot( points(i)\x, points(i)\y, RGBA($FF,$FF,$FF,$FF)) ; draw white point for all path points
Next i
EndIf
gStopDrawing()
EndIf
EndProcedure
Define img
If gInit()
img = CreateImage(#PB_Any,800,600)
Draw(img)
OpenWindow(#PB_Any,0,0,800,600,"gDrawing: get path points",#PB_Window_SystemMenu|#PB_Window_ScreenCentered)
ImageGadget(#PB_Any,0,0,800,600,ImageID( img ))
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
gEnd()
EndIf