Remplace les coefficients d'une matrice par les coefficients du produit d'elle-m�me avec une matrice de rotation
#include <GDIPlus.au3>
_GDIPlus_MatrixRotate ( $hMatrix, $fAngle [, $bAppend = False] )
$hMatrix | Handle de l'objet Matrix |
$fAngle | L'angle de rotation en degr�s. Les valeurs positives indiquent une rotation dans le sens horaire. |
$bAppend | [optionnel] Ordre de multiplication des matrices: True - Indique que la matrice de rotation est � gauche False - Indique que la matrice de rotation est � droite |
Succ�s: | Retourne True. |
�chec: | Retourne False et d�finit @error <> 0, @extended contient le code erreur ($GPID_ERR*). |
Consultez GdipRotateMatrix dans la Librairie MSDN.
#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() Local $hBitmap1, $hBitmap2, $hImage1, $hImage2, $hGraphic, $iWidth, $iHeight ; Initialise la biblioth�que GDI+ _GDIPlus_Startup() ; Capture l'�cran complet $hBitmap1 = _ScreenCapture_Capture("") $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap1) ; Capture une r�gion d'�cran $hBitmap2 = _ScreenCapture_Capture("", 0, 0, 400, 300) $hImage2 = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap2) $iWidth = _GDIPlus_ImageGetWidth($hImage2) $iHeight = _GDIPlus_ImageGetHeight($hImage2) ; Dessine une image dans une autre $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage1) ; DrawInsert ($hGraphic, $hImage2, iX $, $iy, Fangle $, $iwidth, $iheight, $iARGB = 0xFF000000, $iPenWidth = 1) DrawInsert($hGraphic, $hImage2, 350, 100, 0, $iWidth + 2, $iHeight + 2, 0xFFFF8000, 2) DrawInsert($hGraphic, $hImage2, 340, 50, 15, 200, 150, 0xFFFF8000, 4) DrawInsert($hGraphic, $hImage2, 310, 30, 35, $iWidth + 4, $iHeight + 4, 0xFFFF00FF, 4) DrawInsert($hGraphic, $hImage2, 320, 790, -35, $iWidth, $iHeight) ; Enregistre l'image r�sultante _GDIPlus_ImageSaveToFile($hImage1, @MyDocumentsDir & "\GDIPlus_Image.jpg") ; Nettoie les ressources _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _WinAPI_DeleteObject($hBitmap1) _WinAPI_DeleteObject($hBitmap2) ; Arr�te la biblioth�que GDI+ _GDIPlus_Shutdown() ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example ; #FUNCTION# ================================================================================================== ; Name...........: DrawInsert ; Description ...: Dessine une image dans une autre ; Syntax.........: DrawInsert($hGraphic, $hImage2, $iX, $iY, $fAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $iPenWidth = 1) ; ins�re le Graphics $hImage2 dans $hGraphic ; Parameters ....: $hGraphics - Handle de l'objet Graphics ; $hImage - Handle de l'objet Image � ins�rer ; $iX - La coordonn�e X du coin sup�rieur gauche de l'image ins�r�e ; $iY - La coordonn�e Y du coin sup�rieur gauche de l'image ins�r�e ; $iWidth - La largeur du rectangle qui encadre l'image ins�r�e ; $iHeight - La hauteur du rectangle qui encadre l'image ins�r�e ; $iARGB - Les composantes Alpha, Rouge, Vert et Bleu de la couleur du crayon - couleur du cadre ; $iPenWidth - La largeur du crayon mesur�e dans l'unit� sp�cifi�e dans le param�tre $iUnit - Largeur du cadre ; Return values .: Succ�s - True ; Echec - False ; ================================================================================================== Func DrawInsert($hGraphic, $hImage2, $iX, $iY, $fAngle, $iWidth, $iHeight, $iARGB = 0xFF000000, $iPenWidth = 1) Local $hMatrix, $hPen2 ; Matrice de rotation $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixRotate($hMatrix, $fAngle, "False") _GDIPlus_GraphicsSetTransform($hGraphic, $hMatrix) _GDIPlus_GraphicsDrawImage($hGraphic, $hImage2, $iX, $iY) ; Obtient le crayon + la couleur $hPen2 = _GDIPlus_PenCreate($iARGB, $iPenWidth) ; Dessine un cadre autour de l'image ins�r�e _GDIPlus_GraphicsDrawRect($hGraphic, $iX, $iY, $iWidth, $iHeight, $hPen2) ; Nettoie les ressources _GDIPlus_MatrixDispose($hMatrix) _GDIPlus_PenDispose($hPen2) Return 1 EndFunc ;==>DrawInsert