Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-23-2009, 08:22 PM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 394
Default Rotating an image...arg...

I don't know why this is giving me so much trouble but I want to draw an image on the current context and have it rotate around it's center. No matter what I do it rotates around one of it's corners or some other point, how can i get it to rotate around IT'S center?

PHP Code:
CGContextSaveGState(context);
CGContextRotateCTM (contextrotate);
CGContextTranslateCTMcontextx,  y);
CGContextDrawImage(contextCGRectMake(00100100), test.CGImage);
CGContextRestoreGState(context); 
__________________
Super Pig
iOwn - Inventory anything and everything.
detz is offline   Reply With Quote
Old 01-23-2009, 08:28 PM   #2 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

Do the translate first to get the center moved properly, then do the rotate.
RickMaddy is offline   Reply With Quote
Old 01-23-2009, 08:30 PM   #3 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 394
Default

If I move the translate I get the same result..maybe my translate is wrong? Hmm, what should I be translating too..?
__________________
Super Pig
iOwn - Inventory anything and everything.
detz is offline   Reply With Quote
Old 01-23-2009, 08:31 PM   #4 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

The Quartz 2D Reference has a section of transformations. They show an example with a rooster image comparing how the order of transformations changes the result.
RickMaddy is offline   Reply With Quote
Old 01-23-2009, 08:32 PM   #5 (permalink)
New Member
 
Join Date: Aug 2008
Posts: 394
Default

Quote:
Originally Posted by RickMaddy View Post
The Quartz 2D Reference has a section of transformations. They show an example with a rooster image comparing how the order of transformations changes the result.
Yeah, this
Quartz 2D Programming Guide: Modifying the Current Transformation Matrix

but that doesn't help me.
__________________
Super Pig
iOwn - Inventory anything and everything.
detz is offline   Reply With Quote
Old 01-23-2009, 08:38 PM   #6 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

If you create a UIImageView and apply a transform it applies to the center point as describe for the transform property in UIView.

But the Quartz 2D the rotation is always around the current 0,0 coordinate.
RickMaddy is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Stats
Members: 158,309
Threads: 89,033
Posts: 379,817
Top Poster: BrianSlick (7,086)
Welcome to our newest member, alapimba
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 04:58 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0