• 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: Getting a bezier path for a character
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting a bezier path for a character


  • Subject: Re: Getting a bezier path for a character
  • From: Ken Ferry <email@hidden>
  • Date: Thu, 29 Apr 2010 23:46:14 -0700

On Thu, Apr 29, 2010 at 10:28 PM, Graham Cox <email@hidden> wrote:

>
> On 30/04/2010, at 2:21 PM, danchik wrote:
>
> > mine did not,
>
> Did not what?
>
>
> > so I think I might have used context incorrectly:
> >
> > I had a different context to draw into so the code was :
> >
> > [NSGraphicsContext saveGraphicsState];
> > [NSGraphicsContext setCurrentContext:MyActualContext];
> >
> > // do the text draw/rotate
> >
> > [NSGraphicsContext restoreGraphicsState];
> >
> > I was under impression that [...  restoreGraphicsState]  would restore
> the last context at the time it was [... saveGraphicsState]ed?
> > Or does each context have its own state stack?
>
> No. Each thread has its own state stack, so what you said is right - it
> will restore the graphics context that was current when +saveGraphicsState
> was invoked.
>

Well, each thread has a stack of contexts, and each context has a stack of
states.  +saveGraphicsState first pushes the state of the current context
onto the stack of states in that context, then pushes the context itself
onto the stack of contexts.


>
>
> > Would the proper way to draw to a different context be to save the
> current context first???
> >
>
>
> Yes, which is what your code above will do.
>
> What it won't do is to 'undo' the transform of the second context. Rather
> than bother doing that, it might be easier just to reset it at the start, or
> use -set instead of -concat. If the second context has no other
> transformations needed on it, (as a view's context must do) then that should
> work. On the other hand, a view's context is always set up before -drawRect:
> is called so you usually don't have to worry about undoing additional
> transforms there either if nothing else draws following your rotated
> drawing.
>
> To reset the transform completely:
>
> [[NSAffineTransform transform] set];
>
> --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
>
_______________________________________________

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

  • Follow-Ups:
    • Re: Getting a bezier path for a character
      • From: Ken Ferry <email@hidden>
References: 
 >Getting a bezier path for a character (From: email@hidden)
 >Re: Getting a bezier path for a character (From: Douglas Davidson <email@hidden>)
 >Re: Getting a bezier path for a character (From: "danchik" <email@hidden>)
 >Re: Getting a bezier path for a character (From: Graham Cox <email@hidden>)
 >Re: Getting a bezier path for a character (From: "danchik" <email@hidden>)
 >Re: Getting a bezier path for a character (From: Graham Cox <email@hidden>)
 >Re: Getting a bezier path for a character (From: "danchik" <email@hidden>)
 >Re: Getting a bezier path for a character (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Getting a bezier path for a character
  • Next by Date: Re: Getting a bezier path for a character
  • Previous by thread: Re: Getting a bezier path for a character
  • Next by thread: Re: Getting a bezier path for a character
  • Index(es):
    • Date
    • Thread