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

x/skia_canvas/src/svgcanvas.ts>SvgCanvas

Fast HTML Canvas API implementation for Deno using Google Skia
Latest
class SvgCanvas
import { SvgCanvas } from "https://deno.land/x/skia_canvas@0.5.8/src/svgcanvas.ts";

A canvas that can be used to render SVG.

Make sure to call complete() when you are done drawing. Only call save() or encode() after calling complete(), once.

Constructors

new
SvgCanvas(
width: number,
height: number,
options?: SvgCanvasOptions,
)

Methods

In order to complete the SVG, you must call this method. Call it only once before saving or encoding.

encode(): Uint8Array

Encode and return buffer containing SVG data

Obtain 2D context for drawing on SVG

save(path: string)

Save SVG on file system

toString(): string

Convert to SVG string