我正在尝试实现撤消重做功能,以便在自定义视图中删除图片,并尝试从ANDROID - Undo and Redo in canvas实现解决方案,但是当我点击撤消时,它会填充坐标和圆圈位图下面的同一个绘图对象而不是位图本身,因为撤消应该起作用。请帮助。
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
xn=context;
Log.e(TAG, "The Bitmap is " + bmrot);
mPaint = new Paint();
mPaint.setAlpha(0);
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
mPaint.setAntiAlias(true);
mPaint.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.SOLID));
alphaPaint = new Paint();
alphaPaint.setAlpha(255);
pcanvas = new Canvas();
bitmap = bmrot.createBitmap(bmrot.getWidth(), bmrot.getHeight(), Bitmap.Config.ARGB_8888);
bac=bmrot;
setBackgroundColor(Color.parseColor("#4d4d4d"));
Log.e(TAG, "LOGGERHEAD2");
pcanvas.setBitmap(bitmap);
pcanvas.drawBitmap(bmrot, reqx, reqy, alphaPaint);
}