예제 #1
0
 @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));
   }
 }
예제 #2
0
 public void ClearBitmapResource() {
   if (bitmap != null) {
     bitmap.recycle();
     bitmap = null;
   }
   if (drawing != null) {
     drawing.ExitDrawing();
   }
 }
예제 #3
0
 private void fingerMove(float x, float y) {
   this.tempX = x;
   this.tempY = y;
   this.isMoving = true;
   drawing.fingerMove(x, y, paper);
 }
예제 #4
0
 private void fingerDown(float x, float y) {
   this.isMoving = false;
   drawing.fingerDown(x, y, paper);
 }
예제 #5
0
 private void fingerUp(float x, float y) {
   this.tempX = 0;
   this.tempY = 0;
   drawing.fingerUp(x, y, paper);
   this.isMoving = false;
 }