0
我想用Canvas.scale(2f,2f)放大我的位圖,但是當我這樣做時,圖像消失。Canvas.Scale,位圖消失
這裏是我的代碼:
int srcLeft = GodFrameWidth * GodCurAnimation;
int srcTop = 0;
int srcRight = (GodFrameWidth * GodCurAnimation) + GodFrameWidth;
int srcBottom = GodFrameHeight;
float destLeft = CanvasWidth/2 - GodFrameWidth;
float destTop = CanvasHeight/2;
float destRight = destLeft + GodFrameWidth;
float destBottom = destTop + GodFrameHeight;
RectF dst = new RectF(destLeft, destTop,destRight ,destBottom);
Rect src = new Rect(srcLeft,srcTop,srcRight,srcBottom);
canvas.save();
canvas.scale(2f, 2f);
canvas.drawBitmap(GodMap, src, dst,Pencil);
canvas.restore();
,如果我不擴展它,它正好出現在屏幕上,在那裏我希望它是中間。
任何想法?