Question

I want to be able to overlay a semi-transparent PNG with a single colour using an arbitrary blending and keep the alpha.

I'm aware of this solution:

How to tint a transparent PNG image in iPhone?

Unfortunately, DestinationIn / SourceOut / Mask all display noticeable visual artefacts in the alpha regions. This is especially noticeable when layering graphics:

Example on the difference

Aside from using Core Graphics, I've tried CoreImage, which does not display any artefacts in CIMultiplyCompositing, but has no corresponding filter for the other Core Graphics blend modes (such as Screen and Overlay)

I've also worked with GPUImage but encountered the same visual artefacts, although this appears to be a bug in the library.

Was it helpful?

Solution

I found and fixed the bug in GPUImage which was causing the problems. I then manually implemented all the blendings as shaders.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top