LogoPixi’VN
pixi-jsFunctions

Function: graphicsContextToSvg()

> graphicsContextToSvg(source, precision?): string

Defined in: node_modules/pixi.js/lib/scene/graphics/shared/svg/SVGExporter.d.ts:15

Converts a Graphics object or GraphicsContext into an SVG string.

This is a pure function — it reads from the context's instructions and returns a self-contained SVG document string. Texture instructions are skipped since they have no SVG equivalent.

Parameters

source

GraphicsContext | Graphics

A Graphics instance or a GraphicsContext.

precision?

number

Decimal places for SVG coordinates (default 2).

Returns

string

A complete SVG document string.

Standard