#include <GDIPlus.au3>
Local $sFile = 'test.jpg'
_GDIPlus_Startup()
Local $hImage = _GDIPlus_ImageLoadFromFile($sFile)
If @error Then Exit
Local $iW = _GDIPlus_ImageGetWidth($hImage)
Local $iH = _GDIPlus_ImageGetHeight($hImage)
Local $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH)
Local $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iW, $iH)
Local $tBitmapData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $iW, $iH, BitOR($GDIP_ILMWRITE, $GDIP_ILMREAD), $GDIP_PXF32ARGB)
Local $iScan0 = DllStructGetData($tBitmapData, 'Scan0')
Local $tPixel = DllStructCreate('int[' & $iW * $iH & ']', $iScan0)
Local $iY, $iX, $iPixel, $iRowOffset, $iR
For $iY = 0 To $iH - 1
$iRowOffset = $iY * $iW + 1
For $iX = 0 To $iW - 1
$iPixel = DllStructGetData($tPixel, 1, $iRowOffset + $iX)
$iR = BitShift(BitAND($iPixel, 0x00FF0000), 16)
If $iR > 0x7D Then DllStructSetData($tPixel, 1, 0xFFFFFFFF, $iRowOffset + $iX)
Next
Next
_GDIPlus_BitmapUnlockBits($hBitmap, $tBitmapData)
Local $hGUI = GUICreate('', $iW, $iH)
GUISetState()
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI)
_GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iW, $iH)
Do
Until GUIGetMsg() = -3
_GDIPlus_ImageDispose($hImage)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphic)
_GDIPlus_Shutdown()
GUIDelete($hGUI)
|