Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Canvas.clipRect() - Removing existing clip

I have a Canvas object, at some point I set a clip so I could draw into that 'window/section' without worrying about overflow into other parts of the canvas.

After I'm done drawing into the 'window' I want to remove that clip area, which I cant seem to do.

There is no remove clip function, when I try to apply a new clip on the entire canvas, that clip is not being applied - Calling canvas.getClipBounds() right after applying the new clip returns a Rect with the previous clip.

like image 410
Aviran Avatar asked Mar 17 '15 13:03

Aviran


1 Answers

Use canvas.save() before setting the clip rect then canvas.restore() to discard the clipping rect.

like image 117
Raphaël Avatar answered Sep 29 '22 23:09

Raphaël