• 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: "danchik" <email@hidden>
  • Date: Thu, 29 Apr 2010 21:21:41 -0700

mine did not, 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?


Would the proper way to draw to a different context be to save the current context first???

NSGraphicsContext *LASTContext = [NSGraphicsContext currentContext];
[NSGraphicsContext saveGraphicsState];

[NSGraphicsContext setCurrentContext:MyActualContext];
[NSGraphicsContext saveGraphicsState];

// do the text draw/rotate

[NSGraphicsContext restoreGraphicsState];

[NSGraphicsContext setCurrentContext:LASTContext];
[NSGraphicsContext restoreGraphicsState];







----- Original Message ----- From: "Graham Cox" <email@hidden>
To: "danchik" <email@hidden>
Cc: "Cocoa-Dev List" <email@hidden>
Sent: Thursday, April 29, 2010 8:48 PM
Subject: Re: Getting a bezier path for a character




On 30/04/2010, at 1:18 PM, danchik wrote:

by 'reverse' i meant :
[transform invert];
[transform concat];

since i'd have to first
[transform transformXBy:yBy];
[transform rotateByDegrees:];
[transform concat];
[myAttrString drawWithRect:options:]


An alternative is to bracket the drawing operation with a save and restore of the graphics context:

[NSGraphicsContext saveGraphicsState];

// set up a transform

[transform concat];

// draw stuff

[NSGraphicsContext restoreGraphicsState];

--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


  • Follow-Ups:
    • Re: Getting a bezier path for a character
      • From: Graham Cox <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>)

  • 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