@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); if (drawing != null && this.isMoving == true) { if (!(drawing instanceof Eraser)) drawing.draw(canvas); else drawing.draw(paper); } canvas.drawBitmap(bitmap, 0, 0, new Paint(Paint.DITHER_FLAG)); if (!(drawing instanceof Eraser)) { Bitmap pen = BitmapFactory.decodeResource(this.getResources(), R.drawable.pen); canvas.drawBitmap( pen, this.tempX, this.tempY - pen.getHeight(), new Paint(Paint.DITHER_FLAG)); } else { Bitmap eraser = BitmapFactory.decodeResource(this.getResources(), R.drawable.eraser); canvas.drawBitmap( eraser, this.tempX, this.tempY - eraser.getHeight(), new Paint(Paint.DITHER_FLAG)); } }
public void ClearBitmapResource() { if (bitmap != null) { bitmap.recycle(); bitmap = null; } if (drawing != null) { drawing.ExitDrawing(); } }
private void fingerMove(float x, float y) { this.tempX = x; this.tempY = y; this.isMoving = true; drawing.fingerMove(x, y, paper); }
private void fingerDown(float x, float y) { this.isMoving = false; drawing.fingerDown(x, y, paper); }
private void fingerUp(float x, float y) { this.tempX = 0; this.tempY = 0; drawing.fingerUp(x, y, paper); this.isMoving = false; }