Applique une distorsion (définit par un rectangle et son parallélogramme transformé) à un tracé (GraphicsPath). La fonction aplatit aussi le tracé.
#include <GDIPlus.au3>
_GDIPlus_PathWarp ( $hPath, $hMatrix, $aPoints, $nX, $nY, $nWidth, $nHeight [, $iWarpMode = 0 [, $fFlatness = 0.25]] )
$hPath | Handle de l'objet GraphicsPath |
$hMatrix | Handle de l'objet qui représente une matrice de transformation à appliquer en même temps que la distorsion. |
$aPoints | Tableau des sommets d'un parallélogramme dans lequel se transforme le rectangle: [0][0] - Nombre de points. Ce nombre doit être 3 ou 4 [1][0] - Point 1, coordonnée X [1][1] - Point 1, coordonnée Y [2][0] - Point 2, coordonnée X [2][1] - Point 2, coordonnée Y [n][0] - Point n, coordonnée X [n][1] - Point n, coordonnée Y Lorsqu'il contient trois éléments, l'angle inférieur droit du parallélogramme est défini par les trois premiers points. |
$nX | Coordonnée X du coin supérieur gauche du rectangle à transformer en parallélogramme défini par $aPoints |
$nY | Coordonnée Y du coin supérieur gauche du rectangle à transformer en parallélogramme défini par $aPoints |
$nWidth | Largeur du rectangle à transformer en parallélogramme défini par $aPoints |
$nHeight | Hauteur du rectangle à transformer en parallélogramme défini par $aPoints |
$iWarpMode | [optionnel] Type de distorsion à appliquer: 0 - Perspective: Spécifie une distorsion de perspective 1 - Bilinear: Spécifie une distorsion bilinéaire |
$fFlatness | [optionnel] Nombre décimal qui influe sur le nombre de segments de ligne qui sont utilisés pour approcher le tracé initial. Les petites valeurs indiquent que de nombreux segments de ligne sont utilisés, et les grandes valeurs indiquent que peu de segments de ligne sont utilisés. |
Succès: | Retourne True. |
Échec: | Retourne False et définit @error <> 0, @extended contient le code erreur ($GPID_ERR*). |
Consultez GdipWarpPath dans la Librairie MSDN.
#include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $iW, $iH, $hGUI, $hGraphic, $hBrush, $hPath, $hFormat, $hFamily, $tLayout ; Crée une GUI $iW = 600 $iH = 300 $hGUI = GUICreate("GDI+", $iW, $iH) 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, 0xFF000000) $hBrush = _GDIPlus_BrushCreateSolid(0xFFFFFF00) $hPath = _GDIPlus_PathCreate() ; Crée un objet path $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) ; Définit l'alignement au centre $hFamily = _GDIPlus_FontFamilyCreate("Arial Black") ; Crée un objet FontFamily $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH) ; Crée une chaîne délimitée par un rectangle _GDIPlus_PathAddString($hPath, "AutoIt rulez!" & @LF & "and so does" & @LF & "STAR WARS ; )", $TLayout, $hFamily, 0, 64, $hformat); Ajoute le contour de la chaîne au tracé Local $aPoints[5][2] $aPoints[0][0] = 4 $aPoints[1][0] = $iW * 0.3 $aPoints[1][1] = $iH * 0.3 $aPoints[2][0] = $iW * 0.7 $aPoints[2][1] = $iH * 0.3 $aPoints[3][0] = 0 $aPoints[3][1] = $iH $aPoints[4][0] = $iW $aPoints[4][1] = $iH _GDIPlus_PathWarp($hPath, 0, $aPoints, 0, 0, $iW, $iH) ; Applique la distorsion au tracé _GDIPlus_GraphicsFillPath($hGraphic, $hPath, $hBrush) ; Dessine le Path avec le handle Graphic (GUI) ; Boucle jusqu'à ce que l'utilisateur quitte. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Nettoie les ressources _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_PathDispose($hPath) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example