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....



Thanks for the info...

A bit after I posted I suddenly realized that the
kaleidoscopes were generated because I was drawing over the
source image.

As you noted using a new image cleared that problem :)

Anyway I can now rotate "square" images. Oblong images
are still a problem...Today I am going to try increasing
the size of the target image to see if that helps.

The fine manual is less than clear about image manipulation...

Jerry

On Jun 26, 2004, at 11:31 PM, Allan Odgaard wrote:

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>)
 >Re: Rotating Images.... (From: Allan Odgaard <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.