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 6864645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:56:15+00:00 2026-05-27T02:56:15+00:00

I get the context with [NSGraphicsContext currentContext] , how do I get the NSAffineTransform

  • 0

I get the context with [NSGraphicsContext currentContext], how do I get the NSAffineTransform currently applied to it?

I need this for implementing my own transformation stack where I can perform push and pop actions just like glPushMatrix() and glPopMatrix() in OpenGl.

[NSGraphicsContext saveGraphicsState] doesn’t do it for me because it isn’t stackable, or is it?

  • 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-27T02:56:15+00:00Added an answer on May 27, 2026 at 2:56 am

    It is. Save the graphic state before you apply your changes to the context and restore the state after. Each saveGraphicsState must be paired with corresponding restoreGraphicsState call.

    // Initial state
    
    [NSGraphicsContext saveGraphicsState];
    
    [transform1 concat];
    // State 1.
    //Draw with transform1 concatenated with the current transform of the context
    
    [NSGraphicsContext saveGraphicsState];
    
    [transform2 set];
    // State 2
    // draw with transform2 that replaces the transform of the context
    
    [NSGraphicsContext restoreGraphicsState];
    
    // now we have State 1 again
    
    [NSGraphicsContext restoreGraphicsState];
    
    // We came back to the initial state
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this code in my plugin used to work just fine: jQuery('#embedded_obj', context).get(0).getVersion(); and the
I need to get the spring application context from a non bean object. In
When a user request comes in, I can use Context.Request.UserHostAddress to get the user's
How can I get content of a DIV using regular expression. What I need
When I am in a Java class file, I can get context info of
I have list activity with custom array adapter and I can't to get context
How can I get the context path in the BootStrap.groovy file of a Grails
I am trying to get the Edit with Vim context menu to open files
Some code for context: class a { } class b { public a a{get;set;}
I don't really get the concept of bytecode interpreter in the context of CPython.

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.