Funktionreferenz


_GDIPlus_BitmapCloneArea

Beschreibung anzeigen in

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

#include <GDIPlus.au3>
_GDIPlus_BitmapCloneArea ( $hBitmap, $nLeft, $nTop, $nWidth, $nHeight [, $iFormat = 0x00021808] )

Parameter

$hBitmap Handle auf ein Bitmap-Objekt
$nLeft X-Koordinate der oberen linken Ecke des zu kopierenden Rechtecks
$nTop Y-Koordinate der oberen linken Ecke des zu kopierenden Rechtecks
$nWidth Länge des zu kopierenden Rechtecks
$nHeight 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: ein Handle auf das neue Bitmap-Objekt
Fehler: 0 und setzt das @error Flag auf ungleich null. @extended kann den GPSTATUS Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten.

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 nach GdipCloneBitmapAreaI in der MSDN Bibliothek.

Beispiel

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

Example()

Func Example()
    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()

    ShellExecute(@MyDocumentsDir & "\GDIPlus_Image.jpg")
EndFunc   ;==>Example