SkiaSharp ver : 1.56.0
tested on Xamarin.Forms
hi,
Once I clip canvas, like below
canvas.ClipPath(mypath);
There is no way to remove clipping path like,
I really need to remove clipping mask.
If it's not working, I have to create new SKCanvasView and put on it to archive what I want.
(Like a Photoshop Layer.)
I tried it but performance is bad.
I haven't tested it yet, but have you tried saving the canvas, then restoring it after the clipped drawing operation:
canvas.Save();
canvas.ClipPath(mypath);
// .. do stuff ...
canvas.Restore();
You can also make use of the nice SKAutoCanvasRestore:
using (new SKAutoCanvasRestore(canvas)) {
canvas.ClipPath(mypath);
// .. do stuff ...
}
According to the docs: https://developer.xamarin.com/api/member/SkiaSharp.SKCanvas.Save()/
This call saves the current matrix, clip, and draw filter, and pushes a copy onto a private stack. Subsequent calls to translate, scale, rotate, skew, concat or clipping path or drawing filter all operate on this copy. When the balancing call to聽SKCanvas.Restore聽is made, the previous matrix, clipping, and drawing filters are restored.
Yey!!
Your solution is working.
Thanks.
Most helpful comment
I haven't tested it yet, but have you tried saving the canvas, then restoring it after the clipped drawing operation:
You can also make use of the nice
SKAutoCanvasRestore:According to the docs: https://developer.xamarin.com/api/member/SkiaSharp.SKCanvas.Save()/