Class: Snapshoter
@geenee/armature.Snapshoter
Snapshot helper
Takes a snapshot of the ResponsiveCanvas backing a CanvasRenderer. In general, ResponsiveCanvas is multi-layer therefore two capturing modes are available: capture all layers separately or merge them into one image. When you call snapshot() method Snapshoter waits for the next render update and makes a copy of all canvas layers. There're several modes for the resolution of the snapshot: "video" - snapshot has the same size as the video stream, "max"/"min" - in maximum/minimum size among canvas layers.
Constructors
constructor
• new Snapshoter(renderer
, mirror?
, sizeMode?
, sizeMax?
)
Constructor
Parameters
Name | Type | Default value | Description |
---|---|---|---|
renderer | CanvasRenderer <{}> | undefined | Renderer to take snapshot of |
mirror | boolean | false | Mirror captured images |
sizeMode | "video" | "max" | "min" | "video" | Video size mode |
sizeMax? | number | undefined | Maximum video size |
Properties
mirror
• Protected
mirror: boolean
= false
renderer
• Protected
renderer: CanvasRenderer
<{}>
sizeMax
• Protected
Optional
sizeMax: number
sizeMode
• Protected
sizeMode: "video"
| "max"
| "min"
= "video"
Methods
snapshot
▸ snapshot(): Promise
<undefined
| ImageData
>
Take snapshot of the renderer
Enqueues capture after the next renderer update. All canvas layers are merged into one final image.
Returns
Promise
<undefined
| ImageData
>
Promise resolved to the merged captured image
snapshotLayers
▸ snapshotLayers(): Promise
<(undefined
| ImageData
)[]>
Take snapshot of the renderer
Enqueues capture after the next renderer update. All canvas layers are returned as separate images.
Returns
Promise
<(undefined
| ImageData
)[]>
Promise resolved to the array of captured images