Rotate image in Quartz? Image is upside down! (iPhone)

Posted by Johannes Jensen on Stack Overflow See other posts from Stack Overflow or by Johannes Jensen
Published on 2010-04-05T14:09:57Z Indexed on 2010/04/05 14:13 UTC
Read the original article Hit count: 377

Filed under:
|
|
|
|
  • I don't want to transform the ENTIRE context.

I'm making a game with Quartz, and I'm drawing my player with lines, rects and ellipses.

And then I have diamong.png which I rendered at 0,0 in the top left of the screen.

Problem is...

It renders upside down!

How would I rotate it 180 degrees?

Here's some of my code:

CGImageRef diamondImage = CGImageRetain([UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:@"Diamond.png" ofType:nil]].CGImage);
CGContextDrawImage(context, CGRectMake(0, 0, 32, 24), diamondImage);

If it's of any help, I'm using Landscape mode, with home button to the right. It's defined both in my .plist, and in my ViewController's

-shouldAutorotateToInterfaceOrientation:interfaceOrientation:

How would I rotate/transform it?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about iphone