Drawing canvas script interface

The IDrawingCanvasInstance interface derives from IWorldInstance to add APIs specific to the Drawing Canvas plugin.

Drawing Canvas APIs

surfaceDeviceWidth
surfaceDeviceHeight
Read-only values representing the size of the Drawing Canvas rendering surface in device pixels.
async getImagePixelData()
Takes a snapshot of the drawing canvas pixel state on the GPU, and reads it back to the CPU asynchronously. Resolves with an ImageData representing the pixel data. Note this uses unpremultiplied alpha, whereas the surface on the GPU is premultiplied, so technically this is lossy.
loadImagePixelData(imageData, premultiplyAlpha = false)
Load pixel data in an ImageData in to the Drawing Canvas rendering surface. The ImageData must have a size equal to surfaceDeviceWidth and surfaceDeviceHeight. If the optional premultiplyAlpha parameter is set to true, the pixel data will premultiply the alpha (multiplying the RGB components by the A component). This can be left disabled if the pixel data is already premultiplied, which is also faster since the premultiplication step can be skipped.
Construct 3 Manual 2020-01-10

On this page