0

I know the x and y coordinates in an bitmap and want to draw a rectangle there. I think this picture illustrates what I want.

l

Lets say I want to draw a green rectangle over the red one. I know the coordinates of the top left corner and the coordinates of the bottom left corner. Usually it should not be a problem. But I display the bitmap in an Imageview. I use this code to map the coordinates form the bitmap to the coordinates in the canvas of the imageview. For image_view_width and image_view_height I use the getHeight and getWidth form inside of the Imageview.

This solution works on my real device but on the emulator it shows the rectangle on the wrong position. Can someone help me and tell me what is wrong?

Community
  • 1
  • 1
Asker
  • 431
  • 5
  • 14
  • the code you linked is wrong, use `ImageView#getImageMatrix` and one of `Matrix#map*`methods to map the coordinates form the bitmap to the coordinates in the canvas of the imageview – pskink Dec 13 '15 at 14:42
  • Thanks for your help. I use this code 'float[] point=new float[2]; point[0]=x; point[1]=y; this.getImageMatrix().mapPoints(point);' . But the coordinates are way to small. – Asker Dec 13 '15 at 15:09

0 Answers0