Jump to content
Sign in to follow this  

confused in gdiplus and resizing imgaes

Recommended Posts



okay i have this code that i bitblt the screen ,put it on the gui and blur it

all on the fly ,but the code show the image magnified , don't ask me how

anyway here's the code

 #include <WinAPI.au3>
 #include <GDIPlus.au3>
 #include <Constants.au3>
 #include <SendMessage.au3>
 #include <GuiConstants.au3>
 #include <GUIConstantsEx.au3>
 #include <WindowsConstants.au3>
 Global Const $WS_EX_COMPOSITED = 0x2000000
 Global Const $WM_MOVING = 0x0216
 Global Const $WM_EXITSIZEMOVE  = 0x0232
 Global Const $WM_ENTERSIZEMOVE = 0x0231
 $handle = GUICreate("Trial", 600, 500, 100, 100, $WS_CLIPCHILDREN + $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_COMPOSITED))
 $pic2 = GUICtrlCreatePic(@ScriptDir & "\top.bmp", 0, 0, 100, 100, -1, $GUI_WS_EX_PARENTDRAG)
 $pic = GUICtrlCreatePic("", 0, 0, 600, 500, -1, $GUI_WS_EX_PARENTDRAG)
 WinSetOnTop($handle, "", 1)
 _WinAPI_SetLayeredWindowAttributes($handle, 0x4FBB00C7)
 $hwnd = GUICtrlGetHandle($pic)
 $tohdc = _WinAPI_GetDC($hwnd)
 $FromDC = _WinAPI_GetDC(0)
 $Pos = WinGetPos($handle)
 Local $width = $Pos[2], $height = $Pos[3] , $nRatio = 3 , $iInterMode = 6
 $hScreenGraph = _GDIPlus_GraphicsCreateFromHDC($tohdc)
 $hImg = _GDIPlus_BitmapCreateFromGraphics($width, $height,$hScreenGraph)
 $hImg2 = _GDIPlus_BitmapCloneArea($hImg, 0, 0, $width/$nRatio, $height/$nRatio)
 $hMemGraph = _GDIPlus_ImageGetGraphicsContext($hImg2)
 $a = DllCall("gdiplus.dll", "int", "GdipSetInterpolationMode", "hwnd", $hMemGraph, "int", $iInterMode)
 $a = DllCall("gdiplus.dll", "int", "GdipSetInterpolationMode", "hwnd", $hScreenGraph, "int", $iInterMode)
 $ToDC = _GDIPlus_GraphicsGetDC($hScreenGraph)
 $ToDC2 = _GDIPlus_GraphicsGetDC($hMemGraph)
 _WinAPI_BitBlt($ToDC, 0, 0, $Pos[2], $Pos[3], $FromDC, $Pos[0], $Pos[1], $SRCCOPY)
 _WinAPI_BitBlt($ToDC2, 0, 0, $Pos[2], $Pos[3], $FromDC, $Pos[0], $Pos[1], $SRCCOPY)
 _GDIPlus_GraphicsReleaseDC($hScreenGraph, $ToDC)
 _GDIPlus_GraphicsReleaseDC($hMemGraph, $ToDC2)
 _GDIPlus_GraphicsDrawImageRectRect($hMemGraph, $hImg, 0, 0, $width, $height, 0, 0, $width/$nRatio, $height/$nRatio)
 _GDIPlus_GraphicsDrawImageRectRect($hScreenGraph, $hImg2, 0, 0, $width/$nRatio, $height/$nRatio, 0, 0, $width, $height)
 Until GUIGetMsg() = -3
Edited by komalo

[font="Palatino Linotype"][size="3"]AutoIt Script Examples :[/size][/font][font="Palatino Linotype"][size="3"]_CaptureBehindWindowGlass CMD for Windows Vista/Seven[/size][/font][left][/left][font="Palatino Linotype"][size="3"]Non AutoIt Script programs : Border Skin - Aero Glass On XP[/size][/font]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this