Re: Object not being drawn in Cmd + N. Why? SOLVED
Re: Object not being drawn in Cmd + N. Why? SOLVED
- Subject: Re: Object not being drawn in Cmd + N. Why? SOLVED
- From: Graham Cox <email@hidden>
- Date: Thu, 06 Dec 2012 09:41:09 +1100
On 06/12/2012, at 5:59 AM, Peter Teeson <email@hidden> wrote:
> In my case I use a number of gradients as well a bezier paths and the crucial thing was to understand just where and when to save/restore the context.
Well, knowing this is usually a case of common sense. In the vast majority of drawing, you do not need to do this at all, so perhaps you're just doing it "just in case" without fully understanding whether it's really needed. If you overdo it, there is a much bigger likelihood of overdoing it wrong.
1. context save/restores must balance. (if you throw an exception in between, you need to ensure that the restore happens in @finally)
2. you only need to save the context if you make a state change to it that you will want to reverse BEFORE you complete your drawing.
3. Given 2, there are many drawing scenarios where you do not need to save/restore the context at all.
4. I'm pretty sure this is all very well documented in the drawing guide.
--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