Konvertiert eine Bitmap in ein angegebenes Pixelformat
#include <GDIPlus.au3>
_GDIPlus_BitmapConvertFormat ( $hBitmap, $iPixelFormat, $iDitherType, $iPaletteType, $tPalette [, $fAlphaThresholdPercent = 0.0] )
$hBitmap | Handle zu der Bitmap die konvertiert werden soll. |
$iPixelFormat | Pixelformat Konstante die das neue Pixelformat festlegt ($GDIP_PXF*). |
$iDitherType | Dither-Typ Konstante die den dithering Algorithmus angibt ($GDIP_DitherType*). |
$iPaletteType | Palette-Typ Konstante welche die Standardpalette für das dithering angibt ($GDIP_PaletteType*). |
$tPalette | Struktur welche die Palette beschreibt dessen Indexe in den Pixeldaten der konvertierten Bitmap gespeichert sind. |
$fAlphaThresholdPercent | [optional] Reale Zahl im Bereich von 0.0 bis 100.0 welche angbit, welche Pixel in der Quell-Bitmap zur Transparenten Farbe in der konvertierten Bitmap umgewandelt werden. |
Erfolg: | True. |
Fehler: | False und setzt das @error Flag auf ungleich null, das @extended Flag kann den GPSTATUS-Fehlercode ($GPID_ERR* siehe GDIPlusConstants.au3) enthalten. |
@error: | -1 - GDIPlus.dll unterstützt diese Funktion nicht. 10 - Falsche Parameter. |
Die originalen Pixeldaten in der Bitmap werden durch die neuen Pixeldaten ersetzt.
Suche nach GdipBitmapConvertFormat in der MSDN Bibliothek.
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
_Example()
Func _Example()
If Not _GDIPlus_Startup() Or @extended < 6 Then
MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available")
Return
EndIf
Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)")
If @error Or Not FileExists($sFile) Then Return
Local $hImage = _GDIPlus_ImageLoadFromFile($sFile)
Local $iWidth = 600
Local $iHeight = _GDIPlus_ImageGetHeight($hImage) * 600 / _GDIPlus_ImageGetWidth($hImage)
Local $hGui = GUICreate("GDI+ v1.1 (" & @ScriptName & ")", $iWidth, $iHeight)
Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
GUISetState(@SW_SHOW)
;Convert to a 16-color bitmap (4 bits per pixel) using FixedHalftone27 dithering
Local $tPalette = _GDIPlus_PaletteInitialize(16, $GDIP_PaletteTypeFixedHalftone27, 16, False, $hImage)
_GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF04INDEXED, $GDIP_DitherTypeDualSpiral8x8, $GDIP_PaletteTypeFixedHalftone27, $tPalette)
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
EndFunc ;==>_Example