* GraphicsPath.cs (GraphicsPath): Filled out the missing
authorDuncan Mak <duncan@mono-cvs.ximian.com>
Wed, 7 Apr 2004 02:19:42 +0000 (02:19 -0000)
committerDuncan Mak <duncan@mono-cvs.ximian.com>
Wed, 7 Apr 2004 02:19:42 +0000 (02:19 -0000)
constructors.
(ConvertPoints): New helper function. Converts a Point array to a
PointF array.

* gdipFunctions.cs (GdipCreatePath2): Fixed signature.

* pie.cs: Save to PNG, instead of BMP.

svn path=/trunk/mcs/; revision=25125

mcs/class/System.Drawing/Samples/System.Drawing/ChangeLog
mcs/class/System.Drawing/Samples/System.Drawing/pie.cs
mcs/class/System.Drawing/System.Drawing.Drawing2D/ChangeLog
mcs/class/System.Drawing/System.Drawing.Drawing2D/GraphicsPath.cs
mcs/class/System.Drawing/System.Drawing/ChangeLog
mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs

index a57877b9b3ab8830ccf32f02e7ca677078a10d82..7826ce8f39a92c5a04978efb9c445fc1df547c36 100644 (file)
@@ -1,3 +1,7 @@
+2004-04-06  Duncan Mak  <duncan@ximian.com>
+
+       * pie.cs: Save to PNG, instead of BMP.
+
 2004-03-26  Ravindra <rkumar@novell.com>
        * TextureWrapModes.cs: Changed the file format dos2unix and 
        adjusted the generated image size.
index ed2fecf5f35b005f125ca2c8c287ddc9404462ac..649123fcb8cd6c5fa4631b0c75f1407ea4a6db30 100644 (file)
@@ -41,10 +41,10 @@ public class graphicsUI
                Rectangle rect5 = new Rectangle (200, 0, 75, 75);               
                dc.FillPie (yellowBrush, rect5, 190, 300);
                
-               Rectangle rect6 = new Rectangle (200, 100, 75, 75);             
+               Rectangle rect6 = new Rectangle (200, 100, 75, 75);
                dc.FillPie (whiteBrush, rect6, 200, 20);
 
-               bmp.Save("fillpie.bmp", ImageFormat.Bmp);                               
+               bmp.Save("fillpie.png", ImageFormat.Png); 
        }       
 
 }
index cf6e6a8bb4dcd0138ebf8a3e042251219612e489..fc508814d3b44b0bef8de218c75c66f157f03ccc 100644 (file)
@@ -1,3 +1,10 @@
+2004-04-06  Duncan Mak  <duncan@ximian.com>
+
+       * GraphicsPath.cs (GraphicsPath): Filled out the missing
+       constructors.
+       (ConvertPoints): New helper function. Converts a Point array to a
+       PointF array.
+       
 2004-04-05  Jordi Mas i Hernandez <jordi@ximian.com>
        * GraphicsPath.cs: added missing methods
        
index 214acd64eadd561fa25ed2afcae3102756b4241f..4fdef7e8b451af339169f26fd53f5a6aaf0655e0 100644 (file)
@@ -28,40 +28,52 @@ namespace System.Drawing.Drawing2D
                 public GraphicsPath ()\r
                 {\r
                         Status status = GDIPlus.GdipCreatePath (FillMode.Alternate, out nativePath);\r
-                        GDIPlus.CheckStatus (status);                          \r
+                        GDIPlus.CheckStatus (status);\r
                 }\r
                 \r
-                [MonoTODO]\r
                 public GraphicsPath (FillMode fillMode)\r
                 {\r
-                       throw new NotImplementedException ();\r
+                        Status status = GDIPlus.GdipCreatePath (fillMode, out nativePath);\r
+                        GDIPlus.CheckStatus (status);\r
                 }\r
                 \r
-                [MonoTODO]\r
                 public GraphicsPath (Point[] pts, byte[] types)\r
                 {\r
-                       throw new NotImplementedException ();\r
+                        Status status = GDIPlus.GdipCreatePath2 (\r
+                                ConvertPoints (pts), types, pts.Length, FillMode.Alternate, out nativePath);\r
+                        GDIPlus.CheckStatus (status);\r
                 }\r
                 \r
-                [MonoTODO]\r
                 public GraphicsPath (PointF[] pts, byte[] types)\r
                 {\r
-                       throw new NotImplementedException ();\r
+                        Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, FillMode.Alternate, out nativePath);\r
+                        GDIPlus.CheckStatus (status);\r
                 }\r
                 \r
-                [MonoTODO]\r
-               public GraphicsPath (Point[] pts,  byte[] types,  FillMode fillMode)\r
+               public GraphicsPath (Point[] pts, byte[] types, FillMode fillMode)\r
                {\r
-                       throw new NotImplementedException ();   \r
+                        Status status = GDIPlus.GdipCreatePath2 (\r
+                                ConvertPoints (pts), types, pts.Length, fillMode, out nativePath);\r
+                        GDIPlus.CheckStatus (status);\r
                 }\r
 \r
-               [MonoTODO]\r
-               public GraphicsPath(PointF[] pts,  byte[] types,   FillMode fillMode)\r
+               public GraphicsPath(PointF[] pts, byte[] types, FillMode fillMode)\r
                {\r
-                       throw new NotImplementedException ();\r
+                        Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, fillMode, out nativePath);\r
+                        GDIPlus.CheckStatus (status);\r
+                }\r
+\r
+                PointF [] ConvertPoints (Point [] pt)\r
+                {\r
+                        int length = pt.Length;                        \r
+                        PointF [] pf = new PointF [length];\r
+\r
+                        for (int i = 0; i < length; i++)\r
+                                pf [i] = pt [i];\r
+\r
+                        return pf;\r
                 }\r
        \r
-               \r
                 public object Clone ()\r
                 {\r
                         IntPtr clone;\r
@@ -162,13 +174,13 @@ namespace System.Drawing.Drawing2D
                 \r
                 internal IntPtr NativeObject{\r
                 \r
-                                       get{\r
-                                                       return nativePath;\r
-                                       }\r
-                                       set     {\r
-                                                       nativePath = value;\r
-                                       }\r
-                               }\r
+                        get {\r
+                                return nativePath;\r
+                        }\r
+                        set {\r
+                                nativePath = value;\r
+                        }\r
+                }\r
         \r
                 //\r
                 // AddArc\r
@@ -187,7 +199,7 @@ namespace System.Drawing.Drawing2D
 \r
                 public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)\r
                 {\r
-                        Status status = GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);                \r
+                        Status status = GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);\r
                         GDIPlus.CheckStatus (status);                          \r
                 }\r
 \r
@@ -311,7 +323,8 @@ namespace System.Drawing.Drawing2D
 \r
                         for (int i = 0; i < length - 2; i += 2) {\r
                                 int j = i + 1;\r
-                                Status status = GDIPlus.GdipAddPathLineI (nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
+                                Status status = GDIPlus.GdipAddPathLineI (\r
+                                        nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
                                 GDIPlus.CheckStatus (status);                          \r
                         }\r
                 }\r
@@ -322,7 +335,8 @@ namespace System.Drawing.Drawing2D
 \r
                         for (int i = 0; i < length - 2; i += 2) {\r
                                 int j = i + 1;\r
-                                Status status = GDIPlus.GdipAddPathLine (nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
+                                Status status = GDIPlus.GdipAddPathLine (\r
+                                        nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
                                 GDIPlus.CheckStatus (status);                          \r
                         }\r
                 }\r
@@ -332,7 +346,8 @@ namespace System.Drawing.Drawing2D
                 //\r
                 public void AddPie (Rectangle rect, float startAngle, float sweepAngle)\r
                 {\r
-                        Status status = GDIPlus.GdipAddPathPie (nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);\r
+                        Status status = GDIPlus.GdipAddPathPie (\r
+                                nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);\r
                         GDIPlus.CheckStatus (status);                          \r
                 }\r
 \r
index 7f191ca3bd9d13063420bd899c0bdc0414b56755..17ac54d1dd16b73272e799c242e8bfb235d902a4 100644 (file)
@@ -1,3 +1,7 @@
+2004-04-06  Duncan Mak  <duncan@ximian.com>
+
+       * gdipFunctions.cs (GdipCreatePath2): Fixed signature.
+
 2004-04-06  Jordi Mas i Hernandez <jordi@ximian.com>
        * Region.cs: fixes GetRegionScans
        * gdipFunctions.cs: fixes GetRegionScans
index 94fab637a058f18c6e5dd886ff613932c36d6919..05d006b942991ff91c8d0a3f3c23955b13a5e472 100644 (file)
@@ -985,7 +985,7 @@ namespace System.Drawing {
                 [DllImport ("gdiplus.dll")]
                 internal static extern Status GdipCreatePath (FillMode brushMode, out IntPtr path);
                 [DllImport ("gdiplus.dll")]                
-                internal static extern Status GdipCreatePath2 (PointF points, byte [] types, int count, FillMode brushMode, out IntPtr path);
+                internal static extern Status GdipCreatePath2 (PointF [] points, byte [] types, int count, FillMode brushMode, out IntPtr path);
                 [DllImport ("gdiplus.dll")]
                 internal static extern Status GdipClonePath (IntPtr path, out IntPtr clonePath);
                 [DllImport ("gdiplus.dll")]