UDF > GDIPlus > GraphicsPath >


_GDIPlus_PathFlatten

Applique une transformation � un GraphicsPath et convertit chaque courbe en une s�quence de segments de ligne connect�s

#include <GDIPlus.au3>
_GDIPlus_PathFlatten ( $hPath [, $fFlatness = 0.25 [, $hMatrix = 0]] )

Param�tres

$hPath Handle de l'objet GraphicsPath
$fFlatness [optionnel] Nombre d�cimal qui sp�cifie l'erreur maximale entre la trajectoire et son approximation aplatie.
La r�duction de la plan�it� augmente le nombre de segments de droite.
$hMatrix [optionnel] Handle de l'objet Matrix qui sp�cifie la transformation � appliquer aux points de donn�es de la trajectoire

Valeur de retour

Succ�s: Retourne True.
�chec: Retourne False et d�finit @error <> 0, @extended contient le code erreur ($GPID_ERR*).

En relation

_GDIPlus_PathWarp

Voir aussi

Consultez GdipFlattenPath dans la Librairie MSDN.

Exemple

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

Example()

Func Example()
    Local $hGUI, $hGraphic, $hPen1, $hPen2, $hPath, $aPoints

    ; Cr�e une GUI
    $hGUI = GUICreate("GDI+", 800, 400)
    GUISetState(@SW_SHOW)

    _GDIPlus_Startup()
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) ; Cr�e un objet graphique � partir du handle de la fen�tre
    _GDIPlus_GraphicsSetSmoothingMode($hGraphic, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ; D�finit pour l'objet graphique la qualit� de rendu antialiasing
    _GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)

    $hPen1 = _GDIPlus_PenCreate(0xFFFFBB00, 2)
    $hPen2 = _GDIPlus_PenCreate(0xFF0000FF, 2)

    ; ellipse originale
    _GDIPlus_GraphicsDrawString($hGraphic, "original ellipse as bezier points", 10, 10)

    $hPath = _GDIPlus_PathCreate() ; Cr�e un objet path
    _GDIPlus_PathAddEllipse($hPath, 50, 50, 300, 300)

    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1) ; Dessine le Path avec le handle Graphic (GUI)

    $aPoints = _GDIPlus_PathGetPoints($hPath)
    For $i = 1 To $aPoints[0][0]
        _GDIPlus_GraphicsDrawEllipse($hGraphic, $aPoints[$i][0] - 4, $aPoints[$i][1] - 4, 8, 8, $hPen2)
    Next

    ; Ellipse aplatie
    _GDIPlus_GraphicsDrawString($hGraphic, "flattened ellipse as a sequence of straight lines", 410, 10)

    _GDIPlus_PathReset($hPath)
    _GDIPlus_PathAddEllipse($hPath, 450, 50, 300, 300)
    _GDIPlus_PathFlatten($hPath, 10)

    _GDIPlus_GraphicsDrawPath($hGraphic, $hPath, $hPen1) ; Dessine le Path avec le handle Graphic (GUI)

    $aPoints = _GDIPlus_PathGetPoints($hPath)
    For $i = 1 To $aPoints[0][0]
        _GDIPlus_GraphicsDrawEllipse($hGraphic, $aPoints[$i][0] - 4, $aPoints[$i][1] - 4, 8, 8, $hPen2)
    Next

    ; Boucle jusqu'� ce que l'utilisateur quitte.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Nettoie les ressources
    _GDIPlus_PathDispose($hPath)
    _GDIPlus_PenDispose($hPen1)
    _GDIPlus_PenDispose($hPen2)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
EndFunc   ;==>Example