Re: CALayer's backgrounds filters having effect only on immediate parent?
Re: CALayer's backgrounds filters having effect only on immediate parent?
- Subject: Re: CALayer's backgrounds filters having effect only on immediate parent?
- From: Oleg Krupnov <email@hidden>
- Date: Thu, 21 Feb 2013 00:12:13 +0200
Not exactly. Here is what the documentation says:
backgroundFilters
An array of Core Image filters to apply to the content immediately
behind the layer. Animatable.
@property(copy) NSArray *backgroundFilters
Discussion
Background filters affect the content behind the layer that shows
through into the layer itself. Typically this content belongs to the
superlayer that acts as the parent of the layer. These filters do not
affect the content of the layer itself, including the layer’s
background color and border. They also do not affect content outside
of the layer’s bounds.
So basically it can blur/filter other layers. So my question remains -
why doesn't it filter all layers below it, but only the immediate
parent layer?
What seems suspicious about it is that the internets are not full of
bitching about this gaping shortcoming, the search yields nothing,
which makes me think that it must be working perfectly for everyone
else, and I'm just missing something obvious.
Any help please?
On Wed, Feb 20, 2013 at 1:51 AM, Graham Cox <email@hidden> wrote:
>
> On 20/02/2013, at 5:42 AM, Oleg Krupnov <email@hidden> wrote:
>
> In my understanding, if I apply, say, a blur filter to layer's
> background (CALayer->backgroundFilters), all layers that are behind
> that layer - that is, immediate parent, grand parent, etc. and all
> children and siblings of those parent and grandparents that are lower
> in the tree of layers - should appear blurred.
>
> An experiment however shows that it's not the case. The background
> blur filter only blurs the direct parent of the target layer, but not
> its grandparent and other layers.
>
> The same applies for compositingFilter.
>
> Am I doing something wrong?
>
> Or, if this is the way it should work as documented, how do achieve
> the effect I want?
>
>
>
> I think your understanding is incorrect. My interpretation of the docs is
> simply that the background - that is to say, the background colour of the
> layer - is filtered. If you think about how layers are composited, this is
> the only interpretation that makes sense - how could a layer retroactively
> apply a bunch of filters to things that have already been rendered?
>
> Setting the filters on the root layer or on some layer further up the tree
> should achieve the effect you want, though most likely you'll want the
> compositingFilters rather than the background filters property.
>
>
> --Graham
>
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden