alpha change with setContext?

Hey everyone, take a look at this:
I’ve created a drawing app but I’ve come across a problem with the alpha, the way the app works is there is one image called screen that all images get drawn to with setContext, what happens is a mesh is created while the touch is still moving with the same colour attributes as the final drawn image. But when the image is actually drawn it loses a lot of alpha and so by about 2/3 of the way down the alpha bar, all images become see though but then if you draw over it with another image it draws the overlapping space as the original colour… I’m not sure what to do

Here’s another video to show the effects

If it falls by 2/3 all the time why don’t you just try multiply 3/2 to all alphas it might make a difference. And one more thing, draw the meshes in the order of their alpha i.e. ones with highest alpha first. That will prevent adding of alpha when things are drawn(most probably), unless ofcourse you want that effect.

I want to keep that effect but obviously I’ve tried multiplying it by 1.5 but that’s still out, it’s weird how it works

Okay I figured out the problem, from an earlier thread where setContext was used to clear a screen sized image, someone said to use background(255,255,255,0) and this causes the image to act weirdly with the alpha, I’m sure it’s a bug as it works fine with background(0,0,0,0)

It’s not a bug, you just have to consider that your offscreen image will also be transparent if you draw transparent shapes onto a transparent background, and colors get mixed twice (the second time is when you draw your image on screen). The reason (0,0,0,0) looks correct is that the ratios between your color components don’t get lost when you mix with black. 50% red + 50% of nothing is still pure red with no blue or green component, it’s just not as intense. On the other hand, 50% red + 50% white is not pure red anymore, and when you mix that with white again when you draw your offscreen image on screen, it becomes even more white and less red.

There’s still that what you display on screen is only one half of the truth. Your image is still transparent, but the user can’t see the transparency unless you do one of those things other drawing software does, like use a checkered grey background or something like that instead of pure white.

Ahhh thanks for the explanation, the behaviour sort of makes sense now. I was thinking of putting in a checkered background to make it more clear to people that it doesn’t have a background