Dann noch Colormatrix mit XOR dazu und fertig ![]()
Spoiler anzeigen
#AutoIt3Wrapper_Autoit3Dir=c:\Program Files (x86)\AutoIt3\Beta
[/autoit] [autoit][/autoit] [autoit]#include <Screencapture.au3>
[/autoit] [autoit][/autoit] [autoit]Opt('GUIOnEventMode', 1)
[/autoit] [autoit][/autoit] [autoit]Global $iSize = 32, $iW = 576, $iH = 576
[/autoit] [autoit][/autoit] [autoit]Global $hGUI, $hGFX, $hBMP, $hBUF, $hBmps[$iSize][$iSize], $hBRU, $iFrame, $iTimer = TimerInit(), $iFPS, $iFrameTimer = TimerInit(), $iCount = 0, _
$hHBitmap, $hBitmap, $x, $y
_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)")
If @error Or Not FileExists($sFile) Then Exit
$hImage = _GDIPlus_ImageLoadFromFile($sFile)
$iImgW = _GDIPlus_ImageGetWidth($hImage)
$iImgH = _GDIPlus_ImageGetHeight($hImage)
$hGUI = GUICreate('Text', $iW, $iH)
$hGFX = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBMP = _GDIPlus_BitmapCreateFromGraphics($iW, $iH, $hGFX)
$hBUF = _GDIPlus_ImageGetGraphicsContext($hBMP)
;$hHBitmap = _ScreenCapture_Capture("", 0, 0, $iSize^2, $iSize^2)
$hBitmap = _GDIPlus_BitmapCreateFromScan0($iSize^2, $iSize^2)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsDrawImageRect($hContext, $hImage, 0, 0, $iSize^2, $iSize^2)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_ImageDispose($hImage)
;_WinAPI_DeleteObject($hHBitmap)
[/autoit] [autoit][/autoit] [autoit]$tCM = _GDIPlus_ColorMatrixCreateScale(0,0,0)
$hImgAttr = _GDIPlus_ImageAttributesCreate()
Local $aResult, $fValue
$fSizeInv = 1 / $iSize
For $y = 0 To $iSize - 1
For $x = 0 To $iSize - 1
$hBmps[$y][$x] = _GDIPlus_BitmapCreateFromScan0($iSize, $iSize)
$hCtxt = _GDIPlus_ImageGetGraphicsContext($hBmps[$y][$x])
$fValue = BitXOR($x, $y) * $fSizeInv
$tCM.m(1) = $fValue
$tCM.m(13) = 1-$fValue
_GDIPlus_ImageAttributesSetColorMatrix($hImgAttr, 0, True, $tCM)
$aResult = DllCall($ghGDIPDll, "int", "GdipCreateTextureIA", "handle", $hBitmap, "handle", $hImgAttr, "float", $x * $iSize, "float", $y * $iSize, "float", $iSize, "float", $iSize, "handle*", 0)
_GDIPlus_GraphicsFillRect($hCtxt, 0, 0, $iSize, $iSize, $aResult[7])
_GDIPlus_GraphicsDispose($hCtxt)
_GDIPlus_BrushDispose($aResult[7])
Next
Next
_GDIPlus_ImageAttributesDispose($hImgAttr)
GUISetOnEvent(-3, '_Exit', $hGUI)
GUIRegisterMsg(0xF, 'WM_PAINT')
GUISetState(@SW_SHOW, $hGUI)
While Sleep(10)
_XOR_Tex()
WEnd
Func _XOR_Tex()
Local $iCol, $iTMP
Local Static $iSin = 0, $iMulti = 256 / $iSize, $2Multi = 2 * $iMulti
$iSin += 5 / (1000 / TimerDiff($iFrameTimer))
$iFrameTimer = TimerInit()
_GDIPlus_GraphicsClear($hBUF, 0xA0808080)
For $x = 0 To $iSize - 1
$iTMP = 2 * $x * $iMulti
For $y = 0 To $iSize - 1
_GDIPlus_GraphicsDrawImageRectF($hBUF, $hBmps[$y][$x], _
25 + 15 * Sin($y * $iMulti / 64 + $iSin) + $iTMP, _
15 * Cos($x * $iMulti / 64 + $iSin) + 25 + $y * $2Multi, _
$2Multi * 1.1, _
$2Multi * 1.1)
Next
Next
$iFPS += 1
If TimerDiff($iTimer) > 1000 Then
$iTimer = TimerInit()
WinSetTitle($hGUI, '', 'XOR Textur (' & $iFPS & 'FPS - ' & $iSize & 'x' & $iSize & ')')
$xFPS = $iFPS
$iFPS = 0
EndIf
WM_PAINT()
EndFunc ;==>_XOR_Tex
Func WM_PAINT()
_GDIPlus_GraphicsDrawImage($hGFX, $hBMP, 0, 0)
EndFunc ;==>WM_PAINT
Func _Exit()
_GDIPlus_GraphicsDispose($hBUF)
_GDIPlus_BitmapDispose($hBMP)
_GDIPlus_GraphicsDispose($hGFX)
For $y = 0 To $iSize - 1
For $x = 0 To $iSize - 1
_GDIPlus_BitmapDispose($hBmps[$y][$x])
Next
Next
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit