Copying parts of pictures to the front

Geoff Canyon gcanyon at inspiredlogic.com
Wed Jan 30 05:02:01 EST 2002


At 9:35 PM -0800 1/29/02, Ken Norris (dialup) wrote:
>This is what I'm trying to avoid. There are about 80 buttons, all similar
>but different. The main picts..er..uh..images, are full screen. Everything
>is there, including the images of the buttons (which have complex colors,
>shading, text), in one FULL SCREEN image. The transparent buttons are all
>aligned properly with the image. In my HC stack, Uli's xGWorld holds the
>FULL SCREEN PICT (image) of the 'down' buttons, located congruently (thus,
>the buttons align with it as well), but not visible. The handler for
>animating the buttons uses the rect of the button to copy that portion of
>the gWorld image and temporarily (until the mouse is up) place it on the
>screen right over the corresponding portion of the 'up' state image, similar
>to RR's icon hiliting. Very neat, doesn't require drawing separate button
>icons. The buttons are in rows, so all the text parts had to align, too. I
>wouldn't have wanted to do that for each separate button.

It seems as though you have a choice: write code that splits out the appropriate chunk of the image each time at runtime, or write code that splits out the appropriate chunk of the image once at design time.

I'd go with the latter. I'm pretty sure you could script this entirely and be done pretty quickly.

If you still want to do it at runtime, one way (untested) would be to make a group out of the image. Then set the size of the group to the size you want the buttons. Then you can set the loc of the group and of the image to show whatever area of the image you want. You might have to fiddle with the lockLoc property of the image and/or the group to get this to work properly.

regards,

Geoff



More information about the use-livecode mailing list