Author: spouliot
Date: 2006-05-25 12:06:45 -0400 (Thu, 25 May 2006)
New Revision: 61119
Modified:
trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
trunk/mcs/class/System.Drawing/System.Drawing/Region.cs
trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
Log:
2006-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
* gdipFunctions.cs: Added wrapper methods for GdipGetRegionHRgn and
GdipCreateRegionHrgn functions.
* Region.cs: Reimplement GetHrgn and FromHrgn methods using the GDI+
calls.
Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2006-05-25
16:05:05 UTC (rev 61118)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog 2006-05-25
16:06:45 UTC (rev 61119)
@@ -1,3 +1,10 @@
+2006-05-25 Sebastien Pouliot <[EMAIL PROTECTED]>
+
+ * gdipFunctions.cs: Added wrapper methods for GdipGetRegionHRgn and
+ GdipCreateRegionHrgn functions.
+ * Region.cs: Reimplement GetHrgn and FromHrgn methods using the GDI+
+ calls.
+
2006-05-24 Sebastien Pouliot <[EMAIL PROTECTED]>
* PointConverter.cs: Fx 2.0 throws an ArgumentException in
Modified: trunk/mcs/class/System.Drawing/System.Drawing/Region.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/Region.cs 2006-05-25
16:05:05 UTC (rev 61118)
+++ trunk/mcs/class/System.Drawing/System.Drawing/Region.cs 2006-05-25
16:06:45 UTC (rev 61119)
@@ -516,21 +516,32 @@
{
if (hrgn == IntPtr.Zero)
throw new ArgumentException ("hrgn");
- return new Region (hrgn);
+
+ IntPtr handle;
+ Status status = GDIPlus.GdipCreateRegionHrgn (hrgn, out
handle);
+ GDIPlus.CheckStatus (status);
+
+ return new Region (handle);
}
- public IntPtr GetHrgn(Graphics g)
+ public IntPtr GetHrgn (Graphics g)
{
-#if false
- //
// Our WindowsForms implementation uses null to avoid
// creating a Graphics context when not needed
- //
+#if false
+ // this is MS behaviour
if (g == null)
throw new ArgumentNullException ("g");
+#else
+ // this is an hack for MWF (libgdiplus would reject
that)
+ if (g == null)
+ return nativeRegion;
#endif
- return nativeRegion;
+ IntPtr handle = IntPtr.Zero;
+ Status status = GDIPlus.GdipGetRegionHRgn
(nativeRegion, g.NativeObject, ref handle);
+ GDIPlus.CheckStatus (status);
+ return handle;
}
Modified: trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
2006-05-25 16:05:05 UTC (rev 61118)
+++ trunk/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs
2006-05-25 16:06:45 UTC (rev 61119)
@@ -324,7 +324,13 @@
[DllImport("gdiplus.dll")]
static internal extern Status GdipFillRegion(IntPtr graphics,
IntPtr brush, IntPtr region);
-
+
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipGetRegionHRgn (IntPtr region,
IntPtr graphics, ref IntPtr hRgn);
+
+ [DllImport("gdiplus.dll")]
+ static internal extern Status GdipCreateRegionHrgn (IntPtr
hRgn, out IntPtr region);
+
// Solid brush functions
[DllImport("gdiplus.dll")]
static internal extern Status GdipCreateSolidFill (int color,
out IntPtr brush);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches