;Coded by UEZ 2010 Build 2010-08-31
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_Run_After=del /f /q "Zoomer_Obfuscated.au3"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#include <GDIP.au3>
#include <GUIConstantsEx.au3>

Opt("MustDeclareVars", 1)
Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode", 1)

Local $hGUI, $hGraphics, $hBackbuffer, $hBitmap, $hBuffer, $hContext
Local $W = 800, $H = $W
Local $W2 = $W / 2, $H2 = $H / 2
; Initialize GDI+
_GDIPlus_Startup()

Local $GUI_title = "GDI+ Zoomer by UEZ 2010"
$hGUI = GUICreate($GUI_title, $W, $H)
GUISetBkColor(0x000000, $hGUI)
GUISetState()

$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI)
$hBitmap = _GDIPlus_BitmapCreateFromGraphics($W, $H, $hGraphics)
$hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
; Using antialiasing
_GDIPlus_GraphicsSetSmoothingMode($hBackbuffer, 2)


; Create a Brush object
Local $hBrush = _GDIPlus_BrushCreateSolid()
Local $hPen = _GDIPlus_PenCreate(0xA0000000, 2)

GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

Local $p = 40
Local $k = 40
Local $ps = $p / 10
Local $t = 0
Local $min = 8
Local $mouse_sense = 5
Local $i, $mpos, $fps, $cx, $cy, $pp

$hBuffer = _GDIPlus_BitmapCreateFromScan0($W, $H)
$hContext = _GDIPlus_ImageGetGraphicsContext($hBuffer)
_GDIPlus_GraphicsTranslateTransform($hContext, -23, -23)
_GDIPlus_GraphicsScaleTransform($hContext, 1.05, 1.05)
_GDIPlus_GraphicsSetInterpolationMode($hContext, 0)

MouseMove(@DesktopWidth / 2, @DesktopHeight / 2, 20)

WinSetTitle($hGUI, "", $GUI_title & " / FPS: 0")

AdlibRegister("FPS", 1000)
Local $timer = TimerInit()
While Sleep(20)
	_GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hBuffer, 0, 0, $W, $H)

	$mpos = MouseGetPos()
	If $mpos[0] / $mouse_sense > $min Then $p = $mpos[0] / $mouse_sense
	If $mpos[1] / $mouse_sense > $min Then $k = $mpos[1] / $mouse_sense

	For $i = 0 To 4
		_GDIPlus_BrushSetSolidColor($hBrush, "0x80FFFFFF")
		_GDIPlus_PenSetWidth($hPen, $ps)
		$pp = $p / 2
		$cx = $W2 - $pp + Sin($t / 15 + $i * 1.3) * $k
		$cy = $W2 - $pp + Cos($t / 23 - $i * 2.3) * $k
		_GDIPlus_GraphicsDrawEllipse($hBackbuffer, $cx , $cy, $p, $p, $hPen)
		_GDIPlus_GraphicsFillEllipse($hBackbuffer, $cx , $cy, $p, $p, $hBrush)
	Next
	$t += 3
	If TimerDiff($timer) > Random(5000, 15000, 1) Then
		_GDIPlus_GraphicsDrawString($hBackbuffer, "Coded by UEZ 2010", Random($W * 0.7, $W * 0.9, 1), Random($H * 0.33, $H * 0.66, 1), "Arial", 40, 1)
		$timer = TimerInit()
	EndIf

	_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $W, $H)
	_GDIPlus_GraphicsDrawImageRect($hContext, $hBitmap, 0, 0, $W, $H)

	$fps += 1

WEnd

Func FPS()
	WinSetTitle($hGUI, "", $GUI_title & " / FPS: " & $fps)
	$fps = 0
EndFunc

Func _Exit()
	AdlibUnRegister("FPS")
	; Clean up
	_GDIPlus_BrushDispose($hBrush)
	_GDIPlus_PenDispose($hPen)
	_GDIPlus_BitmapDispose($hBuffer)
	_GDIPlus_GraphicsDispose($hContext)
	_GDIPlus_BitmapDispose($hBitmap)
	_GDIPlus_GraphicsDispose($hBackbuffer)
	_GDIPlus_GraphicsDispose($hGraphics)

	; Uninitialize GDI+
	_GDIPlus_Shutdown()
	GUIDelete($hGUI)
	Exit
EndFunc