Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a couple of CGContext questions



On Jan 30, 2007, at 4:15 PM, Steve Christensen wrote:

On Jan 30, 2007, at 3:52 PM, Steve Mills wrote:

On Jan 30, 2007, at 17:11:34, Steve Christensen wrote:

2. Is there a way to restore a CGContext's transformation matrix to the identity matrix? Perhaps calling CGContextConcatCTM with a matrix modified from the one returned by CGContextGetCTM?

Get the current ctm, invert it, and concat it. Aside from some floating point math (depending on how whacked the matrix is), I *think* this gets you the identity matrix.

Thanks, Steve. I'll see if that does it.

I would not recommend that approach, as the math is non-trivial, and you can get subtle floating point errors (due to rounding). Your far better off doing a CGContextSaveGState() when you first get the context, and if you ever need to go back to the initial CTM, popping state until you reach the default state again (then saving state again to preserve that).
--
David Duncan
Apple DTS Quartz and Printing
email@hidden



_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >a couple of CGContext questions (From: Steve Christensen <email@hidden>)
 >Re: a couple of CGContext questions (From: "Steve Mills" <email@hidden>)
 >Re: a couple of CGContext questions (From: Steve Christensen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.