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 <developm...@fornextsoft.com> wrote: > 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 alloc]initWithCGImage:cgImage > size:NSMakeSize(CGImageGetWidth(cgImage), CGImageGetHeight(cgImage))]; > > NSImage * destination = [[NSImage alloc]initWithSize:movieFrame.size]; > [destination lockFocus]; > [[NSColor blackColor]set]; > NSRectFill([destination alignmentRect]); //I want a black poster frame > around the image > [screenImage drawInRect:[destination alignmentRect] fromRect:[screenImage > alignmentRect] operation:NSCompositeSourceAtop fraction:1.0]; > > [destination unlockFocus]; > > > Was I completely mistaken in thinking that the way I'm doing this was suppose > to preserve the aspect ratio? > Is it even possible to do what I'm trying to do? (I know the answer is yes > since I've seen it done.) > > Am I going to have to do this at the CGImage level? > > Some kind of information would be nice google is a bust, cannot find the > information on the developer site. > All the examples I have seen assume the source and destination images are the > same size > However as I explained before, the user is able to select specific areas in > the capture view to focus on. And since the selections never have the same > aspect ratio as the destination, when I try to draw the image it's distorted. > > >> >> > > _______________________________________________ > > 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/mike%40bellerby.com > > This email sent to m...@bellerby.com _______________________________________________ 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