Re: NSImage and zooming PDFs vs. bitmaps
Re: NSImage and zooming PDFs vs. bitmaps
- Subject: Re: NSImage and zooming PDFs vs. bitmaps
- From: "Ken Ferry" <email@hidden>
- Date: Tue, 12 Aug 2008 11:09:29 -0700
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.
-Ken
Cocoa Frameworks
On Tue, Aug 12, 2008 at 5:56 AM, Hamish Sanderson
<email@hidden> wrote:
> On 11 Aug 2008, at 17:52, Ken Ferry wrote:
>
>>> A combination of -setDataRetained: on image loading and -recache on
>>> zooming did the trick, although I did need to kludge in a size check before
>>> calling -recache as rasterising an entire PDF above ~10,000x10,000 quickly
>>> gets painful performance- and memory-wise.
>>
>> For drawing that would lead to a very large raster cache, NSImage prefers
>> to draw directly from the source rather than make a cache.
>
> That would make lots of sense. Unfortunately it isn't doing it for me, and
> if the image is big enough a memory error occurs.
>
>
>> However, it sounds like this isn't doing it for you. Could you file a bug
>> with a demonstration app?
>
> Done. Filed as bug ID# 6143188 (NSImage caching and vector images:
> out-of-memory error).
>
>
>> Perhaps you could try just turning caching off, or turning it off when the
>> scale factor is high?
>
> Just tried this as-per your suggestion, but -setCacheMode:NSImageCacheNever
> doesn't appear to have any effect as the NSImage continues to create and use
> a raster cache. Filed as bug ID# 6143199 (NSImage caching and vector images:
> -setCacheMode: ignored).
>
> I also ran into a third problem while writing demos for the first two:
> NSImages created via +imageNamed: constructor appear to ignore
> -setDataRetained:YES. Filed as bug ID# 6143194 (NSImage caching and vector
> images: -setDataRetained: ignored).
>
>
>> Also, sorry, there's nothing built-in that caches partial images or holds
>> caches for multiple destination sizes.
>
>
> Okay, I can probably kludge something if I have to, although when zoomed in
> it would be much better if NSImage just drew the visible portion of the PDF
> directly as you say it should.
>
>
> In the meantime, given the problems I'm having with NSImage's caching
> behaviour, any suggestions on how else I could draw PDF/EPS files into
> nested, Core Animation-enabled NSViews?
>
> Many thanks,
>
> Hamish
>
> --
>
> Hamish Sanderson
> Production Workflow Developer
> Sun Branding Solutions Ltd
> Tel: +44(0)1274 200 700
> www.s-brandingsolutions.com
>
>
>
>
>
_______________________________________________
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