简体   繁体   中英

Which mode to use to draw on a bitmap

Hi I am using bitmap and following code to erase arcs from bitmap

mPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));

What should I do with mPaint now to make it draw on bitmap.

Make separate methods like

// To clear arcs

void turnEraserOn(){ 
    mPaint.setXfermode(new PorterDuffXfermode(Mode.CLEAR));
}

// To draw again

void turnEraserOff(){
    mPaint.setXfermode(null);
}

and call them whenever needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM