erase Rectangle from Canvas - Android Graphics

Android examples for Graphics:Canvas

Description

erase Rectangle from Canvas

Demo Code


//package com.java2s;

import android.graphics.Canvas;

import android.graphics.Paint;

import android.graphics.PorterDuffXfermode;

import android.graphics.RectF;

public class Main {
    public static void erase(Canvas canvas, RectF rectf) {
        Paint paint = new Paint();
        paint.setColor(0);/*from w  w  w . j  a va  2s  . c  o  m*/
        paint.setDither(true);
        paint.setXfermode(new PorterDuffXfermode(
                android.graphics.PorterDuff.Mode.CLEAR));
        canvas.drawRect(rectf, paint);
    }
}

Related Tutorials