方法(因要取得SurfaceView的寬高,故下面程式碼以this取得)
int W = this.getWidth(); //縮放後的寬
int H = this.getHeight(); //縮放後的高
Bitmap resizeBmp = Bitmap.createScaledBitmap(bmpBackField, W, H, true);
canvas.drawBitmap(resizeBmp, 0, 0, null);
官方Bitmap的相關說明
**************************
public static Bitmap createScaledBitmap (Bitmap src, int dstWidth, int dstHeight, boolean filter)
Creates a new bitmap, scaled from an existing bitmap.
Parameters
src The source bitmap.
dstWidth The new bitmap's desired width.
dstHeight The new bitmap's desired height.
filter true if the source should be filtered.
Returns
the new scaled bitmap.
**************************
沒有留言:
張貼留言