1

Im scaling down (and moving) a canvas and need to find out the 0,0 of the actual canvas (in able to get the position of bitmaps within the canvas).

Does anyone know how?

DecodeGnome
  • 1,809
  • 1
  • 19
  • 36
  • Can you describe this more, I dont understand what it is your needing to find – Chris Sep 02 '11 at 15:00
  • I'm sorry if I was unclear. When the canvas is scaled down and moved, the top left corner of the canvas is no longer at 0,0 on the screen. To calculate the position (relative to the screen) of bitmaps withing this canvas I need to know where the canvas is. A bitmap may be at 10,10 on the canvas, but at 80,80 on the actual screen. – DecodeGnome Sep 02 '11 at 15:12

1 Answers1

2

0, 0 is alway in the top left corner, only the images previously drawn on the canvas would move. Check this post: Android Bitmap/Canvas offset after scale

Community
  • 1
  • 1
Lumis
  • 21,517
  • 8
  • 63
  • 67
  • This solves part of it, though when also moving the canvas (not only scaling it), the XY position isn't updated with this. Has helpt me abit on the way so thanks ;) – DecodeGnome Sep 05 '11 at 12:08
  • Yes it should not be too hard; scale, calculate and store new bitmap coordinates, then move and calcualte again. If you create a class object for your image then this code can be the methods of that object, which would make it very clean. – Lumis Sep 05 '11 at 12:29
  • I'm having same kind of problem. Check this: http://stackoverflow.com/questions/7524843/get-canvas-coordinates-after-scaling-up-down-or-dragging-in-android I need help to sort it out. – Awais Tariq Sep 26 '11 at 05:18