• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Rotating Images....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rotating Images....


  • Subject: Re: Rotating Images....
  • From: Allan Odgaard <email@hidden>
  • Date: Mon, 28 Jun 2004 10:00:52 +0200

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

  • Prev by Date: IB Palette List?
  • Next by Date: Re: Resizing NSButton doesn't clear previous size
  • Previous by thread: Re: Rotating Images....
  • Next by thread: Re: Rotating Images....
  • Index(es):
    • Date
    • Thread