Fill a closed cardinal spline
#include <GDIPlus.au3>
_GDIPlus_GraphicsFillClosedCurve ( $hGraphics, $aPoints [, $hBrush = 0] )
$hGraphics | Handle to a Graphics object |
$aPoints | Array that specifies the points of the curve: [0][0] - Number of points [1][0] - Point 1 X position [1][1] - Point 1 Y position [2][0] - Point 2 X position [2][1] - Point 2 Y position [n][0] - Point n X position [n][1] - Point n Y position |
$hBrush | [optional] Handle to a brush object that is used to fill the ellipse. If 0, a black brush will be used. |
Success: | True. |
Failure: | False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
In a closed cardinal spline, the curve continues through the last point in the points array and connects with the first point in the array.
The array of points must contain a minimum of three elements.
Search GdipFillClosedCurve in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI, $hGraphic, $aPoints[8][2]
; Create GUI
$hGUI = GUICreate("GDI+", 400, 300)
GUISetState(@SW_SHOW)
; Fill a cardinal spline
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$aPoints[0][0] = 7
$aPoints[1][0] = 50
$aPoints[1][1] = 50
$aPoints[2][0] = 100
$aPoints[2][1] = 25
$aPoints[3][0] = 200
$aPoints[3][1] = 5
$aPoints[4][0] = 250
$aPoints[4][1] = 50
$aPoints[5][0] = 300
$aPoints[5][1] = 100
$aPoints[6][0] = 350
$aPoints[6][1] = 200
$aPoints[7][0] = 250
$aPoints[7][1] = 250
_GDIPlus_GraphicsFillClosedCurve($hGraphic, $aPoints)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_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 $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) ;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_GraphicsFillClosedCurve($hGraphics, $aPoints, $hBrush)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
;cleanup GDI+ resources
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
EndFunc ;==>Example