@Override protected void onDraw(Canvas canvas) {
if (mBitmap != null) {
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(background,0,0,mBitmapPaint);
if(isRelevant){
canvas.drawBitmap(mBitmapLast, 0,0, mBitmapLastPaint);
}
canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
canvas.drawPath(mPath, mPaint);
}
}
我尝试过切换
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(background,0,0,mBitmapPaint);
当canvas.drawColor(0xFFAAAAAA);
为秒时,当我在屏幕上绘制它们时,我的路径会显示出来。有没有办法让背景(位图)显示在画布路径下?
答案 0 :(得分:2)
尝试在路径的油漆中设置Xfermode:
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OVER)); // or DST_OVER
并查看PorterDuff.Mode解释。