Crée un nouveau bitmap en copiant une partie rectangulaire d'un bitmap source
#include <GDIPlus.au3>
_GDIPlus_BitmapCloneArea ( $hBitmap, $nLeft, $nTop, $nWidth, $nHeight [, $iFormat = $GDIP_PXF24RGB] )
$hBitmap | Handle de l'objet Bitmap |
$nLeft | Coordonnée X du coin supérieur gauche du rectangle à copier |
$nTop | Coordonnée Y du coin supérieur gauche du rectangle à copier |
$nWidth | Largeur du rectangle qui spécifie la partie du Bitmap à copier |
$nHeight | Hauteur du rectangle qui spécifie la partie du Bitmap à copier |
$iFormat | [optionnel] Format de pixel pour le nouveau Bitmap: $GDIP_PXF01INDEXED = 1 bit par pixel, indexé $GDIP_PXF04INDEXED = 4 bits par pixel, indexé $GDIP_PXF08INDEXED = 8 bits par pixel, indexé $GDIP_PXF16GRAYSCALE = 16 bits par pixel, niveaux de gris $GDIP_PXF16RGB555 = 16 bits par pixel; 5 bits pour chaque composante RVB $GDIP_PXF16RGB565 = 16 bits par pixel; 5 bits pour le rouge, 6 bits pour le vert et 5 bits pour le bleu $GDIP_PXF16ARGB1555 = 16 bits par pixel; 1 bit pour la transparence et 5 bits pour chaque composante RVB $GDIP_PXF24RGB = 24 bits par pixel; 8 bits pour chaque composante RVB $GDIP_PXF32RGB = 32 bits par pixel; 8 bits pour chaque composante RVB. Pas de composante de transparence. $GDIP_PXF32ARGB = 32 bits par pixel; 8 bits pour chaque composante RVB et composante de transparence $GDIP_PXF32PARGB = 32 bits par pixel; 8 bits pour chaque composante RVB et composante de transparence, pré-multiplié $GDIP_PXF48RGB = 48 bits par pixel; 16 bits pour chaque composante RVB $GDIP_PXF64ARGB = 64 bits par pixel; 16 bits pour chaque composante RVB et composante de transparence $GDIP_PXF64PARGB = 64 bits par pixel; 16 bits pour chaque composante RVB et composante de transparence, pré-multiplié |
Succès: | Retourne le handle du nouvel objet Bitmap |
Échec: | Retourne 0 et définit @error <> 0, @extended contient le code erreur GPSTATUS ($GPID_ERR*). |
Lorsque vous en avez terminé avec l'objet Bitmap, appelez _GDIPlus_BitmapDispose() pour libérer les ressources.
_GDIPlus_BitmapDispose, _GDIPlus_ImageGetPixelFormat
Consultez GdipCloneBitmapAreaI dans la Librairie MSDN.
#include <GDIPlus.au3> #include <ScreenCapture.au3> #include <WinAPIHObj.au3> Example() Func Example() Local $hBitmap, $hClone, $hImage, $iX, $iY ; Initialise la bibliothèque GDI + _GDIPlus_Startup() ; Capture un bitmap 32 bits $hBitmap = _ScreenCapture_Capture("") $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap) ; Crée un clone 24 bits du bitmap $iX = _GDIPlus_ImageGetWidth($hImage) $iY = _GDIPlus_ImageGetHeight($hImage) $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB) ; Enregistre le bitmap dans un fichier _GDIPlus_ImageSaveToFile($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp") ; Nettoie les ressources _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBitmap) ; Arrête la bibliothèque GDI + _GDIPlus_Shutdown() ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg") EndFunc ;==>Example