Removes lock operations. Agreed with Miguel
[mono.git] / mcs / class / System.Drawing / System.Drawing / Graphics.cs
1 //
2 // System.Drawing.Graphics.cs
3 //
4 // Authors:
5 //      Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
6 //      Alexandre Pigolkine(pigolkine@gmx.de)
7 //      Jordi Mas i Hernandez (jordi@ximian.com)
8 //
9 // Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
10 //
11 // Copyright (C) 2004 Novell, Inc. (http://www.novell.com)
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
20 // 
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 // 
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 //
32 using System;
33 using System.Drawing.Drawing2D;
34 using System.Drawing.Imaging;
35 using System.Drawing.Text;
36 using System.ComponentModel;
37 using System.Runtime.InteropServices;
38 using System.Text;
39
40 namespace System.Drawing
41 {
42         [ComVisible(false)]
43         public sealed class Graphics : MarshalByRefObject, IDisposable
44         {
45                 internal IntPtr nativeObject = IntPtr.Zero;
46                 private bool disposed = false;
47                 private static float defDpiX = 0;
48                 private static float defDpiY = 0;
49                 private static IntPtr display = IntPtr.Zero;
50
51                 // We use X Drawable on Linux.
52                 private static bool use_x_drawable = (Environment.OSVersion.Platform == (PlatformID) 128);
53
54                 [ComVisible(false)]
55                 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
56                                                             int flags,
57                                                             int dataSize,
58                                                             IntPtr data,
59                                                             PlayRecordCallback callbackData);
60                 
61                 [ComVisible (false)]
62                 public delegate bool DrawImageAbort (IntPtr callbackData);
63
64                 private Graphics (IntPtr nativeGraphics)
65                 {
66                         nativeObject = nativeGraphics;
67                 }
68
69                 ~Graphics ()
70                 {
71                         Dispose ();                     
72                 }               
73
74                 static internal float systemDpiX {
75                         get {
76                                 if (defDpiX == 0) {
77                                         Bitmap bmp = new Bitmap (1, 1);
78                                         Graphics g = Graphics.FromImage (bmp);
79                                         defDpiX = g.DpiX;
80                                 }
81                                 return defDpiX;
82                         }
83                 }
84
85                 static internal float systemDpiY {
86                         get {
87                                 if (defDpiY == 0) {
88                                         Bitmap bmp = new Bitmap (1, 1);
89                                         Graphics g = Graphics.FromImage (bmp);
90                                         defDpiY = g.DpiY;
91                                 }
92                                 return defDpiY;
93                         }
94                 }
95
96                 internal IntPtr NativeObject {
97                         get {
98                                 return nativeObject;
99                         }
100
101                         set {
102                                 nativeObject = value;
103                         }
104                 }
105
106                 [MonoTODO]
107                 public void AddMetafileComment (byte [] data)
108                 {
109                         throw new NotImplementedException ();
110                 }
111
112                 
113                 public GraphicsContainer BeginContainer ()
114                 {
115                         int state;
116                         Status status;
117                         status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
118                         GDIPlus.CheckStatus (status);
119
120                         return new GraphicsContainer(state);
121                 }
122                 
123                 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
124                 {
125                         int state;
126                         Status status;
127                         status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
128                         GDIPlus.CheckStatus (status);
129
130                         return new GraphicsContainer (state);
131                 }
132
133                 
134                 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
135                 {
136                         int state;
137                         Status status;
138                         status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
139                         GDIPlus.CheckStatus (status);
140
141                         return new GraphicsContainer (state);
142                 }
143
144                 
145                 public void Clear (Color color)
146                 {
147                         Status status;
148                         status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
149                         GDIPlus.CheckStatus (status);
150                 }
151
152                 public void Dispose ()
153                 {
154                         Status status;
155                         if (! disposed) {
156                                 status = GDIPlus.GdipDeleteGraphics (nativeObject);
157                                 GDIPlus.CheckStatus (status);
158                                 disposed = true;                                
159                         }
160                 }
161
162                 
163                 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
164                 {
165                         DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
166                 }
167
168                 
169                 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
170                 {
171                         DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
172                 }
173
174                 
175                 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
176                 {
177                         Status status;
178                         status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
179                                         x, y, width, height, startAngle, sweepAngle);
180                         GDIPlus.CheckStatus (status);
181                 }
182
183                 // Microsoft documentation states that the signature for this member should be
184                 // public void DrawArc( Pen pen,  int x,  int y,  int width,  int height,   int startAngle,
185                 // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
186                 public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
187                 {
188                         Status status;
189                         status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
190                                                 x, y, width, height, startAngle, sweepAngle);
191                         GDIPlus.CheckStatus (status);
192                 }
193
194                 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
195                 {
196                         Status status;
197                         status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
198                                                         pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
199                                                         pt3.Y, pt4.X, pt4.Y);
200                         GDIPlus.CheckStatus (status);
201                 }
202
203                 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
204                 {
205                         Status status;
206                         status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
207                                                         pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
208                                                         pt3.Y, pt4.X, pt4.Y);
209                         GDIPlus.CheckStatus (status);
210                 }
211
212                 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
213                 {
214                         Status status;
215                         status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
216                                                         y1, x2, y2, x3, y3, x4, y4);
217                         GDIPlus.CheckStatus (status);
218                 }
219
220                 public void DrawBeziers (Pen pen, Point [] points)
221                 {
222                         int length = points.Length;
223                         Status status;
224
225                         if (length < 3)
226                                 return;
227
228                         for (int i = 0; i < length; i += 3) {
229                                 Point p1 = points [i];
230                                 Point p2 = points [i + 1];
231                                 Point p3 = points [i + 2];
232                                 Point p4 = points [i + 3];
233
234                                 status = GDIPlus.GdipDrawBezier (nativeObject, 
235                                                         pen.nativeObject,
236                                                         p1.X, p1.Y, p2.X, p2.Y, 
237                                                         p3.X, p3.Y, p4.X, p4.Y);
238                                 GDIPlus.CheckStatus (status);
239                         }
240                 }
241
242                 public void DrawBeziers (Pen pen, PointF [] points)
243                 {
244                         int length = points.Length;
245                         Status status;
246
247                         if (length < 3)
248                                 return;
249
250                         for (int i = 0; i < length; i += 3) {
251                                 PointF p1 = points [i];
252                                 PointF p2 = points [i + 1];
253                                 PointF p3 = points [i + 2];
254                                 PointF p4 = points [i + 3];
255
256                                 status = GDIPlus.GdipDrawBezier (nativeObject, 
257                                                         pen.nativeObject,
258                                                         p1.X, p1.Y, p2.X, p2.Y, 
259                                                         p3.X, p3.Y, p4.X, p4.Y);
260                                 GDIPlus.CheckStatus (status);
261                         }
262                 }
263
264                 
265                 public void DrawClosedCurve (Pen pen, PointF [] points)
266                 {
267                         Status status;
268                         status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
269                         GDIPlus.CheckStatus (status);
270                 }
271                 
272                 public void DrawClosedCurve (Pen pen, Point [] points)
273                 {
274                         Status status;
275                         status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
276                         GDIPlus.CheckStatus (status);
277                 }
278                         
279                 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
280                 {
281                         Status status;
282                         status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
283                         GDIPlus.CheckStatus (status);
284                 }
285                 
286                 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
287                 {
288                         Status status;
289                         status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
290                         GDIPlus.CheckStatus (status);
291                 }
292                 
293                 public void DrawCurve (Pen pen, Point [] points)
294                 {
295                         Status status;
296                         status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
297                         GDIPlus.CheckStatus (status);
298                 }
299                 
300                 public void DrawCurve (Pen pen, PointF [] points)
301                 {
302                         Status status;
303                         status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
304                         GDIPlus.CheckStatus (status);
305                 }
306                 
307                 public void DrawCurve (Pen pen, PointF [] points, float tension)
308                 {
309                         Status status;
310                         status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
311                         GDIPlus.CheckStatus (status);
312                 }
313                 
314                 public void DrawCurve (Pen pen, Point [] points, float tension)
315                 {
316                         Status status;
317                         status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);              
318                         GDIPlus.CheckStatus (status);
319                 }
320                 
321                 
322                 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
323                 {
324                         Status status;
325                         status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
326                                                         points, points.Length, offset,
327                                                         numberOfSegments, 0.5f);
328                         GDIPlus.CheckStatus (status);
329                 }
330
331                 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
332                 {
333                         Status status;
334                         status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
335                                                         points, points.Length, offset,
336                                                         numberOfSegments, tension);
337                         GDIPlus.CheckStatus (status);
338                 }
339
340                 
341                 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
342                 {
343                         Status status;
344                         status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
345                                                         points, points.Length, offset,
346                                                         numberOfSegments, tension);
347                         GDIPlus.CheckStatus (status);
348                 }
349
350                 public void DrawEllipse (Pen pen, Rectangle rect)
351                 {
352                         DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
353                 }
354
355                 public void DrawEllipse (Pen pen, RectangleF rect)
356                 {
357                         DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
358                 }
359
360                 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
361                 {
362                         Status status;
363                         status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
364                         GDIPlus.CheckStatus (status);
365                 }
366
367                 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
368                 {
369                         Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
370                         GDIPlus.CheckStatus (status);
371                 }
372
373                 public void DrawIcon (Icon icon, Rectangle targetRect)
374                 {
375                         Image img = icon.ToBitmap ();
376                         DrawImage (img, targetRect);
377                 }
378
379                 public void DrawIcon (Icon icon, int x, int y)
380                 {
381                         Image img = icon.ToBitmap ();
382                         DrawImage (img, x, y);
383                 }
384
385                 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
386                 {
387                         Image img = icon.ToBitmap ();
388                         DrawImageUnscaled (img, targetRect);
389                 }
390                 
391                 public void DrawImage (Image image, RectangleF rect)
392                 {
393                         Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
394                         GDIPlus.CheckStatus (status);
395                 }
396
397                 
398                 public void DrawImage (Image image, PointF point)
399                 {
400                         Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
401                         GDIPlus.CheckStatus (status);
402                 }
403
404                 
405                 public void DrawImage (Image image, Point [] destPoints)
406                 {
407                         Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
408                         GDIPlus.CheckStatus (status);
409                 }
410
411                 
412                 public void DrawImage (Image image, Point point)
413                 {
414                         DrawImage (image, point.X, point.Y);
415                 }
416
417                 
418                 public void DrawImage (Image image, Rectangle rect)
419                 {
420                         DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
421                 }
422
423                 
424                 public void DrawImage (Image image, PointF [] destPoints)
425                 {
426                         Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
427                         GDIPlus.CheckStatus (status);
428                 }
429
430                 
431                 public void DrawImage (Image image, int x, int y)
432                 {
433                         Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
434                         GDIPlus.CheckStatus (status);
435                 }
436
437                 
438                 public void DrawImage (Image image, float x, float y)
439                 {
440                         Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
441                         GDIPlus.CheckStatus (status);
442                 }
443
444                 
445                 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
446                 {
447                         Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
448                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
449                                 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
450                                 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
451                         GDIPlus.CheckStatus (status);
452                 }
453                 
454                 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
455                 {                       
456                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
457                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
458                                 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
459                                 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
460                         GDIPlus.CheckStatus (status);
461                 }
462
463                 
464                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
465                 {
466                         Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
467                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
468                                 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, 
469                                 null, IntPtr.Zero);
470                         GDIPlus.CheckStatus (status);
471                 }
472
473                 
474                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
475                 {
476                         
477                         Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
478                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
479                                 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero, 
480                                 null, IntPtr.Zero);
481                         GDIPlus.CheckStatus (status);
482                 }
483
484                 
485                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
486                                 ImageAttributes imageAttr)
487                 {
488                         Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
489                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
490                                 srcRect.Width, srcRect.Height, srcUnit,
491                                 imageAttr.NativeObject, null, IntPtr.Zero);
492                         GDIPlus.CheckStatus (status);
493                 }
494                 
495                 public void DrawImage (Image image, float x, float y, float width, float height)
496                 {
497                         Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
498                            width, height);
499                         GDIPlus.CheckStatus (status);
500                 }
501
502                 
503                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
504                                 ImageAttributes imageAttr)
505                 {
506                         Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
507                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
508                                 srcRect.Width, srcRect.Height, srcUnit, 
509                                 imageAttr.NativeObject, null, IntPtr.Zero);
510                         GDIPlus.CheckStatus (status);
511                 }
512
513                 
514                 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
515                 {                       
516                         Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
517                         GDIPlus.CheckStatus (status);
518                 }
519                 
520                 public void DrawImage (Image image, int x, int y, int width, int height)
521                 {
522                         Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
523                         GDIPlus.CheckStatus (status);
524                 }
525
526                 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
527                 {                       
528                         Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
529                         GDIPlus.CheckStatus (status);
530                 }
531
532                 
533                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
534                 {
535                         Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
536                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
537                                 srcRect.Width, srcRect.Height, srcUnit, 
538                                 imageAttr.NativeObject, callback, IntPtr.Zero);
539                         GDIPlus.CheckStatus (status);
540                 }
541
542                 
543                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
544                 {
545                         
546                         Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
547                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
548                                 srcRect.Width, srcRect.Height, srcUnit, 
549                                 imageAttr.NativeObject, callback, IntPtr.Zero);
550                         GDIPlus.CheckStatus (status);
551                 }
552
553                 
554                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
555                 {
556
557                         Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
558                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y, 
559                                 srcRect.Width, srcRect.Height, srcUnit, 
560                                 imageAttr.NativeObject, callback, (IntPtr) callbackData);
561                         GDIPlus.CheckStatus (status);
562                 }
563
564                 
565                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
566                 {
567                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
568                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
569                                 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, 
570                                 null, IntPtr.Zero);
571                         GDIPlus.CheckStatus (status);                                   
572                 }
573                 
574                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
575                 {
576                         Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
577                                 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
578                                 srcRect.Width, srcRect.Height, srcUnit, 
579                                 imageAttr.NativeObject, callback, (IntPtr) callbackData);
580                         GDIPlus.CheckStatus (status);
581                 }
582
583                 
584                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
585                 {
586                         Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
587                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
588                                 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero, 
589                                 null, IntPtr.Zero);
590                         GDIPlus.CheckStatus (status);
591                 }
592
593                 
594                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
595                 {
596                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
597                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
598                                 srcX, srcY, srcWidth, srcHeight, srcUnit,
599                                 imageAttrs.NativeObject, null, IntPtr.Zero);
600                         GDIPlus.CheckStatus (status);
601                 }
602                 
603                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
604                 {                       
605                         Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject, 
606                                         destRect.X, destRect.Y, destRect.Width, 
607                                         destRect.Height, srcX, srcY, srcWidth, srcHeight,
608                                         srcUnit, imageAttr.NativeObject, null, IntPtr.Zero);
609                         GDIPlus.CheckStatus (status);
610                 }
611                 
612                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
613                 {
614                         Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject, 
615                                         destRect.X, destRect.Y, destRect.Width, 
616                                         destRect.Height, srcX, srcY, srcWidth, srcHeight,
617                                         srcUnit, imageAttr.NativeObject, callback,
618                                         IntPtr.Zero);
619                         GDIPlus.CheckStatus (status);
620                 }
621                 
622                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
623                 {
624                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
625                                         destRect.X, destRect.Y, destRect.Width, 
626                                         destRect.Height, srcX, srcY, srcWidth, srcHeight,
627                                         srcUnit, imageAttr.NativeObject, 
628                                         callback, IntPtr.Zero);
629                         GDIPlus.CheckStatus (status);
630                 }
631
632                 
633                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
634                 {
635                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
636                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
637                                 srcX, srcY, srcWidth, srcHeight, srcUnit, 
638                                 imageAttr.NativeObject, callback, callbackData);
639                         GDIPlus.CheckStatus (status);
640                 }
641
642                 
643                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
644                 {
645                         Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject, 
646                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
647                                 srcX, srcY, srcWidth, srcHeight, srcUnit,
648                                 imageAttr.NativeObject, callback, callbackData);
649                         GDIPlus.CheckStatus (status);
650                 }               
651                 
652                 public void DrawImageUnscaled (Image image, Point point)
653                 {
654                         DrawImageUnscaled (image, point.X, point.Y);
655                 }
656                 
657                 public void DrawImageUnscaled (Image image, Rectangle rect)
658                 {
659                         DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
660                 }
661                 
662                 public void DrawImageUnscaled (Image image, int x, int y)
663                 {
664                         DrawImage (image, x, y, image.Width, image.Height);
665                 }
666
667                 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
668                 {
669                         Image tmpImg = new Bitmap (width, height);
670                         Graphics g = FromImage (tmpImg);
671                         g.DrawImage (image, 0, 0, image.Width, image.Height);
672                         this.DrawImage (tmpImg, x, y, width, height);
673                         tmpImg.Dispose ();
674                         g.Dispose ();
675                 }
676
677                 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
678                 {
679                         Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
680                                                 pt1.X, pt1.Y, pt2.X, pt2.Y);
681                         GDIPlus.CheckStatus (status);
682                 }
683
684                 public void DrawLine (Pen pen, Point pt1, Point pt2)
685                 {
686                         Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
687                                                 pt1.X, pt1.Y, pt2.X, pt2.Y);
688                         GDIPlus.CheckStatus (status);
689                 }
690
691                 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
692                 {
693                         Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
694                         GDIPlus.CheckStatus (status);
695                 }
696
697                 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
698                 {
699                         Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
700                         GDIPlus.CheckStatus (status);
701                 }
702
703                 public void DrawLines (Pen pen, PointF [] points)
704                 {
705                         Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
706                         GDIPlus.CheckStatus (status);
707                 }
708
709                 public void DrawLines (Pen pen, Point [] points)
710                 {
711                         Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
712                         GDIPlus.CheckStatus (status);
713                 }
714
715                 public void DrawPath (Pen pen, GraphicsPath path)
716                 {
717                         Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
718                         GDIPlus.CheckStatus (status);
719                 }
720                 
721                 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
722                 {
723                         DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
724                 }
725                 
726                 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
727                 {
728                         DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
729                 }
730                 
731                 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
732                 {
733                         Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
734                         GDIPlus.CheckStatus (status);
735                 }
736                 
737                 // Microsoft documentation states that the signature for this member should be
738                 // public void DrawPie(Pen pen, int x,  int y,  int width,   int height,   int startAngle
739                 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
740                 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
741                 {
742                         Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
743                         GDIPlus.CheckStatus (status);
744                 }
745
746                 public void DrawPolygon (Pen pen, Point [] points)
747                 {
748                         Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
749                         GDIPlus.CheckStatus (status);
750                 }
751
752                 public void DrawPolygon (Pen pen, PointF [] points)
753                 {
754                         Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
755                         GDIPlus.CheckStatus (status);
756                 }
757
758                 internal void DrawRectangle (Pen pen, RectangleF rect)
759                 {
760                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
761                 }
762
763                 public void DrawRectangle (Pen pen, Rectangle rect)
764                 {
765                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
766                 }
767
768                 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
769                 {
770                         Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
771                         GDIPlus.CheckStatus (status);
772                 }
773
774                 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
775                 {
776                         Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
777                         GDIPlus.CheckStatus (status);
778                 }
779
780                 public void DrawRectangles (Pen pen, RectangleF [] rects)
781                 {
782                         Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
783                         GDIPlus.CheckStatus (status);
784                 }
785
786                 public void DrawRectangles (Pen pen, Rectangle [] rects)
787                 {
788                         Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
789                         GDIPlus.CheckStatus (status);
790                 }
791
792                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
793                 {                       
794                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
795                         GDIPlus.CheckStatus (status);
796                 }
797                 
798                 public void DrawString (string s, Font font, Brush brush, PointF point)
799                 {
800                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
801                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
802                         GDIPlus.CheckStatus (status);
803                 }
804                 
805                 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
806                 {
807                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
808                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, format.NativeObject, brush.nativeObject);
809                         GDIPlus.CheckStatus (status);
810                 }
811                 
812                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
813                 {
814                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format.NativeObject, brush.nativeObject);
815                         GDIPlus.CheckStatus (status);
816                 }
817
818                 public void DrawString (string s, Font font, Brush brush, float x, float y)
819                 {
820                         RectangleF rc = new RectangleF (x, y, 0, 0);
821                         
822                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, 
823                                 ref rc, IntPtr.Zero, brush.nativeObject);
824                         GDIPlus.CheckStatus (status);
825                 }
826
827                 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
828                 {
829                         RectangleF rc = new RectangleF (x, y, 0, 0);
830
831                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
832                                 ref rc, format.NativeObject, brush.nativeObject);
833                         GDIPlus.CheckStatus (status);
834                 }
835
836                 
837                 public void EndContainer (GraphicsContainer container)
838                 {
839                         Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
840                         GDIPlus.CheckStatus (status);
841                 }
842
843                 [MonoTODO]
844                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
845                 {
846                         throw new NotImplementedException ();
847                 }
848
849                 [MonoTODO]
850                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
851                 {
852                         throw new NotImplementedException ();
853                 }
854
855                 [MonoTODO]
856                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
857                 {
858                         throw new NotImplementedException ();
859                 }
860
861                 [MonoTODO]
862                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
863                 {
864                         throw new NotImplementedException ();
865                 }
866
867                 [MonoTODO]
868                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
869                 {
870                         throw new NotImplementedException ();
871                 }
872
873                 [MonoTODO]
874                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
875                 {
876                         throw new NotImplementedException ();
877                 }
878
879                 [MonoTODO]
880                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
881                 {
882                         throw new NotImplementedException ();
883                 }
884
885                 [MonoTODO]
886                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
887                 {
888                         throw new NotImplementedException ();
889                 }
890
891                 [MonoTODO]
892                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
893                 {
894                         throw new NotImplementedException ();
895                 }
896
897                 [MonoTODO]
898                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
899                 {
900                         throw new NotImplementedException ();
901                 }
902
903                 [MonoTODO]
904                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
905                 {
906                         throw new NotImplementedException ();
907                 }
908
909                 [MonoTODO]
910                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
911                 {
912                         throw new NotImplementedException ();
913                 }
914
915                 [MonoTODO]
916                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
917                 {
918                         throw new NotImplementedException ();
919                 }
920
921                 [MonoTODO]
922                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
923                 {
924                         throw new NotImplementedException ();
925                 }
926
927                 [MonoTODO]
928                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
929                 {
930                         throw new NotImplementedException ();
931                 }
932
933                 [MonoTODO]
934                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
935                 {
936                         throw new NotImplementedException ();
937                 }
938
939                 [MonoTODO]
940                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
941                 {
942                         throw new NotImplementedException ();
943                 }
944
945                 [MonoTODO]
946                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
947                 {
948                         throw new NotImplementedException ();
949                 }
950
951                 [MonoTODO]
952                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
953                 {
954                         throw new NotImplementedException ();
955                 }
956
957                 [MonoTODO]
958                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
959                 {
960                         throw new NotImplementedException ();
961                 }
962
963                 [MonoTODO]
964                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
965                 {
966                         throw new NotImplementedException ();
967                 }
968
969                 [MonoTODO]
970                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
971                 {
972                         throw new NotImplementedException ();
973                 }
974
975                 [MonoTODO]
976                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
977                 {
978                         throw new NotImplementedException ();
979                 }
980
981                 [MonoTODO]
982                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
983                 {
984                         throw new NotImplementedException ();
985                 }
986
987                 [MonoTODO]
988                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
989                 {
990                         throw new NotImplementedException ();
991                 }
992
993                 [MonoTODO]
994                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
995                 {
996                         throw new NotImplementedException ();
997                 }
998
999                 [MonoTODO]
1000                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1001                 {
1002                         throw new NotImplementedException ();
1003                 }
1004
1005                 [MonoTODO]
1006                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1007                 {
1008                         throw new NotImplementedException ();
1009                 }
1010
1011                 [MonoTODO]
1012                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1013                 {
1014                         throw new NotImplementedException ();
1015                 }
1016
1017                 [MonoTODO]
1018                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1019                 {
1020                         throw new NotImplementedException ();
1021                 }
1022
1023                 [MonoTODO]
1024                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1025                 {
1026                         throw new NotImplementedException ();
1027                 }
1028
1029                 [MonoTODO]
1030                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1031                 {
1032                         throw new NotImplementedException ();
1033                 }
1034
1035                 [MonoTODO]
1036                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1037                 {
1038                         throw new NotImplementedException ();
1039                 }
1040
1041                 [MonoTODO]
1042                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1043                 {
1044                         throw new NotImplementedException ();
1045                 }
1046
1047                 [MonoTODO]
1048                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1049                 {
1050                         throw new NotImplementedException ();
1051                 }
1052
1053                 [MonoTODO]
1054                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1055                 {
1056                         throw new NotImplementedException ();
1057                 }
1058         
1059                 public void ExcludeClip (Rectangle rect)
1060                 {
1061                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1062                         GDIPlus.CheckStatus (status);
1063                 }
1064
1065                 public void ExcludeClip (Region region)
1066                 {
1067                         Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1068                         GDIPlus.CheckStatus (status);
1069                 }
1070
1071                 
1072                 public void FillClosedCurve (Brush brush, PointF [] points)
1073                 {
1074                        Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1075                         GDIPlus.CheckStatus (status);
1076                 }
1077
1078                 
1079                 public void FillClosedCurve (Brush brush, Point [] points)
1080                 {
1081                         Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1082                         GDIPlus.CheckStatus (status);
1083                 }
1084
1085                 
1086                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1087                 {
1088                         FillClosedCurve (brush, points, fillmode, 0.5f);
1089                 }
1090                 
1091                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1092                 {
1093                         FillClosedCurve (brush, points, fillmode, 0.5f);
1094                 }
1095
1096                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1097                 {
1098                         Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1099                         GDIPlus.CheckStatus (status);
1100                 }
1101
1102                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1103                 {
1104                         Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1105                         GDIPlus.CheckStatus (status);
1106                 }
1107
1108                 public void FillEllipse (Brush brush, Rectangle rect)
1109                 {
1110                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1111                 }
1112
1113                 public void FillEllipse (Brush brush, RectangleF rect)
1114                 {
1115                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1116                 }
1117
1118                 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1119                 {
1120                         Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1121                         GDIPlus.CheckStatus (status);
1122                 }
1123
1124                 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1125                 {
1126                         Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1127                         GDIPlus.CheckStatus (status);
1128                 }
1129
1130                 public void FillPath (Brush brush, GraphicsPath path)
1131                 {
1132                         Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject,  path.NativeObject);
1133                         GDIPlus.CheckStatus (status);
1134                 }
1135
1136                 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1137                 {
1138                         Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1139                         GDIPlus.CheckStatus (status);
1140                 }
1141
1142                 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1143                 {
1144                         Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1145                         GDIPlus.CheckStatus (status);
1146                 }
1147
1148                 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1149                 {
1150                         Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1151                         GDIPlus.CheckStatus (status);
1152                 }
1153
1154                 public void FillPolygon (Brush brush, PointF [] points)
1155                 {
1156                         Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1157                         GDIPlus.CheckStatus (status);
1158                 }
1159
1160                 public void FillPolygon (Brush brush, Point [] points)
1161                 {
1162                         Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1163                         GDIPlus.CheckStatus (status);
1164                 }
1165
1166                 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1167                 {
1168                         Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1169                         GDIPlus.CheckStatus (status);
1170                 }
1171
1172                 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1173                 {
1174                         Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1175                         GDIPlus.CheckStatus (status);
1176                 }
1177
1178                 public void FillRectangle (Brush brush, RectangleF rect)
1179                 {
1180                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1181                 }
1182
1183                 public void FillRectangle (Brush brush, Rectangle rect)
1184                 {
1185                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1186                 }
1187
1188                 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1189                 {
1190                         Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
1191                         GDIPlus.CheckStatus (status);
1192                 }
1193
1194                 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1195                 {
1196                         Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1197                         GDIPlus.CheckStatus (status);
1198                 }
1199
1200                 public void FillRectangles (Brush brush, Rectangle [] rects)
1201                 {
1202                         Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
1203                         GDIPlus.CheckStatus (status);
1204                 }
1205
1206                 public void FillRectangles (Brush brush, RectangleF [] rects)
1207                 {
1208                         Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
1209                         GDIPlus.CheckStatus (status);
1210                 }
1211
1212                 
1213                 public void FillRegion (Brush brush, Region region)
1214                 {
1215                         Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);                  
1216                         GDIPlus.CheckStatus(status);
1217                 }
1218
1219                 
1220                 public void Flush ()
1221                 {
1222                         Flush (FlushIntention.Flush);
1223                 }
1224
1225                 
1226                 public void Flush (FlushIntention intention)
1227                 {
1228                         Status status = GDIPlus.GdipFlush (nativeObject, intention);
1229                         GDIPlus.CheckStatus (status);                     
1230                 }
1231
1232                 [EditorBrowsable (EditorBrowsableState.Advanced)]               
1233                 public static Graphics FromHdc (IntPtr hdc)
1234                 {
1235                         IntPtr graphics;
1236                         Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1237                         GDIPlus.CheckStatus (status);
1238                         return new Graphics (graphics);
1239                 }
1240
1241                 [MonoTODO]
1242                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1243                 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1244                 {
1245                         throw new NotImplementedException ();
1246                 }
1247
1248                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1249                 public static Graphics FromHdcInternal (IntPtr hdc)
1250                 {
1251                         display = hdc;
1252                         return null;
1253                 }
1254
1255                 [EditorBrowsable (EditorBrowsableState.Advanced)]               
1256                 public static Graphics FromHwnd (IntPtr hwnd)
1257                 {
1258                         IntPtr graphics;
1259
1260                         if (use_x_drawable) {
1261                                 if (display == IntPtr.Zero) {
1262                                         display = GDIPlus.XOpenDisplay (IntPtr.Zero);
1263                                 }
1264
1265                                 return FromXDrawable (hwnd, display);
1266                         }
1267
1268                         Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
1269                         GDIPlus.CheckStatus (status);
1270
1271                         return new Graphics (graphics);
1272                 }
1273
1274                 [MonoTODO]
1275                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1276                 public static Graphics FromHwndInternal (IntPtr hwnd)
1277                 {
1278                         throw new NotImplementedException ();
1279                 }
1280
1281                 public static Graphics FromImage (Image image)
1282                 {
1283                         if (image == null) throw new ArgumentException ();
1284
1285                         int graphics;
1286                         Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1287                         GDIPlus.CheckStatus (status);
1288                         Graphics result = new Graphics ((IntPtr) graphics);
1289                                 
1290                         if (Environment.OSVersion.Platform == (PlatformID) 128)  {
1291                                 Rectangle rect  = new Rectangle (0,0, image.Width, image.Height);
1292                                 GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1293                         }
1294                                 
1295                         return result;
1296                 }
1297
1298                 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1299                 {
1300                         IntPtr graphics;
1301                         Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1302                         GDIPlus.CheckStatus (s);
1303                         return new Graphics (graphics);
1304                 }
1305
1306                 [MonoTODO]
1307                 public static IntPtr GetHalftonePalette ()
1308                 {
1309                         throw new NotImplementedException ();
1310                 }
1311
1312                 [MonoTODO]
1313                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1314                 public IntPtr GetHdc ()
1315                 {
1316                         int hdc;
1317                         Status status = GDIPlus.GdipGetDC (nativeObject, out hdc);
1318                         GDIPlus.CheckStatus (status);
1319
1320                         return (IntPtr) hdc;
1321                 }
1322
1323                 
1324                 public Color GetNearestColor (Color color)
1325                 {
1326                         int argb;
1327                         
1328                         Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1329                         GDIPlus.CheckStatus (status);
1330
1331                         return Color.FromArgb (argb);
1332                 }
1333
1334                 
1335                 public void IntersectClip (Region region)
1336                 {
1337                         Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1338                         GDIPlus.CheckStatus (status);
1339                 }
1340                 
1341                 public void IntersectClip (RectangleF rect)
1342                 {
1343                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1344                         GDIPlus.CheckStatus (status);
1345                 }
1346
1347                 public void IntersectClip (Rectangle rect)
1348                 {                       
1349                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1350                         GDIPlus.CheckStatus (status);
1351                 }
1352
1353                 public bool IsVisible (Point point)
1354                 {
1355                         bool isVisible = false;
1356
1357                         Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1358                         GDIPlus.CheckStatus (status);
1359
1360                         return isVisible;
1361                 }
1362
1363                 
1364                 public bool IsVisible (RectangleF rect)
1365                 {
1366                         bool isVisible = false;
1367
1368                         Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1369                         GDIPlus.CheckStatus (status);
1370
1371                         return isVisible;
1372                 }
1373
1374                 public bool IsVisible (PointF point)
1375                 {
1376                         bool isVisible = false;
1377
1378                         Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1379                         GDIPlus.CheckStatus (status);
1380
1381                         return isVisible;
1382                 }
1383                 
1384                 public bool IsVisible (Rectangle rect)
1385                 {
1386                         bool isVisible = false;
1387
1388                         Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1389                         GDIPlus.CheckStatus (status);
1390
1391                         return isVisible;
1392                 }
1393                 
1394                 public bool IsVisible (float x, float y)
1395                 {
1396                         return IsVisible (new PointF (x, y));
1397                 }
1398                 
1399                 public bool IsVisible (int x, int y)
1400                 {
1401                         return IsVisible (new Point (x, y));
1402                 }
1403                 
1404                 public bool IsVisible (float x, float y, float width, float height)
1405                 {
1406                         return IsVisible (new RectangleF (x, y, width, height));
1407                 }
1408
1409                 
1410                 public bool IsVisible (int x, int y, int width, int height)
1411                 {
1412                         return IsVisible (new Rectangle (x, y, width, height));
1413                 }
1414
1415                 
1416                 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1417                 {       
1418                         Status status;                  
1419                         int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1420                         IntPtr[] native_regions = new IntPtr [regcount];
1421                         Region[] regions = new Region [regcount];
1422                         
1423                         for (int i = 0; i < regcount; i++) {
1424                                 regions[i] = new Region ();
1425                                 native_regions[i] = regions[i].NativeObject;                            
1426                         }                                                                                               
1427                         
1428                         status =  GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1429                                 font.NativeObject, ref layoutRect, stringFormat.NativeObject, 
1430                                 regcount, out native_regions[0]); 
1431                         
1432                         GDIPlus.CheckStatus (status);                           
1433                                                         
1434                         return regions;                                                 
1435                 }
1436
1437                 
1438                 public SizeF MeasureString (string text, Font font)
1439                 {
1440                         return MeasureString (text, font, new Size(0,0));
1441                 }
1442
1443                 
1444                 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1445                 {
1446                         int charactersFitted, linesFilled;                      
1447                         RectangleF boundingBox = new RectangleF ();
1448                         RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1449                                         
1450                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1451                                 font.NativeObject, ref rect, IntPtr.Zero, out boundingBox,
1452                                 out charactersFitted, out linesFilled);
1453                         GDIPlus.CheckStatus (status);
1454
1455                         return new SizeF(boundingBox.Width, boundingBox.Height);
1456                 }
1457
1458                 
1459                 public SizeF MeasureString (string text, Font font, int width)
1460                 {                               
1461                         RectangleF boundingBox = new RectangleF ();
1462                         RectangleF rect = new RectangleF (0, 0, width, 999999);
1463                         int charactersFitted, linesFilled;
1464
1465                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1466                                 font.NativeObject, ref rect, IntPtr.Zero, 
1467                                 out boundingBox, out charactersFitted, out linesFilled);
1468                         GDIPlus.CheckStatus (status);
1469
1470                         return new SizeF (boundingBox.Width, boundingBox.Height);
1471                 }
1472
1473                 
1474                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
1475                 {
1476                         int charactersFitted, linesFilled;                      
1477                         return MeasureString (text, font, layoutArea, stringFormat, out charactersFitted, out linesFilled);
1478                 }
1479
1480                 
1481                 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1482                 {
1483                         int charactersFitted, linesFilled;                      
1484                         return MeasureString (text, font, new SizeF (width, 999999), 
1485                                 format, out charactersFitted, out linesFilled);
1486                 }
1487
1488                 
1489                 public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
1490                 {
1491                         RectangleF boundingBox = new RectangleF ();
1492                         RectangleF rect = new RectangleF (origin.X, origin.Y, 0,0);
1493                         int charactersFitted, linesFilled;
1494
1495                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1496                                 font.NativeObject, ref rect, stringFormat.NativeObject, 
1497                                 out boundingBox, out charactersFitted, out linesFilled);
1498                         GDIPlus.CheckStatus (status);
1499
1500                         return new SizeF (boundingBox.Width, boundingBox.Height);
1501                 }
1502
1503                 
1504                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
1505                 {       
1506                         RectangleF boundingBox = new RectangleF ();
1507                         RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1508                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1509                                 font.NativeObject, ref rect, stringFormat.NativeObject,
1510                                 out boundingBox, out charactersFitted, out linesFilled);
1511                         GDIPlus.CheckStatus (status);
1512
1513                         return new SizeF (boundingBox.Width, boundingBox.Height);
1514                 }
1515
1516                 public void MultiplyTransform (Matrix matrix)
1517                 {
1518                         MultiplyTransform (matrix, MatrixOrder.Prepend);
1519                 }
1520
1521                 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
1522                 {
1523                         Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
1524                         GDIPlus.CheckStatus (status);
1525                 }
1526
1527                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1528                 public void ReleaseHdc (IntPtr hdc)
1529                 {
1530                         Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
1531                         GDIPlus.CheckStatus (status);
1532                 }
1533
1534                 [MonoTODO]
1535                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1536                 public void ReleaseHdcInternal (IntPtr hdc)
1537                 {
1538                         throw new NotImplementedException ();
1539                 }
1540
1541                 
1542                 public void ResetClip ()
1543                 {
1544                         Status status = GDIPlus.GdipResetClip (nativeObject);
1545                         GDIPlus.CheckStatus (status);
1546                 }
1547
1548                 public void ResetTransform ()
1549                 {
1550                         Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
1551                         GDIPlus.CheckStatus (status);
1552                 }
1553
1554                 public void Restore (GraphicsState gstate)
1555                 {
1556                         Transform = gstate.matrix.Clone ();
1557                         Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
1558                         GDIPlus.CheckStatus (status);
1559                 }
1560
1561
1562                 public void RotateTransform (float angle)
1563                 {
1564                         RotateTransform (angle, MatrixOrder.Prepend);
1565                 }
1566
1567                 public void RotateTransform (float angle, MatrixOrder order)
1568                 {
1569
1570                         Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
1571                         GDIPlus.CheckStatus (status);
1572                 }
1573
1574                 public GraphicsState Save ()
1575                 {
1576                         GraphicsState state = new GraphicsState ();
1577                         state.matrix = Transform.Clone ();
1578                         uint saveState;
1579                         Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
1580                         GDIPlus.CheckStatus (status);
1581
1582                         state.nativeState = saveState;
1583                         return state;
1584                 }
1585
1586                 public void ScaleTransform (float sx, float sy)
1587                 {
1588                         ScaleTransform (sx, sy, MatrixOrder.Prepend);
1589                 }
1590
1591                 public void ScaleTransform (float sx, float sy, MatrixOrder order)
1592                 {
1593                         Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
1594                         GDIPlus.CheckStatus (status);
1595                 }
1596
1597                 
1598                 public void SetClip (RectangleF rect)
1599                 {
1600                         SetClip (rect, CombineMode.Replace);
1601                 }
1602
1603                 
1604                 public void SetClip (GraphicsPath path)
1605                 {
1606                         SetClip (path, CombineMode.Replace);
1607                 }
1608
1609                 
1610                 public void SetClip (Rectangle rect)
1611                 {
1612                         SetClip (rect, CombineMode.Replace);
1613                 }
1614
1615                 
1616                 public void SetClip (Graphics g)
1617                 {
1618                         SetClip (g, CombineMode.Replace);
1619                 }
1620
1621                 
1622                 public void SetClip (Graphics g, CombineMode combineMode)
1623                 {
1624                         Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
1625                         GDIPlus.CheckStatus (status);
1626                 }
1627
1628                 
1629                 public void SetClip (Rectangle rect, CombineMode combineMode)
1630                 {
1631                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1632                         GDIPlus.CheckStatus (status);
1633                 }
1634
1635                 
1636                 public void SetClip (RectangleF rect, CombineMode combineMode)
1637                 {
1638                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1639                         GDIPlus.CheckStatus (status);
1640                 }
1641
1642                 
1643                 public void SetClip (Region region, CombineMode combineMode)
1644                 {
1645                         Status status =   GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode); 
1646                         GDIPlus.CheckStatus (status);
1647                 }
1648
1649                 
1650                 public void SetClip (GraphicsPath path, CombineMode combineMode)
1651                 {
1652                         Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
1653                         GDIPlus.CheckStatus (status);
1654                 }
1655
1656                 
1657                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1658                 {
1659                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
1660             
1661                         Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
1662                         GDIPlus.CheckStatus (status);
1663                         
1664                         GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
1665                 }
1666
1667
1668                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1669                 {                                               
1670                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
1671             
1672                         Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1673                         GDIPlus.CheckStatus (status);
1674                         
1675                         GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
1676                 }
1677
1678                 
1679                 public void TranslateClip (int dx, int dy)
1680                 {
1681                         Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
1682                         GDIPlus.CheckStatus (status);
1683                 }
1684
1685                 
1686                 public void TranslateClip (float dx, float dy)
1687                 {
1688                         Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
1689                         GDIPlus.CheckStatus (status);
1690                 }
1691
1692                 public void TranslateTransform (float dx, float dy)
1693                 {
1694                         TranslateTransform (dx, dy, MatrixOrder.Prepend);
1695                 }
1696
1697                 
1698                 public void TranslateTransform (float dx, float dy, MatrixOrder order)
1699                 {                       
1700                         Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
1701                         GDIPlus.CheckStatus (status);
1702                 }
1703
1704                 public Region Clip {
1705                         get {
1706                                 Region reg = new Region();
1707                                 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
1708                                 GDIPlus.CheckStatus (status);
1709                                 return reg;                             
1710                         }
1711                         set {
1712                                 SetClip (value, CombineMode.Replace);
1713                         }
1714                 }
1715
1716                 public RectangleF ClipBounds {
1717                         get {
1718                                 RectangleF rect = new RectangleF ();
1719                                 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
1720                                 GDIPlus.CheckStatus (status);
1721                                 return rect;
1722                         }
1723                 }
1724
1725                 public CompositingMode CompositingMode {
1726                         get {
1727                                 CompositingMode mode;
1728                                 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
1729                                 GDIPlus.CheckStatus (status);
1730
1731                                 return mode;
1732                         }
1733                         set {
1734                                 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
1735                                 GDIPlus.CheckStatus (status);
1736                         }
1737
1738                 }
1739
1740                 public CompositingQuality CompositingQuality {
1741                         get {
1742                                 CompositingQuality quality;
1743
1744                                 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
1745                                 GDIPlus.CheckStatus (status);
1746                                 return quality;
1747                         }
1748                         set {
1749                                 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
1750                                 GDIPlus.CheckStatus (status);
1751                         }
1752                 }
1753
1754                 public float DpiX {
1755                         get {
1756                                 float x;
1757
1758                                 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
1759                                 GDIPlus.CheckStatus (status);
1760                                 return x;
1761                         }
1762                 }
1763
1764                 public float DpiY {
1765                         get {
1766                                 float y;
1767
1768                                 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
1769                                 GDIPlus.CheckStatus (status);
1770                                 return y;
1771                         }
1772                 }
1773
1774                 public InterpolationMode InterpolationMode {
1775                         get {                           
1776                                 InterpolationMode imode = InterpolationMode.Invalid;
1777                                 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
1778                                 GDIPlus.CheckStatus (status);
1779                                 return imode;
1780                         }
1781                         set {
1782                                 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
1783                                 GDIPlus.CheckStatus (status);
1784                         }
1785                 }
1786
1787                 public bool IsClipEmpty {
1788                         get {
1789                                 bool isEmpty = false;
1790
1791                                 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
1792                                 GDIPlus.CheckStatus (status);
1793                                 return isEmpty;
1794                         }
1795                 }
1796
1797                 public bool IsVisibleClipEmpty {
1798                         get {
1799                                 bool isEmpty = false;
1800
1801                                 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
1802                                 GDIPlus.CheckStatus (status);
1803                                 return isEmpty;
1804                         }
1805                 }
1806
1807                 public float PageScale {
1808                         get {
1809                                 float scale;
1810
1811                                 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
1812                                 GDIPlus.CheckStatus (status);
1813                                 return scale;
1814                         }
1815                         set {
1816                                 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
1817                                 GDIPlus.CheckStatus (status);
1818                         }
1819                 }
1820
1821                 public GraphicsUnit PageUnit {
1822                         get {
1823                                 GraphicsUnit unit;
1824                                 
1825                                 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
1826                                 GDIPlus.CheckStatus (status);
1827                                 return unit;
1828                         }
1829                         set {
1830                                 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
1831                                 GDIPlus.CheckStatus (status);
1832                         }
1833                 }
1834
1835                 public PixelOffsetMode PixelOffsetMode {
1836                         get {
1837                                 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
1838                                 
1839                                 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
1840                                 GDIPlus.CheckStatus (status);
1841                                 return pixelOffset;
1842                         }
1843                         set {
1844                                 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value); 
1845                                 GDIPlus.CheckStatus (status);
1846                         }
1847                 }
1848
1849                 public Point RenderingOrigin {
1850                         get {
1851                                 int x, y;
1852                                 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
1853                                 GDIPlus.CheckStatus (status);
1854                                 return new Point (x, y);
1855                         }
1856
1857                         set {
1858                                 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
1859                                 GDIPlus.CheckStatus (status);
1860                         }
1861                 }
1862
1863                 public SmoothingMode SmoothingMode {
1864                         get {
1865                                 SmoothingMode mode = SmoothingMode.Invalid;
1866
1867                                 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
1868                                 GDIPlus.CheckStatus (status);
1869                                 return mode;
1870                         }
1871
1872                         set {
1873                                 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
1874                                 GDIPlus.CheckStatus (status);
1875                         }
1876                 }
1877
1878                 public int TextContrast {
1879                         get {   
1880                                 int contrast;
1881                                         
1882                                 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
1883                                 GDIPlus.CheckStatus (status);
1884                                 return contrast;
1885                         }
1886
1887                         set {
1888                                 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
1889                                 GDIPlus.CheckStatus (status);
1890                         }
1891                 }
1892
1893                 public TextRenderingHint TextRenderingHint {
1894                         get {
1895                                 TextRenderingHint hint;
1896
1897                                 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
1898                                 GDIPlus.CheckStatus (status);
1899                                 return hint;        
1900                         }
1901
1902                         set {
1903                                 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
1904                                 GDIPlus.CheckStatus (status);
1905                         }
1906                 }
1907
1908                 public Matrix Transform {
1909                         get {
1910                                 Matrix matrix = new Matrix ();
1911                                 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
1912                                 GDIPlus.CheckStatus (status);
1913                                 return matrix;
1914                         }
1915                         set {
1916                                 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
1917                                 GDIPlus.CheckStatus (status);
1918                         }
1919                 }
1920
1921                 public RectangleF VisibleClipBounds {
1922                         get {
1923                                 RectangleF rect;
1924                                         
1925                                 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
1926                                 GDIPlus.CheckStatus (status);
1927                                 return rect;
1928                         }
1929                 }
1930         }
1931 }
1932