android - Roid SurfaceView Canvas clear bitmap -
after emptying bitmap, redrawn, , displays.not empty
//draw bitmap private void drawpattern(int x, int y) { canvas canvas = mholder.lockcanvas(); canvas newcanvas = new canvas(mdrawbitmap); mcanvases.add(newcanvas); newcanvas.drawbitmap(mbitmap, x, y, mpaint); newcanvas.drawcolor(color.black); canvas.drawbitmap(mdrawbitmap, x, y, mpaint); mholder.unlockcanvasandpost(canvas); } //empty, public void setboardbackgroundcolor() { canvas canvas = mholder.lockcanvas(null); paint paint = new paint(); paint.setxfermode(new porterduffxfermode(porterduff.mode.clear)); canvas.drawpaint(paint); paint.setxfermode(new porterduffxfermode(porterduff.mode.src)); mholder.unlockcanvasandpost(canvas); }
1.drawpattern 2.setboardbackgroundcolor 3.drawpattern
before painting come out again
Comments
Post a Comment