如题,关键代码如下:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.bitmap_change);
iView = (ImageView)findViewById(R.id.iv);
originBg = BitmapFactory.decodeResource(this.getResources(), R.drawable.download_completed);
labelBitmap = BitmapFactory.decodeResource(this.getResources(), R.drawable.icon);
int widthOrg = originBg.getWidth();
int heightOrg = originBg.getHeight();
resultBitmap = Bitmap.createBitmap(widthOrg,heightOrg,Config.ARGB_8888);
Canvas canvasIn = new Canvas(resultBitmap);
canvasIn.drawBitmap(originBg,0,0,null);
canvasIn.drawBitmap(labelBitmap,10,10,null);
canvasIn.save();
iView.setImageBitmap(resultBitmap);
// newMap = Bitmap.createBitmap(bitmap, 0, 0, widthOrg, heightOrg, matrix,true);
}
private Bitmap zoomBitmap(float scale)
{
Matrix m = new Matrix();
m.postScale(scale, scale);
resultBitmap = Bitmap.createBitmap(resultBitmap, 0, 0, resultBitmap.getWidth(), resultBitmap.getHeight(), m, true);
return resultBitmap;
}