Re: Drawing to NSImage to create image data at different resolutions
Re: Drawing to NSImage to create image data at different resolutions
- Subject: Re: Drawing to NSImage to create image data at different resolutions
- From: Erik Buck <email@hidden>
- Date: Thu, 12 Apr 2007 07:10:01 -0700 (PDT)
I want to capture some drawing that is normally performed to draw to
the screen or to print or to produce PDF output (the differences are
minimal), and produce a graphic from that drawing at n-dpi, then save
that graphic to disk. How can I control the resolution at which the
drawing is captured/the resolution at which the graphic is created?
Maybe using NSImage is not the best way to go?
Calculate how many pixels you want in the destination image. Greate an image with that many pixels. lock focus on the image. Scale the coordinate system to map whatever you wnt to draw into the number of pixels in the image. Draw whatever you want. unlock focus on the image. Set the image's dpi. Save the image to disk.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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