Re: Rotating Images....
Re: Rotating Images....
- Subject: Re: Rotating Images....
- From: Allan Odgaard <email@hidden>
- Date: Sun, 27 Jun 2004 05:31:00 +0200
On 27. Jun 2004, at 2:06, Jerry LeVan wrote:
About all I can do is produce "kaleidoscopes"...
NSSize imageSize; // Size of the image to draw
NSSize scaledRect;
NSImage *tmpImage=NULL;
float scaleFactor=[theSlider floatValue];
tmpImage = [anImage copy];
I think this should be:
tmpImage = [[NSImage alloc] initWithSize:imgSize];
Where imgSize should probably be (if you also wanted to scale):
NSSize imgSize = [anImage size];
imgSize.width = ceilf(imgSize.width * scaleFactor);
imgSize.height = ceilf(imgSize.height * scaleFactor);
Because you want a blank image to draw the rotated version into (by
using copy you basically draw on top of the old image).
Btw: the save/restore graphics context is not necessary, since a new
context is setup when you send lockFocus to the image.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.