Obtient la section suivante, délimitée par un marqueur, d'un tracé (GraphicsPath) associé à un itérateur (GraphicsPathIterator)
#include <GDIPlus.au3>
_GDIPlus_PathIterNextMarkerPath ( $hPathIter, $hPath )
$hPathIter | Handle de l'objet GraphicsPathIterator |
$hPath | Handle de l'objet GraphicsPath |
Succès: | Retourne le nombre de points dans la section récupéré ou 0 si aucune nouvelle section n'est récupérée. |
Échec: | Retourne -1 et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GDI_ERR*). |
Cette fonction définit les points de données de l'objet GraphicsPath conçu pour correspondre avec les points de données de la section récupérée.
_GDIPlus_PathIterRewind, _GDIPlus_PathSetMarker
Consultez GdipPathIterNextMarkerPath dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI = GUICreate("GDI+", 600, 300) GUISetState(@SW_SHOW) _GDIPlus_Startup() Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) Local $hBmp_Buffer = _GDIPlus_BitmapCreateFromGraphics(600, 300, $hGraphics) Local $hGfx_Buffer = _GDIPlus_ImageGetGraphicsContext($hBmp_Buffer) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Buffer, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsClear($hGfx_Buffer, 0xFF000000) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFAA00FF) Local $hPen = _GDIPlus_PenCreate(0xFFFFBB00, 2) Local $hPath = _GDIPlus_PathCreate() Local $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) Local $hFamily = _GDIPlus_FontFamilyCreate("Arial") Local $tLayout = _GDIPlus_RectFCreate(0, 0, 600, 300) _GDIPlus_PathAddString($hPath, "AutoIt rulez!", $tLayout, $hFamily, 0, 112, $hFormat) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) Local $hIter = _GDIPlus_PathIterCreate($hPath) Local $hSubPath = _GDIPlus_PathCreate(); Path pour obtenir les figures du sous-tracé Local $iPointCount Do _GDIPlus_PathReset($hSubPath) ; Par exemple La lettre A est composé de deux sous-tracés - comparer avec _GDIPlus_PathIterNextSubpathPath $iPointCount = _GDIPlus_PathIterNextMarkerPath($hIter, $hSubPath) If $iPointCount > 0 Then _GDIPlus_PenSetColor($hPen, BitOR(0xFF000000, Random(0xFF, 0xFFFFFF, 1))) _GDIPlus_BrushSetSolidColor($hBrush, BitOR(0xFF000000, Random(0xFF, 0xFFFFFF, 1))) _GDIPlus_GraphicsFillPath($hGfx_Buffer, $hSubPath, $hBrush) _GDIPlus_GraphicsDrawPath($hGfx_Buffer, $hSubPath, $hPen) EndIf Until $iPointCount = 0 _GDIPlus_GraphicsDrawImage($hGraphics, $hBmp_Buffer, 0, 0) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_PathDispose($hSubPath) _GDIPlus_PathIterDispose($hIter) _GDIPlus_PathDispose($hPath) _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGfx_Buffer) _GDIPlus_BitmapDispose($hBmp_Buffer) _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() EndFunc ;==>Example