• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't)


  • Subject: Re: Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't)
  • From: David Duncan <email@hidden>
  • Date: Thu, 09 Feb 2012 11:26:06 -0800

On Feb 9, 2012, at 11:09 AM, Fritz Anderson wrote:

> The trick was that -initWithLayer: did not produce a usable mask layer.

Applications should not call -initWithLayer:. Its purpose of existence is so that if you have a CALayer subclass that has additional ivars that need copying, you can implement it and CoreAnimation can call it to do the right thing. The layers produced in this way are not expected to be useful as 'model' layers.

> If I created maskL as a new mask layer ([CAShapeLayer layer]), and initialized it to match shapeL (except for the fill), gradL was drawn as expected.
>
> <http://stackoverflow.com/questions/4733966/applying-a-gradient-to-cashapelayer> got me most of the way, but didn't extend to how to re-use the mask layer.

Did you add the stroke shape layer as a sublayer of the gradient layer? If so, that may explain why you didn't get your stroke – the mask applies to a layer and all of its sublayers. As such, the shape layer would have at least partially masked the stroke (its possible Core Animation simply rejected rendering the shape layer entirely, as its path rendering emphasizes speed over accuracy).

--
David Duncan

_______________________________________________

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


References: 
 >Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't) (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't)
  • Next by Date: Re: How to cancel a loading document in NSDocument's readFromURL:ofType:error method ?
  • Previous by thread: Re: Clipping a CAGradientLayer with a duplicated CAShapeLayer (don't)
  • Next by thread: Odd behavior of NSItemReplacementDirectory
  • Index(es):
    • Date
    • Thread