Phaser API Documentation

  Version: 
snapshotPixel(x, y, callback)

Description:

Takes a snapshot of the given pixel from this Dynamic Texture.

The snapshot is taken immediately, but the results are returned via the given callback.

To capture the whole Dynamic Texture see the snapshot method. To capture a portion of this Dynamic Texture see the snapshotArea method.

Unlike the two other snapshot methods, this one will send your callback a Color object containing the color data for the requested pixel. It doesn't need to create an internal Canvas or Image object, so is a lot faster to execute, using less memory than the other snapshot methods.

Parameters:

name type description
x number

The x coordinate of the pixel to get.

y number

The y coordinate of the pixel to get.

callback Phaser.Types.Renderer.Snapshot.SnapshotCallback

The Function to invoke after the snapshot pixel data is extracted.

Returns:
Description:

This Dynamic Texture instance.

Since: 3.19.0