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 Tue, 30 Jan 2007 17:03:14, David Duncan <email@hidden> wrote:

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

Curious, would the errors be observable on the screen or paper.

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

But that will reset the whole context to the saved state. What if
the OP needs to reset only the CTM, while leaving other context
parameters intact?

Mike

 _______________________________________________
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



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.