@@ -100,7 +100,7 @@ private void DrawHorizontalLine(Pen pen, int dx, int x1, int y1)
100
100
DrawPoint ( pen , x1 + i , y1 ) ;
101
101
}
102
102
103
- private void DrawVerthicalLine ( Pen pen , int dy , int x1 , int y1 )
103
+ private void DrawVerticalLine ( Pen pen , int dy , int x1 , int y1 )
104
104
{
105
105
int i ;
106
106
@@ -159,7 +159,7 @@ private void DrawDiagonalLine(Pen pen, int dx, int dy, int x1, int y1)
159
159
* DrawLine throw if the line goes out of the boundary of the Canvas, probably will be better to draw only the part
160
160
* of line visibile. This is too "smart" to do here better do it in a future Window Manager.
161
161
*/
162
- public void DrawLine ( Pen pen , int x1 , int y1 , int x2 , int y2 )
162
+ public virtual void DrawLine ( Pen pen , int x1 , int y1 , int x2 , int y2 )
163
163
{
164
164
if ( pen == null )
165
165
throw new ArgumentOutOfRangeException ( nameof ( pen ) ) ;
@@ -181,7 +181,7 @@ public void DrawLine(Pen pen, int x1, int y1, int x2, int y2)
181
181
182
182
if ( dx == 0 ) /* the line is vertical */
183
183
{
184
- DrawVerthicalLine ( pen , dy , x1 , y1 ) ;
184
+ DrawVerticalLine ( pen , dy , x1 , y1 ) ;
185
185
return ;
186
186
}
187
187
@@ -283,7 +283,7 @@ public virtual void DrawPolygon(Pen pen, params Point[] points)
283
283
DrawLine ( pen , points [ 0 ] , points [ points . Length - 1 ] ) ;
284
284
}
285
285
286
- public void DrawRectangle ( Pen pen , int x , int y , int width , int height )
286
+ public virtual void DrawRectangle ( Pen pen , int x , int y , int width , int height )
287
287
{
288
288
/*
289
289
* we must draw four lines connecting any vertex of our rectangle to do this we first obtain the position of these
@@ -323,6 +323,22 @@ public void DrawRectangle(Pen pen, int x, int y, int width, int height)
323
323
DrawLine ( pen , xc , yc , xd , yd ) ;
324
324
}
325
325
326
+ public virtual void DrawFilledRectangle ( Pen pen , int x_start , int y_start , int width , int height )
327
+ {
328
+ for ( int i = 0 ; i != width ; i ++ )
329
+ {
330
+ DrawLine ( pen , x_start , y_start , x_start + height , y_start ) ;
331
+ y_start ++ ;
332
+ }
333
+ }
334
+
335
+ public virtual void DrawTriangle ( Pen pen , int v1x , int v1y , int v2x , int v2y , int v3x , int v3y )
336
+ {
337
+ DrawLine ( pen , v1x , v1y , v2x , v2y ) ;
338
+ DrawLine ( pen , v1x , v1y , v3x , v3y ) ;
339
+ DrawLine ( pen , v2x , v2y , v3x , v3y ) ;
340
+ }
341
+
326
342
public void DrawRectangle ( Pen pen , float x_start , float y_start , float width , float height )
327
343
{
328
344
throw new NotImplementedException ( ) ;
0 commit comments