Jump to content



Photo

Simple little zoomix ;)


  • Please log in to reply
10 replies to this topic

#1 Uriziel01

Uriziel01

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 281 posts

Posted 06 February 2008 - 03:13 AM

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 :)
Plain Text         
;# 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

Attached Files


Edited by Uriziel01, 06 February 2008 - 03:41 AM.

Posted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted Image





#2 Achilles

Achilles

    Achilles == Ichigo

  • Active Members
  • PipPipPipPipPipPip
  • 2,897 posts

Posted 06 February 2008 - 03:43 AM

Nice work! It works good... I think there have been a few of others of these that went a little faster, you might want to see what they did different so you can learn from it.

#3 Uriziel01

Uriziel01

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 281 posts

Posted 06 February 2008 - 03:48 AM

Thx. Yeah, slowest part of script is the GUICtrlSetBkColor. is there any faster edition of this func? :)
Posted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted ImagePosted Image

#4 Tukata

Tukata

    Adventurer

  • Active Members
  • PipPip
  • 115 posts

Posted 15 May 2008 - 05:14 AM

I like this tool very much.

Thank you
Tukata

Edited by Tukata, 15 May 2008 - 06:12 AM.


#5 Pirosoft

Pirosoft

    Seeker

  • Active Members
  • 11 posts

Posted 25 July 2008 - 05:20 PM

Hi, i have questions to understand your script, please read the comment and help me!
Plain Text         
;# 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

#6 sensalim

sensalim

    Polymath

  • Active Members
  • PipPipPipPip
  • 240 posts

Posted 25 July 2008 - 06:16 PM

It's nice but slow... and I can't close the program.

#7 monoceres

monoceres

    asdf

  • MVPs
  • 3,719 posts

Posted 25 July 2008 - 06:20 PM

Here's my version, it's a tiny bit faster...
Plain Text         
#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, 25 July 2008 - 06:21 PM.

Posted ImageIs the link in my post broken? I do not longer own my domain, all the files are moved to my new domain.Example: http://monoceres.se/test.au3 -> http://andhen.mine.nu/monoceres.se/test.au3

#8 sensalim

sensalim

    Polymath

  • Active Members
  • PipPipPipPip
  • 240 posts

Posted 25 July 2008 - 06:42 PM

No no no, it's not tiny bit faster - it's MUCH faster... and I can close the program.
Thanks to both of you!

#9 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 25 July 2008 - 07:16 PM

Or this one :P Changed Zoomix :P
AutoIt         
;# 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, 25 July 2008 - 07:22 PM.

*GERMAN* Posted Image [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

#10 Pirosoft

Pirosoft

    Seeker

  • Active Members
  • 11 posts

Posted 25 July 2008 - 07:28 PM

ok, it's faster, but is it possible have a image with greater definition like oneloupe?

oneloupe screenshot

#11 ProgAndy

ProgAndy

    You need AutoItObject

  • MVPs
  • 2,508 posts

Posted 25 July 2008 - 07:44 PM

Yes :P But I don't know, how to show the Screen BEHIND the zoomwindow.
AutoIt         
;# 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* Posted Image [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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users