Jump to content
Sign in to follow this  
Uriziel01

Simple little zoomix ;)

Recommended Posts

Hi ! :) I have some free time thin night and I have wrote something like magnifying glass. It have function of increasing (PAGE_UP) and decreasing (PAGE_DOWN) the level of zoom. have a nice fun :) p.s-oh yeah! You can also edit the souce code by removing those ";" to get some effects :)

;# Zoomix v0.1 by Uriziel01
#include <GUIConstants.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
$gui = GUICreate("Zoomix- x", 100, 100)
GUISetBkColor(0xEEEEEE)
GUISetState(@SW_SHOW)
$z1=4
$z2=120/$z1
$z3=120/$z1
Global $z2,$z3,$pos2,$pos3
Func start()
$z2=120/$z1
$z3=120/$z1
for $a=0 to $z3 step 1
for $i=0 to $z2 step 1
GUICtrlCreateLabel("",$i*$z1,$a*$z1,$z1,$z1)
Next
Next
_WinAPI_SetWindowText($gui, "Zoomix- x"&$z1)
EndFunc
$dll = DllOpen("user32.dll")
    $ii=0
    Start()
While 1
    $pos = MouseGetPos()
    if $pos[0] = $pos2 and $pos[1]=$pos3 then
    else
        If _IsPressed("21", $dll) and $z1 < 32  Then 
        for $dd=0 to 8000 step 1
            GUICtrlDelete($dd)
            next
        $z1=$z1*2
        start()
        endif
If _IsPressed("22", $dll) and $z1 > 2 Then
        for $dd=-1 to 10000/$z1 step 1
            GUICtrlDelete($dd)
            next
    $z1=$z1/2
start() 
    EndIf
    $pos2=$pos[0]
    $pos3=$pos[1]
for $a=0 to $z3 step 1
for $i=0 to $z2 step 1
    $ii=$ii+1
$var = PixelGetColor( $pos[0]+$i , $pos[1]+$a ); Normal zoomix mode
;$var=Random(99909999,99999999); random colors
;$var=Random(1,99999999);all colors
;$var=Random(9999,119999);Blue and Green
;$var=Random(1,9999);most dark blue

; This will make the image lighter
 #cs
$var=Hex($var)
$var = StringReplace($var, "E", "F")
$var = StringReplace($var, "D", "E")
$var = StringReplace($var, "B", "C")
$var = StringReplace($var, "A", "B")
$var = StringReplace($var, "9", "A")
$var = StringReplace($var, "8", "9")
$var = StringReplace($var, "7", "8")
$var = StringReplace($var, "6", "7")
$var = StringReplace($var, "5", "6")
$var = StringReplace($var, "4", "6")
$var = StringReplace($var, "3", "4")
$var = StringReplace($var, "2", "4")
$var = StringReplace($var, "1", "3")
$var = StringReplace($var, "0", "2")
$var=Dec($var)
#ce
GUICtrlSetBkColor($ii,$var)
Next
next
$ii=0
endif
sleep(10)
WEnd

Zoomix_v0.1.exe

Edited by Uriziel01

Share this post


Link to post
Share on other sites

Hi, i have questions to understand your script, please read the comment and help me!

;# Zoomix v0.1 by Uriziel01
#include <GUIConstants.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
$gui = GUICreate("Zoomix- x", 100, 100) //gui creation
GUISetBkColor(0xEEEEEE) //background gui
GUISetState(@SW_SHOW)
$z1=4  //zoom factor - it's right?
$z2=120/$z1  // why 120? 120/4 = 30
$z3=120/$z1
Global $z2,$z3,$pos2,$pos3
Func start()
$z2=120/$z1
$z3=120/$z1
for $a=0 to $z3 step 1
for $i=0 to $z2 step 1
GUICtrlCreateLabel("",$i*$z1,$a*$z1,$z1,$z1) // you create 30*30=900  label  4pixel*4pixel   it's right?
Next
Next
_WinAPI_SetWindowText($gui, "Zoomix- x"&$z1)
EndFunc
$dll = DllOpen("user32.dll")
    $ii=0
    Start()
