 |
 |
|
 |
01-23-2009, 08:22 PM
|
#1 (permalink)
|
|
New Member
Join Date: Aug 2008
Posts: 394
|
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 (context, rotate);
CGContextTranslateCTM( context, x, y);
CGContextDrawImage(context, CGRectMake(0, 0, 100, 100), test.CGImage);
CGContextRestoreGState(context);
__________________
Super Pig
iOwn - Inventory anything and everything.
|
|
|
01-23-2009, 08:28 PM
|
#2 (permalink)
|
|
New Member
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
|
Do the translate first to get the center moved properly, then do the rotate.
|
|
|
01-23-2009, 08:30 PM
|
#3 (permalink)
|
|
New Member
Join Date: Aug 2008
Posts: 394
|
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.
|
|
|
01-23-2009, 08:31 PM
|
#4 (permalink)
|
|
New Member
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
|
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.
|
|
|
01-23-2009, 08:38 PM
|
#6 (permalink)
|
|
New Member
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
|
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.
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 372 |
| 27 members and 345 guests |
| bluemonkey, chakri_123, CoolApps, dongmark796, dre, Ed99, ethanwa, hinderberg, jasonfan, kikesantos, Lalitpune, mallmertl, MarkC, mizan_102, mlfarrell, msudan, pjlocko, racer_X, rahul, rainbows, raziiq, sanjeev, scalar, shuvo1879, sijo006, steve6546, Tambourin |
| Most users ever online was 779, 05-11-2009 at 10:55 AM. |
» Stats |
Members: 21,463
Threads: 35,753
Posts: 156,615
Top Poster: smasher (2,448)
|
| Welcome to our newest member, dongmark796 |
|