Creates a CustomLineCap object
#include <GDIPlus.au3>
_GDIPlus_CustomLineCapCreate ( $hPathFill, $hPathStroke [, $iLineCap = 0 [, $nBaseInset = 0]] )
$hPathFill | Pointer to a Path object that defines the fill for the custom tip. |
$hPathStroke | Pointer to a Path object that defines the contour of the nozzle custom. |
$iLineCap | [optional] The line cap that will be used. $GDIP_LINECAPFLAT = Specifies a flat cap $GDIP_LINECAPSQUARE = Specifies a square cap $GDIP_LINECAPROUND = Specifies a circular cap $GDIP_LINECAPTRIANGLE = Specifies a triangular cap $GDIP_LINECAPNOANCHOR = Specifies that the line ends are not anchored $GDIP_LINECAPSQUAREANCHOR = Specifies that the line ends are anchored with a square $GDIP_LINECAPROUNDANCHOR = Specifies that the line ends are anchored with a circle $GDIP_LINECAPDIAMONDANCHOR = Specifies that the line ends are anchored with a diamond $GDIP_LINECAPARROWANCHOR = Specifies that the line ends are anchored with arrowheads $GDIP_LINECAPCUSTOM = Specifies that the line ends are made from a CustomLineCap |
$nBaseInset | [optional] Distance between the tip and the line. This distance is expressed in units. |
Success: | a handle to a new CustomLineCap object. |
Failure: | 0 and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
After you are done with the object, call _GDIPlus_CustomLineCapDispose() to release the object resources.
Search GdipCreateCustomLineCap in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI, $hGraphics, $hPath, $hCustomLineCap, $hClonedLineCap, $hPen
Local $avPoints[4][2] = [[3], [-15, -15], [0, 0], [15, -15]]
; Initialize GDI+
_GDIPlus_Startup()
;create a Graphics object from a window handle
$hGUI = GUICreate("_GDIPlus_CustomLineCapCreate Example", 400, 200)
GUISetState(@SW_SHOW)
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
;sets the graphics object rendering quality (antialiasing)
_GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY)
; Create GraphicsPath and add two lines to it.
$hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddLine2($hPath, $avPoints)
; Create a CustomLineCap object.
$hCustomLineCap = _GDIPlus_CustomLineCapCreate(0, $hPath)
; Create a clone CustomLineCap object.
$hClonedLineCap = _GDIPlus_CustomLineCapClone($hCustomLineCap)
; Create a Pen object, assign cloned cap as the custom end cap, and draw a line.
$hPen = _GDIPlus_PenCreate(0xFFFF0000)
_GDIPlus_PenSetCustomEndCap($hPen, $hClonedLineCap)
_GDIPlus_GraphicsDrawLine($hGraphics, 50, 50, 350, 150, $hPen)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up
_GDIPlus_PenDispose($hPen)
_GDIPlus_CustomLineCapDispose($hClonedLineCap)
_GDIPlus_CustomLineCapDispose($hCustomLineCap)
_GDIPlus_PathDispose($hPath)
_GDIPlus_GraphicsDispose($hGraphics)
; Uninitialize GDI+
_GDIPlus_Shutdown()
EndFunc ;==>Example