lens effect on an image

Ken Norris pixelbird at interisland.net
Tue Nov 25 14:30:28 EST 2003


Hi Yves,

> Date: Tue, 25 Nov 2003 08:49:00 +0100
> From: Yves COPPE <yvescoppe at skynet.be>
> Subject: lens effect on an image
> 
> Is it possible to have a funciton which should
> 
> 1) zoom in or zoom out on image
> 2) WITHIN the same rect of the original image
> 3) where the user click
> 
> as you use the lens f. ex. in photoshop
-----------
OK, here's a handler someone sent (I think...the style doesn't look like
mine, but it could be) awhile back...sorry I can't remember who.

First, you need to capture the image section you want to zoom, and put it
into the image-to-zoom, but that should be easy for someone of your skills.
This would then go into that image or modified to go wherever. This script
uses a click to zoom in and Option/click to zoom out, but you could change
that to something more common, perhaps cmd/+   cmd/-    :

local tSizeChange

on mouseup
   if optionkey()="Down" then
     put (-10) into tSizeChange
     changeSize
     exit mouseup
   end if
   put (+10) into tSizeChange
   changeSize
end mouseup

on changeSize
    put (the height of the target/the width of the target) into tRatio
    set the width of  the target to (the width of me +tSizeChange)
    set the height of  the target to (the width of the target * tRatio)
end changeSize

HTH,
Ken N.



More information about the use-livecode mailing list