Set the blend mode to CALayer with CIFilters

I am trying to use the backgroundFilters CALayer property to control a kind of Blendmode.

This is my current structure:

LAYER A 
   |
   |_______LAYER B 

      

  • Content Layer A

    is an image.
  • Layer B

    is a sublayer Layer A

    and has a red backgroundColor

What I am trying to do is blend the content Layer A

using backgroundColor Layer B

.

I added the filter B

this way:

    CIFilter *blending = [CIFilter filterWithName:@"CIColorBlendMode"];
    blending.name = @"blendingFilter";

    [blending setDefaults];
    layerB.filters = [NSArray arrayWithObject:blending];

      

But that won't work.

What is the correct way to create a colorBlending effect between two layers?

(I am working on OSX, not iOS)

+3
cocoa calayer


source to share


No one has answered this question yet

Check out similar questions:

354
Fast and Fast PDF Viewer for iPhone / iPad / iOs - Tips and Tricks?
7
Using CALayer as Background for Other NSViews
7
- [CALayer setNeedsDisplayInRect:] forces the whole layer to redraw
6
Hit testing using CALayer using alpha properties of CALayer's content
6
Composite colors: CALayer mode and blend on iPhone
five
CALayer compositingFilter, iOS 5 and CoreImage
1
Is it possible to keep the content of the CALayer between calls to drawInContext?
1
Using CALayer in NSStatusBarButton
0
iOS: How to Animate Multiple Image Layers Using Different Blend Modes
0
Line drawing on CALayer in OSx



All Articles
Loading...
X
Show
Funny
Dev
Pics