Re: NSImage and zooming PDFs vs. bitmaps
Re: NSImage and zooming PDFs vs. bitmaps
- Subject: Re: NSImage and zooming PDFs vs. bitmaps
- From: "Adam R. Maxwell" <email@hidden>
- Date: Tue, 12 Aug 2008 11:38:26 -0700
On Tuesday, August 12, 2008, at 11:09AM, "Ken Ferry" <email@hidden> wrote:
>Okay, thanks Hamish. This area is getting some love for SnowLeopard.
>I suspect that all these issues except for the one about opting not to
>make large caches are already fixed. NSImage should be something that
>(a) does things you want, (b) does things you understand.
>
>As far as options, NSPDFImageRep and NSEPSImageRep themselves do not
>do any raster caching, so you could use them and do anything else you
>need on top. There are also other system APIs such as CGPDFDocument
>and PDFKit.
FWIW, I ran into some of these problems a while ago and didn't file bug reports since I figured NSImage behaved that way by design! Anyway, I decided to avoid NSImage entirely and ended up using an object that draws the PDF as a rasterized CGImage when scrolling or at low magnification, and draws a CGPDFPage at high magnification levels. It works fairly well, although I had to cache bitmaps to disk for the large number of files I was looking at, in order to keep memory usage down.
Source (BSD license) for that class is at http://code.google.com/p/fileview/source/browse/trunk/fileview/FVPDFIcon.m. Most of the complexity is due to my threading/caching scheme, but drawing takes place in drawInRect:ofContext:, and I suspect you might be able to do something similar with Core Animation.
--
Adam
_______________________________________________
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