Class MetafileRenderOptions
How Draw(Canvas, RectF?, MetafileRenderOptions?) and Rasterize<TPixel>(MetafileRenderOptions?) draw a metafile.
public sealed record MetafileRenderOptions : IEquatable<MetafileRenderOptions>
- Inheritance
-
MetafileRenderOptions
- Implements
- Inherited Members
Examples
// Faces the machine lacks: the built-in table maps Calibri to Carlito, Arial to Liberation Sans and so on; add your own.
Metafile picture = Metafile.Load(path);
using Raster<Rgba8> image = picture.Rasterize<Rgba8>(new MetafileRenderOptions
{
FontSubstitutions = new Dictionary<string, string> { ["Segoe UI"] = "Noto Sans" },
Antialias = false, // GDI's own aliased look, for comparing with Windows
});
Properties
Antialias
Gets a value indicating whether GDI records are drawn antialiased; true by default. false gives GDI's own aliased look, for comparing pixels with Windows. EMF+ records follow the file's own smoothing mode either way.
public bool Antialias { get; init; }
Property Value
Background
Gets the color the raster starts with; transparent by default.
public RgbaF32 Background { get; init; }
Property Value
CanvasOptions
Gets the options of the raster canvas Rasterize<TPixel>(MetafileRenderOptions?) draws on, or null for the defaults.
public CanvasOptions? CanvasOptions { get; init; }
Property Value
Context
Gets the context of the raster Rasterize<TPixel>(MetafileRenderOptions?) creates, for its limits and memory, or null for the metafile's.
public EgamiContext? Context { get; init; }
Property Value
Default
Gets the defaults: 96 DPI, transparent, antialiased, the installed fonts, played as GDI+ plays it.
public static MetafileRenderOptions Default { get; }
Property Value
Dpi
Gets the resolution Rasterize<TPixel>(MetafileRenderOptions?) draws the picture's Size at when neither Width nor Height is set; 96 by default.
public float Dpi { get; init; }
Property Value
Exceptions
- ArgumentOutOfRangeException
The value is not positive and finite.
FontSubstitutions
Gets faces to use for faces the fonts lack, by name (case-insensitive), tried after the built-in table of metric-compatible open fonts (Arial to Liberation Sans, Calibri to Carlito and so on).
public IReadOnlyDictionary<string, string>? FontSubstitutions { get; init; }
Property Value
Fonts
public FontCollection? Fonts { get; init; }
Property Value
Height
Gets the raster's height in pixels, or null to take it from Width and the aspect ratio, or from Dpi. With both set, the picture is stretched to fill, as Word stretches it to its frame.
public int? Height { get; init; }
Property Value
- int?
Exceptions
- ArgumentOutOfRangeException
The value is not positive.
Playback
Gets which records of an EMF+ dual file play; Auto by default.
public MetafilePlayback Playback { get; init; }
Property Value
TextAsPaths
Gets a value indicating whether text is drawn as outlines instead of glyph runs, for callers that need paths. On a raster both look the same; a PDF or SVG backend then holds no selectable text.
public bool TextAsPaths { get; init; }
Property Value
Width
Gets the raster's width in pixels, or null to take it from Height and the aspect ratio, or from Dpi.
public int? Width { get; init; }
Property Value
- int?
Exceptions
- ArgumentOutOfRangeException
The value is not positive.