While 1
    $pos = MouseGetPos();mouse position
    if $pos[0] = $pos2 and $pos[1]=$pos3 then
    else
        If _IsPressed("21", $dll) and $z1 < 32  Then  //ip press pageup the zoomfactor = zoomfactor*2
        for $dd=0 to 8000 step 1    ; why 8000? i don't understand this number
            GUICtrlDelete($dd)
            next
        $z1=$z1*2
        start()
        endif
If _IsPressed("22", $dll) and $z1 > 2 Then
        for $dd=-1 to 10000/$z1 step 1; why 10000/4? i don't understand this number to!
            GUICtrlDelete($dd)
            next
    $z1=$z1/2
start() 
    EndIf
    $pos2=$pos[0]
    $pos3=$pos[1]
for $a=0 to $z3 step 1
for $i=0 to $z2 step 1
    $ii=$ii+1
$var = PixelGetColor( $pos[0]+$i , $pos[1]+$a ); Normal zoomix mode
;$var=Random(99909999,99999999); random colors
;$var=Random(1,99999999);all colors
;$var=Random(9999,119999);Blue and Green
;$var=Random(1,9999);most dark blue

; This will make the image lighter
 #cs
$var=Hex($var)
$var = StringReplace($var, "E", "F")
$var = StringReplace($var, "D", "E")
$var = StringReplace($var, "B", "C")
$var = StringReplace($var, "A", "B")
$var = StringReplace($var, "9", "A")
$var = StringReplace($var, "8", "9")
$var = StringReplace($var, "7", "8")
$var = StringReplace($var, "6", "7")
$var = StringReplace($var, "5", "6")
$var = StringReplace($var, "4", "6")
$var = StringReplace($var, "3", "4")
$var = StringReplace($var, "2", "4")
$var = StringReplace($var, "1", "3")
$var = StringReplace($var, "0", "2")
$var=Dec($var)
#ce
GUICtrlSetBkColor($ii,$var)
Next
next
$ii=0
endif
sleep(10)
WEnd

thanks for your help!

Francesco

Share this post


Link to post
Share on other sites

Here's my version, it's a tiny bit faster...

#include <GUIConstants.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
HotKeySet("{NUMPADADD}","_ZoomIn")
HotKeySet("{NUMPADSUB}","_ZoomOut")

Opt("GUIOnEventMode",1)
Global $zoomwidth=30, $zoomheight=30
Global $width=200,$height=200


$hwnd=GUICreate("Zoom Zoom",$width,$height)
GUISetOnEvent(-3,"close")

GUISetState()

_GDIPlus_Startup()
$graphics=_GDIPlus_GraphicsCreateFromHWND($hwnd)



Do
    
    $pos=MouseGetPos()
    $hbitmap=_ScreenCapture_Capture("",$pos[0]-$zoomwidth/2,$pos[1]-$zoomheight/2,$pos[0]+$zoomwidth/2,$pos[1]+$zoomheight/2,False)
    $bitmap=_GDIPlus_BitmapCreateFromHBITMAP($hbitmap)
    _GDIPlus_GraphicsDrawImageRectRect($graphics,$bitmap,0,0,$zoomwidth,$zoomheight,0,0,$width,$height)
    _WinAPI_DeleteObject($hbitmap)
    _WinAPI_DeleteObject($bitmap)
    Sleep(25)
Until False


Func close()
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_SHutdown()
    Exit
EndFunc

Func _ZoomIn()
    If $zoomheight<=1 Then Return
    $zoomheight-=1
    $zoomwidth-=1
EndFunc

Func _ZoomOut()
    $zoomheight+=1
    $zoomwidth+=1
EndFunc
Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

Or this one :P Changed Zoomix :P

;# Zoomix v0.1 by Uriziel01 and Prog@ndy
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
Opt("GUIOnEventMode",1)
$SIZE = 120
$gui = GUICreate("Zoomix", $SIZE, $SIZE,-1,-1,BitOR($WS_SYSMENU,$WS_BORDER,$WS_CAPTION),$WS_EX_TOPMOST)
GUISetOnEvent(-3,"_EXIT")

GUISetBkColor(0xEEEEEE)
GUISetState(@SW_SHOW)
$z1=4
$zoomp = Int($SIZE / $z1)
Global $pos2,$pos3
Func start()
_WinAPI_SetWindowText($gui, "Zoomix- x"&$z1)
$zoomp = Int($SIZE / $z1)
EndFunc
$DeskDC = _WinAPI_GetDC(0)
$MyDC = _WinAPI_GetDC($gui)
_WinAPI_SetBkMode($MyDC,1) ; Transparent Backgrounds smile.gif
$Brush = _WinAPI_CreateSolidBrush(0)
$s = DllStructCreate($tagRECT)
DllStructSetData($s,1,$SIZE/2-1)
DllStructSetData($s,2,0)
DllStructSetData($s,3,$SIZE/2+1)
DllStructSetData($s,4,$SIZE)
$ps1 = DllStructGetPtr($s)

$dll = DllOpen("user32.dll")

$s2 = DllStructCreate($tagRECT)
DllStructSetData($s2,1,0)
DllStructSetData($s2,2,$SIZE/2-1)
DllStructSetData($s2,3,$SIZE)
DllStructSetData($s2,4,$SIZE/2+1)
$ps2 = DllStructGetPtr($s2)
$s3 = DllStructCreate($tagRECT)
DllStructSetData($s3,1,1)
DllStructSetData($s3,2,0)
DllStructSetData($s3,3,50)
DllStructSetData($s3,4,50)
$ps3 = DllStructGetPtr($s2)

    $ii=0
    Start()
While 1
    $pos = MouseGetPos()
    If _IsPressed("21", $dll) and $z1 < 32  Then
        $z1=$z1*2
        start()
        Do
            Sleep(10)
        Until Not _IsPressed("21", $dll)
        $pos2 = -1
    endif
    If _IsPressed("22", $dll) and $z1 > 2 Then
        $z1=$z1/2
        start()
    Do
            Sleep(10)
        Until Not _IsPressed("22", $dll)
        $pos2 = -1
    EndIf
    if $pos[0] = $pos2 and $pos[1]=$pos3 then
    else
    $pos2=$pos[0]
    $pos3=$pos[1]
_WinAPI_stretchBlt($MyDC,0,0,$SIZE,$SIZE,$DeskDC,$pos2-($zoomp/2),$pos3-($zoomp/2),$zoomp,$zoomp,$SRCCOPY)

_WinAPI_FillRect($MyDC,$ps1,$Brush)
_WinAPI_FillRect($MyDC,$ps2,$Brush)
_WinAPI_DrawText($MyDC,"x" & $z1,$s3,0)
If @error Then MsgBox(0, '', @error)
endif
sleep(10)
WEnd
Func _EXIT()
   Exit
EndFunc
Func OnAutoItExit()
    _WinAPI_ReleaseDC(0,$DeskDC)
    _WinAPI_ReleaseDC($gui,$MyDC)
    _WinAPI_DeleteObject($Brush)
EndFunc

;Author(s) : Prog@ndy, after _WinAPI_BitBlt
Func _WinAPI_stretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP)
    Local $aResult

    $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _
            "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc,"int",$iWidthSrc,"int",$iHeightSrc, "int", $iROP)
    If @error Then Return SetError(@error, 0, False)
    Return $aResult[0] <> 0
EndFunc   ;==>_WinAPI_BitBlt

;Author(s) : Prog@ndy, after _WinAPI_SetBKColor
Func _WinAPI_SetBkMode($hDC, $imode)
    Local $aResult

    $aResult = DllCall("GDI32.dll", "int", "SetBkMode", "hwnd", $hDC, "int", $imode)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetBkColor
Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Yes :P But I don't know, how to show the Screen BEHIND the zoomwindow.

;# Zoomix v0.1 by Uriziel01 and Prog@ndy
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <WinAPI.au3>
Opt("GUIOnEventMode",1)
$SIZEX = 500 ; Width 
$SIZEY = 300 ; Height
;~ $SIZEX = 100 ; Width 
;~ $SIZEY = 100 ; Height
$gui = GUICreate("Zoomix", $SIZEX, $SIZEY,-1,-1,BitOR($WS_SYSMENU,$WS_BORDER,$WS_CAPTION),$WS_EX_TOPMOST)
GUISetOnEvent(-3,"_EXIT")

