• 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: NSImage Rotation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImage Rotation


  • Subject: Re: NSImage Rotation
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 29 Mar 2005 08:15:55 -0800


On Mar 29, 2005, at 8:05 AM, Ian was here wrote:

45 degree angles cause the image to only show part
way, while 180 degrees causes the image to disappear.

Not knowing how you are doing your rotation....

It sounds like you are rotating the image without translating it. Basically a rotation transform will rotate things about the origin (the lower left corner) unless you translate things as needed to make it rotate about the center of your image (or whatever you are attempting to rotate).

Something like this...

// need only if things after shouldn't be xlated
[NSGraphicsContext saveGraphicsState];

[rotation rotateByDegrees:angle];
[translation translateXBy: NSMaxX(bounds)/2 yBy: NSMaxY(bounds)/2];
[translation concat];
[rotation concat];

// draw your image

// need only if things after shouldn't be xlated
[currentContext restoreGraphicsState];

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSImage Rotation (From: Ian was here <email@hidden>)

  • Prev by Date: Re: NSImage Rotation
  • Next by Date: Re: NSImage Rotation
  • Previous by thread: Re: NSImage Rotation
  • Next by thread: Re: NSImage Rotation
  • Index(es):
    • Date
    • Thread