@@ -34,18 +34,35 @@ public abstract class DrawAttribute
3434 public static ( int X , int Y , int X1 , int Y1 ) Last = ( 0 , 0 , 0 , 0 ) ;
3535
3636 /// <summary>
37- /// Should return the vertices position in NDC format
37+ /// Update the Last drawn values
3838 /// </summary>
39- /// <returns>array of vertices position. x, y, x, y, ... (clockwise)</returns>
40- ///
41- public abstract ( Vector2i position , Vector2i ? controlPosition ) Information ( ) ;
4239 public abstract void UpdateLast ( ) ;
40+
41+ /// <summary>
42+ /// Return the vertices position in NDC format
43+ /// </summary>
44+ /// <returns>array of vertices position. x, y, x, y, ... (clockwise)</returns>
4345 public abstract float [ ] GetVertices ( ) ;
46+
47+ /// <summary>
48+ /// Return the indexes position of the triangles/lines
49+ /// </summary>
50+ /// <returns>array of indexes</returns>
4451 public abstract uint [ ] GetVerticesIndexes ( ) ;
45- public abstract void MoveDelta ( Vector2i deltaPosition ) ;
52+
53+ /// <summary>
54+ /// Retrieve the points that made the attribute detectable
55+ /// </summary>
56+ /// <returns>Position of all the points</returns>
4657 public abstract List < Vector2i > GetSelectablePoints ( ) ;
58+
59+ /// <summary>
60+ /// Retrieve the attribute for the d attribute
61+ /// </summary>
62+ /// <returns>string of the attribute</returns>
4763 public abstract override string ToString ( ) ;
4864 }
65+
4966 /// <summary>
5067 /// MoveTo, M or m.
5168 /// Moving the current point to another point.
@@ -54,13 +71,15 @@ public abstract class DrawAttribute
5471 public class MoveTo : DrawAttribute
5572 {
5673 public MoveTo ( ) { }
74+
5775 /// <summary>
5876 /// Moving the current point to another point.
5977 /// </summary>
6078 /// <param name="x">position x</param>
6179 /// <param name="y">positin y</param>
6280 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
6381 public MoveTo ( Group x , Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( x . Value ) , Convert . ToInt32 ( y . Value ) , isRelative ) { }
82+
6483 /// <summary>
6584 /// Moving the current point to another point.
6685 /// </summary>
@@ -74,20 +93,13 @@ public MoveTo(int x, int y, bool isRelative = false)
7493 IsRelative = isRelative ;
7594 }
7695 public override float [ ] GetVertices ( ) => Array . Empty < float > ( ) ; // Move doesnt have any vertices
96+
7797 public override uint [ ] GetVerticesIndexes ( ) => Array . Empty < uint > ( ) ;
7898
7999 public override string ToString ( ) => String . Format ( "{0} {1},{2}" , IsRelative ? 'm' : 'M' , X , Y ) ;
80100
81101 public override List < Vector2i > GetSelectablePoints ( ) => new List < Vector2i > ( ) ;
82102
83- public override void MoveDelta ( Vector2i deltaPosition )
84- {
85- X += deltaPosition . X ;
86- Y += deltaPosition . Y ;
87- }
88-
89- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( ) => ( new Vector2i ( X , Y ) , null ) ;
90-
91103 public override void UpdateLast ( )
92104 {
93105 if ( IsRelative )
@@ -102,6 +114,7 @@ public override void UpdateLast()
102114 }
103115 }
104116 }
117+
105118 /// <summary>
106119 /// LineTo, L or l.
107120 /// Use to draw a straight line from the current point to the given point.
@@ -110,13 +123,15 @@ public override void UpdateLast()
110123 public class LineTo : DrawAttribute
111124 {
112125 public LineTo ( ) { }
126+
113127 /// <summary>
114128 /// Use to draw a straight line from the current point to the given point.
115129 /// </summary>
116130 /// <param name="x">end point x</param>
117131 /// <param name="y">end point y</param>
118132 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
119133 public LineTo ( Group x , Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( x . Value ) , Convert . ToInt32 ( y . Value ) , isRelative ) { }
134+
120135 /// <summary>
121136 /// Use to draw a straight line from the current point to the given point.
122137 /// </summary>
@@ -129,7 +144,6 @@ public LineTo(int x, int y, bool isRelative = false)
129144 Y = y ;
130145 IsRelative = isRelative ;
131146 }
132-
133147 public override float [ ] GetVertices ( )
134148 {
135149 float [ ] vertices ;
@@ -162,13 +176,6 @@ public override List<Vector2i> GetSelectablePoints()
162176 return points ;
163177 }
164178
165- public override void MoveDelta ( Vector2i deltaPosition )
166- {
167- X += deltaPosition . X ;
168- Y += deltaPosition . Y ;
169- }
170- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( ) => ( new Vector2i ( X , Y ) , null ) ;
171-
172179 public override void UpdateLast ( )
173180 {
174181 if ( IsRelative )
@@ -183,6 +190,7 @@ public override void UpdateLast()
183190 }
184191 }
185192 }
193+
186194 /// <summary>
187195 /// HorizontalLineTo, H or h.
188196 /// Use to draw a horizontal line from the current point to the given point.
@@ -191,12 +199,14 @@ public override void UpdateLast()
191199 public class HorizontalLineTo : DrawAttribute
192200 {
193201 public HorizontalLineTo ( ) { }
202+
194203 /// <summary>
195204 /// Use to draw a horizontal line from the current point to the given point.
196205 /// </summary>
197206 /// <param name="x">offset end point x</param>
198207 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
199208 public HorizontalLineTo ( Group x , bool isRelative = false ) : this ( Convert . ToInt32 ( x . Value ) , isRelative ) { }
209+
200210 /// <summary>
201211 /// Use to draw a horizontal line from the current point to the given point.
202212 /// </summary>
@@ -241,12 +251,6 @@ public override List<Vector2i> GetSelectablePoints()
241251 return points ;
242252 }
243253
244- public override void MoveDelta ( Vector2i deltaPosition )
245- {
246- X += deltaPosition . X ;
247- }
248- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( ) => ( new Vector2i ( X , Last . Y ) , null ) ;
249-
250254 public override void UpdateLast ( )
251255 {
252256 if ( IsRelative )
@@ -255,6 +259,7 @@ public override void UpdateLast()
255259 Last . X = X ; // Update last position
256260 }
257261 }
262+
258263 /// <summary>
259264 /// VerticalLineTo, V or v.
260265 /// Use to draw a vertical line from the current point to the given point.
@@ -263,12 +268,14 @@ public override void UpdateLast()
263268 public class VerticalLineTo : DrawAttribute
264269 {
265270 public VerticalLineTo ( ) { }
271+
266272 /// <summary>
267273 /// Use to draw a vertical line from the current point to the given point.
268274 /// </summary>
269275 /// <param name="y">offset end point y</param>
270276 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
271277 public VerticalLineTo ( Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( y . Value ) , isRelative ) { }
278+
272279 /// <summary>
273280 /// Use to draw a vertical line from the current point to the given point.
274281 /// </summary>
@@ -279,7 +286,6 @@ public VerticalLineTo(int y, bool isRelative = false)
279286 Y = y ;
280287 IsRelative = isRelative ;
281288 }
282-
283289 public override float [ ] GetVertices ( )
284290 {
285291 float [ ] vertices ;
@@ -291,6 +297,7 @@ public override float[] GetVertices()
291297
292298 return vertices ;
293299 }
300+
294301 public override uint [ ] GetVerticesIndexes ( ) => new uint [ ] { 0 , 1 } ;
295302
296303 public override List < Vector2i > GetSelectablePoints ( )
@@ -312,16 +319,6 @@ public override List<Vector2i> GetSelectablePoints()
312319
313320 public override string ToString ( ) => String . Format ( "{0} {1}" , IsRelative ? 'v' : 'V' , Y ) ;
314321
315- public override void MoveDelta ( Vector2i deltaPosition )
316- {
317- throw new NotImplementedException ( ) ;
318- }
319-
320- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
321- {
322- throw new NotImplementedException ( ) ;
323- }
324-
325322 public override void UpdateLast ( )
326323 {
327324 if ( IsRelative )
@@ -330,6 +327,7 @@ public override void UpdateLast()
330327 Last . Y = Y ; // Update last position
331328 }
332329 }
330+
333331 /// <summary>
334332 /// CurveTo, Cubic Bézier Curve, C or c.
335333 /// Use to draw a cubic Bézier curve from the current point to the given point.
@@ -344,6 +342,7 @@ public class CurveTo : DrawAttribute
344342 public int Y2 { get => _y2 ; set => _y2 = value ; }
345343
346344 public CurveTo ( ) { }
345+
347346 /// <summary>
348347 /// Use to draw a cubic Bézier curve from the current point to the given point.
349348 /// </summary>
@@ -355,6 +354,7 @@ public CurveTo() { }
355354 /// <param name="y">end point y</param>
356355 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
357356 public CurveTo ( Group x1 , Group y1 , Group x2 , Group y2 , Group x , Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( x1 . Value ) , Convert . ToInt32 ( y1 . Value ) , Convert . ToInt32 ( x2 . Value ) , Convert . ToInt32 ( y2 . Value ) , Convert . ToInt32 ( x . Value ) , Convert . ToInt32 ( y . Value ) , isRelative ) { }
357+
358358 /// <summary>
359359 /// Use to draw a cubic Bézier curve from the current point to the given point.
360360 /// </summary>
@@ -430,21 +430,6 @@ public override List<Vector2i> GetSelectablePoints()
430430
431431 public override string ToString ( ) => String . Format ( "{0} {1},{2} {3},{4} {5},{6}" , IsRelative ? 'c' : 'C' , X1 , Y1 , X2 , Y2 , X , Y ) ;
432432
433- public override void MoveDelta ( Vector2i deltaPosition )
434- {
435- X1 += deltaPosition . X ;
436- Y1 += deltaPosition . Y ;
437- X2 += deltaPosition . X ;
438- Y2 += deltaPosition . Y ;
439- X += deltaPosition . X ;
440- Y += deltaPosition . Y ;
441- }
442-
443- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
444- {
445- throw new NotImplementedException ( ) ;
446- }
447-
448433 public override void UpdateLast ( )
449434 {
450435 if ( IsRelative )
@@ -487,6 +472,7 @@ public override void UpdateLast()
487472 }
488473 }
489474 }
475+
490476 /// <summary>
491477 /// SmoothCurveTo, Smooth Cubic Bézier Curbe, S or s.
492478 /// Use to draw a smooth cubic Bézier curve from the current point to the given point.
@@ -501,6 +487,7 @@ public class SmoothCurveTo : DrawAttribute
501487 public int Y2 { get => _y2 ; set => _y2 = value ; }
502488
503489 public SmoothCurveTo ( ) { }
490+
504491 /// <summary>
505492 /// Use to draw a smooth cubic Bézier curve from the current point to the given point.
506493 /// </summary>
@@ -509,8 +496,8 @@ public SmoothCurveTo() { }
509496 /// <param name="x">end point x</param>
510497 /// <param name="y">end point y</param>
511498 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
512-
513499 public SmoothCurveTo ( Group x2 , Group y2 , Group x , Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( x2 . Value ) , Convert . ToInt32 ( y2 . Value ) , Convert . ToInt32 ( x . Value ) , Convert . ToInt32 ( y . Value ) , isRelative ) { }
500+
514501 /// <summary>
515502 /// Use to draw a smooth cubic Bézier curve from the current point to the given point.
516503 /// </summary>
@@ -527,6 +514,7 @@ public SmoothCurveTo(int x2, int y2, int x, int y, bool isRelative = false)
527514 Y = y ;
528515 IsRelative = isRelative ;
529516 }
517+
530518 public override float [ ] GetVertices ( )
531519 {
532520 List < float > vertices = new List < float > ( ) ;
@@ -582,15 +570,6 @@ public override List<Vector2i> GetSelectablePoints()
582570
583571 public override string ToString ( ) => String . Format ( "{0} {1},{2} {3},{4}" , IsRelative ? 's' : 'S' , X2 , Y2 , X , Y ) ;
584572
585- public override void MoveDelta ( Vector2i deltaPosition )
586- {
587- throw new NotImplementedException ( ) ;
588- }
589- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
590- {
591- throw new NotImplementedException ( ) ;
592- }
593-
594573 public override void UpdateLast ( )
595574 {
596575 if ( IsRelative )
@@ -643,6 +622,7 @@ public override void UpdateLast()
643622 public class QuadraticBezierCurveTo : DrawAttribute
644623 {
645624 public QuadraticBezierCurveTo ( ) { }
625+
646626 /// <summary>
647627 /// Use to draw a quadratic Bézier curve.
648628 /// </summary>
@@ -724,16 +704,6 @@ public override List<Vector2i> GetSelectablePoints()
724704
725705 public override string ToString ( ) => String . Format ( "{0} {1},{2} {3},{4}" , IsRelative ? 'q' : 'Q' , X1 , Y1 , X , Y ) ;
726706
727- public override void MoveDelta ( Vector2i deltaPosition )
728- {
729- throw new NotImplementedException ( ) ;
730- }
731-
732- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
733- {
734- throw new NotImplementedException ( ) ;
735- }
736-
737707 public override void UpdateLast ( )
738708 {
739709 if ( IsRelative )
@@ -843,16 +813,6 @@ public override List<Vector2i> GetSelectablePoints()
843813
844814 public override string ToString ( ) => String . Format ( "{0} {1},{2}" , IsRelative ? 't' : 'T' , X , Y ) ;
845815
846- public override void MoveDelta ( Vector2i deltaPosition )
847- {
848- throw new NotImplementedException ( ) ;
849- }
850-
851- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
852- {
853- throw new NotImplementedException ( ) ;
854- }
855-
856816 public override void UpdateLast ( )
857817 {
858818 if ( IsRelative )
@@ -894,6 +854,7 @@ public class EllipticalArc : DrawAttribute
894854 bool _sweepFlag ;
895855
896856 public EllipticalArc ( ) { }
857+
897858 /// <summary>
898859 /// Use to draw an ellipse.
899860 /// </summary>
@@ -905,8 +866,8 @@ public EllipticalArc() { }
905866 /// <param name="x">new current point x</param>
906867 /// <param name="y">new current point y</param>
907868 /// <param name="isRelative">if true, the points becames relatives to the last point</param>
908-
909869 public EllipticalArc ( Group rx , Group ry , Group angle , Group largeArcFlag , Group sweepFlag , Group x , Group y , bool isRelative = false ) : this ( Convert . ToInt32 ( rx . Value ) , Convert . ToInt32 ( ry . Value ) , Convert . ToInt32 ( angle . Value ) , Convert . ToInt32 ( largeArcFlag . Value ) == 0 ? false : true , Convert . ToInt32 ( sweepFlag . Value ) == 0 ? false : true , Convert . ToInt32 ( x . Value ) , Convert . ToInt32 ( y . Value ) , isRelative ) { }
870+
910871 /// <summary>
911872 /// Use to draw an ellipse.
912873 /// </summary>
@@ -944,14 +905,6 @@ public override uint[] GetVerticesIndexes()
944905 throw new NotImplementedException ( ) ;
945906 }
946907
947- public override void MoveDelta ( Vector2i deltaPosition )
948- {
949- throw new NotImplementedException ( ) ;
950- }
951- public override ( Vector2i position , Vector2i ? controlPosition ) Information ( )
952- {
953- throw new NotImplementedException ( ) ;
954- }
955908 public override string ToString ( ) => String . Format ( "{0} {1} {2} {3} {4} {5} {6},{7}" , IsRelative ? 'a' : 'A' , _rx , _ry , _angle , Convert . ToInt32 ( _largeArcFlag ) , Convert . ToInt32 ( _sweepFlag ) , X , Y ) ;
956909
957910 public override void UpdateLast ( )
0 commit comments