-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
79 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using JetBrains.Annotations; | ||
|
||
namespace SharpEmf.Enums; | ||
|
||
/// <summary> | ||
/// Specifies the indexes of predefined logical graphics objects that can be used in graphics operations | ||
/// </summary> | ||
[PublicAPI] | ||
public enum StockObject : uint | ||
{ | ||
WHITE_BRUSH = 0x80000000, | ||
LTGRAY_BRUSH = 0x80000001, | ||
GRAY_BRUSH = 0x80000002, | ||
DKGRAY_BRUSH = 0x80000003, | ||
BLACK_BRUSH = 0x80000004, | ||
NULL_BRUSH = 0x80000005, | ||
WHITE_PEN = 0x80000006, | ||
BLACK_PEN = 0x80000007, | ||
NULL_PEN = 0x80000008, | ||
OEM_FIXED_FONT = 0x8000000A, | ||
ANSI_FIXED_FONT = 0x8000000B, | ||
ANSI_VAR_FONT = 0x8000000C, | ||
SYSTEM_FONT = 0x8000000D, | ||
DEVICE_DEFAULT_FONT = 0x8000000E, | ||
DEFAULT_PALETTE = 0x8000000F, | ||
SYSTEM_FIXED_FONT = 0x80000010, | ||
DEFAULT_GUI_FONT = 0x80000011, | ||
DC_BRUSH = 0x80000012, | ||
DC_PEN = 0x80000013 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/SharpEmf/Records/ObjectManipulation/EmrSelectObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using JetBrains.Annotations; | ||
using SharpEmf.Enums; | ||
using SharpEmf.Exceptions; | ||
using SharpEmf.Extensions; | ||
using SharpEmf.Interfaces; | ||
|
||
namespace SharpEmf.Records.ObjectManipulation; | ||
|
||
/// <inheritdoc cref="EmfRecordType.EMR_SELECTOBJECT"/> | ||
[PublicAPI] | ||
public record EmrSelectObject : EnhancedMetafileRecord, IEmfParsable<EmrSelectObject> | ||
{ | ||
/// <summary> | ||
/// Specifies either the index of a graphics object in the EMF object table or the index of a stock object in the <see cref="StockObject"/> enumeration | ||
/// </summary> | ||
/// <remarks> | ||
/// The object index MUST NOT be zero, which is reserved and refers to the EMF metafile itself. <para /> | ||
/// The object specified by this record MUST be used in subsequent EMF drawing operations, until another EMR_SELECTOBJECT record | ||
/// changes the object of that type or the object is deleted | ||
/// </remarks> | ||
public uint IHObject { get; } | ||
|
||
private EmrSelectObject(EmfRecordType Type, uint Size, uint ihObject) : base(Type, Size) | ||
{ | ||
IHObject = ihObject; | ||
} | ||
|
||
public static EmrSelectObject Parse(Stream stream, EmfRecordType recordType, uint size) | ||
{ | ||
var ihObject = stream.ReadUInt32(); | ||
|
||
if (ihObject == 0) | ||
{ | ||
throw new EmfParseException("Object index MUST NOT be zero"); | ||
} | ||
|
||
return new EmrSelectObject(recordType, size, ihObject); | ||
} | ||
} |