Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CALayer BlendMode

I am creating a simple iOS application in which I have two CALayers, I want to add the blend effect on the upper CALayer to display the content on the second layer. I dont want to do it alpha. Is there any way to do this without changing the alpha?

like image 661
Obaid Avatar asked Nov 18 '25 20:11

Obaid


2 Answers

iOS (as of 5.1) does not currently support any blend effects on CALayer. In my testing, the compositingFilter property is ignored.

like image 103
rob mayoff Avatar answered Nov 20 '25 09:11

rob mayoff


There's a tricky way to achieve this.

compositingFilter works but filter names should be like subtractBlendMode (lower camel case), not CISubtractBlendMode.

Here is a demo:

https://github.com/arthurschiller/CompositingFilters

like image 42
hezhk3 Avatar answered Nov 20 '25 08:11

hezhk3



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!