Funktionsreferenz

_GDIPlus_BitmapCloneArea

Erzeugt eine Kopie eines Bitmap-Objekts von dem angegeben Bereich und Format.

#Include <GDIPlus.au3>
_GDIPlus_BitmapCloneArea($hBmp, $iLeft, $iTop, $iWidth, $iHeight[, $iFormat = 0x00021808])

 

Parameter

$hBmp Handle auf ein Bitmap-Objekt
$iLeft X-Koordinate der oberen linken Ecke des zu kopierenden Rechtecks
$iTop Y-Koordinate der oberen linken Ecke des zu kopierenden Rechtecks
$iWidth Länge des zu kopierenden Rechtecks
$iHeight Breite des zu kopierenden Rechtecks
$iFormat [optional] Pixelformat der Bitmap-Kopie:
$GDIP_PXF01INDEXED = 1 Bit pro Pixel, indiziert.
$GDIP_PXF04INDEXED = 4 Bit pro Pixel, indiziert.
$GDIP_PXF08INDEXED = 8 Bit pro Pixel, indiziert.
$GDIP_PXF16GRAYSCALE = 16 Bit pro Pixel, Graustufen.
$GDIP_PXF16RGB555 = 16 Bit pro Pixel; je 5 Bits pro Grundfarbe RGB.
$GDIP_PXF16RGB565 = 16 Bit pro Pixel; 5 Bits Rot, 6 Bits Grün und 5 Bits Blau.
$GDIP_PXF16ARGB1555 = 16 Bit pro Pixel; 1 Bit Alphakanal und 5 Bits für jede RGB-Komponente.
$GDIP_PXF24RGB = 24 Bit pro Pixel; 8 Bits pro Grundfarbe RGB.
$GDIP_PXF32RGB = 32 Bit pro Pixel; 8 Bits pro Grundfarbe RGB. Ohne Alphakanal.
$GDIP_PXF32ARGB = 32 Bit pro Pixel; 8 Bits pro Grundfarbe RGB und Alphakanal.
$GDIP_PXF32PARGB = 32 Bit pro Pixel; 8 Bits pro Grundfarbe RGB und Alphakanal, pre-multiplied
$GDIP_PXF48RGB = 48 Bit pro Pixel; 16 Bits pro Grundfarbe RGB.
$GDIP_PXF64ARGB = 64 Bit pro Pixel; 16 Bits pro Grundfarbe RGB und Alphakanal.
$GDIP_PXF64PARGB = 64 Bit pro Pixel; 16 Bits pro Grundfarbe RGB und Alphakanal, pre-multiplied

 

Rückgabewert

Erfolg: Gibt das Handle auf das neue Bitmap-Objekt zurück.
Fehler: 0

 

Bemerkungen

Mit dieser Funktion kann ein bereits vorhandenes Bild kopiert und anschließend zugeschnitten werden.
Wird die Bitmap nicht mehr benötigt, sind die Ressourcen durch Aufruf der Funktion _GDIPlus_BitmapDispose wieder freizugeben.

 

Verwandte Funktionen

_GDIPlus_BitmapDispose, _GDIPlus_ImageGetPixelFormat

 

Siehe auch

Suche in der MSDN Bibliothek nach GdipCloneBitmapAreaI

 

Beispiel


#include <GDIPlus.au3>
#include <ScreenCapture.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $hBitmap, $hClone, $hImage, $iX, $iY

    ; Initialisiert (startet) Microsoft Windows GDI+
    _GDIPlus_Startup()

    ; Erstellt vom kompletten Bildschirm einen Screenshot und erzeugt daraus eine 32 bit Bitmap
    $hBitmap = _ScreenCapture_Capture("")
    $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBitmap)

    ; Erzeugt eine Kopie einer 24 bit Bitmap
    $iX = _GDIPlus_ImageGetWidth($hImage)
    $iY = _GDIPlus_ImageGetHeight($hImage)
    $hClone = _GDIPlus_BitmapCloneArea($hImage, 0, 0, $iX, $iY, $GDIP_PXF24RGB)

    ; Speichert das Bild in eine Datei
    _GDIPlus_ImageSaveToFile($hClone, @MyDocumentsDir & "\GDIPlus_Image.bmp")

    ; Ressourcen freigeben
    _GDIPlus_ImageDispose($hClone)
    _GDIPlus_ImageDispose($hImage)
    _WinAPI_DeleteObject($hBitmap)

    ; Gibt die durch Microsoft Windows GDI+ verwendeten Ressourcen wieder frei
    _GDIPlus_Shutdown()

EndFunc   ;==>_Main