Class MetafileReader
Reads metafile formats (WMF, EMF, EMF+) from streams, byte arrays, or files.
Inherited Members
Namespace: DRIT.Drawing.Metafile
Assembly: DRIT.Drawing.dll
Syntax
public class MetafileReader
Constructors
MetafileReader()
Initializes a empty MetafileReader instance.
Declaration
public MetafileReader()
Methods
DetectFormat(byte[])
Detects the format of a metafile from the specified byte array.
Declaration
public MetafileFormat DetectFormat(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The byte array containing metafile data. |
Returns
| Type | Description |
|---|---|
| MetafileFormat | The detected MetafileFormat. |
DetectFormat(Stream)
Detects the format of a metafile from the specified stream.
Declaration
public MetafileFormat DetectFormat(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing metafile data. |
Returns
| Type | Description |
|---|---|
| MetafileFormat | The detected MetafileFormat. |
Read(byte[])
Reads a metafile from the specified byte array.
Declaration
public MetafileDocument Read(byte[] data)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | data | The byte array containing metafile data. |
Returns
| Type | Description |
|---|---|
| MetafileDocument | The MetafileDocument read from the byte array. |
Read(Stream)
Reads a metafile from the specified stream.
Declaration
public MetafileDocument Read(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing metafile data. |
Returns
| Type | Description |
|---|---|
| MetafileDocument | The MetafileDocument read from the stream. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
| InvalidOperationException | Thrown when the stream does not support seeking. |
| InvalidDataException | Thrown when the metafile format is unsupported or unknown. |
Read(string)
Reads a metafile from the specified file path.
Declaration
public MetafileDocument Read(string filePath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filePath | The path to the metafile. |
Returns
| Type | Description |
|---|---|
| MetafileDocument | The MetafileDocument read from the file. |
TryRead(Stream, out MetafileDocument?)
Attempts to read a metafile from the specified stream.
Declaration
public bool TryRead(Stream stream, out MetafileDocument? document)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing metafile data. |
| MetafileDocument | document | The resulting MetafileDocument, or null if reading failed. |
Returns
| Type | Description |
|---|---|
| bool |
|