0
我有從頂角拍攝的賽道圖像。我想將這張圖放大2倍。 汽車會在背景上移動,背景會因爲放大而變大,應該隨着汽車的行駛而變化。滾動,放大,背景
我已經設法放大背景圖像,但我有點麻煩,使它跟隨汽車。
這是我走到這一步:
float height = (float) background.getHeight();
float width = (float) background.getWidth();
float newLeft = 0
float newTop = 0;
float newWidth = background.getWidth() * 2; //zoom in effect
float newHeight = background.getHeight() * 2; //zoom in effect
Matrix mat = new Matrix();
mat.postTranslate(newLeft, newTop);
mat.setScale(newWidth/width, newHeight/height);
canvas.drawBitmap(background, mat, new Paint());
它給了我在後臺放大,但我不知道如何在圖像中移動此變焦。
有誰知道如何做到這一點?
謝謝!