Function Reference


_GDIPlus_GraphicsDrawBezier

Draw a bezier spline

#include <GDIPlus.au3>
_GDIPlus_GraphicsDrawBezier ( $hGraphics, $nX1, $nY1, $nX2, $nY2, $nX3, $nY3, $nX4, $nY4 [, $hPen = 0] )

Parameters

$hGraphics Handle to a Graphics object
$nX1 X coordinate of the starting point
$nY1 Y coordinate of the starting point
$nX2 X coordinate of the first control point
$nY2 Y coordinate of the first control point
$nX3 X coordinate of the second control point
$nY3 Y coordinate of the second control point
$nX4 X coordinate of the ending point
$nY4 Y coordinate of the ending point
$hPen [optional] Handle to a pen object that is used to draw the bezier. If 0, a solid black pen with a width of 1 will be used.

Return Value

Success: True.
Failure: False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3).

Remarks

A Bezier spline does not pass through its control points.
The control points act as magnets, pulling the curve in certain directions to influence the way the spline bends.

See Also

Search GdipDrawBezier in MSDN Library.

Example

Example 1

#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
        Local $hGUI, $hGraphic

        ; Create GUI
        $hGUI = GUICreate("GDI+", 400, 300)
        GUISetState(@SW_SHOW)

        ; Draw a Bezier curve
        _GDIPlus_Startup()
        $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)

        _GDIPlus_GraphicsDrawBezier($hGraphic, 50, 50, 100, 5, 125, 25, 250, 50)

        ; Loop until the user exits.
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        ; Clean up resources
        _GDIPlus_GraphicsDispose($hGraphic)
        _GDIPlus_Shutdown()
EndFunc   ;==>Example

Example 2

#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(0xFFFFFF00, 8) ;color format AARRGGBB (hex)

        _GDIPlus_GraphicsDrawBezier($hGraphics, 50.25, 350.75, 100.5, 5.5, 125.5, 25.5, 550.5, 550.25, $hPen)

        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE

        ;cleanup GDI+ resources
        _GDIPlus_PenDispose($hPen)
        _GDIPlus_GraphicsDispose($hGraphics)
        _GDIPlus_Shutdown()
        GUIDelete($hGUI)
EndFunc   ;==>Example