Android Bitmap换背景颜色

public static Bitmap drawBg4Bitmap(int color, Bitmap orginBitmap) {
		Paint paint = new Paint();
		paint.setColor(color);
		Bitmap bitmap = Bitmap.createBitmap(orginBitmap.getWidth(),
				orginBitmap.getHeight(), orginBitmap.getConfig());
		Canvas canvas = new Canvas(bitmap);
		canvas.drawRect(0, 0, orginBitmap.getWidth(), orginBitmap.getHeight(), paint);
		canvas.drawBitmap(orginBitmap, 0, 0, paint);
		return bitmap;
	}

你可能感兴趣的:(Android Bitmap换背景颜色)