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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:39:39+00:00 2026-06-11T03:39:39+00:00

There is an ImageView and it has an Image, which has been zoomed and

  • 0

There is an ImageView and it has an Image, which has been zoomed and rotated.

See the picture:

enter image description here

The image is scaled by android.graphics.Matrix.

You can see there is red point which is the center point of the image, and also a blue border. How to calculate them?

(Update: I want to operate on the image of the girl inside the blue border, not the whole picture, that’s background)

  • 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-06-11T03:39:41+00:00Added an answer on June 11, 2026 at 3:39 am

    There is a mathematical dependency between two. If there is other information available:
    -assuming rectangle has right angles for all corners-.

    center.X = (aCorner.X + oppositeCorner.X)/2;
    center.Y = (aCorner.Y + oppositeCorner.Y)/2;
    

    Where aCorner is a arbitrary corner and oppositeCorner is opposite corner to aCorner.

    This was trivial, a little more hard work included to calculate borders (and a bit more of information; center position, width and the height of the picture and rotation angle).
    Assuming image’s width is “w”, height is “h”, angle is “a”, and center “cX” and “cY”.
    First corner;

    length = sqrt(w^2+h^2)/2;
    x = (length)*(cos(a)*(-w/length) - (h/length)*sin(a)) + cX;
    y = (length)*(sin(a)*(-w/length) + (h/length)*cos(a)) + cY;
    

    Second corner;

    x = (length)*(cos(a)*(w/length) + sin(a)*(h/length)) + cX;
    y = (length)*(cos(a)*(h/length) - sin(a)*(w/length)) + cY;
    

    Third;

    x = -(length)*(cos(a)*(-w/length) + (h/length)*sin(a)) + cX;
    y = -(length)*(sin(a)*(-w/length) - (h/length)*cos(a)) + cY;
    

    Fourth;

    x = -(length)*(cos(a)*(w/length) - sin(a)*(h/length)) + cX;
    y = (length)*(cos(a)*(h/length) - sin(a)*(w/length)) + cY;
    

    Length is a half of diagonal of the rectangle. The inner part with cos and sin is result of trigonometric transformation:

    sin(a+b) = sin(a)*cos(b) + cos(a)*sin(b)
    [....]
    

    And cX and cY is used to translate corners from a arbitrary coordinate system to a specific coordinate system.

    I know, I know this was kind of overkill. Matrix class may have this functions on its own. I believe if it has, the method used in it can be broken into method I described here.

    NOTE: Angle a -actually even sin(a) and cos(a), which is better- can be accessed via
    Matrix.getValues(float[] values)

    Most 2D matrices use this scheme:

    | sin(a) 0       0    |
    | 0      -cos(a) 0    |
    | 0      0       scale|
    

    I am not sure about particular implementation of Android API.

    BTW, there may have been some signature errors up there so be careful.

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

Sidebar

Related Questions

I am creating UIView on top of tableview in which there will an imageview
Is there a way to programmatically highlight an imageview in android? I am showing
i have a tableview which has image and a text behind, i create the
I have a listview which includes 2 textviews and 1 imageview. Now, the image
I have a TabView in android. The first tab has an Image and a
I am having a problem with setting an ImageView image to an image which
In my app I have a scrollview which has some objects like an imageview,
I have seen an app called ZuluTrade, which has a charts in there tableView
I have made an android application in which there is a text and button
I am creating an android application in which the user can view the channel

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.