I am trying to make an application in which i can zoom in and draw some thing on the image i have used following link to make a zoomable image view which is working fine zoom functionality for images
now the problem is that i dont know how to scale and translate whatever i am drawing on my canvas to the image size when it is zoomed out. following is the onDraw() function. i have recorded the touch points added them into a list and in this onDraw() function of my view i am retrieving those points but these points are relative to screen . i have to translate and scale it according to the image operation(in case of zoom in/out of the image) .
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if(mMarkers!=null)
{
for(Marker m : mMarkers) {
// draw the marker
Log.v("IP","position"+ m.x+" "+ m.y);
Paint paint=new Paint();
paint.setARGB(255, 2, 255, 2);
canvas.drawText("O", m.x, m.y, paint);
if(x!=-1){
Log.v("IP","LINE"+x+" " + y+ " "+ m.x+" "+ m.y);
canvas.drawLine(x, y,m.x, m.y, paint);
}
x=m.x;
y=m.y;
}
x=y=-1;
}
}