Zeichnet eine geschlossene Spline
#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawCurve ( $hGraphics, $aPoints [, $hPen = 0] )
$hGraphics | Handle zu einem Grafik-Objekt |
$aPoints | Array welches die Punkte der Kurve festlegt: [0][0] - Anzahl der Punkte [1][0] - Punkt 1 X-Position [1][1] - Punkt 1 Y-Position [2][0] - Punkt 2 X-Position [2][1] - Punkt 2 Y-Position [n][0] - Punkt n X-Position [n][1] - Punkt n Y-Position |
$hPen | [optional] Handle zu einem Zeichenstift-Objekt, welches benutzt wird um die Spline zu zeichnen. Falls 0, wird ein vollfarbig schwarz gefüllter Zeichenstift mit der Breite 1 verwendet. |
Erfolg: | True |
Fehler: | False und setzt das @error Flag auf ungleich null, das @extended Flag kann den GPSTATUS-Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten. |
Ein Segment ist definiert als eine Kurve, die zwei Punkte in der Spline verbindet.
Der Endpunkt eines jeden Segmentes ist der Startpunkt für das nächste Segment.
Suche nach GdipDrawCurve in der MSDN Bibliothek.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGui, $hGraphic, $aPoints[5][2]
; Erstellt eine GUI
$hGui = GUICreate("GDI+", 400, 300)
GUISetState(@SW_SHOW)
; Zeichnet eine Spline
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
$aPoints[0][0] = 4
$aPoints[1][0] = 0
$aPoints[1][1] = 100
$aPoints[2][0] = 50
$aPoints[2][1] = 50
$aPoints[3][0] = 100
$aPoints[3][1] = 100
$aPoints[4][0] = 150
$aPoints[4][1] = 50
_GDIPlus_GraphicsDrawCurve($hGraphic, $aPoints)
; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Ressourcen freigeben
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>Example
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
_GDIPlus_Startup() ;initialize GDI+
Local Const $iWidth = 600, $iHeight = 600, $iBgColor = 0x303030 ;$iBGColor format RRGGBB
Local $hGUI = GUICreate("GDI+ Example (" & @ScriptName & ")", $iWidth, $iHeight) ;create a test GUI
GUISetBkColor($iBgColor, $hGUI) ;set GUI background color
GUISetState(@SW_SHOW)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;create a graphics object from a window handle
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing)
Local $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 4) ;color format AARRGGBB (hex)
Local $aPoints[8][2]
$aPoints[0][0] = 7
$aPoints[1][0] = 50.5
$aPoints[1][1] = 50.5
$aPoints[2][0] = 100.75
$aPoints[2][1] = 25.33
$aPoints[3][0] = 200.66
$aPoints[3][1] = 5.5
$aPoints[4][0] = 250.25
$aPoints[4][1] = 50.75
$aPoints[5][0] = 300.125
$aPoints[5][1] = 100.375
$aPoints[6][0] = 590.8
$aPoints[6][1] = 200.222
$aPoints[7][0] = 250.55
$aPoints[7][1] = 590.45
_GDIPlus_GraphicsDrawCurve($hGraphics, $aPoints, $hPen)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;cleanup GDI+ resources
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
EndFunc ;==>Example