2
觸摸我創建並移動位圖。現在我想在縮放位圖的同時移動它。我如何帶來這種效果?我使用一個精靈對象來移動它。我想創造一個拍攝的幻覺。我想這應該通過邏輯來實現。如何在移動位圖時縮放位圖?
public class SpriteObject {
private Bitmap bitmap;
private int x;
private int y;
private int x_move = 0;
private int y_move = -1;
public SpriteObject(Bitmap bitmap, int x, int y) {
this.bitmap = bitmap;
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public Bitmap getBitmap() {
return bitmap;
}
public void setMoveX(int movex){
x_move = movex;
}
public void setMoveY(int movey){
y_move = movey;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public void setBitmap(Bitmap bitmap) {
this.bitmap = bitmap;
}
public void draw(Canvas canvas) {
canvas.drawBitmap(bitmap, x - (bitmap.getWidth()/2), y - (bitmap.getHeight()/2), null);
}
public void update(int adj_mov) {
x += (adj_mov * x_move);
y += (adj_mov * y_move);
}
public void still(int adj_still) {
x += (adj_still * x_move);
y += (adj_still * y_move);
}
}
規模,然後在規定的(移動)座標繪製。 'Bitmap.createScaledBitmap' – Doomsknight
可以給我來源或鏈接,這將導致我的解決方案。我試圖使用scaledbitmap它wouldnt工作。 – koherent
http://stackoverflow.com/questions/4837715/how-to-resize-a-bitmap-in-android – Doomsknight