Re: Rotate NSImage to get a new NSImage, without drawing

2009-03-01 Thread Jerry Krinock
On 2009 Mar 01, at 14:27, Steve Christensen wrote: That version only works for a ±90° rotation since you're just swapping the width and height for the rotated image size. A more generalized solution would be: Thank you, Steve. Yes, yours works for a 45° rotation whereas mine clipped.

Re: Rotate NSImage to get a new NSImage, without drawing

2009-03-01 Thread douglas welton
Jerry, I'll offer a couple of other alternatives: 1) Use Quartz Composer to do the transformation for you. You should be able to build a composition with just a few (2?) patches. You can even bind the parameters for the composition to controls on your UI using Interface builder. 2) Us

Re: Rotate NSImage to get a new NSImage, without drawing

2009-03-01 Thread Steve Christensen
On Feb 28, 2009, at 10:20 PM, Jerry Krinock wrote: On 2009 Feb 28, at 20:10, Graham Cox wrote: Create the new image, swapping width and height, lock focus onto it, apply a transform that rotates 90 degrees, and draw the first into the second. You can't do it without drawing, but the draw

Re: Rotate NSImage to get a new NSImage, without drawing

2009-02-28 Thread Jerry Krinock
On 2009 Feb 28, at 20:10, Graham Cox wrote: Create the new image, swapping width and height, lock focus onto it, apply a transform that rotates 90 degrees, and draw the first into the second. You can't do it without drawing, but the drawing doesn't need to be onscreen. Thanks, Graham.

Re: Rotate NSImage to get a new NSImage, without drawing

2009-02-28 Thread Graham Cox
On 01/03/2009, at 2:31 PM, Jerry Krinock wrote: I understand that NSAffineTransform can rotate an image while you're drawing it. But is there any way to rotate an image and get a new image? Something like: NSImage* imageUp = [NSImage imageNamed:@"BaseImage"] ; NSImage* imageLeft = [image