【发布时间】:2022-02-21 19:54:42
【问题描述】:
以下代码定义了我的位图:
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 形式返回的缩放位图,而不是原始?
【问题讨论】: