Page 1 of 2
Applying transparency to only a part of a stack?
Posted: Wed May 26, 2021 5:21 pm
by Zax
Hello,
Is there a way to apply
transparency to only a part of a stack like the following demo (made with Photoshop) with LC Indy 9.04?
If the blendLevel of a stack is modified, all its controls will be transparent. On the other hand, if the blendLevel of an image is modified, the stack background is still visible.
Thank you.
Re: Applying transparency to only a part of a stack?
Posted: Wed May 26, 2021 5:27 pm
by Klaus
Re: Applying transparency to only a part of a stack?
Posted: Wed May 26, 2021 9:58 pm
by bogs
Yes, it is possible (and fairly easy).
I recreated the look of the stack you posted, but I prefer cars to dogs. The settings and controls are included in the picture (Lc 6.5.2, will work in any version later I suspect).

Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 9:02 am
by Zax
Thanks for your answers.
@
Klaus: I'm studying this lesson but I'm not sure it will help me.
@
bogs: I don't understand because this is what I have with a default stack, only applying a 50% blendSrcIn effect of an image object :
Making the image transparent only reveals stack's background (default grey).
But you're right, cars are better than dogs

Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 11:19 am
by bogs
Zax wrote: ↑Thu May 27, 2021 9:02 am
@
bogs: I don't understand because this is what I have with a default stack, only applying a 50% blendSrcIn effect of an image object :
screen.jpg
Making the image transparent only reveals stack's background (default grey).
But you're right, cars are better than dogs
Heh, I dunno what to tell you there, I rarely venture higher than 6.5.x, and usually am far lower in version numbers (like Mc 2.5) as far as IDEs go, but since your test flopped, I dragged some of the newer IDEs out of storage to see what was going on.
What I found out (on linux) was -
- I couldn't get 9.6 to even resize the image, and changing blend levels for various inks did nothing. { This is no surprise to me, LOTS of things in 9.6 don't work here worth squat }
- 9.5 - was at least able to assemble a copy stack for demonstration and worked as far as the topic is concerned.

- I guess I didn't even try to download any versions between 8.1.2 and 9.5, 8.1.2 is iffy here, even 8.0.1 is no wonder shakes.
- 8.0.1 and 8.1.2 *were* able to do exactly that same trick, though.
So, my guess would be that, much like 9.6 here, something is going on in that version your using, or, alternately, there is some conflict between that version ( or version range ) and your OS.
The only way to know that would be to post your OS specs ( guessing OSX, but which one? ) and see if someone else using it in combination with LC 9.04 can duplicate the problem.
Likely suspects for testing would be Klaus, Richmond, or Jacque off the top of my head.
Alternately, make the stack in an earlier (or later) version of Lc, save it setup how you like, then open it in 9.04 and see if the transparency stuck while in that IDE or after building. I don't see why it shouldn't as long as it is properly set.
Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 12:03 pm
by Zax
OK, I finally understand the lesson linked by
Klaus. It's very helpful, though it could be a little bit more accurate.
I still have a problem about the ink: I would like to a assign a "blendMultiply" ink to the process but it doesn't seem to work as intended.
(the red border is for development purpose)
@
bogs: I'm using LC 9.04 on MacOS Sierra 10.12.6.
Maybe it depends on car model

Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 12:08 pm
by bogs
@bogs: I'm using LC 9.04 on MacOS Sierra 10.12.6.
Maybe it depends on car model
No, it is almost certainly that the ink isn't being properly applied heh, but I'm sure you already know that
You know, it also came to my mind that there is a (relatively) simple way to accomplish this outside of Lc, but I hesitate to mention it as some people don't care for windowShape.
WindowShape requires a bit more massaging as well, but the basic idea is, you take a picture of your stack in it's solid shape with all areas defined, make whatever area you want to be transparent more transparent in a paint program, and then set the window shape to that image after you import it as a control (or reference it, but then your dealing with file systems as well).
This would be an example of using windowShape and an image to define solid / non solid parts of the window.
I'll work up an example of some different ways to accomplish what I mean and post a link to it.
Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 1:17 pm
by Zax
Thanks
bogs for your time

I would like to manage transparency from
inside LC because I would like to adjust it with the scroller (shown at the topleft of my screenshot).
When my user interface (and my scripts) will work, I'll try to make more accurate ink transformation, like full transparency on white or black areas.
Re: Applying transparency to only a part of a stack?
Posted: Thu May 27, 2021 1:22 pm
by bogs
This would be the brute force method, just using windowShape (and an image editor!). Mind you, for what your doing, I would just find out which vers. of Lc accomplishes what you want, and use that to make the stack initially.
- Here I blatantly ripped off your smug dog picture stack
and imported it into a paint program (GIMP).

- I used the rectangle select tool and cut the area I want transparent.

*Note - make sure you put some kind of fill color with the opacity desired into that area, or you will see nothing.
- Save the file as a .png and import it as a control to the stack you want this ultimately to wind up in.

- Set the windowShape of the stack to that image.

- Put another image control on top of that and set it's size appropriately...

As you can see, you have your semi transparent image at this point.
- PROFIT !
Mind you, you will have to write a (small to medium) amount of code to handle things like dragging the window, resizing it, etc., there are a lot of examples around on how to do this. Me, I would probably stick to the inks and blendlevels for this kind of effect though.
**Edit - you posted as I was composing this ...
Zax wrote: ↑Thu May 27, 2021 1:17 pm
Thanks
bogs for your time

I would like to manage transparency from
inside LC because I would like to adjust it with the scroller (shown at the topleft of my screenshot).
In the case of the above method, the only thing that would change is that you would group the image on top of the windowShape image, the group would provide scrollbars for you if the image is larger than the group.
Some caveats to that would be that the region itself couldn't be resized, so the group's size would have to be locked at the size of that region.
Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 9:01 am
by Zax
I spent some time trying to make the picture resizable but finally it works

Thanks again for all your help.
As you can see, it works with cars and dogs. I didn't try with cats but it should work
Now ink effects remain rather mysterious for me... For example, is there a way to make transparency only for
white, or only for
black?
Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 11:04 am
by bogs
Unfortunately, I don't have the answer to the question about black and white, we'll need someone that actually knows more about inks and blending to step up to answer for you

Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 1:21 pm
by jmburnod
Hi Zax,
For example, is there a way to make transparency only for white, or only for black?
Not sure I understand correctly
If you want apply transparency to an image I think yes but i never did it.
From dictionary
Use the alphaData property to control the transparency of the pixels in an image.
Each pixel is represented by 8 bits (1 byte) of alpha channel data, with pixels numbered from the top left corner of the image, left to right, then top to bottom.
A value of zero means the pixel is fully transparent; a value of 255 is fully opaque; and values in between indicate a level of partial translucency.
Best regards
Jean-Marc
Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 1:58 pm
by Zax
jmburnod wrote: ↑Sat May 29, 2021 1:21 pm
Not sure I understand correctly
Sorry, for a given image, I would like to make the darker parts more transparent than the brighter ones, and conversely. It can be done with softwares like Photoshop.
I tried to play with
alphaData but didn't understand. In fact, I was wondering if there is a preset ink mode in LC that would do what I want.
Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 4:08 pm
by jacque
I can never remember what each ink does. I just select the image and click my way through them all. Sometimes twice.
Re: Applying transparency to only a part of a stack?
Posted: Sat May 29, 2021 4:22 pm
by bogs
That is my method usually as well, sometimes I see an effect that is more desirable than what I was shooting for to begin with
