Applying transparency to only a part of a stack?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Zax
Posts: 431
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Applying transparency to only a part of a stack?

Post by Zax » Sun May 30, 2021 9:47 am

jacque wrote:
Sat May 29, 2021 4:08 pm
I can never remember what each ink does. I just select the image and click my way through them all. Sometimes twice.
Already tried this method (but not twice).
Most of effects produce the same result — a basic transparency effect on every colours —, though some display nothing. Maybe these strange results come from the transparent window shape?

I use this script to make the desired part of my stack transparent:

Code: Select all

on recreateWindowShape blendValue, inkMode
   # This handler takes a snapshot of group "GpeViewer", which contains all our
   # controls and most importantly the background image "WindowShape"
   
   clearGraphic // card : Delete the window shape image if there is one
   try
      set the ink of image "BkImg" to inkMode
      set the blendLevel of image "BkImg" to blendValue
   catch errorVariable
      answer "Invalid blendLevel or inkMode." & cr & cr & inkMode & cr & blendValue
      exit recreateWindowShape
   end try
   
   # Set the properties of the template image which will apply to our new window shape
   # image when we use the command 'snapshot'
   set the visible of the templateImage to false
   set the paintCompression to "png"
   set the resizeQuality of image "BkImg" to Best
   set the alwaysBuffer of image "BkImg" to true
   
   # Take a snapshot of the whole group, including all the controls
   import snapshot from group "GpeViewer"
   set the name of the last image to "WindowShape"
   
   # Finally, set the window shape of the stack to the new image
   set the windowShape of this stack to (the id of image "WindowShape")
end recreateWindowShape

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: Applying transparency to only a part of a stack?

Post by jmburnod » Sun May 30, 2021 6:56 pm

Hi All,
I found a useful script written by Hermann R.I.P about alphadata.
Here is
viewtopic.php?f=7&t=32606&p=181064&hili ... ta#p181064
Best regards
Jean-Marc
https://alternatic.ch

Zax
Posts: 431
Joined: Mon May 28, 2007 10:12 am
Location: France

Re: Applying transparency to only a part of a stack?

Post by Zax » Mon May 31, 2021 11:30 am

Very interesting link. Thanks.
I think I'll now be able to make transparency on colors with alphaData.

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”