2005-09-26 Sebastien Pouliot <sebastien@ximian.com>
[mono.git] / mcs / class / System.Drawing / System.Drawing / Graphics.cs
old mode 100755 (executable)
new mode 100644 (file)
index 4379148..42b107c
@@ -1,17 +1,42 @@
 //
 // System.Drawing.Graphics.cs
 //
-// (C) 2003 Ximian, Inc.  http://www.ximian.com
-//
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
 //      Alexandre Pigolkine(pigolkine@gmx.de)
+//     Jordi Mas i Hernandez (jordi@ximian.com)
+//
+// Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
+//
+// Copyright (C) 2004-2005 Novell, Inc. (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using System;
+
 using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Drawing.Text;
+using System.ComponentModel;
 using System.Runtime.InteropServices;
+using System.Security.Permissions;
+using System.Text;
 
 namespace System.Drawing
 {
@@ -19,13 +44,18 @@ namespace System.Drawing
        public sealed class Graphics : MarshalByRefObject, IDisposable
        {
                internal IntPtr nativeObject = IntPtr.Zero;
-               
+               private bool disposed = false;
+               private static float defDpiX = 0;
+               private static float defDpiY = 0;
+
+               [ComVisible(false)]
                public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
                                                            int flags,
                                                            int dataSize,
                                                            IntPtr data,
                                                            PlayRecordCallback callbackData);
                
+               [ComVisible (false)]
                public delegate bool DrawImageAbort (IntPtr callbackData);
 
                private Graphics (IntPtr nativeGraphics)
@@ -33,42 +63,98 @@ namespace System.Drawing
                        nativeObject = nativeGraphics;
                }
 
+               ~Graphics ()
+               {
+                       Dispose ();                     
+               }               
+
+               static internal float systemDpiX {
+                       get {
+                               if (defDpiX == 0) {
+                                       Bitmap bmp = new Bitmap (1, 1);
+                                       Graphics g = Graphics.FromImage (bmp);
+                                       defDpiX = g.DpiX;
+                               }
+                               return defDpiX;
+                       }
+               }
+
+               static internal float systemDpiY {
+                       get {
+                               if (defDpiY == 0) {
+                                       Bitmap bmp = new Bitmap (1, 1);
+                                       Graphics g = Graphics.FromImage (bmp);
+                                       defDpiY = g.DpiY;
+                               }
+                               return defDpiY;
+                       }
+               }
+
+               internal IntPtr NativeObject {
+                       get {
+                               return nativeObject;
+                       }
+
+                       set {
+                               nativeObject = value;
+                       }
+               }
+
                [MonoTODO]
                public void AddMetafileComment (byte [] data)
                {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
+               
                public GraphicsContainer BeginContainer ()
                {
-                       throw new NotImplementedException ();
-               }
+                       int state;
+                       Status status;
+                       status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
+                       GDIPlus.CheckStatus (status);
 
-               [MonoTODO]
+                        return new GraphicsContainer(state);
+               }
+               
                public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
                {
-                       throw new NotImplementedException ();
+                       int state;
+                       Status status;
+                       status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
+                       GDIPlus.CheckStatus (status);
+
+                       return new GraphicsContainer (state);
                }
 
-               [MonoTODO]
+               
                public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
                {
-                       throw new NotImplementedException ();
+                       int state;
+                       Status status;
+                       status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
+                       GDIPlus.CheckStatus (status);
+
+                       return new GraphicsContainer (state);
                }
 
                
                public void Clear (Color color)
-               {                       
-                       Status status = GDIPlus.GdipGraphicsClear(nativeObject, color.ToArgb());
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipGraphicsClear:" +status);
+               {
+                       Status status;
+                       status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void Dispose ()
                {
+                       Status status;
+                       if (! disposed) {
+                               status = GDIPlus.GdipDeleteGraphics (nativeObject);
+                               nativeObject = IntPtr.Zero;
+                               GDIPlus.CheckStatus (status);
+                               disposed = true;                                
+                       }
                }
 
                
@@ -86,53 +172,53 @@ namespace System.Drawing
                
                public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
                {
-                       Status status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
+                       Status status;
+                       status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
                                         x, y, width, height, startAngle, sweepAngle);
-                                        
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipGraphicsClear:" +status);                                        
+                       GDIPlus.CheckStatus (status);
                }
 
-               public void DrawArc (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
-               {                       
-                       Status status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
-                                        x, y, width, height, startAngle, sweepAngle);
-                                                    
-            if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipGraphicsClear:" +status);                                        
-                                                       
+               // Microsoft documentation states that the signature for this member should be
+               // public void DrawArc( Pen pen,  int x,  int y,  int width,  int height,   int startAngle,
+               // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
+               public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
+               {
+                       Status status;
+                       status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
+                                               x, y, width, height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
                {
-                       Status status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, 
-                                        pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
-                                        
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.DrawBezier:" +status);                                                                                
+                       Status status;
+                       status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
+                                                       pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
+                                                       pt3.Y, pt4.X, pt4.Y);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
                {
-                       Status status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject, 
-                                        pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
-                                        
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawBezierI:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
+                                                       pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
+                                                       pt3.Y, pt4.X, pt4.Y);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
                {
-                       Status status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1, y1, x2, y2, x3, y3, x4, y4);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawBezier:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
+                                                       y1, x2, y2, x3, y3, x4, y4);
+                       GDIPlus.CheckStatus (status);
                }
 
-        [MonoTODO]
                public void DrawBeziers (Pen pen, Point [] points)
                {
                         int length = points.Length;
+                       Status status;
 
                         if (length < 3)
                                 return;
@@ -143,16 +229,18 @@ namespace System.Drawing
                                 Point p3 = points [i + 2];
                                 Point p4 = points [i + 3];
 
-                                GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
+                                status = GDIPlus.GdipDrawBezier (nativeObject, 
+                                                       pen.nativeObject,
                                                         p1.X, p1.Y, p2.X, p2.Y, 
                                                         p3.X, p3.Y, p4.X, p4.Y);
+                               GDIPlus.CheckStatus (status);
                         }
                }
 
