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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:25:31+00:00 2026-05-27T10:25:31+00:00

For my application, i have used pinch zoom feature by adapting from the tutorial

  • 0

For my application, i have used pinch zoom feature by adapting from the tutorial and creating a custom view http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847

Right now i’m working on capturing the zoomed image as bitmap.

Partially I was able to get the bitmap by making use of

setDrawingCacheEnabled(true);
Bitmap bm = Bitmap.createBitmap(finalView.getDrawingCache());
setDrawingCacheEnabled(false);

Using this approach, I’m getting both the zoomed image and the screen background.

Is there any way to capture only the zoomed image as a bitmap?

  • 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-27T10:25:32+00:00Added an answer on May 27, 2026 at 10:25 am

    After having searched a lot, I found a ‘Temporary’ solution in the same Community & also thanks for the code from ‘weakwire’ provided in the same post.

    Getting coordinates and width/height from a matrix

    Idea is simple, all i have do is remove the background screen from the scaled image by cropping. Code is bit lengthy, but worked for me.

    1. First get the Original Bitmap size

      float imgWidth = imgBitmap.getWidth()   
      float imgHeight = imgBitmap.getHeight()
      
    2. Obtain the matrix ( pinch zoom feature used in my application uses matrix ‘trick’) values, used to scale the image and get the scaledWidth & scaledHeight of the original image.

      float[] values = new float[9];
      matrix.getValues(values);
      float globalX = values[2];
      float globalY = values[5];
      float scaledWidth = values[0]*imgWidth;
      float scaledHeight = values[4]*imgHeight;   
      
      // If zoomed Image gets out of screen, I'm trying to crop the image available in the screen by considering image from (0,0)
      
      if(globalX<0)
      globalX = 0;
      
      if(globalY<0)
      globalY = 0;
      
    3. Finally capture the View and crop the background
      In my case (“finalView” is the custom View name, where pinch zooming happens)

      setDrawingCacheEnabled(false);
      destroyDrawingCache();
      finalView.setDrawingCacheEnabled(true);
      Bitmap bm = Bitmap.createBitmap(finalView.getDrawingCache());
      finalView.setDrawingCacheEnabled(false);    
      
      //Final Image Width &  Height
      
      int finalWidth = Math.min((int)width,(int)finalView.getWidth());
      int finalHeight = Math.min((int)height,(int)finalView.getHeight());        
      

      // crop to get the scaled image

       Bitmap finalBitmap = Bitmap.createBitmap(bm, (int)globalX, (int)globalY, finalWidth ,finalHeight);
      

    Though this is a temporary solution, it works for me. If there is any alternate solution, please post it.

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

Sidebar

Related Questions

In my application i have used list view and custom cell which contain product
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them
In my iPhone application I have used MKMapView to navigate from different pages. But
In my application i have used some custom buttons/icon,i have all images in the
I see an application have used Log.info = some info where are these logs
i have used impersonation in this application. whenever this error occurs i required to
i have used progress bar in my application..my application is working fine but the
I have used spring framework 3 for my application. Everything is ok while developed
I have used JMS in the past to build application and it works great.
I am developing an application using MVC Preview 5. I have used typed views.

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.