简体   繁体   中英

Arbitrary blending of semi-transparent PNG, retaining alpha on iOS

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:

差异示例

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM