Moin,
Es ist wieder nur eine sehr kleine Funktion für GDI+ von der ich nicht weiß ob ich sie in dieser Form schonmal im Forum gesehen habe. Der Übersicht halber hat sie jetzt einen eigenen Thread, falls sie jemand sucht. Das Prinzip der Funktion ist bekannt, aber ehe Irgendwer Workarounds fabriziert, lieber den einfachen Weg wählen
Was kann die Funktion:
- Das berühmte "Links rein, Rechts raus" Prinzip auf Bitmaps anwenden.
- Das Bild "verschmierfrei" behandeln. (Ist 2x abgesichert. Wer das nicht will nimmt Round heraus und ändert die Zeichenfunktion von int zu float.)
- mehr nicht.
Im Anhang ist eine Zip versehen mit der Funktion selbst und einem Anwendungsbeispiel.
AutoIt: _GDIPlus_BitmapMove
Func _GDIPlus_BitmapMove($hBMP, $dx, $dy)
$dx = Round($dx, 0)
$dy = Round($dy, 0)
Local $iW = DllCall($__g_hGDIPDll, 'int', 'GdipGetImageWidth', 'handle', $hBMP, 'uint*', 0)[2]
Local $iH = DllCall($__g_hGDIPDll, 'int', 'GdipGetImageHeight', 'handle', $hBMP, 'uint*', 0)[2]
Local $hClone = DllCall($__g_hGDIPDll, 'int', 'GdipCloneBitmapAreaI', 'int', 0, 'int', 0, 'int', $iW, 'int', $iH, 'int', 0x00021808, 'handle', $hBMP, 'handle*', 0)[7]
Local $hGFX = DllCall($__g_hGDIPDll, 'int', 'GdipGetImageGraphicsContext', 'handle', $hBMP, 'handle*', 0)[2]
Local $iX = Int($dx / $iW) * $iW + $dx, $iY = Int($dy / $iH) * $iH + $dy, $tX = $dx < 0 ? $iW : -$iW, $tY = $dy < 0 ? $iH : -$iH
DllCall($__g_hGDIPDll, 'int', 'GdipDrawImageI', 'handle', $hGFX, 'handle', $hClone, 'int', $iX, 'int', $iY)
DllCall($__g_hGDIPDll, 'int', 'GdipDrawImageI', 'handle', $hGFX, 'handle', $hClone, 'int', $iX + $tX, 'int', $iY)
DllCall($__g_hGDIPDll, 'int', 'GdipDrawImageI', 'handle', $hGFX, 'handle', $hClone, 'int', $iX, 'int', $iY + $tY)
DllCall($__g_hGDIPDll, 'int', 'GdipDrawImageI', 'handle', $hGFX, 'handle', $hClone, 'int', $iX + $tX, 'int', $iY + $tY)
DllCall($__g_hGDIPDll, 'int', 'GdipDeleteGraphics', 'handle', $hGFX)
DllCall($__g_hGDIPDll, 'int', 'GdipDisposeImage', 'handle', $hClone)
EndFunc
Alles anzeigen
lg
M