|
|
@ -7,30 +7,37 @@ using System.Runtime.InteropServices; |
|
|
namespace SixLabors.ImageSharp.Formats.Icon; |
|
|
namespace SixLabors.ImageSharp.Formats.Icon; |
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = Size)] |
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = Size)] |
|
|
internal struct IconDir(ushort reserved, IconFileType type, ushort count) |
|
|
internal struct IconDir |
|
|
{ |
|
|
{ |
|
|
public const int Size = 3 * sizeof(ushort); |
|
|
public const int Size = 3 * sizeof(ushort); |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Reserved. Must always be 0.
|
|
|
/// Reserved. Must always be 0.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public ushort Reserved = reserved; |
|
|
public ushort Reserved; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid.
|
|
|
/// Specifies image type: 1 for icon (.ICO) image, 2 for cursor (.CUR) image. Other values are invalid.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public IconFileType Type = type; |
|
|
public IconFileType Type; |
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// Specifies number of images in the file.
|
|
|
/// Specifies number of images in the file.
|
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public ushort Count = count; |
|
|
public ushort Count; |
|
|
|
|
|
|
|
|
public IconDir(IconFileType type, ushort count = 0) |
|
|
public IconDir(IconFileType type, ushort count = 0) |
|
|
: this(0, type, count) |
|
|
: this(0, type, count) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public IconDir(ushort reserved, IconFileType type, ushort count) |
|
|
|
|
|
{ |
|
|
|
|
|
this.Reserved = reserved; |
|
|
|
|
|
this.Type = type; |
|
|
|
|
|
this.Count = count; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public static ref IconDir Parse(ReadOnlySpan<byte> data) |
|
|
public static ref IconDir Parse(ReadOnlySpan<byte> data) |
|
|
=> ref Unsafe.As<byte, IconDir>(ref MemoryMarshal.GetReference(data)); |
|
|
=> ref Unsafe.As<byte, IconDir>(ref MemoryMarshal.GetReference(data)); |
|
|
|
|
|
|
|
|
|