Notifications
Clear all

[Closed] pasteBitmap and alpha value

Hi!

Maybe someone has an answer for this:
I try to give an alpha to a bitmap by using pasteBitmap with the following function


function mix_alpha S Sc D Dc=
	(
		R = S
		R.alpha = 255 - ((D.r + D.g + D.b)/3)
		R
	)
pasteBitmap final_mix01 final_mix02 [0,0] [0,0] type:#function function:mix_alpha

What should happen:
The source bitmap should stay intact but use the destination bitmap as alpha.
What happens:
I just get a fully white alpha channel! No alpha values at all!

I don’t know what to do because I think I tried anything!
I used pngio.setType #true48 and pngio.setAlpha true, copied the bitmaps before saving, I tried getPixels to test if there is a bug in pasteBitmap,…

Any solution?

2 Replies
 JHN

Does the source bitmap have a alpha channel to start with?
You can’t add a alpha channel when the target (source in your case) image doesn’t have an alpha channel.

-Johan

Thank you for that information! I will check it out.

Greetings
Fabian