Skip to main content
Module

x/canvas/mod.ts>SkImage

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Go to Latest
interface SkImage
implements EmbindObject<SkImage>
import { type SkImage } from "https://deno.land/x/canvas@v1.0.0/mod.ts";

See SkImage.h for more information on this class.

Methods

encodeToData(): SkData

Encodes this image's pixels to PNG and returns them. Must be built with the PNG codec.

encodeToDataWithFormat(fmt: EncodedImageFormat, quality: number): SkData

Encodes this image's pixels to the specified format and returns them. Must be built with the specified codec.

height(): number

Return the height in pixels of the image.

makeShader(
localMatrix?: InputMatrix,
): SkShader

Returns this image as a shader with the specified tiling.

readPixels(
imageInfo: SkImageInfo,
srcX: number,
srcY: number,
): Uint8Array | Float32Array | null

Returns a TypedArray containing the pixels reading starting at (srcX, srcY) and does not exceed the size indicated by imageInfo. See SkImage.h for more on the caveats.

width(): number

Return the width in pixels of the image.