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