Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone
($4.99)

Shape Up
($0.99)

Your First iPhone App
($1.99)

iVidCam Free
(free)

Kid Art
($0.99)

iPUBQUIZ
(£1.19)

ArtStudio
($3.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, 07: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, 07:28 PM   #2 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
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, 07: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, 07:31 PM   #4 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
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, 07: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, 07:38 PM   #6 (permalink)
New Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
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


Enter the iPhone App Challenge!  Win $500!
» Advertisements
» Stats
Members: 24,084
Threads: 38,865
Posts: 170,510
Top Poster: smasher (2,563)
Welcome to our newest member, lisyqiao
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:14 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0