I have an NSView. It has a layer. Inside of the layer, there are several sublayers. One of those sublayers needs to blend with the layers beneath it. I've set the top layer's compositingFilter
property, but no blending happens. :-(
Here's a visual representation:
Root Layer <-- myView.layer
|- Bottom Layer <-- myView.layer.sublayers[0]
|- Middle Layer <-- myView.layer.sublayers[1]
|- Top Layer <-- myView.layer.sublayers[2]
Root Layer
|- Bottom Layer
|- Middle Layer
|- Top Layer <-- Added filter to this layer.
I set the property like so:
self.topLayer.compositingFilter = [CIFilter filterWithName:@"CIMultiplyBlendMode"];
I assumed that the input image and background image would be supplied automatically with the contents
of each of the layers, but maybe I'm wrong. Am I?
TL;DR: How does a n00b composite a stack of layers together using blending modes?
P.S. I'm drawing the contents
of each layer using the delegate method, -drawLayer:inContext:
.
setDefaults
to the filter before adding it to the layer. – mahal tertin