Table of Contents

Class MetafileLoadOptions

Namespace
Egami.Metafiles
Assembly
Egami.Metafiles.dll

How Metafile reads a file: which limits and diagnostics apply.

public sealed record MetafileLoadOptions : IEquatable<MetafileLoadOptions>
Inheritance
MetafileLoadOptions
Implements
Inherited Members

Examples

// Untrusted files: the context's limits bound the file size and what EMZ and WMZ inflate to; a record that runs past
// the end is skipped with a warning, and what came before it plays.
MetafileLoadOptions options = new()
{
    Context = EgamiContext.Default with { Limits = SafetyLimits.Default with { MaxTotalBytes = 16 << 20 } },
};
Metafile picture = Metafile.Load(new MemoryStream(bytes), options);
if (picture.Kind is MetafileKind.EmfPlusDual or MetafileKind.EmfPlusOnly)
{
    Console.WriteLine("Drawn by its EMF+ records, as GDI+ draws it.");
}

Properties

Context

Gets the context whose limits bound the load (file size, inflated size of EMZ and WMZ) and whose diagnostics receive what the load skipped, or null for Default.

public EgamiContext? Context { get; init; }

Property Value

EgamiContext

Default

Gets the defaults: the default context.

public static MetafileLoadOptions Default { get; }

Property Value

MetafileLoadOptions