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

  • SEARCH
  • Home
  • 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 7548977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:50:03+00:00 2026-05-30T09:50:03+00:00

I am trying to understand quartz 2d coordinate system, Currently I am reading Apple

  • 0

I am trying to understand quartz 2d coordinate system, Currently I am reading Apple reference guide and old book “Quartz 2d graphics for mac os x developer”.

I understand the concept of user-space and device-space concept that device-space can have different default coordinate system and device-space coordinates can’t be modified, and we map user-space by modifying its coordinate system acceding to device-space to achieve desire result.


  • First part of the problem

Quartz 2d graphics for mac os x developer book says:

When transforming a coordinate system, you must have another
coordinate system to compare it to. The transformation provides a
relative mapping from one coordinate system to the other. When you
draw in the transformed coordinate system, the transformation maps the
graphic back to the first coordinate system
. The appearance of that
graphic in the fixed coordinate system is affected by the
transformation.

i didn’t get this point in bold.

And

Quartz 2D programming guide says:

Quartz accomplishes device independence with a separate coordinate
system—user space—mapping it to the coordinate system of the output
device—device space—using the current transformation matrix, or CTM. A
matrix is a mathematical construct used to efficiently describe a set
of related equations. The current transformation matrix is a
particular type of matrix called an affine transform, which maps
points from one coordinate space to another by applying translation,
rotation, and scaling operations (calculations that move, rotate, and
resize a coordinate system).

The current transformation matrix has a secondary purpose: It allows
you to transform how objects are drawn. For example, to draw a box
rotated by 45 degrees, you rotate the coordinate system of the page
(the CTM) before you draw the box. Quartz draws to the output device
using the rotated coordinate system.

Confusion is that “Quartz draws to the output device using the rotated coordinate system.”, if I want to draw one object(image etc) rotated and other with out rotation then what happen? We have whole coordinates rotated every thing will be drawn is rotated?

I am trying different experiments but unable to wrap my head around this, I create an image my drawing two line replicating bottom left coordinate system in photoshop and then added to my project to see visibly how coordinates are behaving by calling CGContextRotateCTM(myContext, 45); in drawrect method, but it didn’t do any thing to image which I included in xib file using interface builder placing image inside uiimage.

this code is from quartz 2D programming guide

CGContextRef myContext = UIGraphicsGetCurrentContext();
CGRect contextRect = self.bounds;

CGContextTranslateCTM(myContext, 0, contextRect.size.height);
CGContextRotateCTM(myContext, 45); //my modification
CGContextScaleCTM(myContext, 1, -1);

float w, h;
w = contextRect.size.width;
h = contextRect.size.height;

CGAffineTransform myTextTransform;
CGContextSelectFont (myContext, "Helvetica-Bold", h/10, kCGEncodingMacRoman);
CGContextSetCharacterSpacing (myContext, 10);
CGContextSetTextDrawingMode (myContext, kCGTextFillStroke);

CGContextSetRGBFillColor (myContext, 0, 1, 0, .5);
CGContextSetRGBStrokeColor (myContext, 0, 0, 1, 1);
myTextTransform =  CGAffineTransformMakeRotation(0);
CGContextSetTextMatrix (myContext, myTextTransform);
CGContextShowTextAtPoint (myContext, 0, 50, "Quartz 2D", 9);

but this code is modifying the text drawn on screen not the image I added?


  • Second Part of the problem

This is also from Quartz 2D programming guide:

… apply a transform that translates the origin to the upper-left
corner of the PDF context and scales the y-coordinate by -1.

Using a scaling transform to negate the y-coordinate alters some
conventions in Quartz drawing. For example, if you call
CGContextDrawImage to draw an image into the context, the image is
modified by the transform when it is drawn into the destination. …

I am already doing this -1 thing but no effect on image and this -1 thing is still not clear to me.

I have read this document several times, tried searching on google but no useful tutorial and also no latest books are available only books written in 2004, 2005, 2006. Can any one help regarding this or can refer me useful resources to learn this in depth.

Desperately waiting for replies, really need help.
Thank you.

  • 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-05-30T09:50:04+00:00Added an answer on May 30, 2026 at 9:50 am

    Read this guide and I hope all your problems will be clear

    https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaDrawingGuide/Transforms/Transforms.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to understand the relationship between UIView and CALayer. I read Apple documentation but
Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling) Input is
Trying to understand the options for will_paginate's paginate method: :page — REQUIRED, but defaults
Trying to understand Ruby a bit better, I ran into this code surfing the
Trying to understand something. I created a d:\svn\repository on my server. I committed folders
After trying to understand why client code is not rendered in a page (injected
I trying to understand if a isset is required during form processing when i
Just trying to understand that - I have never used it before. How is
I've been trying to understand how Ruby blocks work, and to do that I've
I've been trying to understand Process.MainWindowHandle . According to MSDN; The main window is

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.