开发者

How to move bitmap from one point to another point in android

I need to move bitmap from middle of the screen to end. I am using the canvas and I am drawing bitmap on top of another bitmap. I need to move top bitmap alone.

pcanvas = new Canvas();  

 pcanvas.setBitmap(bitmap);  

 pcanvas.drawBitmap(myBitmap, 0, 0, null);  

 pcanvas.drawBitmap(bmp, stDropCurPoint.x, stDropCurPoint.y, null);

i am trying to move bitmap bmp.Currently I am using below code to move the bitmap but it is not working.

    开发者_StackOverflowif (start == true)
{
       pcanvas.drawBitmap(bmp, stDropCurPoint.x, stDropCurPoint.y, null);  
       start = false;
    }
    else
    {
        pcanvas.save();
        pcanvas.clipRect(0,0,stDropCurPoint.x,stDropCurPoint.y);                    
        pcanvas.restore();              

    }

Kindly let me know how to solve this problem. Thanks in advance.

Pavan


cliprect() won't help you... what you are probably looking for is translate()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