title: android tracking the position after translate and scale the image
body: <p>i am the newer of android. 
  i would like to track the position after the image is translated and scaled
  In the following code, i can track the position after the image is translated and also find the scale factor.
  However, how can i get the <strong>left and top</strong> position after scaling??</p>
  
  <pre><code>imageView.setOnTouchListener(new OnTouchListener() {
  
          @Override
          public boolean onTouch(View v, MotionEvent event) {
  
              view = (ImageView) v;
              view.setScaleType(ImageView.ScaleType.MATRIX);
  
              switch (event.getAction() &amp; MotionEvent.ACTION_MASK) 
              {
                  case MotionEvent.ACTION_DOWN:   // first finger down only
                       matrix.set(view.getImageMatrix());
                       savedMatrix.set(matrix);
  
                       start.set(event.getX(), event.getY());
                       mode = DRAG;
                       break;
                  case MotionEvent.ACTION_UP: // first finger lifted
                      move_x = event.getX()-start.x;
                      move_y = event.getY()-start.y;
                      laststop.x = laststop.x + move_x;
                      laststop.y = laststop.y + move_y;
                          tv_touch.setText("Up!! x = "+Float.valueOf(laststop.x)+
                                              ", y = "+Float.valueOf(laststop.y)+
                                              ", scale = "+ Float.valueOf(scale_new));
  
  
                  case MotionEvent.ACTION_POINTER_UP: // second finger lifted
                              if (mode == ZOOM)
                              {
                                  scale_new = scale * scale_new;
  
                              }
                              mode = NONE;
                              break;
  
                  case MotionEvent.ACTION_POINTER_DOWN: // first and second finger down
  
                            oldDist = spacing(event);
                            if (oldDist &gt; 5f) {
                                savedMatrix.set(matrix);
                                midPoint(mid, event);
                                mode = ZOOM;
                            }
                            break;
  
                  case MotionEvent.ACTION_MOVE:
  
                            if (mode == DRAG) 
                            { 
                                matrix.set(savedMatrix);
                                  tv_touch.setText("Move!! x = "+Float.valueOf(event.getX() - start.x)+", y = "+Float.valueOf(event.getY() - start.y));
                                matrix.postTranslate(event.getX() - start.x, event.getY() - start.y); // create the transformation in the matrix  of points
                            } 
                            else if (mode == ZOOM) { 
                                // pinch zooming
                                float newDist = spacing(event);
                                if (newDist &gt; 5f) {
                                    matrix.set(savedMatrix);
                                    scale = newDist / oldDist; 
                                    matrix.postScale(scale, scale, mid.x, mid.y);
                                    tv_touch.setText("BgScale: "+Float.valueOf(scale));
                                }
                            }
                            break;
              }
  
              view.setImageMatrix(matrix);            
              return true;
          }
      });
  </code></pre>