Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rotating Images....



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.


References: 
 >Rotating Images.... (From: Jerry LeVan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.