Will test this too, but I don't think it will work. In my case I moved rectangle from it's real position to zero, then rotate around zero and then moved back. In your case I will move it far from zero and then rotate... But I will give it a try.
On Wed, Aug 6, 2008 at 11:20 AM, Jean-Daniel Dupas <[EMAIL PROTECTED]> wrote: > Shouldn't be this instead (check the translations' signs) ? > > [tr translateXBy:dx yBy:dy]; // center or rect will be the center of > rotation > [tr rotateByDegrees:90]; // rotate it > [tr translateXBy:-dx yBy:-dy]; // move it back > > > Le 6 août 08 à 08:46, Vitaly Ovchinnikov a écrit : > >> Hello, >> >> I need to draw NSString rotated to 90 degrees. Now I have the code: >> >> NSRect rcWhereToDraw = NSMakeRect(........); // <- rect is already >> "rotated" here >> [str drawInRect:rcWhereToDraw withAttributes:attributes]; // string >> will be drawn non-rotated >> >> as far as I know, I need something like this: >> >> [[NSGraphicsContext currentContext] saveGraphicsState]; >> NSRect rcWhereToDraw = NSMakeRect(........); >> >> float dx = NSMidX(rcWhereToDraw), dy = NSMidY(rcWhereToDraw); >> >> NSAffineTransform *tr = [NSAffineTransform transform]; >> [tr translateXBy:-dx yBy:-dy]; // center or rect will be the center of >> rotation >> [tr rotateByDegrees:90]; // rotate it >> [tr translateXBy:dx yBy:dy]; // move it back >> [tr concat]; >> >> [str drawInRect:rcWhereToDraw withAttributes:attributes]; >> [[NSGraphicsContext currentContext] restoreGraphicsState]; >> >> This doesn't work, where am I wrong? >> Thank you. >> _______________________________________________ >> >> Cocoa-dev mailing list ([email protected]) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org >> >> This email sent to [EMAIL PROTECTED] >> > > _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
