Re: Rotation and translation of an image
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