button resize

Ludovic Thébault ludovic.thebault at laposte.net
Sat Aug 16 12:34:00 EDT 2003


On Fri, 15 Aug 2003 12:33:16 -0700, Andrew wrote:
> The main problem that I'm having with Revolution is getting an 
> image's rect to be the right size.  Say I create a cartoon of a man 
> in photoshop and I paste him into Revolution.  Then my little man 
> becomes an "image" in Revolution language.  However, when I paste him 
> in, the rect of the image is the size of the entire card!  How can I 
> get the rect of my little man to be exactly the size of him?

I've made this little script to resize an image :

set the lockloc of image "image" to false
get the rect of image "image"
 put (item 3 of it-item 1 of it) into hor
 put (item 4 of it-item 2 of it) into ver 
-- i use a square in background to have "square border" even if the 
rect of image is not a square :
 put the rect of graphic "tbackground"  into trect
-- to see the border :
 repeat with i=3 to 4
   subtract 2 from item i of trect
 end repeat
if hor >= ver and hor > (item 3 of trect-item 1 of trect)  then set the 
rect of image "image" to (item 1 of trect, item 2 of trect, item 3 of 
trect, (item 2 of trect+(ver*(item 3 of trect-item 1 of trect))/hor))
 else 
if ver > hor and ver > (item 4 of trect-item 2 of trect) then set the 
rect of image "image" to (item 1 of trect, item 2 of trect, (item 1 of 
trect+(hor*(item 4 of trect-item 2 of trect))/ver), item 4 of trect)
end if
set the loc of image "image" to the loc of graphic "tbackground" 
set the lockloc of image "image" to true



More information about the use-livecode mailing list