package com.dome.pokiiez;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.graphics.Canvas;
import android.view.MotionEvent;


public class MyView extends View {


	public Paint paint = new Paint();
	public Path path= new Path();
	protected void onDraw(Canvas canvas){
		Bitmap b= BitmapFactory.decodeResource(getResources(), R.drawable.halfbasket);
		canvas.drawBitmap(b, 0, 0, paint);
		canvas.drawPath(path, paint);
			
	}
public MyView(Context context ){
	super(context);
	path =((Singletouchdemo) context).path;
	paint.setAntiAlias(true);
	paint.setStrokeWidth(6f);
	paint.setColor(Color.WHITE);
	paint.setStyle(Paint.Style.STROKE);
	paint.setStrokeJoin(Paint.Join.ROUND);

	
}

@Override
public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();

switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
	path.moveTo(x, y);
	return true;
case MotionEvent.ACTION_MOVE:
	path.lineTo(x, y);
	break;
case MotionEvent.ACTION_UP:
	break;
	default:
	return false;
}

invalidate();
return true;

}


}