Class SvgFormat
SVG and SVGZ as an Egami format: registered with WithFormat(FormatInfo), Raster.Load draws an SVG file
at its own size (times Scale) and Raster.Probe gives that size without drawing. The
format only reads; nothing outside the file is opened, so images it links are not drawn, and text uses the machine's fonts.
For a resolver, your own fonts, a target size or a background, load an SvgDocument and call
Rasterize<TPixel>(SvgRenderOptions?).
public static class SvgFormat
- Inheritance
-
SvgFormat
- Inherited Members
Examples
// SVG as an Egami format: Raster.Load draws a file at its own size, Raster.Probe reads the size without drawing.
EgamiContext context = EgamiContext.Default.WithFormat(SvgFormat.Info);
RasterInfo info = Raster.Probe(path, context);
using Raster<Rgba8> icon = Raster.Load<Rgba8>(path, context);
// Twice the size, for a high-density screen.
using Raster<Rgba8> sharp = Raster.Load<Rgba8>(path, context, new SvgDecodeOptions { Scale = 2 });
Properties
Info
Gets the SVG format: detected by an svg root element (after any XML declaration, comments and DOCTYPE), or by gzip data whose start is one.
public static FormatInfo Info { get; }
Property Value
Examples
// SVG as an Egami format: Raster.Load draws a file at its own size, Raster.Probe reads the size without drawing.
EgamiContext context = EgamiContext.Default.WithFormat(SvgFormat.Info);
RasterInfo info = Raster.Probe(path, context);
using Raster<Rgba8> icon = Raster.Load<Rgba8>(path, context);
// Twice the size, for a high-density screen.
using Raster<Rgba8> sharp = Raster.Load<Rgba8>(path, context, new SvgDecodeOptions { Scale = 2 });