 |
 |
|
 |
01-23-2009, 07: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, 07: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, 07: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, 07: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, 07: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: 390 |
| 32 members and 358 guests |
| aerialcombat, alexy, aniuco, chaoz1337, DarthVader007, davide.k, Etabubu, finefin, fordprefect77, houssem, iruirc, joalta, Johanovski, LightRoom, lisyqiao, Mac393, Mr Jack, mx2323, myPhone, Oliver Drobnik, Rossco, sani212, sheonlee, sigalf, snyeah, spirestudios, Tambourin, thadre, twerner, virvalid, xebuyt00, yaniv92648 |
| Most users ever online was 779, 05-11-2009 at 09:55 AM. |
» Stats |
Members: 24,084
Threads: 38,865
Posts: 170,510
Top Poster: smasher (2,563)
|
| Welcome to our newest member, lisyqiao |
|