• 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
Re: Rotation and translation of an image
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rotation and translation of an image


  • Subject: Re: Rotation and translation of an image
  • From: Kiel Gillard <email@hidden>
  • Date: Thu, 13 Aug 2009 12:11:59 +1000

Hi Agha,

I'm not too sure what's wrong with the picture so I'm not sure how much I can help you.

But to rotate your image by the centre, first translate your image or context so the centre of the image/context is located at the origin:
1 Translate by negative half width, negative half height,
2 Rotate by theta degrees,
3 Translate by positive half width, positive half height to undo the first transform.


Maybe this helps?

Kiel

On 13/08/2009, at 12:03 PM, Agha Khan wrote:

I have 6 small images which should be rotated in a view. Picture worth 1000 words.


transform = CGAffineTransformMakeTranslation(0.0, 20); transform = CGAffineTransformRotate(transform, M_PI); // transform = CGAffineTransformScale(transform,1, -1); CGContextConcatCTM(ctx, transform); DigFileName = [NSString stringWithFormat:@"n%d.png",Edges[3]]; img = [UIImage imageNamed:DigFileName]; CGContextDrawImage(ctx, CGRectMake(8, 38, 20, 20), img.CGImage);

Because I am rotating the leftside image should be flipped. I know it is wrong and showed you just to explain. I am confused because I want to rotate the image of the center of the image. I am not sure how to rotate image at the center.

Thank you for prompt reply.

Best regards
Agha<Picture 16.png>

On Aug 12, 2009, at 6:49 PM, Kiel Gillard wrote:

Hi Agha,

An appropriate answer depends entirely on what you want to do with the image. Do you want to draw the image into a view? Do you want to save the image to the hard disk?

You'll have to give us more information to help you out.

Kiel

On 13/08/2009, at 11:22 AM, Agha Khan wrote:

HI:
Can someone point me the sample code for image transformation?
You help will be very much appreciated.
Best regards
Agha Khan
_______________________________________________

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



_______________________________________________

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


References: 
 >Rotation and translation of an image (From: Agha Khan <email@hidden>)
 >Re: Rotation and translation of an image (From: Kiel Gillard <email@hidden>)

  • Prev by Date: Re: Rotation and translation of an image
  • Next by Date: UITableView updating problem
  • Previous by thread: Re: Rotation and translation of an image
  • Next by thread: Re: Rotation and translation of an image
  • Index(es):
    • Date
    • Thread