-                [MonoTODO]
                public void DrawBeziers (Pen pen, PointF [] points)
                {
                        int length = points.Length;
+                       Status status;
 
                         if (length < 3)
                                 return;
@@ -163,101 +251,98 @@ namespace System.Drawing
                                 PointF p3 = points [i + 2];
                                 PointF p4 = points [i + 3];
 
-                                GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
+                                status = GDIPlus.GdipDrawBezier (nativeObject, 
+                                                       pen.nativeObject,
                                                         p1.X, p1.Y, p2.X, p2.Y, 
                                                         p3.X, p3.Y, p4.X, p4.Y);
+                               GDIPlus.CheckStatus (status);
                         }
                }
 
                
                public void DrawClosedCurve (Pen pen, PointF [] points)
                {
-                       Status status =  GDIPlus.GdipDrawClosedCurve(nativeObject, pen.nativeObject,  points, points.Length);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawClosedCurve:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
-
                
                public void DrawClosedCurve (Pen pen, Point [] points)
                {
-                       Status status =  GDIPlus.GdipDrawClosedCurveI(nativeObject, pen.nativeObject,  points, points.Length);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawClosedCurveI:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
                        
                public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
                {
-                       Status status =  GDIPlus.GdipDrawClosedCurve2I(nativeObject, pen.nativeObject,  points, points.Length, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawClosedCurve2I:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
+                       GDIPlus.CheckStatus (status);
                }
-
                
                public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
                {
-                       Status status =  GDIPlus.GdipDrawClosedCurve2(nativeObject, pen.nativeObject,  points, points.Length, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawClosedCurve2:" +status);                                                                                                                        
-                       
+                       Status status;
+                       status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
+                       GDIPlus.CheckStatus (status);
                }
                
                public void DrawCurve (Pen pen, Point [] points)
                {
-                       Status status =  GDIPlus.GdipDrawCurveI(nativeObject, pen.nativeObject,  points, points.Length);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurveI:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
                
                public void DrawCurve (Pen pen, PointF [] points)
                {
-                       Status status =  GDIPlus.GdipDrawCurve(nativeObject, pen.nativeObject,  points, points.Length);                 
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurve:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
                
                public void DrawCurve (Pen pen, PointF [] points, float tension)
-               {                       
-                       Status status =  GDIPlus.GdipDrawCurve2(nativeObject, pen.nativeObject,  points, points.Length, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurve2:" +status);                                                                                                                        
+               {
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
+                       GDIPlus.CheckStatus (status);
                }
                
                public void DrawCurve (Pen pen, Point [] points, float tension)
                {
-                       Status status =  GDIPlus.GdipDrawCurve2I(nativeObject, pen.nativeObject,  points, points.Length, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurve2I:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);              
+                       GDIPlus.CheckStatus (status);
                }
                
-               [MonoTODO]
+               
                public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
                {
-                       
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
+                                                       points, points.Length, offset,
+                                                       numberOfSegments, 0.5f);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
                {
-                       Status status =  GDIPlus.GdipDrawCurve3I(nativeObject, pen.nativeObject, points, points.Length, offset,  numberOfSegments, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurve3:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
+                                                       points, points.Length, offset,
+                                                       numberOfSegments, tension);
+                       GDIPlus.CheckStatus (status);
                }
 
                
                public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
                {
-                       Status status =  GDIPlus.GdipDrawCurve3(nativeObject, pen.nativeObject, points, points.Length, offset,  numberOfSegments, tension);
-                       
-                       if (status != Status.Ok)                            
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawCurve3:" +status);                                                                                                                        
+                       Status status;
+                       status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
+                                                       points, points.Length, offset,
+                                                       numberOfSegments, tension);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawEllipse (Pen pen, Rectangle rect)
@@ -272,340 +357,403 @@ namespace System.Drawing
 
                public void DrawEllipse (Pen pen, int x, int y, int width, int height)
                {
-                       GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
+                       Status status;
+                       status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawEllipse (Pen pen, float x, float y, float width, float height)
                {
-                       GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height); 
+                       Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void DrawIcon (Icon icon, Rectangle targetRect)
                {
-                       throw new NotImplementedException ();
+                       Image img = icon.ToBitmap ();
+                       DrawImage (img, targetRect);
                }
 
-               [MonoTODO]
                public void DrawIcon (Icon icon, int x, int y)
                {
-                       throw new NotImplementedException ();
+                       Image img = icon.ToBitmap ();
+                       DrawImage (img, x, y);
                }
 
-               [MonoTODO]
                public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
                {
-                       throw new NotImplementedException ();
+                       Image img = icon.ToBitmap ();
+                       DrawImageUnscaled (img, targetRect);
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, RectangleF rect)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
+                       GDIPlus.CheckStatus (status);
                }
 
                
                public void DrawImage (Image image, PointF point)
                {
-                       Status status = GDIPlus.GdipDrawImage(nativeObject, image.NativeObject, point.X, point.Y);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.DrawImage (Image image, PointF point):" +status);                                   
+                       Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Point [] destPoints)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Point point)
                {
-                       throw new NotImplementedException ();
+                       DrawImage (image, point.X, point.Y);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle rect)
                {
-                       throw new NotImplementedException ();
+                       DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, PointF [] destPoints)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, int x, int y)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, float x, float y)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
+                               destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                               srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
+                               srcUnit, IntPtr.Zero, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
-               {
-                       throw new NotImplementedException ();
+               {                       
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
+                               destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                               srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
+                               srcUnit, IntPtr.Zero, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
+                               srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, 
+                               null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
                {
-                       throw new NotImplementedException ();
+                       
+                       Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
+                               srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, 
+                               null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
-               public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
+               
+               public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
+                                ImageAttributes imageAttr)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y,
+                               srcRect.Width, srcRect.Height, srcUnit,
+                               imageAttr.NativeObject, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, float x, float y, float width, float height)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
+                           width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
-               public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)
+               
+               public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
+                                ImageAttributes imageAttr)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y,
+                               srcRect.Width, srcRect.Height, srcUnit, 
+                               imageAttr.NativeObject, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
-               {
-                       throw new NotImplementedException ();
+               {                       
+                       Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, int x, int y, int width, int height)
                {
-                       GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
+                       Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
-               {
-                       throw new NotImplementedException ();
+               {                       
+                       Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y,
+                               srcRect.Width, srcRect.Height, srcUnit, 
+                               imageAttr.NativeObject, callback, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
                {
-                       throw new NotImplementedException ();
+                       
+                       Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y,
+                               srcRect.Width, srcRect.Height, srcUnit, 
+                               imageAttr.NativeObject, callback, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
                {
-                       throw new NotImplementedException ();
+
+                       Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
+                               srcRect.Width, srcRect.Height, srcUnit, 
+                               imageAttr.NativeObject, callback, (IntPtr) callbackData);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
+                                destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                                       srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, 
+                                       null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);                                   
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
+                               destPoints, destPoints.Length , srcRect.X, srcRect.Y,
+                               srcRect.Width, srcRect.Height, srcUnit, 
+                               imageAttr.NativeObject, callback, (IntPtr) callbackData);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
+                                destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                                       srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, 
+                                       null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
+                                destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                                       srcX, srcY, srcWidth, srcHeight, srcUnit,
+                               imageAttrs.NativeObject, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
                
                public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
                {                       
-                       Status status =  GDIPlus.GdipDrawImageRectRectI(nativeObject, image.NativeObject, //aki
-                                                               destRect.X, destRect.Y, destRect.Width, destRect.Height,
-                                                               srcX, srcY, srcWidth, srcHeight,
-                                                               srcUnit, imageAttr.NativeObject, IntPtr.Zero, 0);
-                                                                                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)" +status);             
+                       Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject, 
+                                        destRect.X, destRect.Y, destRect.Width, 
+                                       destRect.Height, srcX, srcY, srcWidth, srcHeight,
+                                       srcUnit, imageAttr.NativeObject, null, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject, 
+                                        destRect.X, destRect.Y, destRect.Width, 
+                                       destRect.Height, srcX, srcY, srcWidth, srcHeight,
+                                       srcUnit, imageAttr.NativeObject, callback,
+                                       IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
-               public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)
-               {
-                       throw new NotImplementedException ();
-               }
-
-               [MonoTODO]
-               public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
+               
+               public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
+                                        destRect.X, destRect.Y, destRect.Width, 
+                                       destRect.Height, srcX, srcY, srcWidth, srcHeight,
+                                       srcUnit, imageAttr.NativeObject, 
+                                       callback, IntPtr.Zero);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
-               public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
+               
+               public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
+                               destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                               srcX, srcY, srcWidth, srcHeight, srcUnit, 
+                               imageAttr.NativeObject, callback, callbackData);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
+               public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
+               {
+                       Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
+                                       destRect.X, destRect.Y, destRect.Width, destRect.Height,
+                               srcX, srcY, srcWidth, srcHeight, srcUnit,
+                               imageAttr.NativeObject, callback, callbackData);
+                       GDIPlus.CheckStatus (status);
+               }               
+               
                public void DrawImageUnscaled (Image image, Point point)
                {
-                       throw new NotImplementedException ();
+                       DrawImageUnscaled (image, point.X, point.Y);
                }
-
-               [MonoTODO]
+               
                public void DrawImageUnscaled (Image image, Rectangle rect)
                {
-                       throw new NotImplementedException ();
+                       DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
                }
-
-               [MonoTODO]
+               
                public void DrawImageUnscaled (Image image, int x, int y)
                {
-                       throw new NotImplementedException ();
+                       DrawImage (image, x, y, image.Width, image.Height);
                }
 
-               [MonoTODO]
                public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
                {
-                       throw new NotImplementedException ();
+                       Image tmpImg = new Bitmap (width, height);
+                       Graphics g = FromImage (tmpImg);
+                       g.DrawImage (image, 0, 0, image.Width, image.Height);
+                       this.DrawImage (tmpImg, x, y, width, height);
+                       tmpImg.Dispose ();
+                       g.Dispose ();
                }
 
                public void DrawLine (Pen pen, PointF pt1, PointF pt2)
                {
-                       
-                Status status = GDIPlus.GdipDrawLine (
-                                nativeObject, pen.nativeObject,
-                                pt1.X, pt1.Y,
-                                pt2.X, pt2.Y);
-                                
-                               if (status != Status.Ok)
-                                       throw new ArgumentException ("Error calling GDIPlus.GdipDrawLine:" +status);                                
+                        Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
+                                               pt1.X, pt1.Y, pt2.X, pt2.Y);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawLine (Pen pen, Point pt1, Point pt2)
                {
-            Status status =  GDIPlus.GdipDrawLineI (
-                                nativeObject, pen.nativeObject,
-                                pt1.X, pt1.Y,
-                                pt2.X, pt2.Y);
-                                
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawLineI:" +status);                                
+                        Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
+                                               pt1.X, pt1.Y, pt2.X, pt2.Y);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
                {
                        Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawLineI:" +status);                                
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
                {
                        Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawLine:" +status);                                
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawLines (Pen pen, PointF [] points)
                {
                        Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawLines:" +status);                                
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawLines (Pen pen, Point [] points)
                {
                        Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawLinesI:" +status);                                
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void DrawPath (Pen pen, GraphicsPath path)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
                {
                        DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
                }
-
-               [MonoTODO]
+               
                public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
                {
                        DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
                }
-
-               [MonoTODO]
+               
                public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
                {
-                       GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
+                       Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
-               public void DrawPie (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
+               
+               // Microsoft documentation states that the signature for this member should be
+               // public void DrawPie(Pen pen, int x,  int y,  int width,   int height,   int startAngle
+               // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
+               public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
                {
-                       GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
+                       Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawPolygon (Pen pen, Point [] points)
                {
-                       GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
+                       Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawPolygon (Pen pen, PointF [] points)
                {
-                       GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
+                       Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               public void DrawRectangle (Pen pen, RectangleF rect)
+               internal void DrawRectangle (Pen pen, RectangleF rect)
                {
                        DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
                }
@@ -617,82 +765,70 @@ namespace System.Drawing
 
                public void DrawRectangle (Pen pen, float x, float y, float width, float height)
                {
-                       GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
+                       Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawRectangle (Pen pen, int x, int y, int width, int height)
                {
-                       Console.WriteLine(" DrawRectangle (Pen pen, int x, int y, int width, int height)");
-                       
-                       Console.WriteLine("Native->" + nativeObject);
-                       
                        Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.DrawRectangle:" +status);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawRectangles (Pen pen, RectangleF [] rects)
                {
-                       foreach (RectangleF rc in rects)
-                               DrawRectangle (pen, rc.Left, rc.Top, rc.Width, rc.Height);
+                       Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void DrawRectangles (Pen pen, Rectangle [] rects)
                {
-                       foreach (RectangleF rc in rects)
-                               DrawRectangle(pen, rc.Left, rc.Top, rc.Width, rc.Height);
+                       Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO("Ignores the font")]
                public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
                {
-                       GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
+                       DrawString (s, font, brush, layoutRectangle, null);
                }
 
-               [MonoTODO("This ignores the font")]
                public void DrawString (string s, Font font, Brush brush, PointF point)
                {
-                       RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
-                       GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rc, IntPtr.Zero, brush.nativeObject);
+                       DrawString (s, font, brush, new RectangleF (point.X, point.Y, 0, 0), null);
                }
 
-               [MonoTODO ("This ignores the font and format")]
                public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
                {
-                       RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
-                       GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref rc, IntPtr.Zero, brush.nativeObject);
+                       DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
                }
 
-               [MonoTODO ("This ignores the font and the format")]
-               public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
+               public void DrawString (string s, Font font, Brush brush, float x, float y)
                {
-                       GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
+                       DrawString (s, font, brush, new RectangleF (x, y, 0, 0), null);
                }
 
-               [MonoTODO("This ignores the font")]
-               public void DrawString (string s, Font font, Brush brush, float x, float y)
+               public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
                {
-                       Console.WriteLine("DrawString!");
-                       RectangleF rc = new RectangleF (x, y, 0, 0);
-                       
-                       Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, IntPtr.Zero, 
-                               ref rc, IntPtr.Zero, brush.nativeObject);
-                       
-                       if (status != Status.Ok)                                
-                               throw new ArgumentException ("Error calling GDIPlus.GdipDrawString(string s, Font font, Brush brush, float x, float y):" +s);
+                       DrawString (s, font, brush, new RectangleF(x, y, 0, 0), format);
                }
 
-               [MonoTODO]
-               public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
+               public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
                {
-                       //throw new NotImplementedException ();
+                       if (font == null)
+                               throw new ArgumentNullException ("font");
+                       if (brush == null)
+                               throw new ArgumentNullException ("brush");
+                       if (s == null || s.Length == 0)
+                               return;
+
+                       Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.nativeObject);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void EndContainer (GraphicsContainer container)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
+                       GDIPlus.CheckStatus (status);
                }
 
                [MonoTODO]
@@ -910,53 +1046,54 @@ namespace System.Drawing
                {
                        throw new NotImplementedException ();
                }
-
-               [MonoTODO]
+       
                public void ExcludeClip (Rectangle rect)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void ExcludeClip (Region region)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void FillClosedCurve (Brush brush, PointF [] points)
                {
-                       throw new NotImplementedException ();
+                      Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void FillClosedCurve (Brush brush, Point [] points)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
                {
-                       throw new NotImplementedException ();
+                       FillClosedCurve (brush, points, fillmode, 0.5f);
                }
-
-               [MonoTODO]
+               
                public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
                {
-                       throw new NotImplementedException ();
+                       FillClosedCurve (brush, points, fillmode, 0.5f);
                }
 
-               [MonoTODO]
                public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillEllipse (Brush brush, Rectangle rect)
@@ -971,56 +1108,62 @@ namespace System.Drawing
 
                public void FillEllipse (Brush brush, float x, float y, float width, float height)
                {
-                        GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
+                        Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillEllipse (Brush brush, int x, int y, int width, int height)
                {
-                       GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
+                       Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void FillPath (Brush brush, GraphicsPath path)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject,  path.NativeObject);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillPolygon (Brush brush, PointF [] points)
                {
-                       GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
+                       Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillPolygon (Brush brush, Point [] points)
                {
-                       GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
+                       Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
                {
-                       GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
+                       Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
                {
-                       GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
+                       Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillRectangle (Brush brush, RectangleF rect)
@@ -1035,225 +1178,398 @@ namespace System.Drawing
 
                public void FillRectangle (Brush brush, int x, int y, int width, int height)
                {
-                       GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, (float)x, (float)y, (float)width, (float)height);
+                       Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillRectangle (Brush brush, float x, float y, float width, float height)
                {
-                       GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
+                       Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillRectangles (Brush brush, Rectangle [] rects)
                {
-                        foreach (Rectangle rc in rects)
-                                FillRectangle(brush, rc);
+                       Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void FillRectangles (Brush brush, RectangleF [] rects)
                {
-                       foreach (RectangleF rc in rects)
-                                FillRectangle(brush, rc);
+                       Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void FillRegion (Brush brush, Region region)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);                  
+                        GDIPlus.CheckStatus(status);
                }
 
-               [MonoTODO]
+               
                public void Flush ()
                {
-                       Flush(FlushIntention.Flush);
+                       Flush (FlushIntention.Flush);
                }
 
-               [MonoTODO]
+               
                public void Flush (FlushIntention intention)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipFlush (nativeObject, intention);
+                        GDIPlus.CheckStatus (status);                    
+                       if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
+                               Carbon.CGContextSynchronize (GDIPlus.Display);
                }
 
-               [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]               
                public static Graphics FromHdc (IntPtr hdc)
                {
-                       int graphics;
-                       GDIPlus.GdipCreateFromHDC (hdc, out graphics);
-                       Graphics result = new Graphics ((IntPtr)graphics);
-                       return result;
+                       IntPtr graphics;
+                       Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
+                       GDIPlus.CheckStatus (status);
+                       return new Graphics (graphics);
                }
 
                [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
                public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
                {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public static Graphics FromHdcInternal (IntPtr hdc)
                {
-                       throw new NotImplementedException ();
+                       GDIPlus.Display = hdc;
+                       return null;
                }
-               
+
+               [EditorBrowsable (EditorBrowsableState.Advanced)]               
                public static Graphics FromHwnd (IntPtr hwnd)
                {
                        IntPtr graphics;
-                       
-                       Status status = GDIPlus.GdipCreateFromHWND(hwnd, out graphics);
-                       
-                       if (status != Status.Ok)
-                               throw new ArgumentException ("Error calling GDIPlus.GdipCreateFromHWND:" +status);                              
-                       
-                       return new Graphics(graphics);                  
-               }
 
-               [MonoTODO]
+                       if (GDIPlus.UseCocoaDrawable) {
+                               CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
+                               GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
+                               
+                               GDIPlus.Display = cgContext.ctx;
+                               return new Graphics (graphics);
+                       }
+                       if (GDIPlus.UseQuartzDrawable) {
+                               CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
+                               GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
+                               
+                               GDIPlus.Display = cgContext.ctx;
+                               return new Graphics (graphics);
+                       }
+                       if (GDIPlus.UseX11Drawable) {
+                               if (GDIPlus.Display == IntPtr.Zero) {
+                                       GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
+                               }
+
+                               return FromXDrawable (hwnd, GDIPlus.Display);
+
+                       }
+
+                       Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
+                       GDIPlus.CheckStatus (status);
+
+                       return new Graphics (graphics);
+               }
+               
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public static Graphics FromHwndInternal (IntPtr hwnd)
                {
-                       throw new NotImplementedException ();
+                       return FromHwnd (hwnd);
                }
 
-               [MonoTODO]
                public static Graphics FromImage (Image image)
                {
-                       if (image == null) throw new ArgumentException ();
-                       int graphics;
-                       GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
-                       Graphics result = new Graphics ((IntPtr)graphics);
+                       IntPtr graphics;
+
+                       if (image == null) 
+                               throw new ArgumentNullException ();
+
+                       Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
+                       GDIPlus.CheckStatus (status);
+                       Graphics result = new Graphics (graphics);
+                               
+                       // check for Unix platforms - see FAQ for more details
+                       // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
+                       int platform = (int) Environment.OSVersion.Platform;
+                       if ((platform == 4) || (platform == 128)) {
+                               Rectangle rect  = new Rectangle (0,0, image.Width, image.Height);
+                               GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
+                       }
+                               
                        return result;
                }
 
+               internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
+               {
+                       IntPtr graphics;
+
+                       Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
+                       GDIPlus.CheckStatus (s);
+                       return new Graphics (graphics);
+               }
+
                [MonoTODO]
                public static IntPtr GetHalftonePalette ()
                {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
                public IntPtr GetHdc ()
                {
-                       int hdc;
-                       GDIPlus.GdipGetDC (nativeObject, out hdc);
-                       return (IntPtr)hdc;
+                       IntPtr hdc;
+                       GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
+                       return hdc;
                }
 
-               [MonoTODO]
+               
                public Color GetNearestColor (Color color)
                {
-                       throw new NotImplementedException ();
+                       int argb;
+                       
+                       Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
+                       GDIPlus.CheckStatus (status);
+
+                       return Color.FromArgb (argb);
                }
 
-               [MonoTODO]
+               
                public void IntersectClip (Region region)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
+                       GDIPlus.CheckStatus (status);
                }
-
-               [MonoTODO]
+               
                public void IntersectClip (RectangleF rect)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void IntersectClip (Rectangle rect)
-               {
-                       throw new NotImplementedException ();
+               {                       
+                       Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public bool IsVisible (Point point)
                {
-                       throw new NotImplementedException ();
+                       bool isVisible = false;
+
+                       Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
+                       GDIPlus.CheckStatus (status);
+
+                        return isVisible;
                }
 
-               [MonoTODO]
+               
                public bool IsVisible (RectangleF rect)
                {
-                       throw new NotImplementedException ();
+                       bool isVisible = false;
+
+                       Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
+                       GDIPlus.CheckStatus (status);
+
+                        return isVisible;
                }
 
-               [MonoTODO]
                public bool IsVisible (PointF point)
                {
-                       throw new NotImplementedException ();
-               }
+                       bool isVisible = false;
 
-               [MonoTODO]
+                       Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
+                       GDIPlus.CheckStatus (status);
+
+                        return isVisible;
+               }
+               
                public bool IsVisible (Rectangle rect)
                {
-                       throw new NotImplementedException ();
-               }
+                       bool isVisible = false;
 
-               [MonoTODO]
+                       Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
+                       GDIPlus.CheckStatus (status);
+
+                        return isVisible;
+               }
+               
                public bool IsVisible (float x, float y)
                {
-                       throw new NotImplementedException ();
+                       return IsVisible (new PointF (x, y));
                }
-
-               [MonoTODO]
+               
                public bool IsVisible (int x, int y)
                {
-                       throw new NotImplementedException ();
+                       return IsVisible (new Point (x, y));
                }
-
-               [MonoTODO]
+               
                public bool IsVisible (float x, float y, float width, float height)
                {
-                       throw new NotImplementedException ();
+                       return IsVisible (new RectangleF (x, y, width, height));
                }
 
-               [MonoTODO]
+               
                public bool IsVisible (int x, int y, int width, int height)
                {
-                       throw new NotImplementedException ();
+                       return IsVisible (new Rectangle (x, y, width, height));
                }
 
-               [MonoTODO]
+               
                public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
-               {
-                       throw new NotImplementedException ();
+               {       
+                       Status status;                  
+                       int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
+                       IntPtr[] native_regions = new IntPtr [regcount];
+                       Region[] regions = new Region [regcount];
+                       
+                       for (int i = 0; i < regcount; i++) {
+                               regions[i] = new Region ();
+                               native_regions[i] = regions[i].NativeObject;
+                       }
+                       
+                       status =  GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
+                               font.NativeObject, ref layoutRect, stringFormat.NativeObject, 
+                               regcount, out native_regions[0]); 
+                       
+                       GDIPlus.CheckStatus (status);                           
+                                                       
+                       return regions;                                                 
                }
 
-               [MonoTODO]
+               
                public SizeF MeasureString (string text, Font font)
                {
-                       throw new NotImplementedException ();
+                       return MeasureString (text, font, new Size (0, 0));
                }
 
-               [MonoTODO]
+               
                public SizeF MeasureString (string text, Font font, SizeF layoutArea)
                {
-                       throw new NotImplementedException ();
+                       int charactersFitted, linesFilled;
+                       RectangleF boundingBox = new RectangleF ();
+                       RectangleF rect = new RectangleF (0, 0, layoutArea.Width,
+                                                         layoutArea.Height);
+
+                       if (text == null || text.Length == 0)
+                               return SizeF.Empty;
+
+                       if (font == null)
+                               throw new ArgumentNullException ("font");
+
+                       Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
+                                                                  font.NativeObject, ref rect,
+                                                                  IntPtr.Zero, out boundingBox,
+                                                                  out charactersFitted, out linesFilled);
+                       GDIPlus.CheckStatus (status);
+
+                       return new SizeF (boundingBox.Width, boundingBox.Height);
                }
 
-               [MonoTODO]
+               
                public SizeF MeasureString (string text, Font font, int width)
-               {
-                       throw new NotImplementedException ();
+               {                               
+                       RectangleF boundingBox = new RectangleF ();
+                       RectangleF rect = new RectangleF (0, 0, width, 999999);
+                       int charactersFitted, linesFilled;
+
+                       if (text == null || text.Length == 0)
+                               return SizeF.Empty;
+
+                       if (font == null)
+                               throw new ArgumentNullException ("font");
+
+                       Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
+                                                                  font.NativeObject, ref rect,
+                                                                  IntPtr.Zero, out boundingBox,
+                                                                  out charactersFitted, out linesFilled);
+                       GDIPlus.CheckStatus (status);
+
+                       return new SizeF (boundingBox.Width, boundingBox.Height);
                }
 
-               [MonoTODO]
-               public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
+               
+               public SizeF MeasureString (string text, Font font, SizeF layoutArea,
+                                           StringFormat stringFormat)
                {
-                       throw new NotImplementedException ();
+                       int charactersFitted, linesFilled;                      
+                       return MeasureString (text, font, layoutArea, stringFormat,
+                                             out charactersFitted, out linesFilled);
                }
 
-               [MonoTODO]
+               
                public SizeF MeasureString (string text, Font font, int width, StringFormat format)
                {
-                       throw new NotImplementedException ();
+                       int charactersFitted, linesFilled;                      
+                       return MeasureString (text, font, new SizeF (width, 999999), 
+                                             format, out charactersFitted, out linesFilled);
                }
 
-               [MonoTODO]
-               public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
+               
+               public SizeF MeasureString (string text, Font font, PointF origin,
+                                           StringFormat stringFormat)
                {
-                       throw new NotImplementedException ();
+                       RectangleF boundingBox = new RectangleF ();
+                       RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
+                       int charactersFitted, linesFilled;
+
+                       if (text == null || text.Length == 0)
+                               return SizeF.Empty;
+
+                       if (font == null)
+                               throw new ArgumentNullException ("font");
+
+                       if (stringFormat == null)
+                               stringFormat = new StringFormat ();
+
+                       Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
+                                                                  font.NativeObject, ref rect,
+                                                                  stringFormat.NativeObject, 
+                                                                  out boundingBox,
+                                                                  out charactersFitted,
+                                                                  out linesFilled);
+                       GDIPlus.CheckStatus (status);
+
+                       return new SizeF (boundingBox.Width, boundingBox.Height);
                }
 
-               [MonoTODO]
-               public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
-               {
-                       throw new NotImplementedException ();
+               
+               public SizeF MeasureString (string text, Font font, SizeF layoutArea,
+                                           StringFormat stringFormat, out int charactersFitted,
+                                           out int linesFilled)
+               {       
+                       RectangleF boundingBox = new RectangleF ();
+                       RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
+                       charactersFitted = 0;
+                       linesFilled = 0;
+
+                       if (text == null || text.Length == 0)
+                               return SizeF.Empty;
+
+                       if (font == null)
+                               throw new ArgumentNullException ("font");
+
+                       if (stringFormat == null)
+                               stringFormat = new StringFormat ();
+
+                       Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
+                                                                  font.NativeObject, ref rect,
+                                                                  stringFormat.NativeObject,
+                                                                  out boundingBox,
+                                                                  out charactersFitted,
+                                                                  out linesFilled);
+                       GDIPlus.CheckStatus (status);
+
+                       return new SizeF (boundingBox.Width, boundingBox.Height);
                }
 
                public void MultiplyTransform (Matrix matrix)
@@ -1263,60 +1579,66 @@ namespace System.Drawing
 
                public void MultiplyTransform (Matrix matrix, MatrixOrder order)
                {
-                       GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
+                       Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject,
+                                                                           matrix.nativeMatrix,
+                                                                           order);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
                public void ReleaseHdc (IntPtr hdc)
                {
-                       GDIPlus.GdipReleaseDC (nativeObject, hdc);
+                       Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
+                       GDIPlus.CheckStatus (status);
                }
 
                [MonoTODO]
+               [EditorBrowsable (EditorBrowsableState.Advanced)]
+               [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
                public void ReleaseHdcInternal (IntPtr hdc)
                {
                        throw new NotImplementedException ();
                }
 
-               [MonoTODO]
+               
                public void ResetClip ()
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipResetClip (nativeObject);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void ResetTransform ()
                {
-                       GDIPlus.GdipResetWorldTransform (nativeObject);
+                       Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public void Restore (GraphicsState gstate)
-               {
-                       Transform = gstate.matrix.Clone();
-                       GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
+               {                       
+                       Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+
                public void RotateTransform (float angle)
                {
-                       RotateTransform(angle, MatrixOrder.Prepend);
+                       RotateTransform (angle, MatrixOrder.Prepend);
                }
 
-               [MonoTODO]
                public void RotateTransform (float angle, MatrixOrder order)
                {
-                       //transform.Rotate(angle, order);
-                       GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
+
+                       Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
                public GraphicsState Save ()
-               {
-                       //return implementation.Save();
-                       GraphicsState state = new GraphicsState();
-                       state.matrix = Transform.Clone();
+               {                                               
                        uint saveState;
-                       GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
+                       Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
+                       GDIPlus.CheckStatus (status);
+
+                       GraphicsState state = new GraphicsState ();
                        state.nativeState = saveState;
                        return state;
                }
@@ -1328,85 +1650,103 @@ namespace System.Drawing
 
                public void ScaleTransform (float sx, float sy, MatrixOrder order)
                {
-                        GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
+                        Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void SetClip (RectangleF rect)
                {
-                       throw new NotImplementedException ();
+                        SetClip (rect, CombineMode.Replace);
                }
 
-               [MonoTODO]
+               
                public void SetClip (GraphicsPath path)
                {
-                       throw new NotImplementedException ();
+                       SetClip (path, CombineMode.Replace);
                }
 
-               [MonoTODO]
+               
                public void SetClip (Rectangle rect)
                {
-                       throw new NotImplementedException ();
+                       SetClip (rect, CombineMode.Replace);
                }
 
-               [MonoTODO]
+               
                public void SetClip (Graphics g)
                {
-                       throw new NotImplementedException ();
+                       SetClip (g, CombineMode.Replace);
                }
 
-               [MonoTODO]
+               
                public void SetClip (Graphics g, CombineMode combineMode)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void SetClip (Rectangle rect, CombineMode combineMode)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void SetClip (RectangleF rect, CombineMode combineMode)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void SetClip (Region region, CombineMode combineMode)
                {
-                       throw new NotImplementedException ();
+                       Status status =   GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode); 
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void SetClip (GraphicsPath path, CombineMode combineMode)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
                {
-                       throw new NotImplementedException ();
+                       IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
+            
+                        Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
+                       GDIPlus.CheckStatus (status);
+                       
+                       GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
                }
 
-               [MonoTODO]
+
                public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
-               {
-                       throw new NotImplementedException ();
+               {                                               
+                        IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
+            
+                        Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
+                       GDIPlus.CheckStatus (status);
+                       
+                       GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
                }
 
-               [MonoTODO]
+               
                public void TranslateClip (int dx, int dy)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
+                       GDIPlus.CheckStatus (status);
                }
 
-               [MonoTODO]
+               
                public void TranslateClip (float dx, float dy)
                {
-                       throw new NotImplementedException ();
+                       Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
+                       GDIPlus.CheckStatus (status);
                }
 
                public void TranslateTransform (float dx, float dy)
@@ -1414,163 +1754,237 @@ namespace System.Drawing
                        TranslateTransform (dx, dy, MatrixOrder.Prepend);
                }
 
-               [MonoTODO]
+               
                public void TranslateTransform (float dx, float dy, MatrixOrder order)
-               {
-                       //transform.Translate(dx, dy, order);
-                       GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
+               {                       
+                       Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
+                       GDIPlus.CheckStatus (status);
                }
 
                public Region Clip {
                        get {
-                               throw new NotImplementedException ();
+                               Region reg = new Region();
+                               Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
+                               GDIPlus.CheckStatus (status);
+                               return reg;                             
                        }
                        set {
-                               //throw new NotImplementedException ();
+                               SetClip (value, CombineMode.Replace);
                        }
                }
 
                public RectangleF ClipBounds {
                        get {
-                               throw new NotImplementedException ();
+                                RectangleF rect = new RectangleF ();
+                                Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
+                               GDIPlus.CheckStatus (status);
+                               return rect;
                        }
                }
 
                public CompositingMode CompositingMode {
                        get {
-                               throw new NotImplementedException ();
+                                CompositingMode mode;
+                                Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
+                               GDIPlus.CheckStatus (status);
+
+                               return mode;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
 
                }
 
                public CompositingQuality CompositingQuality {
                        get {
-                               throw new NotImplementedException ();
+                                CompositingQuality quality;
+
+                                Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
+                               GDIPlus.CheckStatus (status);
+                               return quality;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public float DpiX {
                        get {
-                               throw new NotImplementedException ();
+                                float x;
+
+                                       Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
+                               GDIPlus.CheckStatus (status);
+                               return x;
                        }
                }
 
                public float DpiY {
                        get {
-                               throw new NotImplementedException ();
+                                float y;
+
+                                       Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
+                               GDIPlus.CheckStatus (status);
+                               return y;
                        }
                }
 
                public InterpolationMode InterpolationMode {
-                       get {
-                               throw new NotImplementedException ();
+                       get {                           
+                                InterpolationMode imode = InterpolationMode.Invalid;
+                               Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
+                               GDIPlus.CheckStatus (status);
+                               return imode;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public bool IsClipEmpty {
                        get {
-                               throw new NotImplementedException ();
+                                bool isEmpty = false;
+
+                               Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
+                               GDIPlus.CheckStatus (status);
+                               return isEmpty;
                        }
                }
 
                public bool IsVisibleClipEmpty {
                        get {
-                               throw new NotImplementedException ();
+                                bool isEmpty = false;
+
+                               Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
+                               GDIPlus.CheckStatus (status);
+                               return isEmpty;
                        }
                }
 
                public float PageScale {
                        get {
-                               throw new NotImplementedException ();
+                                float scale;
+
+                               Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
+                               GDIPlus.CheckStatus (status);
+                               return scale;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public GraphicsUnit PageUnit {
                        get {
-                               throw new NotImplementedException ();
+                                GraphicsUnit unit;
+                                
+                                Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
+                               GDIPlus.CheckStatus (status);
+                               return unit;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public PixelOffsetMode PixelOffsetMode {
                        get {
-                               throw new NotImplementedException ();
+                               PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
+                                
+                                Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
+                               GDIPlus.CheckStatus (status);
+                               return pixelOffset;
                        }
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value); 
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public Point RenderingOrigin {
                        get {
                                 int x, y;
-                               GDIPlus.GdipGetRenderingOrigin (
-                                        nativeObject, out x, out y);
-
+                               Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
+                               GDIPlus.CheckStatus (status);
                                 return new Point (x, y);
                        }
 
                        set {
-                                GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
+                                Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public SmoothingMode SmoothingMode {
                        get {
-                               throw new NotImplementedException ();
+                                SmoothingMode mode = SmoothingMode.Invalid;
+
+                               Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
+                               GDIPlus.CheckStatus (status);
+                                return mode;
                        }
+
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public int TextContrast {
-                       get {
-                               throw new NotImplementedException ();
+                       get {   
+                                int contrast;
+                                       
+                                Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
+                               GDIPlus.CheckStatus (status);
+                                return contrast;
                        }
-                       set {
-                               throw new NotImplementedException ();
+
+                        set {
+                                Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public TextRenderingHint TextRenderingHint {
                        get {
-                               throw new NotImplementedException ();
+                                TextRenderingHint hint;
+
+                                Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
+                               GDIPlus.CheckStatus (status);
+                                return hint;        
                        }
+
                        set {
-                               throw new NotImplementedException ();
+                                Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public Matrix Transform {
                        get {
                                 Matrix matrix = new Matrix ();
-                                GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
-
+                                Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
+                               GDIPlus.CheckStatus (status);
                                 return matrix;
                        }
                        set {
-                                GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
+                                Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
+                               GDIPlus.CheckStatus (status);
                        }
                }
 
                public RectangleF VisibleClipBounds {
                        get {
-                               throw new NotImplementedException ();
+                                RectangleF rect;
+                                       
+                                Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
+                               GDIPlus.CheckStatus (status);
+                                return rect;
                        }
                }
        }