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 04-18-2008, 07:20 AM   #1 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Default How do I rotate a image pointed to by a CGImageRef

NSString* imageFileName = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"tree002.png"];
CGDataProviderRef provider = CGDataProviderCreateWithFilename([imageFileName UTF8String]);
CGImageRef myImage = CGImageCreateWithPNGDataProvider(provider, NULL, true, kCGRenderingIntentDefault);
CGDataProviderRelease(provider);

Anyone have a clean way to rotate the image pointed to by myImage?
I figure there is a call SOMEWHERE like:

[myImage setTransform: CGAffineTransformMakeRotation(3.14/2)];

but cannot find one.
Fastrak is offline   Reply With Quote
Old 04-18-2008, 10:10 AM   #2 (permalink)
New Member
 
Join Date: Apr 2008
Posts: 420
Send a message via AIM to jeff_lamarche Send a message via Yahoo to jeff_lamarche
Default Re: How do I rotate a image pointed to by a CGImageRef

CIFilter *transform = [CIFilter filterWithName:@"CIAffineTransform"];
[transform setValue:img forKey:@"inputImage"];
NSAffineTransform *affineTransform = [NSAffineTransform transform];
[affineTransform rotateByDegrees:90];
[transform setValue:affineTransform forKey:@"inputTransform"];
CIImage * result = [transform valueForKey:@"outputImage"];
__________________
Check out my iPhone Dev Blog
You can send me e-mail at my forum username at mac dot com.
jeff_lamarche is offline   Reply With Quote
Old 04-18-2008, 12:17 PM   #3 (permalink)
New Member
 
Join Date: Apr 2008
Location: Lexington, KY
Posts: 108
Default Re: How do I rotate a image pointed to by a CGImageRef

Maybe I am missing something simple but CIFilter is not included in the latest QuartzCore framework in the iPhone SDK.

Is there something else I need to do?
Fastrak is offline   Reply With Quote
Old 04-19-2008, 10:08 PM   #4 (permalink)
New Member
 
Join Date: Apr 2008
Location: Onomatopoeia, Lugubriousylvania
Posts: 225
Default Re: How do I rotate a image pointed to by a CGImageRef

Yeah I don't see CIFilter or CIImage either in beta3.

I'm assuming UIImage.imageOrientation won't do what you want? Looks like it just affects display.

I looked briefly for something that took the result of NSValue's
+ (NSValue *)valueWithCGAffineTransformCGAffineTransform)tr ansform

but I don't see anything obvious.l
bonehead 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
rotate a UIImage help ddavtian iPhone SDK Development 10 10-07-2009 11:09 PM
Tinting an image? moopf iPhone SDK Development 2 01-28-2009 04:56 AM
Scale & Rotate Gestures - UIImageView col iPhone SDK Development 1 07-14-2008 08:33 AM
UIButton with an image ddavtian iPhone SDK Development 1 04-30-2008 03:53 PM
Help with Image View Nitrex88 iPhone SDK Development 4 04-19-2008 01:02 AM


» Advertisements
» Online Users: 257
23 members and 234 guests
ADY, AragornSG, bookesp, chillyh, dacapo, Dani77, Davey555, Desert Diva, Dominus, glenn_sayers, HemiMG, JasonR, LEARN2MAKE, M.A.S., marshusensei, mer10, nobre84, Oral B, prchn4christ, Raggou, Rudy, themathminister
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,765
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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