以下代码定义了我的 Bitmap:
Resources res = context.getResources();
mBackground = BitmapFactory.decodeResource(res, R.drawable.background);
// scale bitmap
int h = 800; // height in pixels
int w = 480; // width in pixels
// Make sure w and h are in the correct order
Bitmap scaled = Bitmap.createScaledBitmap(mBackground, w, h, true);
以下代码用于执行/绘制它(未进行缩放的位图):
canvas.drawBitmap(mBackground, 0, 0, null);
我的问题是,如何将其设置为绘制以 Bitmap scaled
形式返回的缩放位图,而不是原始位图?