How samukadev/canvas2svg works
Canvas2Svg is a small JavaScript runtime library that accepts Canvas 2D-style drawing operations and builds an SVG document. The principal workflow is to create a context, draw paths, shapes, text, or images through it, then retrieve the SVG or serialize it. The implementation is concentrated in one source file; documented capabilities are included, but details beyond the sampled excerpts are represented only where the README supports them.
Main entry points: canvas2svg.js Canvas context
Components 7
Other components
- Drawing client
- Canvas context
canvas2svg.js - Paths and shapes
canvas2svg.js - Text and images
canvas2svg.js - Styles and paint
canvas2svg.js - SVG document
canvas2svg.js - Serialized SVG
canvas2svg.js
Connections 10
- Drawing client → Canvas context: draws through
- Canvas context → Paths and shapes: creates elements
- Canvas context → Text and images: creates elements
- Canvas context → Styles and paint: applies styles
- Paths and shapes → SVG document: appends elements
- Text and images → SVG document: appends elements
- Styles and paint → SVG document: adds definitions
- Canvas context → SVG document: exposes with getSvg
- Canvas context → Serialized SVG: serializes with getSerializedSvg
- Serialized SVG → Drawing client: returns SVG text