Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:00:53+00:00 2026-06-05T07:00:53+00:00

I know i have to translate the coordinate system, when drawing. The thing is

  • 0

I know i have to translate the coordinate system, when drawing. The thing is that when i use:

CGContextTranslateCTM(_context, 0.0, _size.height);
CGContextScaleCTM(_context, 1.0, -1.0);

My rect of the image is flipped, and the image is ‘non-flipped’, if i dont use the above my image is flipped, and the rect is non-flipped.

Here’s my code:

CGRectMake(60, 100, image.size.width, image.size.height);
CGContextSaveGState(_context);
UIGraphicsBeginImageContext(image.size);
CGContextClearRect(_context, placeholderRect);
CGContextDrawImage(_context, placeholderRect, image.CGImage);
UIGraphicsEndImageContext();
CGContextRestoreGState(_context);

How do i maintain my rect (non-flipped), while the image is flipped?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:00:55+00:00Added an answer on June 5, 2026 at 7:00 am

    The trick may lie in this UIImage method

    + (UIImage *)imageWithCGImage:(CGImageRef)imageRef scale:(CGFloat)scale orientation:(UIImageOrientation)orientation
    

    Where orientation is one of these 🙂

    typedef enum {
       UIImageOrientationUp,
       UIImageOrientationDown,   // 180 deg rotation
       UIImageOrientationLeft,   // 90 deg CCW
       UIImageOrientationRight,   // 90 deg CW
       UIImageOrientationUpMirrored,    // as above but image mirrored along other axis. horizontal flip
       UIImageOrientationDownMirrored,  // horizontal flip
       UIImageOrientationLeftMirrored,  // vertical flip
       UIImageOrientationRightMirrored, // vertical flip
    } UIImageOrientation;
    

    Edit: Update

    I just did this simple code sample in a UIView subclass overriding drawrect and it worked perfectly. It doesn’t use the UIImage method but works all the same.

    UIImage *image = [UIImage imageNamed:@"image.png"];
    
    CGContextRef _context = UIGraphicsGetCurrentContext();
    
    CGContextSaveGState(_context);
    
    CGContextDrawImage(_context, CGRectMake(100, 20, image.size.width, image.size.height), image.CGImage);
    
    CGContextScaleCTM(_context, -1.0f, 1.0f);
    
    CGContextDrawImage(_context, CGRectMake(-300, 20, image.size.width, image.size.height), image.CGImage);
    
    CGContextRestoreGState(_context);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know we have ILdasm, but is there any tool out there that will
I know I have that my connection to the database works, and a test
Does anyone know there have any other way that (by not using json_encode and
I have this Python code that I found online and would like to know
I know that google goggles will translate a picture to text. What I want
The google translate that you actually embed on your page... http://translate.google.com/translate_tools If you have
I have a simple translate tween that moves an object up 200 pixels. As
We all know that you can call $this->translate() within your zend view to translate
I have two points that describe line, problem is that i know coordinates of
I know there have been some similar questions to this, but they haven't helped

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.