-
Notifications
You must be signed in to change notification settings - Fork 111
Expand file tree
/
Copy pathStrokeBox.cs
More file actions
38 lines (31 loc) · 876 Bytes
/
Copy pathStrokeBox.cs
File metadata and controls
38 lines (31 loc) · 876 Bytes
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
using System;
using XamlMath.Rendering;
namespace XamlMath.Boxes;
internal sealed class StrokeBox : Box
{
private readonly StrokeBoxMode _mode;
public StrokeBox(TexEnvironment environment, StrokeBoxMode mode)
: base(environment)
{
_mode = mode;
}
public override void RenderTo(IElementRenderer renderer, double x, double y)
{
if (_mode.HasFlag(StrokeBoxMode.Normal))
renderer.RenderLine(new Point(x, y + Depth), new Point(x + Width, y - Height), Foreground);
if (_mode.HasFlag(StrokeBoxMode.Back))
renderer.RenderLine(new Point(x, y - Height), new Point(x + Width, y + Depth), Foreground);
}
public override int GetLastFontId()
{
return TexFontUtilities.NoFontId;
}
}
[Flags]
internal enum StrokeBoxMode
{
None = 0,
Normal = 1,
Back = 2,
Both = 3
}