PictureRecorder
- class PictureRecorder
Methods
Overloaded function.
Signal that the caller is done recording.
Signal that the caller is done recording.
Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy (BBH) generation.
Returns the recording canvas if one is active, or NULL if recording is not active.
Methods
- PictureRecorder.__init__(self: skia.PictureRecorder) None
- PictureRecorder.beginRecording(*args, **kwargs)
Overloaded function.
beginRecording(self: skia.PictureRecorder, bounds: skia.Rect, bbh: skia.BBoxHierarchy) -> SkCanvas
Returns the canvas that records the drawing commands.
beginRecording(self: skia.PictureRecorder, bounds: skia.Rect) -> SkCanvas
Returns the canvas that records the drawing commands.
- bounds:
the cull rect used when recording this picture. Any drawing the falls outside of this rect is undefined, and may be drawn or it may not.
- return:
the canvas.
beginRecording(self: skia.PictureRecorder, width: float, height: float) -> SkCanvas
- PictureRecorder.finishRecordingAsDrawable(self: skia.PictureRecorder) skia.Drawable
Signal that the caller is done recording.
This invalidates the canvas returned by
beginRecording()
orgetRecordingCanvas()
. Ownership of the object is passed to the caller, who must call unref() when they are done using it.Unlike
finishRecordingAsPicture()
, which returns an immutable picture, the returned drawable may contain live references to other drawables (if they were added to the recording canvas) and therefore this drawable will reflect the current state of those nested drawables anytime it is drawn or a new picture is snapped from it (by calling drawable.newPictureSnapshot()).
- PictureRecorder.finishRecordingAsPicture(self: skia.PictureRecorder) skia.Picture
Signal that the caller is done recording.
This invalidates the canvas returned by
beginRecording()
orgetRecordingCanvas()
. Ownership of the object is passed to the caller, who must call unref() when they are done using it.The returned picture is immutable. If during recording drawables were added to the canvas, these will have been “drawn” into a recording canvas, so that this resulting picture will reflect their current state, but will not contain a live reference to the drawables themselves.
- PictureRecorder.finishRecordingAsPictureWithCull(self: skia.PictureRecorder, cullRect: skia.Rect) skia.Picture
Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy (BBH) generation.
The behavior is the same as calling
finishRecordingAsPicture()
, except that this method updates the cull rect initially passed into beginRecording.- Parameters:
cullRect (skia.Rect) – the new culling rectangle to use as the overall bound for BBH generation and subsequent culling operations.
- Returns:
the picture containing the recorded content.
- PictureRecorder.getRecordingCanvas(self: skia.PictureRecorder) SkCanvas
Returns the recording canvas if one is active, or NULL if recording is not active.
This does not alter the refcnt on the canvas (if present).