Hi all,

I'm writing a Core Animation-based image viewer application for use with both bitmap (TIFF, JPEG) and vector (EPS, PDF) images but I'm rather new to this stuff and am struggling to get the zooming feature to work well with vector images.

Image files are loaded via -[NSImage imageWithContentsOfFile:]. Zooming is achieved by halving/doubling the size of the source rect when calling -[NSImage drawInRect:fromRect:operation:fraction:] to draw a smaller/larger portion of the image into the destination rect.

Bitmap images work exactly as expected. Vector images, however, also become blocky when zoomed in which isn't what you'd hope for with a resolution-independent format.

As far as I can tell, an NSImage instance created from a PDF file initially contains an NSPDFImageRep containing the original resolution- independent image data. The first time -drawInRect... is called, the PDF data is rasterised and the NSImage's NSPDFImageRep is replaced by an NSCachedImageRep. That makes sense from a performance point of view, I guess, but it rather assumes that I won't want to draw that image at different sizes later on.

The resulting NSImage looks fine on screen as long as it's displayed at the size it's first drawn; the problem is, how do I persuade NSImage to re-rasterise the PDF data at a higher resolution when I zoom in or lower resolution when I zoom out so that it always produces a high-quality display?

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 (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