Adds a path to another path
#include <GDIPlus.au3>
_GDIPlus_PathAddPath ( $hPath1, $hPath2 [, $bConnect = True] )
$hPath1 | Pointer to a GraphicsPath object |
$hPath2 | Pointer to a GraphicsPath object to be added to $hPath1 |
$bConnect | [optional] Specifies whether the first figure in the added path is part of the last figure in this path: True - The first figure in the added $hPath2 is part of the last figure in the $hPath1 path False - The first figure in the added $hPath2 is separated from the last figure in the $hPath1 path |
Success: | True. |
Failure: | False and sets the @error flag to non-zero, @extended may contain GPSTATUS error code ($GPIP_ERR* see GPIPlusConstants.au3). |
Even if the value of the $bConnect parameter is True, this function might not be able to make the first figure of the added $hPath2 path part of the last figure of the $hPath1 path.
If either of those figures is closed, then they must remain separated figures.
Search GdipAddPathPath in MSDN Library.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
Example()
Func Example()
Local $hGUI, $hGraphic, $hBrush, $hPath1, $hPath2, $hMatrix
; Create GUI
$hGUI = GUICreate("GDI+", 800, 200)
GUISetState(@SW_SHOW)
_GDIPlus_Startup()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ;Create a graphics object from a window handle
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;Sets the graphics object rendering quality (antialiasing)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
$hBrush = _GDIPlus_BrushCreateSolid(0xFFFF0000)
$hPath1 = _GDIPlus_PathCreate() ;Create new path object
For $i = 1 To 9
_GDIPlus_PathAddRectangle($hPath1, 20 * $i, 10, 10, 180)
Next
$hPath2 = _GDIPlus_PathCreate() ;Create new path object
For $i = 1 To 9
_GDIPlus_PathAddRectangle($hPath2, 10, 20 * $i, 180, 10)
Next
_GDIPlus_GraphicsFillPath($hGraphic, $hPath1, $hBrush) ;Draw path1 to graphics handle (GUI)
_GDIPlus_PathAddPath($hPath1, $hPath2) ;add path2 to path1
$hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, 300, 0)
_GDIPlus_PathTransform($hPath2, $hMatrix) ;move path2 to an offset of 300
_GDIPlus_GraphicsFillPath($hGraphic, $hPath2, $hBrush) ;Draw path2 to graphics handle (GUI)
_GDIPlus_MatrixTranslate($hMatrix, 300, 0)
_GDIPlus_PathTransform($hPath1, $hMatrix) ;move path1+Path2 to an offset of 600
_GDIPlus_GraphicsFillPath($hGraphic, $hPath1, $hBrush) ;Draw path1 to graphics handle (GUI)
_GDIPlus_GraphicsDrawString($hGraphic, "+", 180, 10, "Arial Black", 100)
_GDIPlus_GraphicsDrawString($hGraphic, "=", 480, 10, "Arial Black", 100)
; Loop until the user exits.
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
; Clean up resources
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_PathDispose($hPath1)
_GDIPlus_PathDispose($hPath2)
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
EndFunc ;==>Example