Skip to content

Instantly share code, notes, and snippets.

@codenameone
Created February 25, 2015 12:26
Show Gist options
  • Save codenameone/109a79a32ff372c89cbc to your computer and use it in GitHub Desktop.
Save codenameone/109a79a32ff372c89cbc to your computer and use it in GitHub Desktop.
// Find out the current translation
int currX = g.getTranslateX();
int currY = g.getTranslateY();
// Reset the translation to zeroes
g.translate(-currX, -currY);
// Now we are working in absolute screen coordinates
g.drawRect(10, 10, 100, 100);
// This rectangle should now be drawn at the exact screen
// coordinates (10,10).
//Restore the translation
g.translate(currX, currY);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment