clearguy 0 Posted November 30, 2006 Hi, Here is my very basic script to zoom on an image.Z to zoomS to unzoomright to move right,left...,up to move up, down to...Take this image:http://veimages.gsfc.nasa.gov/2429/globe_east_2048.jpgRename it to terre.jpg.Put the script and that image in the same Dir, and let's zoom .SCRIPT:expandcollapse popup; 8--8 888-8-888-88-88 8--8 ;88-8-88-888-888-8888-888-888888888888--8888888 ; 8 ; - ; ZooMa-ZooMa-ZooMa-ZooMa-ZooMa-ZooMa-ZooMa 8 ; 8 ; Script to zoom on images - ; by Clearguy 8 ; V. - ; 8 ;88888-88-888-88-88-88-8888-888888-8-8-88-8888 ; 8-8- 8-88-8-888-8-88-8 88-- #include <GUIConstants.au3> $hGUI=GUICreate("Zoomah",500,500) GUISetState() Global $CoordGUI2[2] $CoordGUI2[0]=40 $CoordGUI2[1]=60 Global $Center[2] $Center[0]=200 $Center[1]=200 $h_cGUI=GUICreate("Child GUI", 400, 400, 40, 60, $WS_CHILD+$WS_HSCROLL+$WS_VSCROLL, $WS_EX_CLIENTEDGE, $hGUI) $n=GUICtrlCreatePic(@WorkingDir&'\terre.jpg',0,0, 2048,2048) GUICtrlSetPos($n,0,0,400,400) GUISetState() GUISwitch($hGUI) HotKeySet("z", "zoom") HotKeySet("s", "unzoom") HotKeySet("{DOWN}", "down") HotKeySet("{UP}", "up") HotKeySet("{LEFT}", "left") HotKeySet("{RIGHT}", "right") Global $Size=400,$rl=0,$top=0,$ZoomPercent=1.1 Global $x,$X,$y,$Y,$DeltaX,$DeltaY,$Abscisse=0,$Ordonnee=0 While 1 $GUIMsg = GUIGetMsg() Switch $GUIMsg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func unzoom() $Cursor=GUIGetCursorInfo() $X=$Cursor[0] $Y=$Cursor[1] $x=$X-$CoordGUI2[0] $y=$Y-$CoordGUI2[1] $x=$ZoomPercent*$x $z=$ZoomPercent*$y $DeltaX=$Center[0]-$x $DeltaY=$Center[1]-$y $Size=($ZoomPercent-(2*($ZoomPercent-1)))*$Size $Abscisse=$Abscisse+$DeltaX $Ordonnee=$Ordonnee+$DeltaY GUICtrlSetPos($n,$Abscisse,$Ordonnee,$Size,$Size) EndFunc Func zoom() $Cursor=GUIGetCursorInfo() $X=$Cursor[0] $Y=$Cursor[1] $x=$X-$CoordGUI2[0] $y=$Y-$CoordGUI2[1] $x=$ZoomPercent*$x $z=$ZoomPercent*$y $DeltaX=$Center[0]-$x $DeltaY=$Center[1]-$y $Size=$ZoomPercent*$Size $Abscisse=$Abscisse+$DeltaX $Ordonnee=$Ordonnee+$DeltaY GUICtrlSetPos($n,$Abscisse,$Ordonnee,$Size,$Size) EndFunc Func down() $top=$top-10 GUICtrlSetPos($n,$rl,$top,$Size,$Size) EndFunc Func up() $top=$top+10 GUICtrlSetPos($n,$rl,$top,$Size,$Size) EndFunc Func left() $rl=$rl+10 GUICtrlSetPos($n,$rl,$top,$Size,$Size) EndFunc Func right() $rl=$rl-10 GUICtrlSetPos($n,$rl,$top,$Size,$Size) EndFuncThere are some bugs when you zoom to close, don't know why.By each zoom the image disappear some ms, don't know why too.Any help to improve is welcome.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Clearguy Hide clearguy's signature Hide all signatures I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Share this post Link to post Share on other sites
Michel Claveau 1 Posted November 30, 2006 (edited) Bonjour ! Chez moi, après un zoom, ou un dé-zoom, l'image disparaît, jusqu'à ce que je la déplace (gauche, droite, haut ou bas). Edited November 30, 2006 by Michel Claveau Share this post Link to post Share on other sites
clearguy 0 Posted November 30, 2006 Bonjour ! Chez moi, après un zoom, ou un dé-zoom, l'image disparaît, jusqu'à ce que je la déplace (gauche, droite, haut ou bas).Yes I said there were some bugs.P.S.:Je vais le mettre sur le forum français aussi. Hide clearguy's signature Hide all signatures I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Share this post Link to post Share on other sites
clearguy 0 Posted December 1, 2006 Let some comments ! Hide clearguy's signature Hide all signatures I've never met anyone who codes binary. StringMultiInsert()SOW EncryptFrench autoit forum - forum français Share this post Link to post Share on other sites