Skip to content
ChartForgeX
Class

SvgRasterizer

ChartForgeX.SvgRaster

Namespace
ChartForgeX.SvgRaster
Assembly
ChartForgeX
Modifiers
static

Provides deterministic, dependency-free rasterization of SVG documents.

Inheritance

  • object
  • SvgRasterizer

Methods

public static SvgRasterizationResult Rasterize(string svg, int? width = null, int? height = null, bool strict = false, SvgRasterFilterOptions? filters = null) #

Rasterizes SVG and reports encountered unsupported content. Strict mode rejects output with diagnostics.

Parameters

svg string required
The SVG document.
width int? = null optional
Optional output width.
height int? = null optional
Optional output height.
strict bool = false optional
Whether to throw instead of returning pixels when loss diagnostics are present.
filters ChartForgeX.SvgRaster.SvgRasterFilterOptions? = null optional
Optional explicit bounded native-filter import; null retains existing unsupported-filter diagnostics and bytes.

Returns

SvgRasterizationResult Pixels and bounded diagnostics for the supported SVG subset.
ToPng 3 overloads
public static byte[] ToPng(string svg, RasterImageOptions? options = null) #

Rasterizes an SVG document to PNG using its declared viewport size.

Parameters

svg string required
options ChartForgeX.Core.RasterImageOptions? = null optional

Returns

byte[]
public static byte[] ToPng(string svg, int? width, int? height, RasterImageOptions? options = null) #

Rasterizes an SVG document to PNG using optional output dimensions.

Parameters

svg string required
width int? required
height int? required
options ChartForgeX.Core.RasterImageOptions? = null optional

Returns

byte[]
public static byte[] ToPng(byte[] svgBytes, int? width = null, int? height = null, RasterImageOptions? options = null) #

Rasterizes UTF-8 SVG bytes to PNG.

Parameters

svgBytes byte[] required
width int? = null optional
height int? = null optional
options ChartForgeX.Core.RasterImageOptions? = null optional

Returns

byte[]
ToRgbaImage 2 overloads
public static RgbaImage ToRgbaImage(string svg, int? width = null, int? height = null) #

Rasterizes an SVG document to RGBA pixels using its declared viewport size or optional output dimensions. Use this instead of SvgRasterizer.ToPng when the pixels go straight into a composition, so they are not encoded and decoded on the way.

Parameters

svg string required
width int? = null optional
height int? = null optional

Returns

RgbaImage
public static RgbaImage ToRgbaImage(byte[] svgBytes, int? width = null, int? height = null) #

Rasterizes UTF-8 SVG bytes to RGBA pixels.

Parameters

svgBytes byte[] required
width int? = null optional
height int? = null optional

Returns

RgbaImage