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 23:56, Jerry LeVan wrote:

[imageRotation translateXBy:bigSide/2.0 yBy:bigSide/2.0];
[imageRotation rotateByDegrees:-rotateFactor]; // counter clockwise
[imageRotation translateXBy:-bigSide/2.0 yBy:-bigSide/2.0];
I have an image whose size is 4000 (width) by 200 (height)

When I apply my transformation the result is a 4000x4000 image with the desired
bits clinging to the right hand side of the "big" box. I have to scroll a bit
to see the rascal, but it is all there.

I think your translation is wrong. You translate both x and y with the same factor, where as they should differ (one should be half the width; the other, half the height).

Is there a nice way to "trim" the window in the two "bad" cases?

Yes, provide the proper subset rectangle as second argument when calling drawAtPoint:fromRect:...

However, I think this can be done with translations alone. First you translate so that the origin is in the center of the image, i.e. "0.5*width, 0.5*height", then you rotate by 90 degrees, now you need to move back the origin to the lower left corner, but since it has been rotated the translation is: "-0.5*height, -0.5*width".

Although IIRC the translations needs to be done in reverse order, so the last one should be applied first (not really sure about that)...

When I started the rotation study I initially had a slider that sent
a continuous action for rotation, It looked sorta cool watching the stuff
pinwheel around. I was trying things out with a fair size jpeg zoomed by
a factor of about four. All of a sudden I experience a great slow down in
the "force". Peeking at top showed my VM was over a gig (on my 1 gig machine).
Since that experience I decided to restrict rotation to multiples of 90 :)

Sounds like you forgot to free the rotated image, and thus you simply exhausted memory resources.

I'd go back to the slider if I were you, it makes it so much easier!
_______________________________________________
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>)
 >Re: Rotating Images.... (From: Jerry LeVan <email@hidden>)
 >Re: Rotating Images.... (From: Allan Odgaard <email@hidden>)
 >Re: 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.