This commit was manufactured by cvs2svn to create branch 'mono-1-0'.
[mono.git] / mcs / class / System.Drawing / System.Drawing / Graphics.cs
1 //
2 // System.Drawing.Graphics.cs
3 //
4 // (C) 2003 Ximian, Inc.  http://www.ximian.com
5 //
6 // Authors:
7 //      Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
8 //      Alexandre Pigolkine(pigolkine@gmx.de)
9 //              Jordi Mas i Hernandez (jordi@ximian.com)
10 //
11
12 //
13 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 //
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 // 
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 // 
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 //
34 using System;
35 using System.Drawing.Drawing2D;
36 using System.Drawing.Imaging;
37 using System.Drawing.Text;
38 using System.ComponentModel;
39 using System.Runtime.InteropServices;
40 using System.Text;
41
42 namespace System.Drawing
43 {
44         [ComVisible(false)]
45         public sealed class Graphics : MarshalByRefObject, IDisposable
46         {
47                 internal IntPtr nativeObject = IntPtr.Zero;
48                 private bool disposed = false;
49                 private static float defDpiX = 0;
50                 private static float defDpiY = 0;
51         
52                 [ComVisible(false)]
53                 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
54                                                             int flags,
55                                                             int dataSize,
56                                                             IntPtr data,
57                                                             PlayRecordCallback callbackData);
58                 
59                 [ComVisible (false)]
60                 public delegate bool DrawImageAbort (IntPtr callbackData);              
61                 
62                 private Graphics (IntPtr nativeGraphics)
63                 {
64                         nativeObject = nativeGraphics;
65                 }
66                 
67                 ~Graphics ()
68                 {
69                         Dispose ();                     
70                 }               
71                 
72                 static internal float systemDpiX {
73                         get {                                   
74                                         if (defDpiX==0) {
75                                                 Bitmap bmp = new Bitmap(1,1);
76                                                 Graphics g = Graphics.FromImage(bmp);   
77                                         defDpiX = g.DpiX;
78                                 }
79                                 return defDpiX;
80                         }
81                 }
82
83                 static internal float systemDpiY {
84                         get {
85                                         if (defDpiY==0) {
86                                                 Bitmap bmp = new Bitmap(1,1);
87                                                 Graphics g = Graphics.FromImage(bmp);   
88                                         defDpiY = g.DpiY;
89                                 }
90                                 return defDpiY;
91                         }
92                 }
93                 
94                 internal IntPtr NativeObject {
95                         get{
96                                 return nativeObject;
97                         }
98
99                         set {
100                                 nativeObject = value;
101                         }
102                 }
103
104                 [MonoTODO]
105                 public void AddMetafileComment (byte [] data)
106                 {
107                         throw new NotImplementedException ();
108                 }
109
110                 
111                 public GraphicsContainer BeginContainer ()
112                 {
113                         int state;
114                         Status status;
115                         status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
116                         GDIPlus.CheckStatus (status);
117
118                         return new GraphicsContainer(state);
119                 }
120                 
121                 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
122                 {
123                         int state;
124                         Status status;
125                         status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
126                         GDIPlus.CheckStatus (status);
127
128                         return new GraphicsContainer (state);
129                 }
130
131                 
132                 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
133                 {
134                         int state;
135                         Status status;
136                         status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
137                         GDIPlus.CheckStatus (status);
138
139                         return new GraphicsContainer (state);
140                 }
141
142                 
143                 public void Clear (Color color)
144                 {
145                         Status status;
146                         status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());                             GDIPlus.CheckStatus (status);
147                 }
148
149                 public void Dispose ()
150                 {
151                         Status status;
152                         if (! disposed) {
153                                 lock (this)
154                                 {
155                                         status = GDIPlus.GdipDeleteGraphics (nativeObject);
156                                         GDIPlus.CheckStatus (status);
157                                         disposed = true;
158                                 }
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                 [MonoTODO]
374                 public void DrawIcon (Icon icon, Rectangle targetRect)
375                 {
376                         throw new NotImplementedException ();
377                 }
378
379                 [MonoTODO]
380                 public void DrawIcon (Icon icon, int x, int y)
381                 {
382                         throw new NotImplementedException ();
383                 }
384
385                 [MonoTODO]
386                 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
387                 {
388                         throw new NotImplementedException ();
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                         DrawImage(image, point.X, point.Y);
655                 }
656                 
657                 public void DrawImageUnscaled (Image image, Rectangle rect)
658                 {
659                         DrawImage(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);
665                 }
666
667                 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
668                 {
669                         DrawImage(image, x, y, width, height);
670                 }
671
672                 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
673                 {
674                         Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
675                                                 pt1.X, pt1.Y, pt2.X, pt2.Y);
676                         GDIPlus.CheckStatus (status);
677                 }
678
679                 public void DrawLine (Pen pen, Point pt1, Point pt2)
680                 {
681                         Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
682                                                 pt1.X, pt1.Y, pt2.X, pt2.Y);
683                         GDIPlus.CheckStatus (status);
684                 }
685
686                 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
687                 {
688                         Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
689                         GDIPlus.CheckStatus (status);
690                 }
691
692                 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
693                 {
694                         Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
695                         GDIPlus.CheckStatus (status);
696                 }
697
698                 public void DrawLines (Pen pen, PointF [] points)
699                 {
700                         Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
701                         GDIPlus.CheckStatus (status);
702                 }
703
704                 public void DrawLines (Pen pen, Point [] points)
705                 {
706                         Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
707                         GDIPlus.CheckStatus (status);
708                 }
709
710                 public void DrawPath (Pen pen, GraphicsPath path)
711                 {
712                         Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
713                         GDIPlus.CheckStatus (status);
714                 }
715                 
716                 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
717                 {
718                         DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
719                 }
720                 
721                 public void DrawPie (Pen pen, RectangleF 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, float x, float y, float width, float height, float startAngle, float sweepAngle)
727                 {
728                         Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
729                         GDIPlus.CheckStatus (status);
730                 }
731                 
732                 // Microsoft documentation states that the signature for this member should be
733                 // public void DrawPie(Pen pen, int x,  int y,  int width,   int height,   int startAngle
734                 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
735                 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
736                 {
737                         Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
738                         GDIPlus.CheckStatus (status);
739                 }
740
741                 public void DrawPolygon (Pen pen, Point [] points)
742                 {
743                         Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
744                         GDIPlus.CheckStatus (status);
745                 }
746
747                 public void DrawPolygon (Pen pen, PointF [] points)
748                 {
749                         Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
750                         GDIPlus.CheckStatus (status);
751                 }
752
753                 internal void DrawRectangle (Pen pen, RectangleF rect)
754                 {
755                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
756                 }
757
758                 public void DrawRectangle (Pen pen, Rectangle rect)
759                 {
760                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
761                 }
762
763                 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
764                 {
765                         Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
766                         GDIPlus.CheckStatus (status);
767                 }
768
769                 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
770                 {
771                         Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
772                         GDIPlus.CheckStatus (status);
773                 }
774
775                 public void DrawRectangles (Pen pen, RectangleF [] rects)
776                 {
777                         Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
778                         GDIPlus.CheckStatus (status);
779                 }
780
781                 public void DrawRectangles (Pen pen, Rectangle [] rects)
782                 {
783                         Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
784                         GDIPlus.CheckStatus (status);
785                 }
786
787                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
788                 {                       
789                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
790                         GDIPlus.CheckStatus (status);
791                 }
792                 
793                 public void DrawString (string s, Font font, Brush brush, PointF point)
794                 {
795                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
796                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
797                         GDIPlus.CheckStatus (status);
798                 }
799                 
800                 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
801                 {
802                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
803                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, format.NativeObject, brush.nativeObject);
804                         GDIPlus.CheckStatus (status);
805                 }
806                 
807                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
808                 {
809                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format.NativeObject, brush.nativeObject);
810                         GDIPlus.CheckStatus (status);
811                 }
812
813                 public void DrawString (string s, Font font, Brush brush, float x, float y)
814                 {
815                         RectangleF rc = new RectangleF (x, y, 0, 0);
816                         
817                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, 
818                                 ref rc, IntPtr.Zero, brush.nativeObject);
819                         GDIPlus.CheckStatus (status);
820                 }
821
822                 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
823                 {
824                         RectangleF rc = new RectangleF (x, y, 0, 0);
825
826                         Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
827                                 ref rc, format.NativeObject, brush.nativeObject);
828                         GDIPlus.CheckStatus (status);
829                 }
830
831                 
832                 public void EndContainer (GraphicsContainer container)
833                 {
834                         Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
835                         GDIPlus.CheckStatus (status);
836                 }
837
838                 [MonoTODO]
839                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
840                 {
841                         throw new NotImplementedException ();
842                 }
843
844                 [MonoTODO]
845                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
846                 {
847                         throw new NotImplementedException ();
848                 }
849
850                 [MonoTODO]
851                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
852                 {
853                         throw new NotImplementedException ();
854                 }
855
856                 [MonoTODO]
857                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
858                 {
859                         throw new NotImplementedException ();
860                 }
861
862                 [MonoTODO]
863                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
864                 {
865                         throw new NotImplementedException ();
866                 }
867
868                 [MonoTODO]
869                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
870                 {
871                         throw new NotImplementedException ();
872                 }
873
874                 [MonoTODO]
875                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
876                 {
877                         throw new NotImplementedException ();
878                 }
879
880                 [MonoTODO]
881                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
882                 {
883                         throw new NotImplementedException ();
884                 }
885
886                 [MonoTODO]
887                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
888                 {
889                         throw new NotImplementedException ();
890                 }
891
892                 [MonoTODO]
893                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
894                 {
895                         throw new NotImplementedException ();
896                 }
897
898                 [MonoTODO]
899                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
900                 {
901                         throw new NotImplementedException ();
902                 }
903
904                 [MonoTODO]
905                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
906                 {
907                         throw new NotImplementedException ();
908                 }
909
910                 [MonoTODO]
911                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
912                 {
913                         throw new NotImplementedException ();
914                 }
915
916                 [MonoTODO]
917                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
918                 {
919                         throw new NotImplementedException ();
920                 }
921
922                 [MonoTODO]
923                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
924                 {
925                         throw new NotImplementedException ();
926                 }
927
928                 [MonoTODO]
929                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
930                 {
931                         throw new NotImplementedException ();
932                 }
933
934                 [MonoTODO]
935                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
936                 {
937                         throw new NotImplementedException ();
938                 }
939
940                 [MonoTODO]
941                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
942                 {
943                         throw new NotImplementedException ();
944                 }
945
946                 [MonoTODO]
947                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
948                 {
949                         throw new NotImplementedException ();
950                 }
951
952                 [MonoTODO]
953                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
954                 {
955                         throw new NotImplementedException ();
956                 }
957
958                 [MonoTODO]
959                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
960                 {
961                         throw new NotImplementedException ();
962                 }
963
964                 [MonoTODO]
965                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
966                 {
967                         throw new NotImplementedException ();
968                 }
969
970                 [MonoTODO]
971                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
972                 {
973                         throw new NotImplementedException ();
974                 }
975
976                 [MonoTODO]
977                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
978                 {
979                         throw new NotImplementedException ();
980                 }
981
982                 [MonoTODO]
983                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
984                 {
985                         throw new NotImplementedException ();
986                 }
987
988                 [MonoTODO]
989                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
990                 {
991                         throw new NotImplementedException ();
992                 }
993
994                 [MonoTODO]
995                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
996                 {
997                         throw new NotImplementedException ();
998                 }
999
1000                 [MonoTODO]
1001                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1002                 {
1003                         throw new NotImplementedException ();
1004                 }
1005
1006                 [MonoTODO]
1007                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1008                 {
1009                         throw new NotImplementedException ();
1010                 }
1011
1012                 [MonoTODO]
1013                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1014                 {
1015                         throw new NotImplementedException ();
1016                 }
1017
1018                 [MonoTODO]
1019                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1020                 {
1021                         throw new NotImplementedException ();
1022                 }
1023
1024                 [MonoTODO]
1025                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1026                 {
1027                         throw new NotImplementedException ();
1028                 }
1029
1030                 [MonoTODO]
1031                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1032                 {
1033                         throw new NotImplementedException ();
1034                 }
1035
1036                 [MonoTODO]
1037                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1038                 {
1039                         throw new NotImplementedException ();
1040                 }
1041
1042                 [MonoTODO]
1043                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1044                 {
1045                         throw new NotImplementedException ();
1046                 }
1047
1048                 [MonoTODO]
1049                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1050                 {
1051                         throw new NotImplementedException ();
1052                 }
1053         
1054                 public void ExcludeClip (Rectangle rect)
1055                 {
1056                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1057                         GDIPlus.CheckStatus (status);
1058                 }
1059
1060                 public void ExcludeClip (Region region)
1061                 {
1062                         Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1063                         GDIPlus.CheckStatus (status);
1064                 }
1065
1066                 
1067                 public void FillClosedCurve (Brush brush, PointF [] points)
1068                 {
1069                        Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1070                         GDIPlus.CheckStatus (status);
1071                 }
1072
1073                 
1074                 public void FillClosedCurve (Brush brush, Point [] points)
1075                 {
1076                         Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1077                         GDIPlus.CheckStatus (status);
1078                 }
1079
1080                 
1081                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1082                 {
1083                         FillClosedCurve (brush, points, fillmode, 0.5f);
1084                 }
1085                 
1086                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1087                 {
1088                         FillClosedCurve (brush, points, fillmode, 0.5f);
1089                 }
1090
1091                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1092                 {
1093                         Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1094                         GDIPlus.CheckStatus (status);
1095                 }
1096
1097                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1098                 {
1099                         Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1100                         GDIPlus.CheckStatus (status);
1101                 }
1102
1103                 public void FillEllipse (Brush brush, Rectangle rect)
1104                 {
1105                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1106                 }
1107
1108                 public void FillEllipse (Brush brush, RectangleF rect)
1109                 {
1110                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1111                 }
1112
1113                 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1114                 {
1115                         Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1116                         GDIPlus.CheckStatus (status);
1117                 }
1118
1119                 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1120                 {
1121                         Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1122                         GDIPlus.CheckStatus (status);
1123                 }
1124
1125                 public void FillPath (Brush brush, GraphicsPath path)
1126                 {
1127                         Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject,  path.NativeObject);
1128                         GDIPlus.CheckStatus (status);
1129                 }
1130
1131                 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1132                 {
1133                         Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1134                         GDIPlus.CheckStatus (status);
1135                 }
1136
1137                 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1138                 {
1139                         Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1140                         GDIPlus.CheckStatus (status);
1141                 }
1142
1143                 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1144                 {
1145                         Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1146                         GDIPlus.CheckStatus (status);
1147                 }
1148
1149                 public void FillPolygon (Brush brush, PointF [] points)
1150                 {
1151                         Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1152                         GDIPlus.CheckStatus (status);
1153                 }
1154
1155                 public void FillPolygon (Brush brush, Point [] points)
1156                 {
1157                         Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1158                         GDIPlus.CheckStatus (status);
1159                 }
1160
1161                 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1162                 {
1163                         Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1164                         GDIPlus.CheckStatus (status);
1165                 }
1166
1167                 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1168                 {
1169                         Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1170                         GDIPlus.CheckStatus (status);
1171                 }
1172
1173                 public void FillRectangle (Brush brush, RectangleF rect)
1174                 {
1175                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1176                 }
1177
1178                 public void FillRectangle (Brush brush, Rectangle rect)
1179                 {
1180                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1181                 }
1182
1183                 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1184                 {
1185                         Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
1186                         GDIPlus.CheckStatus (status);
1187                 }
1188
1189                 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1190                 {
1191                         Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1192                         GDIPlus.CheckStatus (status);
1193                 }
1194
1195                 public void FillRectangles (Brush brush, Rectangle [] rects)
1196                 {
1197                         Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
1198                         GDIPlus.CheckStatus (status);
1199                 }
1200
1201                 public void FillRectangles (Brush brush, RectangleF [] rects)
1202                 {
1203                         Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
1204                         GDIPlus.CheckStatus (status);
1205                 }
1206
1207                 
1208                 public void FillRegion (Brush brush, Region region)
1209                 {
1210                         Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);                  
1211                         GDIPlus.CheckStatus(status);
1212                 }
1213
1214                 
1215                 public void Flush ()
1216                 {
1217                         Flush (FlushIntention.Flush);
1218                 }
1219
1220                 
1221                 public void Flush (FlushIntention intention)
1222                 {
1223                         Status status = GDIPlus.GdipFlush (nativeObject, intention);
1224                         GDIPlus.CheckStatus (status);                     
1225                 }
1226
1227                 [EditorBrowsable (EditorBrowsableState.Advanced)]               
1228                 public static Graphics FromHdc (IntPtr hdc)
1229                 {
1230                         int graphics;
1231                         Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);                          GDIPlus.CheckStatus (status);
1232                             
1233                         Graphics result = new Graphics ((IntPtr) graphics);
1234                         return result;
1235                 }
1236
1237                 [MonoTODO]
1238                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1239                 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1240                 {
1241                         throw new NotImplementedException ();
1242                 }
1243
1244                 [MonoTODO]
1245                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1246                 public static Graphics FromHdcInternal (IntPtr hdc)
1247                 {
1248                         throw new NotImplementedException ();
1249                 }
1250
1251                 [EditorBrowsable (EditorBrowsableState.Advanced)]               
1252                 public static Graphics FromHwnd (IntPtr hwnd)
1253                 {
1254                         IntPtr graphics;
1255                         
1256                         Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);                                GDIPlus.CheckStatus (status);
1257                         
1258                         return new Graphics (graphics); 
1259                 }
1260
1261                 [MonoTODO]
1262                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1263                 public static Graphics FromHwndInternal (IntPtr hwnd)
1264                 {
1265                         throw new NotImplementedException ();
1266                 }
1267
1268                 public static Graphics FromImage (Image image)
1269                 {
1270                         lock (typeof (Graphics))
1271                         {
1272                                 if (image == null) throw new ArgumentException ();
1273                                 int graphics;
1274                                 Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1275                                 GDIPlus.CheckStatus (status);
1276                                 Graphics result = new Graphics ((IntPtr) graphics);
1277                                 
1278                                 if (Environment.OSVersion.Platform == (PlatformID) 128)  {
1279                                         Rectangle rect  = new Rectangle (0,0, image.Width, image.Height);
1280                                         GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1281                                 }
1282                                 
1283                                 return result;
1284                         }
1285                 }
1286
1287                 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1288                 {
1289                         lock (typeof (Graphics))
1290                         {
1291                                 IntPtr graphics;
1292                                 Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1293                                 GDIPlus.CheckStatus (s);
1294                                 return new Graphics (graphics);
1295                         }
1296                 }
1297
1298                 [MonoTODO]
1299                 public static IntPtr GetHalftonePalette ()
1300                 {
1301                         throw new NotImplementedException ();
1302                 }
1303
1304                 [MonoTODO]
1305                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1306                 public IntPtr GetHdc ()
1307                 {
1308                         int hdc;
1309                         Status status = GDIPlus.GdipGetDC (nativeObject, out hdc);
1310                         GDIPlus.CheckStatus (status);
1311
1312                         return (IntPtr) hdc;
1313                 }
1314
1315                 
1316                 public Color GetNearestColor (Color color)
1317                 {
1318                         int argb;
1319                         
1320                         Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1321                         GDIPlus.CheckStatus (status);
1322
1323                         return Color.FromArgb (argb);
1324                 }
1325
1326                 
1327                 public void IntersectClip (Region region)
1328                 {
1329                         Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1330                         GDIPlus.CheckStatus (status);
1331                 }
1332                 
1333                 public void IntersectClip (RectangleF rect)
1334                 {
1335                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1336                         GDIPlus.CheckStatus (status);
1337                 }
1338
1339                 public void IntersectClip (Rectangle rect)
1340                 {                       
1341                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1342                         GDIPlus.CheckStatus (status);
1343                 }
1344
1345                 public bool IsVisible (Point point)
1346                 {
1347                         bool isVisible = false;
1348
1349                         Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1350                         GDIPlus.CheckStatus (status);
1351
1352                         return isVisible;
1353                 }
1354
1355                 
1356                 public bool IsVisible (RectangleF rect)
1357                 {
1358                         bool isVisible = false;
1359
1360                         Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1361                         GDIPlus.CheckStatus (status);
1362
1363                         return isVisible;
1364                 }
1365
1366                 public bool IsVisible (PointF point)
1367                 {
1368                         bool isVisible = false;
1369
1370                         Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1371                         GDIPlus.CheckStatus (status);
1372
1373                         return isVisible;
1374                 }
1375                 
1376                 public bool IsVisible (Rectangle rect)
1377                 {
1378                         bool isVisible = false;
1379
1380                         Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1381                         GDIPlus.CheckStatus (status);
1382
1383                         return isVisible;
1384                 }
1385                 
1386                 public bool IsVisible (float x, float y)
1387                 {
1388                         return IsVisible (new PointF (x, y));
1389                 }
1390                 
1391                 public bool IsVisible (int x, int y)
1392                 {
1393                         return IsVisible (new Point (x, y));
1394                 }
1395                 
1396                 public bool IsVisible (float x, float y, float width, float height)
1397                 {
1398                         return IsVisible (new RectangleF (x, y, width, height));
1399                 }
1400
1401                 
1402                 public bool IsVisible (int x, int y, int width, int height)
1403                 {
1404                         return IsVisible (new Rectangle (x, y, width, height));
1405                 }
1406
1407                 [MonoTODO]
1408                 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1409                 {
1410                         Region []       result=new Region[stringFormat.GetCharRanges.Length];
1411                         string          textFragment;
1412                         SizeF           fragmentSize;
1413                         
1414                         for (int i=0; i<stringFormat.GetCharRanges.Length; i++) { 
1415                                 textFragment=text.Substring(stringFormat.GetCharRanges[i].First, stringFormat.GetCharRanges[i].Length);
1416                                 fragmentSize=MeasureString(textFragment, font, new SizeF(layoutRect.Width, layoutRect.Height), stringFormat);
1417                                 result[i]=new Region(new RectangleF(layoutRect.X, layoutRect.Y, layoutRect.X+fragmentSize.Width, layoutRect.Y+fragmentSize.Height));
1418                         }
1419
1420                         return(result);
1421                 }
1422
1423                 
1424                 public SizeF MeasureString (string text, Font font)
1425                 {
1426                         return MeasureString (text, font, new Size(0,0));
1427                 }
1428
1429                 
1430                 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1431                 {
1432                         int charactersFitted, linesFilled;                      
1433                         RectangleF boundingBox = new RectangleF ();
1434                         RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1435                                         
1436                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1437                                 font.NativeObject, ref rect, IntPtr.Zero, out boundingBox,
1438                                 out charactersFitted, out linesFilled);
1439                         GDIPlus.CheckStatus (status);
1440
1441                         return new SizeF(boundingBox.Width, boundingBox.Height);
1442                 }
1443
1444                 
1445                 public SizeF MeasureString (string text, Font font, int width)
1446                 {                               
1447                         RectangleF boundingBox = new RectangleF ();
1448                         RectangleF rect = new RectangleF (0, 0, width, 999999);
1449                         int charactersFitted, linesFilled;
1450
1451                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1452                                 font.NativeObject, ref rect, IntPtr.Zero, 
1453                                 out boundingBox, out charactersFitted, out linesFilled);
1454                         GDIPlus.CheckStatus (status);
1455
1456                         return new SizeF (boundingBox.Width, boundingBox.Height);
1457                 }
1458
1459                 
1460                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
1461                 {
1462                         int charactersFitted, linesFilled;                      
1463                         return MeasureString (text, font, layoutArea, stringFormat, out charactersFitted, out linesFilled);
1464                 }
1465
1466                 
1467                 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1468                 {
1469                         int charactersFitted, linesFilled;                      
1470                         return MeasureString (text, font, new SizeF (width, 999999), 
1471                                 format, out charactersFitted, out linesFilled);
1472                 }
1473
1474                 
1475                 public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
1476                 {
1477                         RectangleF boundingBox = new RectangleF ();
1478                         RectangleF rect = new RectangleF (origin.X, origin.Y, 0,0);
1479                         int charactersFitted, linesFilled;
1480
1481                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1482                                 font.NativeObject, ref rect, stringFormat.NativeObject, 
1483                                 out boundingBox, out charactersFitted, out linesFilled);
1484                         GDIPlus.CheckStatus (status);
1485
1486                         return new SizeF (boundingBox.Width, boundingBox.Height);
1487                 }
1488
1489                 
1490                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
1491                 {       
1492                         RectangleF boundingBox = new RectangleF ();
1493                         RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1494                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1495                                 font.NativeObject, ref rect, stringFormat.NativeObject,
1496                                 out boundingBox, out charactersFitted, out linesFilled);
1497                         GDIPlus.CheckStatus (status);
1498
1499                         return new SizeF (boundingBox.Width, boundingBox.Height);
1500                 }
1501
1502                 public void MultiplyTransform (Matrix matrix)
1503                 {
1504                         MultiplyTransform (matrix, MatrixOrder.Prepend);
1505                 }
1506
1507                 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
1508                 {
1509                         Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
1510                         GDIPlus.CheckStatus (status);
1511                 }
1512
1513                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1514                 public void ReleaseHdc (IntPtr hdc)
1515                 {
1516                         Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
1517                         GDIPlus.CheckStatus (status);
1518                 }
1519
1520                 [MonoTODO]
1521                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1522                 public void ReleaseHdcInternal (IntPtr hdc)
1523                 {
1524                         throw new NotImplementedException ();
1525                 }
1526
1527                 
1528                 public void ResetClip ()
1529                 {
1530                         Status status = GDIPlus.GdipResetClip (nativeObject);
1531                         GDIPlus.CheckStatus (status);
1532                 }
1533
1534                 public void ResetTransform ()
1535                 {
1536                         Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
1537                         GDIPlus.CheckStatus (status);
1538                 }
1539
1540                 public void Restore (GraphicsState gstate)
1541                 {
1542                         Transform = gstate.matrix.Clone ();
1543                         Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
1544                         GDIPlus.CheckStatus (status);
1545                 }
1546
1547
1548                 public void RotateTransform (float angle)
1549                 {
1550                         RotateTransform (angle, MatrixOrder.Prepend);
1551                 }
1552
1553                 public void RotateTransform (float angle, MatrixOrder order)
1554                 {
1555
1556                         Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
1557                         GDIPlus.CheckStatus (status);
1558                 }
1559
1560                 public GraphicsState Save ()
1561                 {
1562                         GraphicsState state = new GraphicsState ();
1563                         state.matrix = Transform.Clone ();
1564                         uint saveState;
1565                         Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
1566                         GDIPlus.CheckStatus (status);
1567
1568                         state.nativeState = saveState;
1569                         return state;
1570                 }
1571
1572                 public void ScaleTransform (float sx, float sy)
1573                 {
1574                         ScaleTransform (sx, sy, MatrixOrder.Prepend);
1575                 }
1576
1577                 public void ScaleTransform (float sx, float sy, MatrixOrder order)
1578                 {
1579                         Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
1580                         GDIPlus.CheckStatus (status);
1581                 }
1582
1583                 
1584                 public void SetClip (RectangleF rect)
1585                 {
1586                         SetClip (rect, CombineMode.Replace);
1587                 }
1588
1589                 
1590                 public void SetClip (GraphicsPath path)
1591                 {
1592                         SetClip (path, CombineMode.Replace);
1593                 }
1594
1595                 
1596                 public void SetClip (Rectangle rect)
1597                 {
1598                         SetClip (rect, CombineMode.Replace);
1599                 }
1600
1601                 
1602                 public void SetClip (Graphics g)
1603                 {
1604                         SetClip (g, CombineMode.Replace);
1605                 }
1606
1607                 
1608                 public void SetClip (Graphics g, CombineMode combineMode)
1609                 {
1610                         Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
1611                         GDIPlus.CheckStatus (status);
1612                 }
1613
1614                 
1615                 public void SetClip (Rectangle rect, CombineMode combineMode)
1616                 {
1617                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1618                         GDIPlus.CheckStatus (status);
1619                 }
1620
1621                 
1622                 public void SetClip (RectangleF rect, CombineMode combineMode)
1623                 {
1624                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1625                         GDIPlus.CheckStatus (status);
1626                 }
1627
1628                 
1629                 public void SetClip (Region region, CombineMode combineMode)
1630                 {
1631                         Status status =   GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode); 
1632                         GDIPlus.CheckStatus (status);
1633                 }
1634
1635                 
1636                 public void SetClip (GraphicsPath path, CombineMode combineMode)
1637                 {
1638                         Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
1639                         GDIPlus.CheckStatus (status);
1640                 }
1641
1642                 
1643                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1644                 {
1645                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
1646             
1647                         Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
1648                         GDIPlus.CheckStatus (status);
1649                         
1650                         GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
1651                 }
1652
1653
1654                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1655                 {                                               
1656                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
1657             
1658                         Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1659                         GDIPlus.CheckStatus (status);
1660                         
1661                         GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
1662                 }
1663
1664                 
1665                 public void TranslateClip (int dx, int dy)
1666                 {
1667                         Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
1668                         GDIPlus.CheckStatus (status);
1669                 }
1670
1671                 
1672                 public void TranslateClip (float dx, float dy)
1673                 {
1674                         Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
1675                         GDIPlus.CheckStatus (status);
1676                 }
1677
1678                 public void TranslateTransform (float dx, float dy)
1679                 {
1680                         TranslateTransform (dx, dy, MatrixOrder.Prepend);
1681                 }
1682
1683                 
1684                 public void TranslateTransform (float dx, float dy, MatrixOrder order)
1685                 {                       
1686                         Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
1687                         GDIPlus.CheckStatus (status);
1688                 }
1689
1690                 public Region Clip {
1691                         get {
1692                                 Region reg = new Region();
1693                                 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
1694                                 GDIPlus.CheckStatus (status);
1695                                 return reg;                             
1696                         }
1697                         set {
1698                                 SetClip (value, CombineMode.Replace);
1699                         }
1700                 }
1701
1702                 public RectangleF ClipBounds {
1703                         get {
1704                                 RectangleF rect = new RectangleF ();
1705                                 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
1706                                 GDIPlus.CheckStatus (status);
1707                                 return rect;
1708                         }
1709                 }
1710
1711                 public CompositingMode CompositingMode {
1712                         get {
1713                                 CompositingMode mode;
1714                                 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
1715                                 GDIPlus.CheckStatus (status);
1716
1717                                 return mode;
1718                         }
1719                         set {
1720                                 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
1721                                 GDIPlus.CheckStatus (status);
1722                         }
1723
1724                 }
1725
1726                 public CompositingQuality CompositingQuality {
1727                         get {
1728                                 CompositingQuality quality;
1729
1730                                 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
1731                                 GDIPlus.CheckStatus (status);
1732                                 return quality;
1733                         }
1734                         set {
1735                                 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
1736                                 GDIPlus.CheckStatus (status);
1737                         }
1738                 }
1739
1740                 public float DpiX {
1741                         get {
1742                                 float x;
1743
1744                                 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
1745                                 GDIPlus.CheckStatus (status);
1746                                 return x;
1747                         }
1748                 }
1749
1750                 public float DpiY {
1751                         get {
1752                                 float y;
1753
1754                                 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
1755                                 GDIPlus.CheckStatus (status);
1756                                 return y;
1757                         }
1758                 }
1759
1760                 public InterpolationMode InterpolationMode {
1761                         get {                           
1762                                 InterpolationMode imode = InterpolationMode.Invalid;
1763                                 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
1764                                 GDIPlus.CheckStatus (status);
1765                                 return imode;
1766                         }
1767                         set {
1768                                 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
1769                                 GDIPlus.CheckStatus (status);
1770                         }
1771                 }
1772
1773                 public bool IsClipEmpty {
1774                         get {
1775                                 bool isEmpty = false;
1776
1777                                 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
1778                                 GDIPlus.CheckStatus (status);
1779                                 return isEmpty;
1780                         }
1781                 }
1782
1783                 public bool IsVisibleClipEmpty {
1784                         get {
1785                                 bool isEmpty = false;
1786
1787                                 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
1788                                 GDIPlus.CheckStatus (status);
1789                                 return isEmpty;
1790                         }
1791                 }
1792
1793                 public float PageScale {
1794                         get {
1795                                 float scale;
1796
1797                                 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
1798                                 GDIPlus.CheckStatus (status);
1799                                 return scale;
1800                         }
1801                         set {
1802                                 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
1803                                 GDIPlus.CheckStatus (status);
1804                         }
1805                 }
1806
1807                 public GraphicsUnit PageUnit {
1808                         get {
1809                                 GraphicsUnit unit;
1810                                 
1811                                 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
1812                                 GDIPlus.CheckStatus (status);
1813                                 return unit;
1814                         }
1815                         set {
1816                                 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
1817                                 GDIPlus.CheckStatus (status);
1818                         }
1819                 }
1820
1821                 public PixelOffsetMode PixelOffsetMode {
1822                         get {
1823                                 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
1824                                 
1825                                 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
1826                                 GDIPlus.CheckStatus (status);
1827                                 return pixelOffset;
1828                         }
1829                         set {
1830                                 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value); 
1831                                 GDIPlus.CheckStatus (status);
1832                         }
1833                 }
1834
1835                 public Point RenderingOrigin {
1836                         get {
1837                                 int x, y;
1838                                 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
1839                                 GDIPlus.CheckStatus (status);
1840                                 return new Point (x, y);
1841                         }
1842
1843                         set {
1844                                 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
1845                                 GDIPlus.CheckStatus (status);
1846                         }
1847                 }
1848
1849                 public SmoothingMode SmoothingMode {
1850                         get {
1851                                 SmoothingMode mode = SmoothingMode.Invalid;
1852
1853                                 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
1854                                 GDIPlus.CheckStatus (status);
1855                                 return mode;
1856                         }
1857
1858                         set {
1859                                 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
1860                                 GDIPlus.CheckStatus (status);
1861                         }
1862                 }
1863
1864                 public int TextContrast {
1865                         get {   
1866                                 int contrast;
1867                                         
1868                                 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
1869                                 GDIPlus.CheckStatus (status);
1870                                 return contrast;
1871                         }
1872
1873                         set {
1874                                 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
1875                                 GDIPlus.CheckStatus (status);
1876                         }
1877                 }
1878
1879                 public TextRenderingHint TextRenderingHint {
1880                         get {
1881                                 TextRenderingHint hint;
1882
1883                                 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
1884                                 GDIPlus.CheckStatus (status);
1885                                 return hint;        
1886                         }
1887
1888                         set {
1889                                 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
1890                                 GDIPlus.CheckStatus (status);
1891                         }
1892                 }
1893
1894                 public Matrix Transform {
1895                         get {
1896                                 Matrix matrix = new Matrix ();
1897                                 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
1898                                 GDIPlus.CheckStatus (status);
1899                                 return matrix;
1900                         }
1901                         set {
1902                                 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
1903                                 GDIPlus.CheckStatus (status);
1904                         }
1905                 }
1906
1907                 public RectangleF VisibleClipBounds {
1908                         get {
1909                                 RectangleF rect;
1910                                         
1911                                 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
1912                                 GDIPlus.CheckStatus (status);
1913                                 return rect;
1914                         }
1915                 }
1916         }
1917 }
1918