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