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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:42:06+00:00 2026-05-24T09:42:06+00:00

I have an image in image-view control. User can perform pan and zooming on

  • 0

I have an image in image-view control. User can perform pan and zooming on this image, due to that x and y coordinates of image continously change. Is there any way to find out the current set x and y coordinates of image inside image control ? Any code regarding it would be more beneficial.

  • 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-24T09:42:06+00:00Added an answer on May 24, 2026 at 9:42 am

    ImageView uses Matrix class to do scaling (Zoom) and translation (pan). If you can get hold of matrix, then you can retrieve the (left, top) coordinate of the zoomed/panned view.

    Code for zoomable & pannable extended imageview is available in one of the stackoverflow posts

    In that post you will see extended ImageView class has matrix as a member variable used for scaling / translation.

    You can use the following Code to get bounds of the zoomed / panned ImagevIew (actually bitmap) from matrix.

    RectF r = new RectF(); 
    matrix.mapRect(r);
    Log.i(TAG, "Rect " + r.left + " " + r.top + " " + r.right + " " + r.bottom + " " + mOverAllScale + " ");
    

    NEWLY ADDED ANSWER

    To understand the below code, you need to go thru this link and understand.

    Translation

    When user drags the image, the screen co-ordinate (Absolute) and Bitmap co-ordinate go out of sync. [ Anything you write to the bitmap gets displayed through canvas (in onDraw()) ] If apply coloring, user would see it getting applied on a different region on the bitmap image. To correct this you need to do translation. The translation would change the user input co-ordinates (which are screen co-ordinates) to bitmap co-ordinates (as intended by the user)
    Following code snippet would help you do the translation.

    Let User input co-ordinates be (x,y) then,

    RectF r = new RectF(); 
    matrix.mapRect(r);
    Log.i(TAG, "Rect " + r.left + " " + r.top + " " + r.right + " " + r.bottom + " " + mOverAllScale + " ");
    float newX =  x - r.left;
    float newY =  y - r.top;
    

    You use new co-ordinates in place of (x,y).

    Zooming (Scaling)

    When user pinches in / out ; the bitmap gets Zoomed out / Zoomed in. You must observe that original bitmap does not get changed, zooming is only from display perspective.
    This again result in sync loss between screen and the bitmap. The coloring applied on screen should get reflected in the displayed image.
    Following code snippet would help you do the scaling.

    // mScalingFactor shall contain the scale/zoom factor
    float scaledX = (event.getX() - r.left);
    float scaledY = (event.getY() - r.top);
    
    scaledX /= mScalingFactor;
    scaledY /= mScalingFactor;
    

    Shash

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

Sidebar

Related Questions

I want my app to have a settings that can change image when user
I have an image that is 320x480 and upon orientation change this image obviously
In an iPhone application I'm developing I have a Image View that displays eyes
I am using a webview and on that web view i have a image.
I want to show an image view for three like on/off,if any one have
I have a problem... In my view i have Image.If i click on image
I have 4 image views on a view.I want to make the 4 images
I have a view and template called index.html. I have a image which is
I have an image, when i hover on it i am able to view
i have a JPG image with the 360 degrees view of the city (9000px

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.