/
MetaHeader.cs
76 lines (64 loc) · 2.03 KB
/
MetaHeader.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.InteropServices;
namespace System.Drawing.Imaging;
[StructLayout(LayoutKind.Sequential, Pack = 2)]
public sealed class MetaHeader
{
// The ENHMETAHEADER structure is defined natively as a union with WmfHeader.
// Extreme care should be taken if changing the layout of the corresponding managed
// structures to minimize the risk of buffer overruns. The affected managed classes
// are the following: ENHMETAHEADER, MetaHeader, MetafileHeaderWmf, MetafileHeaderEmf.
internal METAHEADER _data;
public MetaHeader()
{
}
internal MetaHeader(METAHEADER header) => _data = header;
/// <summary>
/// Represents the type of the associated <see cref='Metafile'/>.
/// </summary>
public short Type
{
get => (short)_data.mtType;
set => _data.mtType = (ushort)value;
}
/// <summary>
/// Represents the size, in bytes, of the header file.
/// </summary>
public short HeaderSize
{
get => (short)_data.mtHeaderSize;
set => _data.mtHeaderSize = (ushort)value;
}
/// <summary>
/// Represents the version number of the header format.
/// </summary>
public short Version
{
get => (short)_data.mtVersion;
set => _data.mtVersion = (ushort)value;
}
/// <summary>
/// Represents the size, in bytes, of the associated <see cref='Metafile'/>.
/// </summary>
public int Size
{
get => (int)_data.mtSize;
set => _data.mtSize = (uint)value;
}
public short NoObjects
{
get => (short)_data.mtNoObjects;
set => _data.mtNoObjects = (ushort)value;
}
public int MaxRecord
{
get => (int)_data.mtMaxRecord;
set => _data.mtMaxRecord = (uint)value;
}
public short NoParameters
{
get => (short)_data.mtNoParameters;
set => _data.mtNoParameters = (ushort)value;
}
}