• 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
Yet another NSAffineTransform problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Yet another NSAffineTransform problem


  • Subject: Yet another NSAffineTransform problem
  • From: "I. Savant" <email@hidden>
  • Date: Wed, 11 Jan 2006 16:43:31 -0500

List:

For the very first time, I'm actually in need of an NSAffineTransform in some very simple drawing code. I'm trying to draw a label rotated a quarter-turn counter-clockwise amidst some other things.

I'm locking focus (and unlocking again when I'm done) and drawing onto an image. Everything else in the image draws fine but with this block of code as-is, the label doesn't show up.

"aLabel" is an NSAttributedString formatted with pretty white 12- point system control font. Its string is simply "Away".

// Draw Away label
[[NSGraphicsContext currentContext] saveGraphicsState];
NSAffineTransform * at = [NSAffineTransform transform];
[at rotateByDegrees:180.0f];
[at translateXBy:[aLabel size].width/2 yBy:[aLabel size].height/2];
[at concat];
[aLabel drawAtPoint:NSMakePoint(NSMidX(imgRect), NSMidY(imgRect)];
[[NSGraphicsContext currentContext] restoreGraphicsState];

If I don't "concat" the transform, the label draws just fine, dead- centered in the image. What on earth am I misunderstanding here?

--
I.S.


_______________________________________________ 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
  • Follow-Ups:
    • Re: Yet another NSAffineTransform problem
      • From: John Pannell <email@hidden>
    • Re: Yet another NSAffineTransform problem
      • From: Corbin Dunn <email@hidden>
  • Prev by Date: Re: Force an Application to crash : possible ?
  • Next by Date: Re: Force an Application to crash : possible ?
  • Previous by thread: Re: Will calling entity.name cause a fault to fire?
  • Next by thread: Re: Yet another NSAffineTransform problem
  • Index(es):
    • Date
    • Thread