画在白色位另一个位图 [英] draw over a white bitmap another bitmap
本文介绍了画在白色位另一个位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想画在白色涂漆与位图乱画另一个位图,但结果始终是白色:
I'm trying to draw over a white painted bitmap another bitmap with doodles, but the result is always white:
Bitmap myBitmap = mBitmap;
Canvas canvas = new Canvas(myBitmap);
Paint paint = new Paint(Paint.FILTER_BITMAP_FLAG);
canvas.drawColor(0xffffffff);
canvas.drawBitmap(mBitmap, 0, 0, paint);
myBitmap.compress(CompressFormat.PNG, 100, output);
我怎样才能让白色为背景,和绘画在画面的前景?
How i can make white as background, and paintings as foreground in the picture?
推荐答案
回答我的问题了即将成为提问者:
answering my own question for futur askers:
Bitmap bmOverlay = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig());
Bitmap bmp2 = Bitmap.createBitmap(mBitmap.getWidth(), mBitmap.getHeight(), mBitmap.getConfig());
Canvas canvas = new Canvas(bmOverlay);
bmp2.eraseColor(0xffffffff);
canvas.drawBitmap(bmp2, new Matrix(), null);
canvas.drawBitmap(mBitmap, new Matrix(), null);
bmOverlay是我们想要的最终位图。
bmOverlay is the final bitmap we want.
这篇关于画在白色位另一个位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文