@@ -37,10 +37,15 @@ public enum TextVAlign
3737/// </summary>
3838public sealed record TextRenderOptions
3939{
40+ /// <summary>Font family name (e.g. "Arial").</summary>
4041 public string FontFamily { get ; init ; } = "Arial" ;
42+ /// <summary>Whether the font is bold.</summary>
4143 public bool Bold { get ; init ; }
44+ /// <summary>Whether the font is italic.</summary>
4245 public bool Italic { get ; init ; }
46+ /// <summary>Horizontal text alignment relative to the anchor point.</summary>
4347 public TextHAlign HorizontalAlignment { get ; init ; } = TextHAlign . Left ;
48+ /// <summary>Vertical text alignment relative to the anchor point.</summary>
4449 public TextVAlign VerticalAlignment { get ; init ; } = TextVAlign . Baseline ;
4550}
4651
@@ -55,57 +60,83 @@ public sealed record TextRenderOptions
5560/// </summary>
5661public interface IRenderContext
5762{
63+ /// <summary>Clears the entire canvas with the specified background color.</summary>
5864 void Clear ( uint argbColor ) ;
5965
66+ /// <summary>Draws a line between two points.</summary>
6067 void DrawLine ( double x1 , double y1 , double x2 , double y2 , uint color , double width ,
6168 LineStyle style = LineStyle . Solid ) ;
6269
70+ /// <summary>Draws an elliptical arc.</summary>
6371 void DrawArc ( double cx , double cy , double rx , double ry , double startAngle , double sweepAngle ,
6472 uint color , double width ) ;
6573
74+ /// <summary>Draws a rectangle outline.</summary>
6675 void DrawRectangle ( double x , double y , double width , double height , uint color , double lineWidth ) ;
76+ /// <summary>Fills a rectangle.</summary>
6777 void FillRectangle ( double x , double y , double width , double height , uint color ) ;
6878
79+ /// <summary>Draws a rounded rectangle outline with independent corner radii.</summary>
6980 void DrawRoundedRectangle ( double x , double y , double width , double height ,
7081 double cornerRadiusX , double cornerRadiusY , uint color , double lineWidth ) ;
7182
83+ /// <summary>Fills a rounded rectangle.</summary>
7284 void FillRoundedRectangle ( double x , double y , double width , double height ,
7385 double cornerRadius , uint color ) ;
7486
87+ /// <summary>Draws an ellipse outline.</summary>
7588 void DrawEllipse ( double cx , double cy , double rx , double ry , uint color , double width ) ;
89+ /// <summary>Fills an ellipse.</summary>
7690 void FillEllipse ( double cx , double cy , double rx , double ry , uint color ) ;
7791
92+ /// <summary>Draws a closed polygon outline.</summary>
7893 void DrawPolygon ( ReadOnlySpan < double > xPoints , ReadOnlySpan < double > yPoints , uint color , double width ) ;
94+ /// <summary>Fills a closed polygon.</summary>
7995 void FillPolygon ( ReadOnlySpan < double > xPoints , ReadOnlySpan < double > yPoints , uint color ) ;
8096
97+ /// <summary>Draws an open polyline through the given points.</summary>
8198 void DrawPolyline ( ReadOnlySpan < double > xPoints , ReadOnlySpan < double > yPoints , uint color , double width ,
8299 LineStyle style = LineStyle . Solid ) ;
83100
101+ /// <summary>Draws a cubic bezier curve.</summary>
84102 void DrawBezier ( double x0 , double y0 , double x1 , double y1 , double x2 , double y2 ,
85103 double x3 , double y3 , uint color , double width ) ;
86104
105+ /// <summary>Fills a pie (arc sector) shape.</summary>
87106 void FillPie ( double cx , double cy , double rx , double ry , double startAngle , double sweepAngle ,
88107 uint color ) ;
89108
109+ /// <summary>Draws a pie (arc sector) outline.</summary>
90110 void DrawPie ( double cx , double cy , double rx , double ry , double startAngle , double sweepAngle ,
91111 uint color , double lineWidth ) ;
92112
113+ /// <summary>Draws text at the specified position using the given font family.</summary>
93114 void DrawText ( string text , double x , double y , double fontSize , uint color ,
94115 string fontFamily = "Arial" ) ;
95116
117+ /// <summary>Draws text at the specified position using detailed text rendering options.</summary>
96118 void DrawText ( string text , double x , double y , double fontSize , uint color ,
97119 TextRenderOptions options ) ;
98120
121+ /// <summary>Measures the dimensions of the specified text without rendering it.</summary>
99122 TextMetrics MeasureText ( string text , double fontSize , TextRenderOptions ? options = null ) ;
100123
124+ /// <summary>Draws a raster image from raw byte data into the specified rectangle.</summary>
101125 void DrawImage ( ReadOnlySpan < byte > imageData , double x , double y , double width , double height ) ;
102126
127+ /// <summary>Sets a rectangular clipping region.</summary>
103128 void SetClipRect ( double x , double y , double w , double h ) ;
129+ /// <summary>Resets the clipping region to the full canvas.</summary>
104130 void ResetClip ( ) ;
105131
132+ /// <summary>Saves the current graphics state (transform, clip) onto a stack.</summary>
106133 void SaveState ( ) ;
134+ /// <summary>Restores the most recently saved graphics state from the stack.</summary>
107135 void RestoreState ( ) ;
136+ /// <summary>Applies a translation to the current transform.</summary>
108137 void Translate ( double dx , double dy ) ;
138+ /// <summary>Applies a rotation (in degrees) to the current transform.</summary>
109139 void Rotate ( double angleDegrees ) ;
140+ /// <summary>Applies a scale to the current transform.</summary>
110141 void Scale ( double sx , double sy ) ;
111142}
0 commit comments