Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ScreenshotTools

Class containing a set of static utilities functions for screenshots

Hierarchy

  • ScreenshotTools

Index

Methods

Static CreateScreenshotSearch playground for CreateScreenshot

  • CreateScreenshot(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string): void
  • Captures a screenshot of the current rendering

    see

    https://doc.babylonjs.com/how_to/render_scene_on_a_png

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: IScreenshotSize | number

      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

    • Optional successCallback: (data: string) => void

      defines 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

        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

      defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    Returns void

Static CreateScreenshotAsyncSearch playground for CreateScreenshotAsync

  • CreateScreenshotAsync(engine: Engine, camera: Camera, size: any, mimeType?: string): Promise<string>
  • Captures a screenshot of the current rendering

    see

    https://doc.babylonjs.com/how_to/render_scene_on_a_png

    Parameters

    • engine: Engine

      defines the rendering engine

    • camera: Camera

      defines the source camera

    • size: any

      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

    • Optional mimeType: string

      defines the MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    Returns Promise<string>

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

Static CreateScreenshotUsingRenderTargetSearch playground for CreateScreenshotUsingRenderTarget

  • CreateScreenshotUsingRenderTarget(engine: Engine, camera: Camera, size: IScreenshotSize | number, successCallback?: (data: string) => void, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean, enableStencilBuffer?: boolean): void
  • Generates an image screenshot from the specified camera.

    see

    https://doc.babylonjs.com/how_to/render_scene_on_a_png

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: IScreenshotSize | number

      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

    • Optional successCallback: (data: string) => void

      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

        • (data: string): void
        • Parameters

          • data: string

          Returns void

    • Optional mimeType: string

      The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    • Optional samples: number

      Texture samples (default: 1)

    • Optional antialiasing: boolean

      Whether antialiasing should be turned on or not (default: false)

    • Optional fileName: string

      A name for for the downloaded file.

    • Optional renderSprites: boolean

      Whether the sprites should be rendered or not (default: false)

    • Optional enableStencilBuffer: boolean

      Whether the stencil buffer should be enabled or not (default: false)

    Returns void

Static CreateScreenshotUsingRenderTargetAsyncSearch playground for CreateScreenshotUsingRenderTargetAsync

  • CreateScreenshotUsingRenderTargetAsync(engine: Engine, camera: Camera, size: any, mimeType?: string, samples?: number, antialiasing?: boolean, fileName?: string, renderSprites?: boolean): Promise<string>
  • Generates an image screenshot from the specified camera.

    see

    https://doc.babylonjs.com/how_to/render_scene_on_a_png

    Parameters

    • engine: Engine

      The engine to use for rendering

    • camera: Camera

      The camera to use for rendering

    • size: any

      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

    • Optional mimeType: string

      The MIME type of the screenshot image (default: image/png). Check your browser for supported MIME types

    • Optional samples: number

      Texture samples (default: 1)

    • Optional antialiasing: boolean

      Whether antialiasing should be turned on or not (default: false)

    • Optional fileName: string

      A name for for the downloaded file.

    • Optional renderSprites: boolean

      Whether the sprites should be rendered or not (default: false)

    Returns Promise<string>

    screenshot as a string of base64-encoded characters. This string can be assigned to the src parameter of an to display it

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method