Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/canvaseno/types.ts>SkSurface

Canvas API for deno
Latest
interface SkSurface
implements EmbindObject<SkSurface>
import { type SkSurface } from "https://deno.land/x/canvaseno@v1.0.2/types.ts";

Methods

captureFrameAsSkPicture(drawFrame: (canvas: SkCanvas) => void): SkPicture

Call the given callback and save the result of that draw to a SkPicture with the same dimensions as this surface. The SkPicture will be returned.

dispose(): void

Clean up the surface and any extra memory. [Deprecated]: In the future, calls to delete() will be sufficient to clean up the memory.

flush(): void

Make sure any queued draws are sent to the screen or the GPU.

getCanvas(): SkCanvas

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.

height(): number

Returns the height of this surface in pixels.

imageInfo(): SkImageInfo

Returns the ImageInfo associated with this surface.

makeImageSnapshot(bounds?: InputIRect): SkImage

Returns current contents of the surface as an SkImage. 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 SkImage will be backed by a GPU texture.

makeSurface(info: SkImageInfo): SkSurface

Returns a compatible SkSurface, haring the same raster or GPU properties of the original. The pixels are not shared.

reportBackendTypeIsGPU(): boolean

Returns if this Surface is a GPU-backed surface or not.

sampleCnt(): number

If this surface is GPU-backed, return the sample count of the surface.

width(): number

Returns the width of this surface in pixels.