• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem with Grouping the rotated object.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Problem with Grouping the rotated object.
      • From: Quincey Morris <email@hidden>
    • Re: Problem with Grouping the rotated object.
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Need for a creator code?
  • Next by Date: How to store NSRect as Core Data attribute?
  • Previous by thread: Re: Bindings for NSComboBox?
  • Next by thread: Re: Problem with Grouping the rotated object.
  • Index(es):
    • Date
    • Thread