Problem with Grouping the rotated object.
Problem with Grouping the rotated object.
- Subject: Problem with Grouping the rotated object.
- From: "Ghufran Ahamad" <email@hidden>
- Date: Wed, 2 Apr 2008 16:30:42 +0530
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 happen only
with rotated object. Below is the code snippet that we are using.
NSRect stRect = NSZeroRect;
NSArray *objTlGraphic = [[self document] graphics];
unsigned iIndex, nCount =[objTlGraphic count];
if(in_Group != 0)
{
for(iIndex = 0; iIndex < nCount; iIndex ++)
{
if([[objTlGraphic objectAtIndex:i] GroupNO] == in_Group)
{
stRect =NSUnionRect(stRect,[[objTlGraphic objectAtIndex:
iIndex] bounds]);
}
}
}
NSAffineTransform* xform = [NSAffineTransform transform];
[currentContext saveGraphicsState];
[NSBezierPath clipRect:drawingBounds];
NSPoint center = NSMakePoint(NSMidX(stRect), NSMidY(stRect));
[xform translateXBy:center.x yBy:center.y];
[xform rotateByDegrees:[curGraphic GetAngle]];
[xform translateXBy:-center.x yBy:-center.y];
[xform concat];
Any one tells me what I'm missing here.
Thanks,
Ghufran Ahmad
+91 - 9953130470
Skype ID: ghufran_khan81
AOL ID: gahmad81
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden