Skip to content

Instantly share code, notes, and snippets.

@vishnukvmd
Last active December 23, 2015 12:58
Show Gist options
  • Save vishnukvmd/6638526 to your computer and use it in GitHub Desktop.
Save vishnukvmd/6638526 to your computer and use it in GitHub Desktop.
public float[] transformCoordinates(float x, float y) {
float [] coordinates = new float [] {x, y};
Matrix matrix = new Matrix();
this.getImageMatrix().invert(matrix); // Inside a class that extends ImageView. Hence this->ImageView
matrix.postTranslate(this.getScrollX(), this.getScrollY());
matrix.mapPoints(coordinates);
return coordinates;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment