# Patch created by brubbel
# Date: Do Mär 17 08:37:51 CET 2005
# Repository: pnetlib
# Comments:
# 
# 
# fixed Graphics.FillPath filling Beziers
# 
#### End of Preamble ####

#### Patch data follows ####
Index: System.Drawing/Drawing2D/GraphicsPath.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Drawing2D/GraphicsPath.cs,v
retrieving revision 1.2
diff -c -r1.2 GraphicsPath.cs
*** System.Drawing/Drawing2D/GraphicsPath.cs	12 Jul 2004 15:51:51 -0000	1.2
--- System.Drawing/Drawing2D/GraphicsPath.cs	17 Mar 2005 07:37:59 -0000
***************
*** 893,900 ****
  		public override void Fill(Graphics graphics, Brush brush,
  								  Pen penBrush, FillMode fillMode)
  				{
! 					graphics.DrawBezier
! 						(penBrush, x1, y1, x2, y2, x3, y3, x4, y4);
  				}
  
  		// Clone this path object.
--- 893,900 ----
  		public override void Fill(Graphics graphics, Brush brush,
  								  Pen penBrush, FillMode fillMode)
  				{
! 					graphics.FillBezier
! 						(brush, x1, y1, x2, y2, x3, y3, x4, y4, fillMode );
  				}
  
  		// Clone this path object.
Index: System.Drawing/Graphics.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Graphics.cs,v
retrieving revision 1.46
diff -c -r1.46 Graphics.cs
*** System.Drawing/Graphics.cs	2 Feb 2005 13:49:01 -0000	1.46
--- System.Drawing/Graphics.cs	17 Mar 2005 07:38:02 -0000
***************
*** 617,622 ****
--- 617,658 ----
  				}
  			}
  
+ 	// Draw a Bezier spline.
+ 			public void FillBezier(Brush brush, Point pt1, Point pt2,
+ 														 Point pt3, Point pt4, FillMode fillMode)
+ 			{
+ 				FillBezier(brush, (float)(pt1.X), (float)(pt1.Y),
+ 									 (float)(pt2.X), (float)(pt2.Y),
+ 									 (float)(pt3.X), (float)(pt3.Y),
+ 									 (float)(pt4.X), (float)(pt4.Y), fillMode);
+ 			}
+ 			public void FillBezier(Brush brush, PointF pt1, PointF pt2,
+ 														 PointF pt3, PointF pt4, FillMode fillMode)
+ 			{
+ 				FillBezier(brush, pt1.X, pt1.Y, pt2.X, pt2.Y,
+ 									 pt3.X, pt3.Y, pt4.X, pt4.Y, fillMode);
+ 			}
+ 			public void FillBezier(Brush brush, float x1, float y1, float x2, float y2,
+ 														 float x3, float y3, float x4, float y4, FillMode fillMode)
+ 			{
+ 
+ 				int dx1, dy1, dx2, dy2;
+ 				int dx3, dy3, dx4, dy4;
+ 				ConvertPoint(x1 + baseWindow.X, y1 + baseWindow.Y, out dx1, out dy1, pageUnit);
+ 				ConvertPoint(x2 + baseWindow.X, y2 + baseWindow.Y, out dx2, out dy2, pageUnit);
+ 				ConvertPoint(x3 + baseWindow.X, y3 + baseWindow.Y, out dx3, out dy3, pageUnit);
+ 				ConvertPoint(x4 + baseWindow.X, y4 + baseWindow.Y, out dx4, out dy4, pageUnit);
+ 				lock(this)
+ 				{
+ 					SelectBrush(brush);
+ 					ToolkitGraphics.DrawBezier(dx1, dy1, dx2, dy2,
+ 																		 dx3, dy3, dx4, dy4);
+ 					ToolkitGraphics.FillBezier(dx1, dy1, dx2, dy2,
+ 																		 dx3, dy3, dx4, dy4, fillMode);
+ 				}
+ 			}
+ 
+ 			
  	// Draw a series of Bezier splines.
  	public void DrawBeziers(Pen pen, Point[] points)
  			{
Index: System.Drawing/Toolkit/ToolkitGraphicsBase.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit/ToolkitGraphicsBase.cs,v
retrieving revision 1.16
diff -c -r1.16 ToolkitGraphicsBase.cs
*** System.Drawing/Toolkit/ToolkitGraphicsBase.cs	17 Dec 2004 12:23:20 -0000	1.16
--- System.Drawing/Toolkit/ToolkitGraphicsBase.cs	17 Mar 2005 07:38:06 -0000
***************
*** 396,402 ****
  				length+=Math.Sqrt((x2-x3)*(x2-x3) + (y2-y3) * (y2-y3));
  				length+=Math.Sqrt((x3-x4)*(x3-x4) + (y3-y4) * (y3-y4));
  				
!                                 return (int)Math.Ceiling(length);	
  			}
  
  	private Point[] ComputeBezier(int x1, int y1, int x2, int y2,		
--- 396,402 ----
  				length+=Math.Sqrt((x2-x3)*(x2-x3) + (y2-y3) * (y2-y3));
  				length+=Math.Sqrt((x3-x4)*(x3-x4) + (y3-y4) * (y3-y4));
  				
!         return (int)Math.Ceiling(length);	
  			}
  
  	private Point[] ComputeBezier(int x1, int y1, int x2, int y2,		
***************
*** 465,477 ****
  			{
  				// TODO: Optimize this to plot points without 
  				// involving line-drawing operations
!                                 Point [] points = ComputeBezier(x1,y1,x2,y2,x3,y3,x4,y4);
!                                 if (points.Length > 2)
  				{
  					DrawLines(points);
  				}
  			}
  
  	// Draw a closed cardinal curve using the current pen.
  	public virtual void DrawClosedCurve(Point[] points, float tension)
  			{			
--- 465,490 ----
  			{
  				// TODO: Optimize this to plot points without 
  				// involving line-drawing operations
! 				Point [] points = ComputeBezier(x1,y1,x2,y2,x3,y3,x4,y4);
! 				if (points.Length > 2)
  				{
  					DrawLines(points);
  				}
  			}
  
+ // Fill a bezier curve using the current pen.
+ 	public virtual void FillBezier(int x1, int y1, int x2, int y2,
+ 																		 int x3, int y3, int x4, int y4, FillMode fillMode )
+ 	{
+ 		// TODO: Optimize this to plot points without 
+ 		// involving line-drawing operations
+ 		Point [] points = ComputeBezier(x1,y1,x2,y2,x3,y3,x4,y4);
+ 		if (points.Length > 2)
+ 		{
+ 			FillPolygon(points,fillMode);
+ 		}
+ 	}
+ 			
  	// Draw a closed cardinal curve using the current pen.
  	public virtual void DrawClosedCurve(Point[] points, float tension)
  			{			
Index: System.Drawing/Toolkit/IToolkitGraphics.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit/IToolkitGraphics.cs,v
retrieving revision 1.9
diff -c -r1.9 IToolkitGraphics.cs
*** System.Drawing/Toolkit/IToolkitGraphics.cs	20 Nov 2003 07:42:20 -0000	1.9
--- System.Drawing/Toolkit/IToolkitGraphics.cs	17 Mar 2005 07:38:11 -0000
***************
*** 61,66 ****
--- 61,70 ----
  	void DrawBezier(int x1, int y1, int x2, int y2,
  					int x3, int y3, int x4, int y4);
  
+ 	// Draw a bezier curve using the current pen.
+ 	void FillBezier(int x1, int y1, int x2, int y2,
+ 									int x3, int y3, int x4, int y4, FillMode fillMode);
+ 	
  	// Draw an arc within a rectangle defined by four points.
  	void DrawArc(Point[] rect, float startAngle, float sweepAngle);
  
#### End of Patch data ####