GUISetBkColor(0xEEEEEE)
GUISetState(@SW_SHOW)
$z1=4
$zoomX = Int($SIZEX / $z1)
$zoomY = Int($SIZEY / $z1)
Global $pos2,$pos3
Func start()
_WinAPI_SetWindowText($gui, "Zoomix- x"&$z1)
$zoomX = Int($SIZEX / $z1)
$zoomY = Int($SIZEY / $z1)
EndFunc
$DeskDC = _WinAPI_GetDC(0)
$MyDC = _WinAPI_GetDC($gui)
_WinAPI_SetBkMode($MyDC,1) ; Transparent Backgrounds smile.gif
$Brush = _WinAPI_CreateSolidBrush(0)
$s = DllStructCreate($tagRECT)
DllStructSetData($s,1,$SIZEX/2-1)
DllStructSetData($s,2,0)
DllStructSetData($s,3,$SIZEX/2+1)
DllStructSetData($s,4,$SIZEY)
$ps1 = DllStructGetPtr($s)

$dll = DllOpen("user32.dll")

$s2 = DllStructCreate($tagRECT)
DllStructSetData($s2,1,0)
DllStructSetData($s2,2,$SIZEY/2-1)
DllStructSetData($s2,3,$SIZEX)
DllStructSetData($s2,4,$SIZEY/2+1)
$ps2 = DllStructGetPtr($s2)
$s3 = DllStructCreate($tagRECT)
DllStructSetData($s3,1,1)
DllStructSetData($s3,2,0)
DllStructSetData($s3,3,50)
DllStructSetData($s3,4,50)
$ps3 = DllStructGetPtr($s2)

    $ii=0
    Start()
While 1
    $pos = MouseGetPos()
    If _IsPressed("21", $dll) and $z1 < 32  Then
        $z1=$z1*2
        start()
        Do
            Sleep(10)
        Until Not _IsPressed("21", $dll)
        $pos2 = -1
    endif
    If _IsPressed("22", $dll) and $z1 > 1 Then
        $z1=$z1/2
        start()
    Do
            Sleep(10)
        Until Not _IsPressed("22", $dll)
        $pos2 = -1
    EndIf
    if $pos[0] = $pos2 and $pos[1]=$pos3 then
    else
    $pos2=$pos[0]
    $pos3=$pos[1]
_WinAPI_stretchBlt($MyDC,0,0,$SIZEX,$SIZEY,$DeskDC,$pos2-($zoomX/2),$pos3-($zoomY/2),$zoomX,$zoomY,$SRCCOPY)

_WinAPI_FillRect($MyDC,$ps1,$Brush)
_WinAPI_FillRect($MyDC,$ps2,$Brush)
_WinAPI_DrawText($MyDC,"x" & $z1,$s3,0)
If @error Then MsgBox(0, '', @error)
endif
sleep(10)
WEnd
Func _EXIT()
   Exit
EndFunc
Func OnAutoItExit()
    _WinAPI_ReleaseDC(0,$DeskDC)
    _WinAPI_ReleaseDC($gui,$MyDC)
    _WinAPI_DeleteObject($Brush)
EndFunc

;Author(s) : Prog@ndy, after _WinAPI_BitBlt
Func _WinAPI_stretchBlt($hDestDC, $iXDest, $iYDest, $iWidth, $iHeight, $hSrcDC, $iXSrc, $iYSrc, $iWidthSrc, $iHeightSrc, $iROP)
    Local $aResult

    $aResult = DllCall("GDI32.dll", "int", "StretchBlt", "hwnd", $hDestDC, "int", $iXDest, "int", $iYDest, "int", $iWidth, "int", $iHeight, _
            "hwnd", $hSrcDC, "int", $iXSrc, "int", $iYSrc,"int",$iWidthSrc,"int",$iHeightSrc, "int", $iROP)
    If @error Then Return SetError(@error, 0, False)
    Return $aResult[0] <> 0
EndFunc   ;==>_WinAPI_BitBlt

;Author(s) : Prog@ndy, after _WinAPI_SetBKColor
Func _WinAPI_SetBkMode($hDC, $imode)
    Local $aResult

    $aResult = DllCall("GDI32.dll", "int", "SetBkMode", "hwnd", $hDC, "int", $imode)
    Return $aResult[0]
EndFunc   ;==>_WinAPI_SetBkColor

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...