Function CreateScreenshot
-
CreateScreenshot(
engine: AbstractEngine,
camera: Camera,
size: number | IScreenshotSize,
successCallback?: (data: string) => void,
mimeType?: string,
forceDownload?: boolean,
quality?: number,
useFill?: boolean,
clearWithSceneColor?: boolean,
): voidParameters
- engine: AbstractEngine
defines the rendering engine
- camera: Camera
defines the source camera. If the camera is not the scene's active camera, CreateScreenshotUsingRenderTarget will be used instead, and
useFillwill be ignored - size: number | IScreenshotSize
This parameter can be set to a single number or to an object with the following (optional) properties: precision, width, height. If a single number is passed, it will be used for both width and height. If an object is passed, the screenshot size will be derived from the parameters. The precision property is a multiplier allowing rendering at a higher or lower resolution
OptionalsuccessCallback: (data: string) => voiddefines the callback receives a single parameter which contains the screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an
to display it
- mimeType: string = "image/png"
defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types
- forceDownload: boolean = false
force the system to download the image even if a successCallback is provided
Optionalquality: numberThe quality of the image if lossy mimeType is used (e.g. image/jpeg, image/webp). See HTMLCanvasElement.toBlob()'s
qualityparameter.- useFill: boolean = false
fill the screenshot dimensions with the render canvas and clip any overflow. If false, fit the canvas within the screenshot, as in letterboxing.
- clearWithSceneColor: boolean = false
If true, the screenshot canvas will be cleared with the scene clear color before copying the render.
Returns void
- engine: AbstractEngine
Captures a screenshot of the current rendering Please note that simultaneous screenshots are not supported: you must wait until one screenshot is complete before taking another.