Scaling a NSImage not working

2011-06-01 Thread Development
I'm trying to capture video. In the capture the user can select a specific area to capture out of the full field of the video. That much functions the problem is that although the image I get has the correct size I cannot figure out how to get that source image to draw in to an NSImage correctly

Re: Scaling a NSImage not working

2011-06-01 Thread Development
Ok am I barking up the wrong tree here? I know there has to be a way of taking an image of size say 128X128 and drawing it in to a rectangle of say size 256X512 without loosing the aspect ratio of the original image. However The following code DOES NOT DO THIS NSImage * screenImage = [[NSImage a

Re: Scaling a NSImage not working

2011-06-01 Thread Steve Christensen
-drawInRect draws the image into the destination rectangle, stretching or shrinking as necessary to get it to fit. If you want to preserve the aspect ratio, you'll have to generate a scaled rectangle with the image's aspect ratio. That's just simple math. On Jun 1, 2011, at 9:29 PM, Develo

Re: Scaling a NSImage not working

2011-06-01 Thread Quincey Morris
On Jun 1, 2011, at 21:29, Development wrote: > Was I completely mistaken in thinking that the way I'm doing this was suppose > to preserve the aspect ratio? Yes, completely mistaken. It may help to think of the source and destination rectangle as an origin and a size separately. The source re

Re: Scaling a NSImage not working

2011-06-01 Thread Mike Bellerby
After doing the ratio copy, you then need to decide what to do with rest of the destination image. Probably set it to a specific colour. Sent from my iPhone On 2 Jun 2011, at 05:29 AM, Development wrote: > Ok am I barking up the wrong tree here? > > I know there has to be a way of taking an i