Ein kleines Script, welches eine Remap-Tabelle benutzt.
In diesem Fall werden Graustufen in verschiedene Farben umgewandelt.
AutoIt
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Global $iRadius = 60
Global $iAlpha = 0x20
Global $iWidth = @DesktopWidth
Global $iHeight = @DesktopHeight
Global $hGDIP = _GDIPlus_Startup()
Global $hGui = GUICreate("", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
Global $tLayered = DllStructCreate("int X; int Y; int W; int H; int Src[2]; byte Blend[4];")
$tLayered.Blend(3) = 0xFF
$tLayered.Blend(4) = 1
$tLayered.W = $iWidth
$tLayered.H = $iHeight
Global $hDC = _WinAPI_GetDC($hGui)
Global $hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight)
Global $hBMP = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
_GDIPlus_BitmapDispose($hBitmap)
Global $hCDC = _WinAPI_CreateCompatibleDC($hDC)
Global $hOBJ = _WinAPI_SelectObject($hCDC, $hBMP)
Global $hGraphics = _GDIPlus_GraphicsCreateFromHDC($hCDC)
$hBitmap = _GDIPlus_BitmapCreateFromScan0($iWidth, $iHeight, $GDIP_PXF32RGB)
Global $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
;_GDIPlus_GraphicsSetSmoothingMode($hContext, 2)
Global $hImgAttr = _CalcRemapTable()
Global $hPath = _GDIPlus_PathCreate()
_GDIPlus_PathAddEllipse($hPath, -$iRadius, -$iRadius, $iRadius * 2, $iRadius * 2)
Global $hBrush = _GDIPlus_PathBrushCreateFromPath($hPath)
_GDIPlus_PathDispose($hPath)
_GDIPlus_PathBrushSetCenterColor($hBrush, BitOR(0x00FFFFFF, BitShift($iAlpha, -24)))
_GDIPlus_PathBrushSetSurroundColor($hBrush, 0)
GUISetState()
While Sleep(10)
_DrawHeatMap()
_WinAPI_UpdateLayeredWindow($hGui, $hDC, DllStructGetPtr($tLayered, "X"), DllStructGetPtr($tLayered, "W"), $hCDC, DllStructGetPtr($tLayered, "Src"), 0, DllStructGetPtr($tLayered, "Blend"), 2)
WEnd
Func _DrawHeatMap()
Local Static $iMXOld, $iMYOld
Local $iMX = MouseGetPos(0)
Local $iMY = MouseGetPos(1)
If $iMX <> $iMXOld Or $iMY <> $iMYOld Then
_GDIPlus_GraphicsTranslateTransform($hContext, $iMX, $iMY)
_GDIPlus_GraphicsFillEllipse($hContext, -$iRadius, -$iRadius, $iRadius * 2, $iRadius * 2, $hBrush)
_GDIPlus_GraphicsResetTransform($hContext)
EndIf
_GDIPlus_GraphicsSetClipRect($hGraphics, $iMX - $iRadius, $iMY - $iRadius, $iRadius * 2, $iRadius * 2)
_GDIPlus_GraphicsClear($hGraphics, 0)
_GDIPlus_GraphicsDrawImageRectRect($hGraphics, $hBitmap, $iMX - $iRadius, $iMY - $iRadius, $iRadius * 2, $iRadius * 2, $iMX - $iRadius, $iMY - $iRadius, $iRadius * 2, $iRadius * 2, $hImgAttr)
_GDIPlus_GraphicsResetClip($hGraphics)
$iMXOld = $iMX
$iMYOld = $iMY
EndFunc ;==>_DrawHeatMap
Func _CalcRemapTable()
Local $tColorMap = DllStructCreate("uint[512];")
Local $iGrey, $iColor, $iTmp, $iR, $iB, $iG
For $i = 0 To 255 Step 1
Switch $i
Case 235 To 255
$iTmp = 255 - $i
$iR = 255 - $iTmp
$iG = $iTmp * 12
$iB = 0
Case 200 To 234
$iTmp = 234 - $i
$iR = 255 - ($iTmp * 8)
$iG = 255
$iB = 0
Case 150 To 199
$iTmp = 199 - $i
$iR = 0
$iG = 255
$iB = $iTmp * 5
Case 100 To 149
$iTmp = 149 - $i
$iR = 0
$iG = 255 - ($iTmp * 5)
$iB = 255
Case Else
$iR = 0
$iG = 0
$iB = 255
EndSwitch
If $iR < 0 Then $iR = 0
If $iR > 0xFF Then $iR = 0xFF
If $iG < 0 Then $iG = 0
If $iG > 0xFF Then $iG = 0xFF
If $iB < 0 Then $iB = 0
If $iB > 0xFF Then $iB = 0xFF
$iColor = BitOR(BitShift($i, -24), BitShift($iR, -16), BitShift($iG, -8), $iB)
$iGrey = BitOR(0xFF000000, BitShift($i, -16), BitShift($i, -8), $i)
DllStructSetData($tColorMap, 1, $iGrey, $i * 2 + 1)
DllStructSetData($tColorMap, 1, $iColor, $i * 2 + 2)
Next
Local $hImgAttr = _GDIPlus_ImageAttributesCreate()
DllCall($hGDIP, "uint", "GdipSetImageAttributesRemapTable", "handle", $hImgAttr, "int", 0, "int", 1, "int", 256, "struct*", $tColorMap)
Return $hImgAttr
EndFunc ;==>_CalcRemapTable
Func _Exit()
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_ImageAttributesDispose($hImgAttr)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hGraphics)
_WinAPI_SelectObject($hCDC, $hOBJ)
_WinAPI_DeleteObject($hBMP)
_WinAPI_DeleteDC($hCDC)
_WinAPI_ReleaseDC($hGui, $hDC)
GUIDelete($hGui)
_GDIPlus_Shutdown()
Exit
EndFunc ;==>_Exit
Alles anzeigen