Jump to content

Search the Community

Showing results for tags 'lens'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • Forum FAQ
  • AutoIt

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. I'm again on a script that simulates a lens on the screen, >here my previous effort that works quite well but only in one mode, that is: it magnifies the area around the mouse while you move it and it shows the zoomed area into the "lens" window that stays somewhere on the screen. In the new mode that I would like to achieve, should be magnifyed the area that lies behind the "lens" window and when you move that window it should magnify what's behind it. Unfortunately here arises the problem, the magnifier magnifies itself recursively, (because it capture the surface of the "lens" itself and not what's behind) with the unwanted result of a zoom area that seems empty. To see the unwanted effect, just change the value of the variable $bFollowMouse from True to False anf then move the "magnifier" window around. (the problem is that the function _ScreenCapture_Capture() should be able to capture behind a window) (I wish the function _ScreenCapture_Capture() where able to capture behind a window) My question is: Is there a way to read the content that lies behind the "lens" window? (hopefully avoiding ways like turn off the "lens" windows, make the SnapShot of what's behind, and turn on the "lens" window again, that should result in an ugly flickering effect) any advise is welcome, thanks Here the listing: #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WinAPI.au3> Global Const $iWidth = 400, $iHeight = 200 ; lens (window) dimensions Global $iMagnify = 5 ; zoom factor Global $bCaptureCursor = False ; If True the cursor will be captured with the image Global $bFollowMouse = True ; If true, magnifies at mouse position by following it ; If false, magnifies portion of screen behind lens (behind the window) ; Global $g_hGUI, $g_hGfxCtxt, $g_hBitmap, $g_hGraphics Global $aLensDim[2], $aViewFinder[2], $CaptureX = $iWidth / ($iMagnify * 2), $CaptureY = $iHeight / ($iMagnify * 2) Example() Func Example() AutoItSetOption("GUIOnEventMode", 1) _GDIPlus_Startup() ;initialize GDI+ $g_hGUI = GUICreate("Magnifier", $iWidth, $iHeight, -1, -1, -1, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW) $aLensDim = WinGetClientSize($g_hGUI) $idPic = GUICtrlCreatePic("", 0, 0, $aLensDim[0], $aLensDim[1], -1, $GUI_WS_EX_PARENTDRAG) ; jast as background to allow drag by client area GUISetState(@SW_SHOW) ;create buffered graphics frame set for smoother gfx object movements $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) ;create a graphics object from a window handle $g_hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $g_hGraphics) $g_hGfxCtxt = _GDIPlus_ImageGetGraphicsContext($g_hBitmap) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Local $g_hBitmap2 = 0 Do $g_hBitmap2 = SnapShot() _GDIPlus_GraphicsClear($g_hGfxCtxt, 0xFF000000) ;clear bitmap for repaint _GDIPlus_GraphicsDrawImage($g_hGfxCtxt, $g_hBitmap2, 0, 0) ;draw bitmap to backbuffer _GDIPlus_GraphicsDrawImageRect($g_hGraphics, $g_hBitmap, 0, 0, $iWidth, $iHeight) ;copy drawn bitmap to graphics handle (GUI) _GDIPlus_BitmapDispose($g_hBitmap2) Until Not Sleep(10) ;sleep 10 ms to avoid high cpu usage EndFunc ;==>Example Func SnapShot() If $bFollowMouse Then ; take snapshot around the mouse $aViewFinder = MouseGetPos() Else ; take the snapshot behind the "lens" <-------------- this will capture the surface of the lens not what's behind <----------------- $aViewFinder = _WinAPI_GetClientScreenPos($g_hGUI) $aViewFinder[0] = $aViewFinder[0] + ($aLensDim[0] / 2) $aViewFinder[1] = $aViewFinder[1] + ($aLensDim[1] / 2) EndIf ; Capture region (at mouse position or behind the lens) $hHBITMAP = _ScreenCapture_Capture("", $aViewFinder[0] - $CaptureX, $aViewFinder[1] - $CaptureY, $aViewFinder[0] + $CaptureX, $aViewFinder[1] + $CaptureY, $bCaptureCursor) ; http://www.autoitscript.com/forum/topic/130856-enlargezoom-image-after-screencapture/?p=910694 ; Create a Bitmap object from the bitmap handle $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hHBITMAP) ; Dispose of the original capture since we now have a bitmap image we can use with GDIPlus. _WinAPI_DeleteObject($hHBITMAP) ; Get the graphics context of the bitmap image. $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) ; Creates a new Bitmap object based on the Graphic object with a new width and height. $hHBITMAP = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic) ; Dispose of the Graphic context now we have a newly sized bitmap image as a canvas. _GDIPlus_GraphicsDispose($hGraphic) ; Get the graphics context of the newly sized bitmap image $hGraphic = _GDIPlus_ImageGetGraphicsContext($hHBITMAP) ; Draw the original image onto the newly sized image. _GDIPlus_GraphicsDrawImageRect($hGraphic, $hImage, 0, 0, $iWidth, $iHeight) ; 200, 200) ; Dispose of the Graphic context now we have drawn the original image to it. _GDIPlus_GraphicsDispose($hGraphic) ; Dispose of the original image. _GDIPlus_ImageDispose($hImage) Return ($hHBITMAP) EndFunc ;==>SnapShot Func _Exit() ;cleanup GDI+ resources _GDIPlus_GraphicsDispose($g_hGfxCtxt) _GDIPlus_GraphicsDispose($g_hGraphics) _GDIPlus_BitmapDispose($g_hBitmap) _GDIPlus_Shutdown() GUIDelete($g_hGUI) Exit EndFunc ;==>_Exit ; #FUNCTION# ==================================================================================================================== ; http://www.autoitscript.com/forum/topic/107966-window-space-position-size/?p=761415 ; Name...........: _WinAPI_GetClientScreenPos ; Description ...: Returns the onscreen x y of a client area of a window. ; Syntax.........: _WinAPI_GetClientScreenPos($hWindow) ; Parameters ....: $hWindow - Identifies an open handle to a window ; Return values .: Success - Array ; [0] x ; [2] y ; Failure - False ; Author ........: Nemcija ; Remarks .......: For minimized windows values wouldn't be correct! ; Related .......: _WinAPI_GetClientRect ; =============================================================================================================================== Func _WinAPI_GetClientScreenPos($hWindow) Local $tLocalClientRect, $tPoint, $aiReturnValue[2] $tLocalClientRect = _WinAPI_GetClientRect($hWindow) If @error Then Return SetError(@error, @extended, False) $tPoint = DllStructCreate("int X;int Y") DllStructSetData($tPoint, "X", DllStructGetData($tLocalClientRect, "Left")) DllStructSetData($tPoint, "Y", DllStructGetData($tLocalClientRect, "Top")) _WinAPI_ClientToScreen($hWindow, $tPoint) If @error Then Return SetError(@error, @extended, False) $aiReturnValue[0] = DllStructGetData($tPoint, "X") $aiReturnValue[1] = DllStructGetData($tPoint, "Y") Return $aiReturnValue EndFunc ;==>_WinAPI_GetClientScreenPos
×
×
  • Create New...