OK, I made some progress. In the case of the CGLayer backing, I have got the problem sorted - in fact passing YES for flipped when creating the NSGraphicsContext was all that was needed.

I still have the same problem with my NSPDFImageRep though. In this case I want to make a higher-quality cache than what I can get with CGLayer (at very high zooms CGLayer's pixellation is unacceptably obvious). While this cache doesn't gain me much performance over drawing each object individually, it has some...

Anyhoo, I create this cache using a temporary view and - dataWithPDFInsideRect:, then make the PDF rep using +imageRepWithData: If I set the temporary view to return YES for isFlipped, the rep draws the right way up but exhibits the text problem mentioned. If I set isFlipped to NO, everything comes out flipped, though text is the right way up relative to it (i.e. it's all upside down but the text lines read OK). Again there's no way to set the flipped state of the rep on its own, and wrapping it in an NSImage makes it draw pixellated all over again, avoiding which is the whole point of trying to use a "raw" PDF rep.

I guess that NSLayoutManager is sensing that it's drawing into a PDF context and doesn't flip the lines in that case?

I guess I could try drawing it (un)flipped using a transform - I'll give that a go.




G.



On 6 May 2008, at 11:21 am, Graham Cox wrote:


On 6 May 2008, at 11:09 am, Aki Inoue wrote:

NSLayoutManager expects that the coordinate system its rendering into to be flipped and the current graphics context's -isFlipped to return YES.

I thought that was the case.

How are you rendering into these contexts ?

The contexts are created in two ways, depending on the kind of cache I use (though both have the same result). In the case of a CGLayer, I use CGLayerCreateWithContext based on the current context (the flipped view), then use the returned layer context to make an NSGraphicsContext. At that point I set flipped to NO. Reason? because if I set it to YES ALL of my other content comes out flipped (because the original view is flipped, two flips would be wrong). If there were a way to set it flipped *after* rendering the content that might do it, but there is no setFlipped: method on NSGraphicsContext, I only get one opportunity to set it, and that's right up front before I can render into it.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to