Transparent

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu Feb 5 16:04:40 EST 2009


Transparent
Richmond Mathewson geradamas at yahoo.com wrote:

> Working from your advice I wrote the following script:
>
> on mouseUp
>   put top of group "gX" into TOPP
>   put bottom of group "gX"  into BUM
>   put left of group "gX"  into LEFTT
>   put right of group "gX"  into RITE
>    put LEFTT & "," & TOPP & "," & RITE & "," & BUM into fld "fRECT"
>   put fld "fRECT" into FRECT
>   put the windowID of this stack into WINDY
>   set the fileType to empty
>      export snapshot from rect FRECT of window WINDY to img "HOLDER" 
> as PNG
>      set the alphaData of img "HOLDER" to the alphaData of img "TRANS"
>      export img "HOLDER" to file "GOTTIT.png" as PNG
> end mouseUp
>
> where the group "gX" contains an odd-shaped image and a transparent
> button.
>
> Everything works well until:
>
>      set the alphaData of img "HOLDER" to the alphaData of img "TRANS"
>
> which makes ALL of the image "HOLDER" transparent!

If you group a field or another object its dimensions are different from 
the rect of the original field. However, to apply imagedata or alphadata 
from one object to the other both objects must possess exactly the same 
dimensions.

What does "transparent button" mean in your case? "opaque" set to false?

I thought your aim was

- to place text on an image
- and then later to integrate this text image as an icon in a button.

This could be achieved by placing a graphic or field with text over the 
image.
The rect of the graphic or field must be equal or smaller than that of 
the image and it must be inside the rect of the image.
There is no need to group graphic and image at this point.

Then you can use

 "export snapshot from rect(the rect of img "trans") of this card to img 
"placeholder" as PNG
set the alphadata of img "Placeholder" to the alphadata of img "trans""

Only these two short lines are needed.

====================

I have to start to pack my luggage now.

Best regards,

Wilhelm Sanke



More information about the use-livecode mailing list