画布中的背景(图像),同时在顶部绘制路径
@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);
是第二个时,当我在屏幕上绘制它们时,我的路径就会显示出来。有没有办法使背景(位图)显示在画布路径下方?
@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);
}
}
I've tried switching around the lines
canvas.drawColor(0xFFAAAAAA);
canvas.drawBitmap(background,0,0,mBitmapPaint);
and when canvas.drawColor(0xFFAAAAAA);
is second, my paths will show up when I draw them on the screen. Is there a way to make the background (bitmap) show underneath the canvas paths?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试设置 Xfermode在你的路径的油漆中:
并参见 PorterDuff .Mode 解释。
Try setting the Xfermode in your Path's paint:
and see PorterDuff.Mode explained.