• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSImage and zooming PDFs vs. bitmaps
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSImage and zooming PDFs vs. bitmaps


  • Subject: NSImage and zooming PDFs vs. bitmaps
  • From: Hamish Sanderson <email@hidden>
  • Date: Fri, 8 Aug 2008 17:25:01 +0100

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


  • Follow-Ups:
    • Re: NSImage and zooming PDFs vs. bitmaps
      • From: "Ken Ferry" <email@hidden>
  • Prev by Date: Re: Xcode 3.1 Debugger Problems
  • Next by Date: Re: Core Data question
  • Previous by thread: Re: Xcode 3.1 Debugger Problems
  • Next by thread: Re: NSImage and zooming PDFs vs. bitmaps
  • Index(es):
    • Date
    • Thread