Hi All,
We are developing a kind of drawing application in Objective C using Cocoa
framework. We have several separate graphical objects, each having their own
position and rotation angle, are then grouped. As soon as we group the
objects the rotated object has got shift with their angle. This
That's not enough code to go on — it's not showing all the drawing.
Are you remembering to restore the saved graphics state after you
finish drawing an object?
Also, if you could paste in the code without the extra blank lines, it
would make it more readable.
—Jens
smime.p7s
On Apr 2, 2008, at 04:00, Ghufran Ahamad wrote:
NSAffineTransform* xform = [NSAffineTransform transform];
[currentContext saveGraphicsState];
[NSBezierPath clipRect:drawingBounds];
NSPoint center = NSMakePoint(NSMidX(stRect), NSMidY(stRect));
[xform translateXBy:center.x yBy:center.y];
Quincey Morris wrote:
On Apr 2, 2008, at 04:00, Ghufran Ahamad wrote:
[xform translateXBy:center.x yBy:center.y];
[xform rotateByDegrees:[curGraphic GetAngle]];
[xform translateXBy:-center.x yBy:-center.y];
This looks kind of wrong. Mathematically, wouldn't you want:
[xform
to compute it's own bounds, including internal
and total rotations. So far, this works quite well and we haven't
encountered the problem you have had.
Message: 4
Date: Wed, 2 Apr 2008 16:30:42 +0530
From: Ghufran Ahamad [EMAIL PROTECTED]
Subject: Problem with Grouping the rotated object