VectSharp  2.2.1
A light library for C# vector graphics
Enums.cs
1 /*
2  VectSharp - A light library for C# vector graphics.
3  Copyright (C) 2020-2022 Giorgio Bianchini
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, version 3.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU Lesser General Public License for more details.
13 
14  You should have received a copy of the GNU Lesser General Public License
15  along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17 
18 namespace VectSharp
19 {
20  /// <summary>
21  /// Represent text baselines.
22  /// </summary>
23  public enum TextBaselines
24  {
25  /// <summary>
26  /// The current vertical coordinate determines where the top of the text string will be placed.
27  /// </summary>
28  Top,
29 
30  /// <summary>
31  /// The current vertical coordinate determines where the bottom of the text string will be placed.
32  /// </summary>
33  Bottom,
34 
35  /// <summary>
36  /// The current vertical coordinate determines where the middle of the text string will be placed.
37  /// </summary>
38  Middle,
39 
40  /// <summary>
41  /// The current vertical coordinate determines where the baseline of the text string will be placed.
42  /// </summary>
43  Baseline
44  }
45 
46  /// <summary>
47  /// Represents text anchors.
48  /// </summary>
49  public enum TextAnchors
50  {
51  /// <summary>
52  /// The current coordinate will determine the position of the left side of the text string.
53  /// </summary>
54  Left,
55 
56  /// <summary>
57  /// The current coordinate will determine the position of the center of the text string.
58  /// </summary>
59  Center,
60 
61  /// <summary>
62  /// The current coordinate will determine the position of the right side of the text string.
63  /// </summary>
64  Right
65  }
66 
67  /// <summary>
68  /// Represents line caps.
69  /// </summary>
70  public enum LineCaps
71  {
72  /// <summary>
73  /// The ends of the line are squared off at the endpoints.
74  /// </summary>
75  Butt = 0,
76 
77  /// <summary>
78  /// The ends of the lines are rounded.
79  /// </summary>
80  Round = 1,
81 
82  /// <summary>
83  /// The ends of the lines are squared off by adding an half square box at each end.
84  /// </summary>
85  Square = 2
86  }
87 
88  /// <summary>
89  /// Represents line joining options.
90  /// </summary>
91  public enum LineJoins
92  {
93  /// <summary>
94  /// Consecutive segments are joined by straight corners.
95  /// </summary>
96  Bevel = 2,
97 
98  /// <summary>
99  /// Consecutive segments are joined by extending their outside edges until they meet.
100  /// </summary>
101  Miter = 0,
102 
103  /// <summary>
104  /// Consecutive segments are joined by arc segments.
105  /// </summary>
106  Round = 1
107  }
108 
109  /// <summary>
110  /// Represents instructions on how to paint a dashed line.
111  /// </summary>
112  public struct LineDash
113  {
114  /// <summary>
115  /// A solid (not dashed) line
116  /// </summary>
117  public static LineDash SolidLine = new LineDash(0, 0, 0);
118 
119  /// <summary>
120  /// Length of the "on" (painted) segment.
121  /// </summary>
122  public double UnitsOn;
123 
124  /// <summary>
125  /// Length of the "off" (not painted) segment.
126  /// </summary>
127  public double UnitsOff;
128 
129  /// <summary>
130  /// Position in the dash pattern at which the line starts.
131  /// </summary>
132  public double Phase;
133 
134  /// <summary>
135  /// Define a new line dash pattern.
136  /// </summary>
137  /// <param name="unitsOn">The length of the "on" (painted) segment.</param>
138  /// <param name="unitsOff">The length of the "off" (not painted) segment.</param>
139  /// <param name="phase">The position in the dash pattern at which the line starts.</param>
140  public LineDash(double unitsOn, double unitsOff, double phase)
141  {
142  UnitsOn = unitsOn;
143  UnitsOff = unitsOff;
144  Phase = phase;
145  }
146  }
147 
148  /// <summary>
149  /// Types of <see cref="Segment"/>.
150  /// </summary>
151  public enum SegmentType
152  {
153  /// <summary>
154  /// The segment represents a move from the current point to a new point.
155  /// </summary>
156  Move,
157 
158  /// <summary>
159  /// The segment represents a straight line from the current point to a new point.
160  /// </summary>
161  Line,
162 
163  /// <summary>
164  /// The segment represents a cubic bezier curve from the current point to a new point.
165  /// </summary>
166  CubicBezier,
167 
168  /// <summary>
169  /// The segment represents a circular arc from the current point to a new point.
170  /// </summary>
171  Arc,
172 
173  /// <summary>
174  /// The segment represents the closing segment of a figure.
175  /// </summary>
176  Close
177  }
178 
179  /// <summary>
180  /// Represents ways to deal with unbalanced graphics state stacks.
181  /// </summary>
183  {
184  /// <summary>
185  /// If the graphics state stack is unbalanced, an exception will be thrown.
186  /// </summary>
187  Throw,
188 
189  /// <summary>
190  /// The graphics state stack will be automatically balanced by adding or removing calls to <see cref="Graphics.Restore"/> as necessary.
191  /// </summary>
192  SilentlyFix,
193 
194  /// <summary>
195  /// No attempt will be made at correcting an unbalanced graphics state stack. This may cause issues with some consumers.
196  /// </summary>
197  Ignore
198  }
199 }
VectSharp.TextBaselines.Middle
@ Middle
The current vertical coordinate determines where the middle of the text string will be placed.
VectSharp.TextBaselines.Bottom
@ Bottom
The current vertical coordinate determines where the bottom of the text string will be placed.
VectSharp.LineDash.UnitsOff
double UnitsOff
Length of the "off" (not painted) segment.
Definition: Enums.cs:127
VectSharp
Definition: Brush.cs:26
VectSharp.UnbalancedStackActions
UnbalancedStackActions
Represents ways to deal with unbalanced graphics state stacks.
Definition: Enums.cs:183
VectSharp.TextAnchors.Left
@ Left
The current coordinate will determine the position of the left side of the text string.
VectSharp.UnbalancedStackActions.Ignore
@ Ignore
No attempt will be made at correcting an unbalanced graphics state stack. This may cause issues with ...
VectSharp.SegmentType.Close
@ Close
The segment represents the closing segment of a figure.
VectSharp.LineCaps
LineCaps
Represents line caps.
Definition: Enums.cs:71
VectSharp.TextBaselines
TextBaselines
Represent text baselines.
Definition: Enums.cs:24
VectSharp.LineDash.LineDash
LineDash(double unitsOn, double unitsOff, double phase)
Define a new line dash pattern.
Definition: Enums.cs:140
VectSharp.LineJoins.Bevel
@ Bevel
Consecutive segments are joined by straight corners.
VectSharp.LineJoins.Miter
@ Miter
Consecutive segments are joined by extending their outside edges until they meet.
VectSharp.LineJoins
LineJoins
Represents line joining options.
Definition: Enums.cs:92
VectSharp.LineDash.UnitsOn
double UnitsOn
Length of the "on" (painted) segment.
Definition: Enums.cs:122
VectSharp.LineCaps.Square
@ Square
The ends of the lines are squared off by adding an half square box at each end.
VectSharp.TextAnchors.Center
@ Center
The current coordinate will determine the position of the center of the text string.
VectSharp.TextBaselines.Baseline
@ Baseline
The current vertical coordinate determines where the baseline of the text string will be placed.
VectSharp.UnbalancedStackActions.Throw
@ Throw
If the graphics state stack is unbalanced, an exception will be thrown.
VectSharp.TextBaselines.Top
@ Top
The current vertical coordinate determines where the top of the text string will be placed.
VectSharp.SegmentType.Line
@ Line
The segment represents a straight line from the current point to a new point.
VectSharp.SegmentType
SegmentType
Types of Segment.
Definition: Enums.cs:152
VectSharp.SegmentType.CubicBezier
@ CubicBezier
The segment represents a cubic bezier curve from the current point to a new point.
VectSharp.LineCaps.Butt
@ Butt
The ends of the line are squared off at the endpoints.
VectSharp.TextAnchors.Right
@ Right
The current coordinate will determine the position of the right side of the text string.
VectSharp.TextAnchors
TextAnchors
Represents text anchors.
Definition: Enums.cs:50
VectSharp.LineDash
Represents instructions on how to paint a dashed line.
Definition: Enums.cs:113
VectSharp.LineDash.SolidLine
static LineDash SolidLine
A solid (not dashed) line
Definition: Enums.cs:117
VectSharp.SegmentType.Arc
@ Arc
The segment represents a circular arc from the current point to a new point.
VectSharp.LineDash.Phase
double Phase
Position in the dash pattern at which the line starts.
Definition: Enums.cs:132
VectSharp.LineCaps.Round
@ Round
The ends of the lines are rounded.
VectSharp.SegmentType.Move
@ Move
The segment represents a move from the current point to a new point.
VectSharp.UnbalancedStackActions.SilentlyFix
@ SilentlyFix
The graphics state stack will be automatically balanced by adding or removing calls to Graphics....