Table of Contents

Method TryPlay

Namespace
DocWright.Core.Metafiles
Assembly
DocWright.Core.dll

TryPlay(byte[]?, long?, out MetafileDisplayList?, out string)

Plays a metafile payload.

public static bool TryPlay(byte[]? bytes, long? maxPixels, out MetafileDisplayList? displayList, out string error)

Parameters

bytes byte[]

The complete metafile bytes.

maxPixels long?

The pixel ceiling applied to each embedded bitmap, or null for none. This is the caller's ResourceLimits.MaxImagePixels: a metafile's bitmaps are images and are charged against the same budget as any other image in the document.

displayList MetafileDisplayList

The playback result on success.

error string

The reason playback produced nothing.

Returns

bool

True when the payload produced a display list.

Remarks

A true result with an empty Commands is a real outcome and not a failure: a metafile may legitimately record nothing but state changes. Callers deciding whether to draw should test IsEmpty rather than the return value.