On Jul 31, 2011, at 4:32 AM, Michael Babin wrote:

On Jul 30, 2011, at 9:10 PM, James Merkel wrote:

I tried ImageKit and it works great. Excellent quality. Thanks for the suggestion, Scott. I didn't have to do much more than change an NSImageView to an IKImageView in InterfaceBuilder and the code.

However, there doesn't appear to be an easy way to print a CGImageRef (which you get from an IKImageView) . So I figure for the printing case, I'll just open the file again and create an NSImage. Seems counterintuitive to open the file again, but its' probably easier than converting a CGImageRef to an NSImage. Interestingly, the quality of the printed NSImage is very good compared to the screen rendition. Never understood why that is.

For 10.6 and later, you can use -[NSImage initWithCGImage:size:] to create an NSImage from a CGImageRef.

For 10.5 and later, you can create an NSBitmapImageRep from your CGImageRef (-[NSBitmapImageRep initWithCGImage:]) and add the representation to an NSImage.

Ok, I found the NSBitmapImageRep method for 10.5. So I can now print.

However, one problem -- the image does not get rotated to the proper orientation.
ImageKit does this automatically for the screen image.
I was hoping to get rid of my rotation code, but maybe I have to keep it for the printed image.

Jim Merkel



_______________________________________________

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 arch...@mail-archive.com

Reply via email to