Clean up the surface and any extra memory. [Deprecated]: In the future, calls to delete() will be sufficient to clean up the memory.
A convenient way to draw exactly once on the canvas associated with this surface. This requires an environment where a global function called requestAnimationFrame is available (e.g. on the web, not on Node). Users do not need to flush the surface, or delete/dispose of it as that is taken care of automatically with this wrapper.
Node users should call getCanvas() and work with that canvas directly.
Make sure any queued draws are sent to the screen or the GPU.
Return a canvas that is backed by this surface. Any draws to the canvas will (eventually) show up on the surface. The returned canvas is owned by the surface and does NOT need to be cleaned up by the client.
Returns the height of this surface in pixels.
Returns the ImageInfo associated with this surface.
Returns a texture-backed image based on the content in src. It uses RGBA_8888, unpremul and SRGB - for more control, use makeImageFromTexture.
The underlying texture for this image will be created immediately from src, so it can be disposed of after this call. This image will only be usable for this surface (because WebGL textures are not transferable to other WebGL contexts). For an image that can be used across multiple surfaces, at the cost of being lazily loaded, see MakeLazyImageFromTextureSource.
Not available for software-backed surfaces.
Optionalinfo: ImageInfo | PartialImageInfoIf provided, will be used to determine the width/height/format of the source image. If not, sensible defaults will be used.
OptionalsrcIsPremul: booleanset to true if the src data has premultiplied alpha. Otherwise, it will be assumed to be Unpremultiplied. Note: if this is true and info specifies Unpremul, Skia will not convert the src pixels first.
Returns current contents of the surface as an Image. This image will be optimized to be drawn to another surface of the same type. For example, if this surface is backed by the GPU, the returned Image will be backed by a GPU texture.
Optionalbounds: InputIRectReturns if this Surface is a GPU-backed surface or not.
A convenient way to draw multiple frames on the canvas associated with this surface. This requires an environment where a global function called requestAnimationFrame is available (e.g. on the web, not on Node). Users do not need to flush the surface, as that is taken care of automatically with this wrapper.
Users should probably call surface.requestAnimationFrame in the callback function to draw multiple frames, e.g. of an animation.
Node users should call getCanvas() and work with that canvas directly.
Returns the animation id.
If this surface is GPU-backed, return the sample count of the surface.
Updates the underlying GPU texture of the image to be the contents of the provided TextureSource. Has no effect on CPU backend or if img was not created with either makeImageFromTextureSource or makeImageFromTexture. If the provided TextureSource is of different dimensions than the Image, the contents will be deformed (e.g. squished). The ColorType, AlphaType, and ColorSpace of src should match the original settings used to create the Image or it may draw strange.
A texture-backed Image.
A valid texture source of any dimensions.
OptionalsrcIsPremul: booleanset to true if the src data has premultiplied alpha. Otherwise, it will be assumed to be Unpremultiplied. Note: if this is true and the image was created with Unpremul, Skia will not convert.
Returns the width of this surface in pixels.
CanvasKit is built with Emscripten and Embind. Embind adds the following methods to all objects that are exposed with it. This _type field is necessary for the TypeScript compiler to differentiate between opaque types such as Shader and ColorFilter. It doesn't exist at runtime.