Re: CALayer's backgrounds filters having effect only on immediate parent?

2013-02-20 Thread Oleg Krupnov
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 graham@bigpond.com wrote:

 On 20/02/2013, at 5:42 AM, Oleg Krupnov oleg.krup...@gmail.com 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CALayer's backgrounds filters having effect only on immediate parent?

2013-02-20 Thread David Duncan

On Feb 20, 2013, at 2:12 PM, Oleg Krupnov oleg.krup...@gmail.com wrote:

 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?

Because thats exactly what it said in the description you just posted.

The Core Animation render model is that you start from the leaves, projecting 
and flattening those layers into its parent recursively. As such when you place 
a background filter on a layer, that filter affects the area in the parent that 
is under that layer. At that point, from a rendering perspective at least, the 
layer and its effects cease to exist, having been flattened into the parent.

All the ways around flattening also disable filters (and other select 
properties of the layer) because getting them correct is reliant upon the 
flattening rendering model described above.

 
 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 graham@bigpond.com wrote:
 
 On 20/02/2013, at 5:42 AM, Oleg Krupnov oleg.krup...@gmail.com 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 (Cocoa-dev@lists.apple.com)
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/david.duncan%40apple.com
 
 This email sent to david.dun...@apple.com

--
David Duncan


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: CALayer's backgrounds filters having effect only on immediate parent?

2013-02-19 Thread Graham Cox

On 20/02/2013, at 5:42 AM, Oleg Krupnov oleg.krup...@gmail.com 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com