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 (Cocoa-dev@lists.apple.com)

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]

Reply via email to