Two transparency levels

Discuss any general programming issues here
Post Reply
User avatar
r-tea
Posts: 123
Joined: Tue Feb 16, 2016 11:48 pm
Location: Zdzieszowice, Poland
Contact:

Two transparency levels

Post by r-tea » Sun May 12, 2019 2:02 am

I created three small two-colour png images in Personal Paint.
Theese are white crosses onto black background. Images are of the same size and crosses are different.
I need to display them as brushes. I need the black background to be fully transparent and the white crosses half transparent.
How to obtain it easily?

User avatar
airsoftsoftwair
Posts: 3072
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Two transparency levels

Post by airsoftsoftwair » Sun May 12, 2019 11:23 am

You can manually apply the desired transparency settings with Hollywood but why don't you simply create PNGs with alpha channel that have your desired transparency settings already applied?

User avatar
jPV
Posts: 261
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Two transparency levels

Post by jPV » Sun May 12, 2019 12:12 pm

There are many ways to do this in Hollywood, but here's an example of few cases:

Code: Select all

@DISPLAY {Color=#BLUE}
@BRUSH 1, "ram:1.png", {LoadAlpha=True} ; Load a brush that already has a (alpha) transparent color
@BRUSH 2, "ram:2.png", {Transparency=#BLACK} ; Load a brush and set a color in it transparent
@BRUSH 3, "ram:2.png" ; Let's set transparency later

SetBrushTransparency(3, #BLACK) ; Makes the black color transparent for the brush 3

; These will display brushes with transparent black color, but white fully visible
DisplayBrush(1,100,100)
DisplayBrush(2,200,100)
DisplayBrush(3,300,100)

; When doing partial transparency we have to notice couple things....

; Brush 1 has already alpha channel, so you can just reduce it
ReduceAlphaChannel(1, "50%")
DisplayBrush(1,100,200)

; Brush 2 is using a mask for transparency, so we have to change it to alpha channel first
ChangeBrushTransparency(2, #ALPHACHANNEL)
ReduceAlphaChannel(2, "50%")
DisplayBrush(2,200,200)

; The previous ones modified the original brushes, but we could also do the transparency when displaying the brush and keep the original brush intact
DisplayBrush(3,300,200,{Transparency="50%"})

WaitLeftMouse
BTW. when you save images in PPaint (as PNG for example), the color at the index 0 becomes transparent, and if you load such image in Hollywood with the LoadAlpha=True option, you don't have to set the transparent color manually.

PPaint can't do other kind of alpha transparency, so if you'd want fully processed semi transparent images that don't need processing in the actual Hollywood script, you'll have to use some other programs too... like RNOEffects ;)

Post Reply