AutoCanvasRestore
- class AutoCanvasRestore
Stack helper class calls
Canvas.restoreToCount()
whenAutoCanvasRestore
goes out of scope.Use this to guarantee that the canvas is restored to a known state.
Example:
with skia.AutoCanvasRestore(canvas): canvas.drawCircle(50., 50., 10., paint)
Methods
Preserves
Canvas.save()
count.Restores
Canvas
to saved state immediately.
Methods
- AutoCanvasRestore.__init__(self: skia.AutoCanvasRestore, canvas: SkCanvas, doSave: bool = True) None
Preserves
Canvas.save()
count.Optionally saves
Canvas
clip andCanvas
matrix.- Parameters:
canvas (skia.Canvas) –
Canvas
to guarddoSave (bool) – call
Canvas.save()
- Returns:
utility to restore
Canvas
state on destructor
- AutoCanvasRestore.restore(self: skia.AutoCanvasRestore) None
Restores
Canvas
to saved state immediately.Subsequent calls and destructor have no effect.