From: Duncan M. <du...@on...> - 2009-07-02 13:21:19
|
On 2 Jul 2009, at 12:38, Scott Thompson wrote: > > On Jul 2, 2009, at 2:37 AM, Duncan McGregor wrote: > >> On Wed, Jul 1, 2009 at 11:20 PM, Scott Thompson<ea...@ma...> wrote: >> >>> If I understand... you're going all the way to NSGraphicsContext >>> just to flip the coordinate system? That's a long row to hoe :-). >> >> It would be, but I'm actually going to NSGraphicsContext so that I >> can >> draw NSImages and NSStrings on the PDF without having to bang my head >> against Quartz, especially in its font handling. > > > :-) I know what you mean, Quartz 2D doesn't have any "font handling". > I usually recommend a higher-level library like Cocoa for the text, > but then I (personally) usually use the CG level calls instead of > NSBezierPath, NSImage and friends. > > OK, the code I gave you should still work out OK with the exception of > the images. As I recall, NSImage is "smart" in that it respects the > flipped bit of the context to do what it thinks is the Right Thing™ > (although all of NSImage's "smarts" tend to bite me in the behind > often... I've heard it's much better under Snow Leopard). > > You might be able to set the flipped bit on the NSImages without > running into a RubyCocoa crash. Failing that, you can always, use > some transform magic to flip the coordinate system the right way > around right before you draw an image and then quickly put it back. Thanks for the attempted help ;-) but the flipped isn't the issue. It just happens to be parameter to the call - in fact I already set a transform into the CGContext. My problem is that I have a CGContextRef and I need to create an NSGraphicsContext from it and set it current in order for the drawing code on NSString, NSImage etc to know where to draw. Duncan |