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