- Fixed pointer type
[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.CGContextFlush (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                         if (Environment.OSVersion.Platform == (PlatformID) 128)  {
1299                                 Rectangle rect  = new Rectangle (0,0, image.Width, image.Height);
1300                                 GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1301                         }
1302                                 
1303                         return result;
1304                 }
1305
1306                 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1307                 {
1308                         IntPtr graphics;
1309
1310                         Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1311                         GDIPlus.CheckStatus (s);
1312                         return new Graphics (graphics);
1313                 }
1314
1315                 [MonoTODO]
1316                 public static IntPtr GetHalftonePalette ()
1317                 {
1318                         throw new NotImplementedException ();
1319                 }
1320
1321                 [MonoTODO]
1322                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1323                 public IntPtr GetHdc ()
1324                 {
1325                         return nativeObject;
1326                 }
1327
1328                 
1329                 public Color GetNearestColor (Color color)
1330                 {
1331                         int argb;
1332                         
1333                         Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1334                         GDIPlus.CheckStatus (status);
1335
1336                         return Color.FromArgb (argb);
1337                 }
1338
1339                 
1340                 public void IntersectClip (Region region)
1341                 {
1342                         Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1343                         GDIPlus.CheckStatus (status);
1344                 }
1345                 
1346                 public void IntersectClip (RectangleF rect)
1347                 {
1348                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1349                         GDIPlus.CheckStatus (status);
1350                 }
1351
1352                 public void IntersectClip (Rectangle rect)
1353                 {                       
1354                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1355                         GDIPlus.CheckStatus (status);
1356                 }
1357
1358                 public bool IsVisible (Point point)
1359                 {
1360                         bool isVisible = false;
1361
1362                         Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1363                         GDIPlus.CheckStatus (status);
1364
1365                         return isVisible;
1366                 }
1367
1368                 
1369                 public bool IsVisible (RectangleF rect)
1370                 {
1371                         bool isVisible = false;
1372
1373                         Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1374                         GDIPlus.CheckStatus (status);
1375
1376                         return isVisible;
1377                 }
1378
1379                 public bool IsVisible (PointF point)
1380                 {
1381                         bool isVisible = false;
1382
1383                         Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1384                         GDIPlus.CheckStatus (status);
1385
1386                         return isVisible;
1387                 }
1388                 
1389                 public bool IsVisible (Rectangle rect)
1390                 {
1391                         bool isVisible = false;
1392
1393                         Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1394                         GDIPlus.CheckStatus (status);
1395
1396                         return isVisible;
1397                 }
1398                 
1399                 public bool IsVisible (float x, float y)
1400                 {
1401                         return IsVisible (new PointF (x, y));
1402                 }
1403                 
1404                 public bool IsVisible (int x, int y)
1405                 {
1406                         return IsVisible (new Point (x, y));
1407                 }
1408                 
1409                 public bool IsVisible (float x, float y, float width, float height)
1410                 {
1411                         return IsVisible (new RectangleF (x, y, width, height));
1412                 }
1413
1414                 
1415                 public bool IsVisible (int x, int y, int width, int height)
1416                 {
1417                         return IsVisible (new Rectangle (x, y, width, height));
1418                 }
1419
1420                 
1421                 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1422                 {       
1423                         Status status;                  
1424                         int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1425                         IntPtr[] native_regions = new IntPtr [regcount];
1426                         Region[] regions = new Region [regcount];
1427                         
1428                         for (int i = 0; i < regcount; i++) {
1429                                 regions[i] = new Region ();
1430                                 native_regions[i] = regions[i].NativeObject;
1431                         }
1432                         
1433                         status =  GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1434                                 font.NativeObject, ref layoutRect, stringFormat.NativeObject, 
1435                                 regcount, out native_regions[0]); 
1436                         
1437                         GDIPlus.CheckStatus (status);                           
1438                                                         
1439                         return regions;                                                 
1440                 }
1441
1442                 
1443                 public SizeF MeasureString (string text, Font font)
1444                 {
1445                         return MeasureString (text, font, new Size (0, 0));
1446                 }
1447
1448                 
1449                 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1450                 {
1451                         int charactersFitted, linesFilled;
1452                         RectangleF boundingBox = new RectangleF ();
1453                         RectangleF rect = new RectangleF (0, 0, layoutArea.Width,
1454                                                           layoutArea.Height);
1455
1456                         if (text == null || text.Length == 0)
1457                                 return SizeF.Empty;
1458
1459                         if (font == null)
1460                                 throw new ArgumentNullException ("font");
1461
1462                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1463                                                                    font.NativeObject, ref rect,
1464                                                                    IntPtr.Zero, out boundingBox,
1465                                                                    out charactersFitted, out linesFilled);
1466                         GDIPlus.CheckStatus (status);
1467
1468                         return new SizeF (boundingBox.Width, boundingBox.Height);
1469                 }
1470
1471                 
1472                 public SizeF MeasureString (string text, Font font, int width)
1473                 {                               
1474                         RectangleF boundingBox = new RectangleF ();
1475                         RectangleF rect = new RectangleF (0, 0, width, 999999);
1476                         int charactersFitted, linesFilled;
1477
1478                         if (text == null || text.Length == 0)
1479                                 return SizeF.Empty;
1480
1481                         if (font == null)
1482                                 throw new ArgumentNullException ("font");
1483
1484                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1485                                                                    font.NativeObject, ref rect,
1486                                                                    IntPtr.Zero, out boundingBox,
1487                                                                    out charactersFitted, out linesFilled);
1488                         GDIPlus.CheckStatus (status);
1489
1490                         return new SizeF (boundingBox.Width, boundingBox.Height);
1491                 }
1492
1493                 
1494                 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1495                                             StringFormat stringFormat)
1496                 {
1497                         int charactersFitted, linesFilled;                      
1498                         return MeasureString (text, font, layoutArea, stringFormat,
1499                                               out charactersFitted, out linesFilled);
1500                 }
1501
1502                 
1503                 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1504                 {
1505                         int charactersFitted, linesFilled;                      
1506                         return MeasureString (text, font, new SizeF (width, 999999), 
1507                                               format, out charactersFitted, out linesFilled);
1508                 }
1509
1510                 
1511                 public SizeF MeasureString (string text, Font font, PointF origin,
1512                                             StringFormat stringFormat)
1513                 {
1514                         RectangleF boundingBox = new RectangleF ();
1515                         RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
1516                         int charactersFitted, linesFilled;
1517
1518                         if (text == null || text.Length == 0)
1519                                 return SizeF.Empty;
1520
1521                         if (font == null)
1522                                 throw new ArgumentNullException ("font");
1523
1524                         if (stringFormat == null)
1525                                 stringFormat = new StringFormat ();
1526
1527                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1528                                                                    font.NativeObject, ref rect,
1529                                                                    stringFormat.NativeObject, 
1530                                                                    out boundingBox,
1531                                                                    out charactersFitted,
1532                                                                    out linesFilled);
1533                         GDIPlus.CheckStatus (status);
1534
1535                         return new SizeF (boundingBox.Width, boundingBox.Height);
1536                 }
1537
1538                 
1539                 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1540                                             StringFormat stringFormat, out int charactersFitted,
1541                                             out int linesFilled)
1542                 {       
1543                         RectangleF boundingBox = new RectangleF ();
1544                         RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1545                         charactersFitted = 0;
1546                         linesFilled = 0;
1547
1548                         if (text == null || text.Length == 0)
1549                                 return SizeF.Empty;
1550
1551                         if (font == null)
1552                                 throw new ArgumentNullException ("font");
1553
1554                         if (stringFormat == null)
1555                                 stringFormat = new StringFormat ();
1556
1557                         Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, 
1558                                                                    font.NativeObject, ref rect,
1559                                                                    stringFormat.NativeObject,
1560                                                                    out boundingBox,
1561                                                                    out charactersFitted,
1562                                                                    out linesFilled);
1563                         GDIPlus.CheckStatus (status);
1564
1565                         return new SizeF (boundingBox.Width, boundingBox.Height);
1566                 }
1567
1568                 public void MultiplyTransform (Matrix matrix)
1569                 {
1570                         MultiplyTransform (matrix, MatrixOrder.Prepend);
1571                 }
1572
1573                 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
1574                 {
1575                         Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject,
1576                                                                             matrix.nativeMatrix,
1577                                                                             order);
1578                         GDIPlus.CheckStatus (status);
1579                 }
1580
1581                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1582                 public void ReleaseHdc (IntPtr hdc)
1583                 {
1584                         Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
1585                         GDIPlus.CheckStatus (status);
1586                 }
1587
1588                 [MonoTODO]
1589                 [EditorBrowsable (EditorBrowsableState.Advanced)]
1590                 public void ReleaseHdcInternal (IntPtr hdc)
1591                 {
1592                         throw new NotImplementedException ();
1593                 }
1594
1595                 
1596                 public void ResetClip ()
1597                 {
1598                         Status status = GDIPlus.GdipResetClip (nativeObject);
1599                         GDIPlus.CheckStatus (status);
1600                 }
1601
1602                 public void ResetTransform ()
1603                 {
1604                         Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
1605                         GDIPlus.CheckStatus (status);
1606                 }
1607
1608                 public void Restore (GraphicsState gstate)
1609                 {
1610                         Transform = gstate.matrix.Clone ();
1611                         Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
1612                         GDIPlus.CheckStatus (status);
1613                 }
1614
1615
1616                 public void RotateTransform (float angle)
1617                 {
1618                         RotateTransform (angle, MatrixOrder.Prepend);
1619                 }
1620
1621                 public void RotateTransform (float angle, MatrixOrder order)
1622                 {
1623
1624                         Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
1625                         GDIPlus.CheckStatus (status);
1626                 }
1627
1628                 public GraphicsState Save ()
1629                 {
1630                         GraphicsState state = new GraphicsState ();
1631                         state.matrix = Transform.Clone ();
1632                         uint saveState;
1633                         Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
1634                         GDIPlus.CheckStatus (status);
1635
1636                         state.nativeState = saveState;
1637                         return state;
1638                 }
1639
1640                 public void ScaleTransform (float sx, float sy)
1641                 {
1642                         ScaleTransform (sx, sy, MatrixOrder.Prepend);
1643                 }
1644
1645                 public void ScaleTransform (float sx, float sy, MatrixOrder order)
1646                 {
1647                         Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
1648                         GDIPlus.CheckStatus (status);
1649                 }
1650
1651                 
1652                 public void SetClip (RectangleF rect)
1653                 {
1654                         SetClip (rect, CombineMode.Replace);
1655                 }
1656
1657                 
1658                 public void SetClip (GraphicsPath path)
1659                 {
1660                         SetClip (path, CombineMode.Replace);
1661                 }
1662
1663                 
1664                 public void SetClip (Rectangle rect)
1665                 {
1666                         SetClip (rect, CombineMode.Replace);
1667                 }
1668
1669                 
1670                 public void SetClip (Graphics g)
1671                 {
1672                         SetClip (g, CombineMode.Replace);
1673                 }
1674
1675                 
1676                 public void SetClip (Graphics g, CombineMode combineMode)
1677                 {
1678                         Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
1679                         GDIPlus.CheckStatus (status);
1680                 }
1681
1682                 
1683                 public void SetClip (Rectangle rect, CombineMode combineMode)
1684                 {
1685                         Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1686                         GDIPlus.CheckStatus (status);
1687                 }
1688
1689                 
1690                 public void SetClip (RectangleF rect, CombineMode combineMode)
1691                 {
1692                         Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1693                         GDIPlus.CheckStatus (status);
1694                 }
1695
1696                 
1697                 public void SetClip (Region region, CombineMode combineMode)
1698                 {
1699                         Status status =   GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode); 
1700                         GDIPlus.CheckStatus (status);
1701                 }
1702
1703                 
1704                 public void SetClip (GraphicsPath path, CombineMode combineMode)
1705                 {
1706                         Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
1707                         GDIPlus.CheckStatus (status);
1708                 }
1709
1710                 
1711                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1712                 {
1713                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
1714             
1715                         Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
1716                         GDIPlus.CheckStatus (status);
1717                         
1718                         GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
1719                 }
1720
1721
1722                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1723                 {                                               
1724                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
1725             
1726                         Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1727                         GDIPlus.CheckStatus (status);
1728                         
1729                         GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
1730                 }
1731
1732                 
1733                 public void TranslateClip (int dx, int dy)
1734                 {
1735                         Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
1736                         GDIPlus.CheckStatus (status);
1737                 }
1738
1739                 
1740                 public void TranslateClip (float dx, float dy)
1741                 {
1742                         Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
1743                         GDIPlus.CheckStatus (status);
1744                 }
1745
1746                 public void TranslateTransform (float dx, float dy)
1747                 {
1748                         TranslateTransform (dx, dy, MatrixOrder.Prepend);
1749                 }
1750
1751                 
1752                 public void TranslateTransform (float dx, float dy, MatrixOrder order)
1753                 {                       
1754                         Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
1755                         GDIPlus.CheckStatus (status);
1756                 }
1757
1758                 public Region Clip {
1759                         get {
1760                                 Region reg = new Region();
1761                                 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
1762                                 GDIPlus.CheckStatus (status);
1763                                 return reg;                             
1764                         }
1765                         set {
1766                                 SetClip (value, CombineMode.Replace);
1767                         }
1768                 }
1769
1770                 public RectangleF ClipBounds {
1771                         get {
1772                                 RectangleF rect = new RectangleF ();
1773                                 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
1774                                 GDIPlus.CheckStatus (status);
1775                                 return rect;
1776                         }
1777                 }
1778
1779                 public CompositingMode CompositingMode {
1780                         get {
1781                                 CompositingMode mode;
1782                                 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
1783                                 GDIPlus.CheckStatus (status);
1784
1785                                 return mode;
1786                         }
1787                         set {
1788                                 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
1789                                 GDIPlus.CheckStatus (status);
1790                         }
1791
1792                 }
1793
1794                 public CompositingQuality CompositingQuality {
1795                         get {
1796                                 CompositingQuality quality;
1797
1798                                 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
1799                                 GDIPlus.CheckStatus (status);
1800                                 return quality;
1801                         }
1802                         set {
1803                                 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
1804                                 GDIPlus.CheckStatus (status);
1805                         }
1806                 }
1807
1808                 public float DpiX {
1809                         get {
1810                                 float x;
1811
1812                                 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
1813                                 GDIPlus.CheckStatus (status);
1814                                 return x;
1815                         }
1816                 }
1817
1818                 public float DpiY {
1819                         get {
1820                                 float y;
1821
1822                                 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
1823                                 GDIPlus.CheckStatus (status);
1824                                 return y;
1825                         }
1826                 }
1827
1828                 public InterpolationMode InterpolationMode {
1829                         get {                           
1830                                 InterpolationMode imode = InterpolationMode.Invalid;
1831                                 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
1832                                 GDIPlus.CheckStatus (status);
1833                                 return imode;
1834                         }
1835                         set {
1836                                 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
1837                                 GDIPlus.CheckStatus (status);
1838                         }
1839                 }
1840
1841                 public bool IsClipEmpty {
1842                         get {
1843                                 bool isEmpty = false;
1844
1845                                 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
1846                                 GDIPlus.CheckStatus (status);
1847                                 return isEmpty;
1848                         }
1849                 }
1850
1851                 public bool IsVisibleClipEmpty {
1852                         get {
1853                                 bool isEmpty = false;
1854
1855                                 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
1856                                 GDIPlus.CheckStatus (status);
1857                                 return isEmpty;
1858                         }
1859                 }
1860
1861                 public float PageScale {
1862                         get {
1863                                 float scale;
1864
1865                                 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
1866                                 GDIPlus.CheckStatus (status);
1867                                 return scale;
1868                         }
1869                         set {
1870                                 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
1871                                 GDIPlus.CheckStatus (status);
1872                         }
1873                 }
1874
1875                 public GraphicsUnit PageUnit {
1876                         get {
1877                                 GraphicsUnit unit;
1878                                 
1879                                 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
1880                                 GDIPlus.CheckStatus (status);
1881                                 return unit;
1882                         }
1883                         set {
1884                                 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
1885                                 GDIPlus.CheckStatus (status);
1886                         }
1887                 }
1888
1889                 public PixelOffsetMode PixelOffsetMode {
1890                         get {
1891                                 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
1892                                 
1893                                 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
1894                                 GDIPlus.CheckStatus (status);
1895                                 return pixelOffset;
1896                         }
1897                         set {
1898                                 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value); 
1899                                 GDIPlus.CheckStatus (status);
1900                         }
1901                 }
1902
1903                 public Point RenderingOrigin {
1904                         get {
1905                                 int x, y;
1906                                 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
1907                                 GDIPlus.CheckStatus (status);
1908                                 return new Point (x, y);
1909                         }
1910
1911                         set {
1912                                 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
1913                                 GDIPlus.CheckStatus (status);
1914                         }
1915                 }
1916
1917                 public SmoothingMode SmoothingMode {
1918                         get {
1919                                 SmoothingMode mode = SmoothingMode.Invalid;
1920
1921                                 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
1922                                 GDIPlus.CheckStatus (status);
1923                                 return mode;
1924                         }
1925
1926                         set {
1927                                 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
1928                                 GDIPlus.CheckStatus (status);
1929                         }
1930                 }
1931
1932                 public int TextContrast {
1933                         get {   
1934                                 int contrast;
1935                                         
1936                                 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
1937                                 GDIPlus.CheckStatus (status);
1938                                 return contrast;
1939                         }
1940
1941                         set {
1942                                 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
1943                                 GDIPlus.CheckStatus (status);
1944                         }
1945                 }
1946
1947                 public TextRenderingHint TextRenderingHint {
1948                         get {
1949                                 TextRenderingHint hint;
1950
1951                                 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
1952                                 GDIPlus.CheckStatus (status);
1953                                 return hint;        
1954                         }
1955
1956                         set {
1957                                 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
1958                                 GDIPlus.CheckStatus (status);
1959                         }
1960                 }
1961
1962                 public Matrix Transform {
1963                         get {
1964                                 Matrix matrix = new Matrix ();
1965                                 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
1966                                 GDIPlus.CheckStatus (status);
1967                                 return matrix;
1968                         }
1969                         set {
1970                                 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
1971                                 GDIPlus.CheckStatus (status);
1972                         }
1973                 }
1974
1975                 public RectangleF VisibleClipBounds {
1976                         get {
1977                                 RectangleF rect;
1978                                         
1979                                 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
1980                                 GDIPlus.CheckStatus (status);
1981                                 return rect;
1982                         }
1983                 }
1984         }
1985 }
1986