Yet another NSAffineTransform problem
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