Transparent

Wilhelm Sanke sanke at hrz.uni-kassel.de
Thu Feb 5 12:38:17 EST 2009


On Wed Feb 4, 2009, Richmond Mathewson geradamas at yahoo.com wrote:
    
> I made an image via IMPORT SNAPSHOT on a card, set its INK to
> TRANSPARENT:
>
> But when I exported the image as both PNG and GIF the transparency
> was lost.
>
> Does this mean that transparency is only local?
>
> sincerely, Richmond Mathewson.

I assume you try to get the transparency of an odd-shaped image for use 
with your Button Basher stack?

If that is the case, then follow these steps and use these syntax examples.

1. Using "export snapshot"

   First, create an empty (and possibly invisible) image named 
"placeholder" or similar (Bernd used that name in one of his scripts).

   The odd-shaped image - transparent in the rect outside the odd shape 
- is image "trans".

   The syntax is now:
          "export snapshot from rect (rect of img "trans") of img 
"trans" to img "Placeholder" as PNG"

This captures the odd shape along with the transparency, but leaves out 
all things - transparent fields or graphics for text - you may have 
piled onto the image in Button Basher.

If you want to capture the oddshaped image with its transparency and 
together with the overlayed fields or graphics you need to apply two steps:

- "export snapshot from rect (rect of img 1) of this card to img 
"Placeholder" as PNG"

 This captures the rect of the oddshaped image along with the text of 
graphic or fields, but *not* the transparency.

You then apply the transparency of the underlying oddshaped image to the 
snapshot in a second step:

- "set the alphadata of img "placeholder" to the alphadata of img "trans"

That's it.

2. Using "import sapshot".

 The procedure is only slightly different.

- "import snapshot from rect (rect of img "trans") of img "trans" as 
above imports only the image without overlayed text, but with its 
transparency.

The two steps to get both:

- "import snapshot from rect (rect of img "trans") of this cd
  set the alphadata of last img to the alphadata of img "trans""

After that you could rename the 'last image'.

Is this what you were looking for?

Regards,

Wilhelm Sanke
<http://www.sanke.org/MetaMedia>




More information about the Use-livecode mailing list