I've attached an image of the problem I'm having with blend modes in 5.0.10 (mingw, codeblocks)
I have two images that I'm drawing to scene.
The source image I'm drawing are tiny blood splatters as they move through the air. The destination image is the concrete and wood parts of the background with alpha=0 for the air. I then draw that destination image to screen.
The blood splatter shouldn't be drawn in the air (alpha 0 where it appears pink) but only when the destination layer's alpha is 1.
I've been banging my head on this for a day now, and cannot simply do a masked draw to a bitmap.
Relevant code when drawing splatter to background image:
From my understanding (based solely on the documentation of al_set_blender, why is there no thorough documentation for al_set_separate_blender?) the colour component will be additive, where the source colour is multiplied by the source alpha (1 or 0) and the destination colour will be multiplied by (1-source alpha, so 0 or 1) which seems to be fine.
But the alpha channel, as far as I can tell, I'm saying I want to add them, but I only want to use the destination pixels alpha, ever. So if destination alpha is 0, then alpha of drawn pixel should be zero, and if destination alpha is 1, then the alpha of drawn pixel should be one.
And that does not appear to be what I'm getting. This blender stuff has vexed me since day one, and I swear I have a handle on it now, but the function doesn't appear to be doing what I think I'm telling it to do.
Is this a bug or am I still confused ?
I draw this stuff to background and then set blending back to the default state (that works fine for everything else) before I draw the background image to screen:
I don't imagine this is a problem since the alpha on the intermediate background image shouldn't be getting anything but zero written to it where there are already zeros...