I have implemented a code which display back image on touch . Where touch finger move that area of back image view display and front image view become invisible . I just want scrub massage on hand my code is here can anybody suggest how i do that
public class StartActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new TouchView(this));
}
public TouchView(Context context) {
super(context);
bgr = BitmapFactory.decodeResource(getResources(), R.drawable.bgr);
overlayDefault = BitmapFactory.decodeResource(getResources(),
R.drawable.over);
overlay = BitmapFactory.decodeResource(getResources(),
R.drawable.over).copy(Config.ARGB_8888, true);
c2 = new Canvas(overlay);
pTouch = new Paint(Paint.ANTI_ALIAS_FLAG);
pTouch.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT));
pTouch.setColor(Color.TRANSPARENT);
pTouch.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN: {
X = (int) ev.getX();
Y = (int) ev.getY();
invalidate();
break;
}
case MotionEvent.ACTION_MOVE: {
X = (int) ev.getX();
Y = (int) ev.getY();
invalidate();
break;
}
case MotionEvent.ACTION_UP:
break;
}
return true;
}
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
// draw background
canvas.drawBitmap(bgr, 0, 0, null);
// copy the default overlay into temporary overlay and punch a hole
// in it
c2.drawBitmap(overlayDefault, 0, 0, null); // exclude this line to
// show all as you draw
c2.drawCircle(X, Y, 80, pTouch);
// draw the overlay over the background
canvas.drawBitmap(overlay, 0, 0, null);
}
}