Rendering big PDF into thumbnail bitmap - too blurry
Rendering big PDF into thumbnail bitmap - too blurry
- Subject: Rendering big PDF into thumbnail bitmap - too blurry
- From: "Oleg Krupnov" <email@hidden>
- Date: Wed, 24 Sep 2008 08:33:17 +0300
I want to render a big PDF image into a small thumbnail image in a custom view.
In drawRect:
NSImageRep* pdfImageRep = [[pdfImage representations] lastObject];
[pdfImageRep drawInRect:thumbBounds];
This renders perfectly, however the operation is pretty costy as for
using in drawRect, so I want to cache the thumbnail bitmap:
NSImage* thumbnail = [[NSImage alloc] initWithSize:thumbBounds.size];
[thumbnail lockFocus];
[pdfImageRep drawInRect:NSMakeRect(0, 0, thumbBounds.size.width,
thumbBounds.size.height)];
[thumbnail unlockFocus];
NSImageRep* thumbnailRep = [[thumbnail representations] lastObject];
[thumbnailRep drawAtPoint:bounds.origin];
However it appears that as soon as I get any kind of bitmap, much of
the initial PDF shaprness gets lost and the thumbnail appears too
blurry compared to directly rendering the PDF to the screen. It's not
totally blurred, but a significant difference is noticeable.
I seem to have tried all feasible methods of caching but the blur
always occurs once the image becomes cached into a bitmap. I tried
using both NSImage and NSImageRep to bypass caching of NSImage. I even
tried - [NSBitmapImageRep initWithFocusedViewRect] to capture the
image right from the screen after it first gets painted sharply, but
still the thumbnail appears blurred! :-o
What could be the problem?
_______________________________________________
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