Hier mal der Code, um das Bild in einen Path zu packen:
Spoiler anzeigen
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]Global $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Tussie.png")
[/autoit] [autoit][/autoit] [autoit]Global $iImgW = _GDIPlus_ImageGetWidth($hImage) * 96 / _GDIPlus_ImageGetHorizontalResolution($hImage)
Global $iImgH = _GDIPlus_ImageGetHeight($hImage) * 96 / _GDIPlus_ImageGetVerticalResolution($hImage)
Global $iWidth = $iImgW
Global $iHeight = $iImgH
Global $hGui = GUICreate("Test", $iWidth, $iHeight)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
_GDIPlus_GraphicsSetSmoothingMode($hGfxBuffer, 2)
_GDIPlus_GraphicsClear($hGfxBuffer, 0xFFFFFFFF)
Global $hPen = _GDIPlus_PenCreate(0xFF00AA00)
[/autoit] [autoit][/autoit] [autoit]GUIRegisterMsg($WM_PAINT, "_WM_PAINT")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_GraphicsDrawImageRect($hGfxBuffer, $hImage, 0, 0, $iWidth, $iHeight)
GUISetState()
Global $iTimer = TimerInit()
Global $hPath = _ScanBMP($hImage)
ConsoleWrite("! " & TimerDiff($iTimer) & @CRLF)
DllCall($ghGDIPDll, "uint", "GdipDrawPath", "hwnd", $hGfxBuffer, "hwnd", $hPen, "hwnd", $hPath)
DllCall($ghGDIPDll, "uint", "GdipDeletePath", "hwnd", $hPath)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
While Sleep(20)
WEnd
Func _ScanBMP($hBitmap)
Local $aPixelFormat = _GDIPlus_ImageGetPixelFormat($hBitmap)
If $aPixelFormat[0] <> $GDIP_PXF01INDEXED Then Return SetError(1, 1, False)
Local $iBmpW = _GDIPlus_ImageGetWidth($hBitmap)
Local $iBmpH = _GDIPlus_ImageGetHeight($hBitmap)
Local $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iBmpW, $iBmpH, $GDIP_ILMREAD, $GDIP_PXF32ARGB)
Local $iStride = DllStructGetData($tData, "Stride")
Local $iWidth = DllStructGetData($tData, "Width")
Local $iHeight = DllStructGetData($tData, "Height")
Local $pScan0 = DllStructGetData($tData, "Scan0")
Local $tPixel = DllStructCreate("uint[" & $iWidth * $iHeight & "];", $pScan0)
Local $iRect = $iWidth * $iHeight
Local $tRects = DllStructCreate("int[" & $iRect * 4 & "];")
$iRect = -1
Local $iOff, $iNew = 1
Local $iRectX, $iRectW = 0
For $y = 0 To $iHeight - 1
$iOff = $y * $iWidth
For $x = 0 To $iWidth - 1
Switch DllStructGetData($tPixel, 1, $iOff + $x + 1)
Case 4294967295
$iNew = 1
If $iRectW > 0 Then
$iRect += 1
DllStructSetData($tRects, 1, $iRectX, $iRect * 4 + 1)
DllStructSetData($tRects, 1, $y, $iRect * 4 + 2)
DllStructSetData($tRects, 1, $iRectW, $iRect * 4 + 3)
DllStructSetData($tRects, 1, 1, $iRect * 4 + 4)
$iRectW = 0
EndIf
Case Else
Switch $iNew
Case 1
$iNew = 0
$iRectX = $x
$iRectW = 1
Case Else
$iRectW += 1
EndSwitch
EndSwitch
Next
$iNew = 1
If $iRectW > 0 Then
$iRect += 1
DllStructSetData($tRects, 1, $iRectX, $iRect * 4 + 1)
DllStructSetData($tRects, 1, $y, $iRect * 4 + 2)
DllStructSetData($tRects, 1, $iRectW, $iRect * 4 + 3)
DllStructSetData($tRects, 1, 1, $iRect * 4 + 4)
$iRectW = 0
EndIf
Next
$iRect += 1
_GDIPlus_BitmapUnlockBits($hBitmap, $tData)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreatePath", "int", 0, "int*", 0)
Local $hPath = $aResult[2]
$aResult = DllCall($ghGDIPDll, "uint", "GdipAddPathRectanglesI", "hwnd", $hPath, "ptr", DllStructGetPtr($tRects), "int", $iRect)
Return $hPath
EndFunc ;==>_ScanBMP
Func _WM_PAINT($hWnd, $iMsg, $wParam, $lParam)
_GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
Return $GUI_RUNDEFMSG
EndFunc ;==>_WM_PAINT
Func _Exit()
_GDIPlus_ImageDispose($hImage)
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGfxBuffer)
_GDIPlus_BitmapDispose($hBmpBuffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Eine Region daraus erhält man wie in meinem ersten Beispiel.
Dieser Code sollte sich auch relativ einfach in ASM umsetzen lassen...
lgE