0.1.0 • Published 9 months ago

@jsrob/svg-canvas v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

svg-canvas

Forked from red-agate-svg-canvas

Changes in this fork
  • ESM by default.
  • Ships ESM and CJS bundles.
  • Conventional Commits by default.
import { Rect2D, SvgCanvas }  from '@jsrob/svg-canvas';

const canvasCtx = new SvgCanvas();

// You can call HTML5 Canvas APIs.
// See also: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API
canvasCtx.fillRect(10, 10, 80, 180);

// Render as SVG.
const svgString = canvasCtx.render(new Rect2D(0, 0 , 100, 200), 'mm');

// //Render as data URL encoded SVG.
// const svgDataUrl = canvasCtx.toDataUrl(new Rect2D(0, 0 , 100, 200), 'mm');

console.log(svgString);
0.1.0

9 months ago

0.0.2

9 months ago