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