Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: Snapshot
Phaser.Types.Renderer.Snapshot

Type Definitions

SnapshotCallback(snapshot)
Focus
Focus

Parameters:

name type description
snapshot HTMLImageElement | Phaser.Display.Color

Either a Color object if a single pixel is being grabbed, or a new Image which contains a snapshot of the canvas contents.

Type:
function
Focus
Focus
SnapshotState
Focus
Focus
Properties:
name type arguments Default description
callback Phaser.Types.Renderer.Snapshot.SnapshotCallback

The function to call after the snapshot is taken.

type string <optional> 'image/png'

The format of the image to create, usually image/png or image/jpeg.

encoderOptions number <optional> 0.92

The image quality, between 0 and 1. Used for image formats with lossy compression, such as image/jpeg.

x number <optional> 0

The x coordinate to start the snapshot from.

y number <optional> 0

The y coordinate to start the snapshot from.

width number <optional>

The width of the snapshot.

height number <optional>

The height of the snapshot.

getPixel boolean <optional> false

Is this a snapshot to get a single pixel, or an area?

isFramebuffer boolean <optional> false

Is this snapshot grabbing from a frame buffer or a canvas?

bufferWidth number <optional>

The width of the frame buffer, if a frame buffer grab.

bufferHeight number <optional>

The height of the frame buffer, if a frame buffer grab.

Type:
object
Since: 3.16.1
Focus
Focus