I want to remove the area where the finger is detected in the bitmap of the gray square, but it does not work.
I show a bitmap with ic_launch as an image, then I show a gray Paint square in the image where I can change the color to TRANSPARENT
What is the problem? Thanks you
private Bitmap mBitmap; private Canvas mCanvas; private Path mPath; private Paint mBitmapPaint; private Paint mPaint; public CaseView(Context c) { super(c); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeWidth(40); mBitmap = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888); for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { mBitmap.setPixel(i, j, Color.GRAY); } } mCanvas = new Canvas(mBitmap); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(0, 0, oldw, oldh); } @Override protected void onDraw(Canvas canvas) { canvas.drawRect(100, 100, 200, 200, mBitmapPaint); canvas.drawPath(mPath, mPaint); Bitmap _scratch = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); canvas.drawColor(Color.WHITE);
source share