CGContext Blendmode

I am drawing muliptle images (Swift) and sometimes they overlap.
but if two areas overlap that have an alpha value (both have same color, same alpha) I get a darker image, as colors are normally additive.

I think blendmode is supposed to compensate for this (unless I’m out in left field).
but if so, I have NO idea what mode to use…

I don’t have much experience with graphics and animation, so can’t help much with this one.
But “CGBlendMode” has several different settings.

I noticed there is an “.overlay” setting in the CGBlendMode.
Perhaps something like this.

myUIImage.draw(in: myRect, blendMode: .overlay, alpha: 1)

May not be much help in the context of your code, but may spark an idea for you.

thanks I’ll see what that does… guess if it does anything, I’ll have to try all the modes, since nothing really explains the effect except as a mathematical equation

Sounds to me like your images may not be 100% where they should be, or Swift is having trouble with colorspaces (rather the conversion of colorspaces).

CGBlendMode is a useful tool for creating graphics, but yes you need to understand some graphics math to make sense of it current documentation.
Apple BC used to include examples of what the functions do, but current Apple doesn’t feel the need to document API to the same high level as 10 years ago.

Maybe this overview helps a bit: