;Coded by UEZ 2010-01-10
#include <GDIplus.au3>
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
Global $load_foreground = _GDIPlus_BitmapCreateFromFile(@ScriptDir & "\1.jpg")
Global $width =680; _GDIPlus_ImageGetWidth($load_background)
Global $height =680; _GDIPlus_ImageGetHeight($load_background)
Global $dx = 680; _GDIPlus_ImageGetWidth($load_foreground)
Global $dy = 680; _GDIPlus_ImageGetHeight($load_foreground)
Global $hWnd = GUICreate("GDI+: Example by UEZ", $width, $height);, -1, -1, Default)
GUISetOnEvent(-3, "_Exit")
GUISetState()
Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
Global $hBitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $hGraphics)
Global $hBackbuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
Global $hFGBitmap = _GDIPlus_BitmapCreateFromGraphics($dx, $dy, $hGraphics)
Global $hFGBackbuffer = _GDIPlus_ImageGetGraphicsContext($hFGBitmap)
Global $hMatrix = _GDIPlus_MatrixCreate()
_GDIPlus_MatrixTranslate($hMatrix, $dx/2 , $dy/2 )
Global $FG_x = 150
Global $FG_y = 150
Global $V = 2 ; 2 ; 2 ; 2 ; 2 ; 2 ;; 2 ; 35 ; 62 ; 74 ; 96
Global $Q = 2 ; 35 ; 62 ; 74 ; 96 ;; 2 ; 2 ; 2 ; 2 ; 2 ; 2
While Sleep(100)
_GDIPlus_GraphicsSetTransform($hFGBackbuffer, $hMatrix)
_GDIPlus_GraphicsDrawImage($hFGBackbuffer, $load_foreground, -$dx /2, -$dy/2)
_GDIPlus_GraphicsDrawImageRect($hBackbuffer, $hFGBitmap, $FG_x, $FG_y, $dx/$V, $dy/$Q) ;copy foreground backbuffer to main backbuffer
_GDIPlus_GraphicsDrawImageRect($hGraphics, $hBitmap, 0, 0, $width, $height) ;copy full drawn image to main screen
WEnd
Func _Exit()
_GDIPlus_BitmapDispose($hFGBitmap)
_GDIPlus_GraphicsDispose($hFGBackbuffer)
_GDIPlus_MatrixDispose($hMatrix)
_GDIPlus_BitmapDispose($hBitmap)
_GDIPlus_GraphicsDispose($hBackbuffer)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Exit
EndFunc