Q:

How to draw lines on the bitmap used in ImageViewZoom?

I recently started using ImageViewZoom 
(https://github.com/sephiroth74/ImageViewZoom)
and what I'm going to do is to draw some lines on the bitmap used in this View from time to time. 
I tried to do it in the following way, but the result is that the View is no longer able to zoom.
protected void onDraw(Canvas canvas) 
{   
    // TODO Auto-generated method stub
    super.onDraw(canvas);

    Canvas bmp_canvas = new Canvas(bmp);//bmp is the original bitmap

    Paint paint = new Paint();

    //Draw map
    paint. setColor(Color.BLUE);
    paint. setStrokeWidth(10);
    int i;
    for(i=0; i<toDraw.size();i++)
    {
        Segment now = toDraw.get(i); //toDraw is a List and stores the lines

        PointType tmp_start = now.s;
        PointType tmp_end = now.e;

        bmp_canvas.drawLine((float)tmp_start.x, (float)tmp_start.y, 
                (float)tmp_end.x, (float)tmp_end.y, paint);
    }

    Matrix matrix = getImageViewMatrix();
    setImageBitmap(bmp, matrix, ZOOM_INVALID, ZOOM_INVALID);        
    return;
}

So what is the correct way to do it? Thank you very much!

A:

Well, I solved it myself!
I did it in the following way:
public void drawMap(Bitmap bmp) //a new function outside of onDraw()
{
    Bitmap now_bmp = Bitmap.createBitmap(bmp);
    Canvas canvas = new Canvas(now_bmp);
    Paint paint = new Paint();

    //Draw map
    paint. setColor(Color.BLUE);
    paint. setStrokeWidth(10);
    int i;
    for(i=0; i<toDraw.size();i++)
    {
        Segment now = toDraw.get(i);

        PointType tmp_start = now.s;
        PointType tmp_end = now.e;

        canvas.drawLine((float)tmp_start.x, (float)tmp_start.y, 
                (float)tmp_end.x, (float)tmp_end.y, paint);
    }

    Matrix matrix = getDisplayMatrix();
    setImageBitmap(now_bmp, matrix, ZOOM_INVALID, ZOOM_INVALID);     
}

In short, just create a Canvas with the origin Bitmap, then draw something on it, the result will be stored in the bitmap, and get the current matrix, and set the new bitmap to the ImageViewZoom, that's all.

