Class
SvgRasterizer
ChartForgeX.SvgRaster
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
- The SVG document.
- width int? = null
- Optional output width.
- height int? = null
- Optional output height.
- strict bool = false
- Whether to throw instead of returning pixels when loss diagnostics are present.
- filters ChartForgeX.SvgRaster.SvgRasterFilterOptions? = null
- Optional explicit bounded native-filter import; null retains existing unsupported-filter diagnostics and bytes.
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
- options ChartForgeX.Core.RasterImageOptions? = null
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
- width int?
- height int?
- options ChartForgeX.Core.RasterImageOptions? = null
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[]
- width int? = null
- height int? = null
- options ChartForgeX.Core.RasterImageOptions? = null
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
- width int? = null
- height int? = null
Returns
RgbaImage