units font support
[mono.git] / mcs / class / System.Drawing / System.Drawing / Graphics.cs
1 //
2 // System.Drawing.Graphics.cs
3 //
4 // (C) 2003 Ximian, Inc.  http://www.ximian.com
5 //
6 // Authors:
7 //      Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
8 //      Alexandre Pigolkine(pigolkine@gmx.de)
9 //              Jordi Mas i Hernandez (jordi@ximian.com)
10 //
11 using System;
12 using System.Drawing.Drawing2D;
13 using System.Drawing.Imaging;
14 using System.Drawing.Text;
15 using System.Runtime.InteropServices;
16 using System.Text;
17
18 namespace System.Drawing
19 {
20         [ComVisible(false)]
21         public sealed class Graphics : MarshalByRefObject, IDisposable
22         {
23                 internal IntPtr nativeObject = IntPtr.Zero;
24                 internal static float defDpiX = 0;
25                 internal static float defDpiY = 0;
26                 
27                 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
28                                                             int flags,
29                                                             int dataSize,
30                                                             IntPtr data,
31                                                             PlayRecordCallback callbackData);
32                 
33                 public delegate bool DrawImageAbort (IntPtr callbackData);
34
35                 private Graphics (IntPtr nativeGraphics)
36                 {
37                         nativeObject = nativeGraphics;
38                 }
39                 
40                 static internal float systemDpiX {
41                         get {                                   
42                                         if (defDpiX==0) {
43                                                 Bitmap bmp = new Bitmap(1,1);
44                                                 Graphics g = Graphics.FromImage(bmp);   
45                                         defDpiX = g.DpiX;
46                                 }
47                                 return defDpiX;
48                         }
49                 }
50
51                 public float systemDpiY {
52                         get {
53                                         if (defDpiY==0) {
54                                                 Bitmap bmp = new Bitmap(1,1);
55                                                 Graphics g = Graphics.FromImage(bmp);   
56                                         defDpiY = g.DpiY;
57                                 }
58                                 return defDpiY;
59                         }
60                 }
61                 
62                 internal IntPtr NativeObject {
63                         get{
64                                 return nativeObject;
65                         }
66
67                         set {
68                                 nativeObject = value;
69                         }
70                 }
71
72                 [MonoTODO]
73                 public void AddMetafileComment (byte [] data)
74                 {
75                         throw new NotImplementedException ();
76                 }
77
78                 
79                 public GraphicsContainer BeginContainer ()
80                 {
81                         int state;
82
83                         GDIPlus.GdipBeginContainer2 (nativeObject, out state);
84                 
85                         return new GraphicsContainer(state);
86                 }
87                 
88                 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
89                 {
90                         int state;
91
92                         GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);          
93                 
94                         return new GraphicsContainer (state);
95                 }
96
97                 
98                 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
99                 {
100                         int state;
101
102                         GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);           
103                 
104                         return new GraphicsContainer (state);
105                 }
106
107                 
108                 public void Clear (Color color)
109                 {                       
110                         GDIPlus.GdipGraphicsClear(nativeObject, color.ToArgb());                        
111                 }
112
113                 [MonoTODO]
114                 public void Dispose ()
115                 {
116                 }
117
118                 
119                 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
120                 {
121                         DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
122                 }
123
124                 
125                 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
126                 {
127                         DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
128                 }
129
130                 
131                 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
132                 {
133                         GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
134                                         x, y, width, height, startAngle, sweepAngle);                        
135                 }
136
137                 public void DrawArc (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
138                 {                       
139                         GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
140                                         x, y, width, height, startAngle, sweepAngle);
141                                                     
142                 }
143
144                 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
145                 {
146                         GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, 
147                                         pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);                                     
148                         
149                 }
150
151                 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
152                 {
153                         GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject, 
154                                         pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);                                        
155                 
156                 }
157
158                 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
159                 {
160                         GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1, y1, x2, y2, x3, y3, x4, y4);
161                 }
162
163                 [MonoTODO]
164                 public void DrawBeziers (Pen pen, Point [] points)
165                 {
166                         int length = points.Length;
167
168                         if (length < 3)
169                                 return;
170
171                         for (int i = 0; i < length; i += 3) {
172                                 Point p1 = points [i];
173                                 Point p2 = points [i + 1];
174                                 Point p3 = points [i + 2];
175                                 Point p4 = points [i + 3];
176
177                                 GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
178                                                         p1.X, p1.Y, p2.X, p2.Y, 
179                                                         p3.X, p3.Y, p4.X, p4.Y);
180                         }
181                 }
182
183                 [MonoTODO]
184                 public void DrawBeziers (Pen pen, PointF [] points)
185                 {
186                         int length = points.Length;
187
188                         if (length < 3)
189                                 return;
190
191                         for (int i = 0; i < length; i += 3) {
192                                 PointF p1 = points [i];
193                                 PointF p2 = points [i + 1];
194                                 PointF p3 = points [i + 2];
195                                 PointF p4 = points [i + 3];
196
197                                 GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
198                                                         p1.X, p1.Y, p2.X, p2.Y, 
199                                                         p3.X, p3.Y, p4.X, p4.Y);
200                         }
201                 }
202
203                 
204                 public void DrawClosedCurve (Pen pen, PointF [] points)
205                 {
206                         GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
207                 }
208                 
209                 public void DrawClosedCurve (Pen pen, Point [] points)
210                 {
211                         GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);                   
212                 }
213                         
214                 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
215                 {
216                         GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension); 
217                 }
218                 
219                 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
220                 {
221                         GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
222                 }
223                 
224                 public void DrawCurve (Pen pen, Point [] points)
225                 {
226                         GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);                 
227                 }
228                 
229                 public void DrawCurve (Pen pen, PointF [] points)
230                 {
231                         GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);                          
232                         
233                 }
234                 
235                 public void DrawCurve (Pen pen, PointF [] points, float tension)
236                 {                       
237                         GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);                
238                         
239                 }
240                 
241                 public void DrawCurve (Pen pen, Point [] points, float tension)
242                 {
243                         GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);               
244                         
245                 }
246                 
247                 [MonoTODO]
248                 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
249                 {
250                         
251                 }
252
253                 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
254                 {
255                         GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject, points, points.Length,
256                                         offset, numberOfSegments, tension);
257                 }
258
259                 
260                 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
261                 {
262                         GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject, points, points.Length, 
263                                         offset, numberOfSegments, tension);
264                 }
265
266                 public void DrawEllipse (Pen pen, Rectangle rect)
267                 {
268                         DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
269                 }
270
271                 public void DrawEllipse (Pen pen, RectangleF rect)
272                 {
273                         DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
274                 }
275
276                 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
277                 {
278                         GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
279                 }
280
281                 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
282                 {
283                         GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height); 
284                 }
285
286                 [MonoTODO]
287                 public void DrawIcon (Icon icon, Rectangle targetRect)
288                 {
289                         throw new NotImplementedException ();
290                 }
291
292                 [MonoTODO]
293                 public void DrawIcon (Icon icon, int x, int y)
294                 {
295                         throw new NotImplementedException ();
296                 }
297
298                 [MonoTODO]
299                 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
300                 {
301                         throw new NotImplementedException ();
302                 }
303                 
304                 public void DrawImage (Image image, RectangleF rect)
305                 {
306                         GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y,
307                            rect.Width, rect.Height);
308                 }
309
310                 
311                 public void DrawImage (Image image, PointF point)
312                 {
313                         GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);                     
314                 }
315
316                 
317                 public void DrawImage (Image image, Point [] destPoints)
318                 {
319                         GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
320                 }
321
322                 
323                 public void DrawImage (Image image, Point point)
324                 {
325                         DrawImage (image, point.X, point.Y);
326                 }
327
328                 
329                 public void DrawImage (Image image, Rectangle rect)
330                 {
331                         DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
332                 }
333
334                 
335                 public void DrawImage (Image image, PointF [] destPoints)
336                 {
337                         GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
338                 }
339
340                 
341                 public void DrawImage (Image image, int x, int y)
342                 {
343                         GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
344                 }
345
346                 
347                 public void DrawImage (Image image, float x, float y)
348                 {
349                         GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
350                 }
351
352                 [MonoTODO]
353                 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
354                 {
355                         throw new NotImplementedException ();
356                 }
357
358                 [MonoTODO]
359                 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
360                 {
361                         throw new NotImplementedException ();
362                 }
363
364                 [MonoTODO]
365                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
366                 {
367                         throw new NotImplementedException ();
368                 }
369
370                 [MonoTODO]
371                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
372                 {
373                         throw new NotImplementedException ();
374                 }
375
376                 [MonoTODO]
377                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
378                                 ImageAttributes imageAttr)
379                 {
380                         throw new NotImplementedException ();
381                 }
382                 
383                 public void DrawImage (Image image, float x, float y, float width, float height)
384                 {
385                         GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
386                            width, height);
387                 }
388
389                 [MonoTODO]
390                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
391                                 ImageAttributes imageAttr)
392                 {
393                         throw new NotImplementedException ();
394                 }
395
396                 [MonoTODO]
397                 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
398                 {
399                         throw new NotImplementedException ();
400                 }
401                 
402                 public void DrawImage (Image image, int x, int y, int width, int height)
403                 {
404                         GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
405                 }
406
407                 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
408                 {
409                         GDIPlus.GdipDrawImagePointRect(nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);                                                            
410                 }
411
412                 [MonoTODO]
413                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
414                                 ImageAttributes imageAttr, DrawImageAbort callback)
415                 {
416                         throw new NotImplementedException ();
417                 }
418
419                 [MonoTODO]
420                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
421                                 ImageAttributes imageAttr, DrawImageAbort callback)
422                 {
423                         throw new NotImplementedException ();
424                 }
425
426                 [MonoTODO]
427                 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, 
428                                 ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
429                 {
430                         throw new NotImplementedException ();
431                 }
432
433                 [MonoTODO]
434                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
435                                 GraphicsUnit srcUnit)
436                 {
437                         throw new NotImplementedException ();
438                 }
439
440                 [MonoTODO]
441                 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, 
442                                 ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
443                 {
444                         throw new NotImplementedException ();
445                 }
446
447                 [MonoTODO]
448                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, 
449                                 GraphicsUnit srcUnit)
450                 {
451                         throw new NotImplementedException ();
452                 }
453
454                 [MonoTODO]
455                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, 
456                                 GraphicsUnit srcUnit, ImageAttributes imageAttrs)
457                 {
458                         throw new NotImplementedException ();
459                 }
460                 
461                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, 
462                                 GraphicsUnit srcUnit, ImageAttributes imageAttr)
463                 {                       
464                         GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject, 
465                                         destRect.X, destRect.Y, destRect.Width, destRect.Height,
466                                         srcX, srcY, srcWidth, srcHeight, srcUnit, imageAttr.NativeObject, IntPtr.Zero, 0);
467  
468                 }
469
470                 [MonoTODO]
471                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight,
472                                 GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
473                 {
474                         throw new NotImplementedException ();
475                 }
476
477                 [MonoTODO]
478                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
479                                 GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)
480                 {
481                         throw new NotImplementedException ();
482                 }
483
484                 [MonoTODO]
485                 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight,
486                                 GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
487                 {
488                         throw new NotImplementedException ();
489                 }
490
491                 [MonoTODO]
492                 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, 
493                                 GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
494                 {
495                         throw new NotImplementedException ();
496                 }               
497                 
498                 public void DrawImageUnscaled (Image image, Point point)
499                 {
500                         DrawImage(image, point.X, point.Y);
501                 }
502                 
503                 public void DrawImageUnscaled (Image image, Rectangle rect)
504                 {
505                         DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
506                 }
507                 
508                 public void DrawImageUnscaled (Image image, int x, int y)
509                 {
510                         DrawImage(image, x, y);
511                 }
512
513                 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
514                 {
515                         DrawImage(image, x, y, width, height);
516                 }
517
518                 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
519                 {
520                         GDIPlus.GdipDrawLine (
521                                 nativeObject, pen.nativeObject,
522                                 pt1.X, pt1.Y,
523                                 pt2.X, pt2.Y);                             
524                                 
525                 }
526
527                 public void DrawLine (Pen pen, Point pt1, Point pt2)
528                 {
529                         GDIPlus.GdipDrawLineI (
530                                 nativeObject, pen.nativeObject,
531                                 pt1.X, pt1.Y,
532                                 pt2.X, pt2.Y);                           
533                 }
534
535                 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
536                 {
537                         GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);                 
538                 }
539
540                 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
541                 {
542                         GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);  
543                 }
544
545                 public void DrawLines (Pen pen, PointF [] points)
546                 {
547                         GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);  
548                 }
549
550                 public void DrawLines (Pen pen, Point [] points)
551                 {
552                         GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);                 
553                 }
554
555                 public void DrawPath (Pen pen, GraphicsPath path)
556                 {
557                         GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
558                 }
559                 
560                 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
561                 {
562                         DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
563                 }
564                 
565                 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
566                 {
567                         DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
568                 }
569                 
570                 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
571                 {
572                         GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
573                 }
574                 
575                 public void DrawPie (Pen pen, int x, int y, int width, int height, float startAngle, float sweepAngle)
576                 {
577                         GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
578                 }
579
580                 public void DrawPolygon (Pen pen, Point [] points)
581                 {
582                         GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
583                 }
584
585                 public void DrawPolygon (Pen pen, PointF [] points)
586                 {
587                         GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
588                 }
589
590                 public void DrawRectangle (Pen pen, RectangleF rect)
591                 {
592                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
593                 }
594
595                 public void DrawRectangle (Pen pen, Rectangle rect)
596                 {
597                         DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
598                 }
599
600                 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
601                 {
602                         GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
603                 }
604
605                 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
606                 {
607                         GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
608                 }
609
610                 public void DrawRectangles (Pen pen, RectangleF [] rects)
611                 {
612                         foreach (RectangleF rc in rects)
613                                 DrawRectangle (pen, rc.Left, rc.Top, rc.Width, rc.Height);
614                 }
615
616                 public void DrawRectangles (Pen pen, Rectangle [] rects)
617                 {
618                         foreach (RectangleF rc in rects)
619                                 DrawRectangle(pen, rc.Left, rc.Top, rc.Width, rc.Height);
620                 }
621
622                 
623                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
624                 {                       
625                         GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);                     
626                 }
627                 
628                 public void DrawString (string s, Font font, Brush brush, PointF point)
629                 {
630                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
631                         GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
632                 }
633                 
634                 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
635                 {
636                         RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
637                         GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, format.NativeObject, brush.nativeObject);
638                 }
639                 
640                 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
641                 {
642                         GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, 
643                                 format.NativeObject, brush.nativeObject);
644                 }
645
646                 public void DrawString (string s, Font font, Brush brush, float x, float y)
647                 {
648                         Console.WriteLine ("DrawString!");
649                         RectangleF rc = new RectangleF (x, y, 0, 0);
650                         
651                         GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, 
652                                 ref rc, IntPtr.Zero, brush.nativeObject);                       
653                 }
654
655                 [MonoTODO]
656                 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
657                 {
658                         //throw new NotImplementedException ();
659                 }
660
661                 
662                 public void EndContainer (GraphicsContainer container)
663                 {
664                         GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
665                 }
666
667                 [MonoTODO]
668                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
669                 {
670                         throw new NotImplementedException ();
671                 }
672
673                 [MonoTODO]
674                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
675                 {
676                         throw new NotImplementedException ();
677                 }
678
679                 [MonoTODO]
680                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
681                 {
682                         throw new NotImplementedException ();
683                 }
684
685                 [MonoTODO]
686                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
687                 {
688                         throw new NotImplementedException ();
689                 }
690
691                 [MonoTODO]
692                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
693                 {
694                         throw new NotImplementedException ();
695                 }
696
697                 [MonoTODO]
698                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
699                 {
700                         throw new NotImplementedException ();
701                 }
702
703                 [MonoTODO]
704                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
705                 {
706                         throw new NotImplementedException ();
707                 }
708
709                 [MonoTODO]
710                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
711                 {
712                         throw new NotImplementedException ();
713                 }
714
715                 [MonoTODO]
716                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
717                 {
718                         throw new NotImplementedException ();
719                 }
720
721                 [MonoTODO]
722                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
723                 {
724                         throw new NotImplementedException ();
725                 }
726
727                 [MonoTODO]
728                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
729                 {
730                         throw new NotImplementedException ();
731                 }
732
733                 [MonoTODO]
734                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
735                 {
736                         throw new NotImplementedException ();
737                 }
738
739                 [MonoTODO]
740                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
741                 {
742                         throw new NotImplementedException ();
743                 }
744
745                 [MonoTODO]
746                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
747                 {
748                         throw new NotImplementedException ();
749                 }
750
751                 [MonoTODO]
752                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
753                 {
754                         throw new NotImplementedException ();
755                 }
756
757                 [MonoTODO]
758                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
759                 {
760                         throw new NotImplementedException ();
761                 }
762
763                 [MonoTODO]
764                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
765                 {
766                         throw new NotImplementedException ();
767                 }
768
769                 [MonoTODO]
770                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
771                 {
772                         throw new NotImplementedException ();
773                 }
774
775                 [MonoTODO]
776                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
777                 {
778                         throw new NotImplementedException ();
779                 }
780
781                 [MonoTODO]
782                 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
783                 {
784                         throw new NotImplementedException ();
785                 }
786
787                 [MonoTODO]
788                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
789                 {
790                         throw new NotImplementedException ();
791                 }
792
793                 [MonoTODO]
794                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
795                 {
796                         throw new NotImplementedException ();
797                 }
798
799                 [MonoTODO]
800                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
801                 {
802                         throw new NotImplementedException ();
803                 }
804
805                 [MonoTODO]
806                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
807                 {
808                         throw new NotImplementedException ();
809                 }
810
811                 [MonoTODO]
812                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
813                 {
814                         throw new NotImplementedException ();
815                 }
816
817                 [MonoTODO]
818                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
819                 {
820                         throw new NotImplementedException ();
821                 }
822
823                 [MonoTODO]
824                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
825                 {
826                         throw new NotImplementedException ();
827                 }
828
829                 [MonoTODO]
830                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
831                 {
832                         throw new NotImplementedException ();
833                 }
834
835                 [MonoTODO]
836                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
837                 {
838                         throw new NotImplementedException ();
839                 }
840
841                 [MonoTODO]
842                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
843                 {
844                         throw new NotImplementedException ();
845                 }
846
847                 [MonoTODO]
848                 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
849                 {
850                         throw new NotImplementedException ();
851                 }
852
853                 [MonoTODO]
854                 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
855                 {
856                         throw new NotImplementedException ();
857                 }
858
859                 [MonoTODO]
860                 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
861                 {
862                         throw new NotImplementedException ();
863                 }
864
865                 [MonoTODO]
866                 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
867                 {
868                         throw new NotImplementedException ();
869                 }
870
871                 [MonoTODO]
872                 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
873                 {
874                         throw new NotImplementedException ();
875                 }
876
877                 [MonoTODO]
878                 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
879                 {
880                         throw new NotImplementedException ();
881                 }
882         
883                 public void ExcludeClip (Rectangle rect)
884                 {
885                         GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);    
886                 }
887
888                 [MonoTODO]
889                 public void ExcludeClip (Region region)
890                 {
891                         throw new NotImplementedException ();
892                 }
893
894                 
895                 public void FillClosedCurve (Brush brush, PointF [] points)
896                 {
897                        GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
898                 }
899
900                 
901                 public void FillClosedCurve (Brush brush, Point [] points)
902                 {
903                         GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
904                 }
905
906                 
907                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
908                 {
909                         FillClosedCurve (brush, points, fillmode, 0.5f);
910                 }
911                 
912                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
913                 {
914                         FillClosedCurve (brush, points, fillmode, 0.5f);
915                 }
916
917                 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
918                 {
919                         GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
920                 }
921
922                 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
923                 {
924                         GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
925                 }
926
927                 public void FillEllipse (Brush brush, Rectangle rect)
928                 {
929                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
930                 }
931
932                 public void FillEllipse (Brush brush, RectangleF rect)
933                 {
934                         FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
935                 }
936
937                 public void FillEllipse (Brush brush, float x, float y, float width, float height)
938                 {
939                         GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
940                 }
941
942                 public void FillEllipse (Brush brush, int x, int y, int width, int height)
943                 {
944                         GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
945                 }
946
947                 public void FillPath (Brush brush, GraphicsPath path)
948                 {
949                         GDIPlus.GdipFillPath (nativeObject, brush.NativeObject,  path.NativeObject);
950                 }
951
952                 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
953                 {
954                         GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height,
955                                         startAngle, sweepAngle);
956                 }
957
958                 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
959                 {
960                         GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
961                 }
962
963                 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
964                 {
965                         GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
966                 }
967
968                 public void FillPolygon (Brush brush, PointF [] points)
969                 {
970                         GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
971                 }
972
973                 public void FillPolygon (Brush brush, Point [] points)
974                 {
975                         GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
976                 }
977
978                 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
979                 {
980                         GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
981                 }
982
983                 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
984                 {
985                         GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
986                 }
987
988                 public void FillRectangle (Brush brush, RectangleF rect)
989                 {
990                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
991                 }
992
993                 public void FillRectangle (Brush brush, Rectangle rect)
994                 {
995                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
996                 }
997
998                 public void FillRectangle (Brush brush, int x, int y, int width, int height)
999                 {
1000                         GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, (float)x, (float)y, (float)width, (float)height);
1001                 }
1002
1003                 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1004                 {
1005                         GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1006                 }
1007
1008                 public void FillRectangles (Brush brush, Rectangle [] rects)
1009                 {
1010                         foreach (Rectangle rc in rects)
1011                                 FillRectangle(brush, rc);
1012                 }
1013
1014                 public void FillRectangles (Brush brush, RectangleF [] rects)
1015                 {
1016                         foreach (RectangleF rc in rects)
1017                                 FillRectangle(brush, rc);
1018                 }
1019
1020                 [MonoTODO]
1021                 public void FillRegion (Brush brush, Region region)
1022                 {
1023                         throw new NotImplementedException ();
1024                 }
1025
1026                 [MonoTODO]
1027                 public void Flush ()
1028                 {
1029                         Flush (FlushIntention.Flush);
1030                 }
1031
1032                 [MonoTODO]
1033                 public void Flush (FlushIntention intention)
1034                 {
1035                         throw new NotImplementedException ();
1036                 }
1037
1038                 
1039                 public static Graphics FromHdc (IntPtr hdc)
1040                 {
1041                         int graphics;
1042                         GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1043                         Graphics result = new Graphics ((IntPtr) graphics);
1044                         return result;
1045                 }
1046
1047                 [MonoTODO]
1048                 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1049                 {
1050                         throw new NotImplementedException ();
1051                 }
1052
1053                 [MonoTODO]
1054                 public static Graphics FromHdcInternal (IntPtr hdc)
1055                 {
1056                         throw new NotImplementedException ();
1057                 }
1058                 
1059                 public static Graphics FromHwnd (IntPtr hwnd)
1060                 {
1061                         IntPtr graphics;
1062                         
1063                         GDIPlus.GdipCreateFromHWND (hwnd, out graphics);                        
1064                         
1065                         return new Graphics (graphics); 
1066                 }
1067
1068                 [MonoTODO]
1069                 public static Graphics FromHwndInternal (IntPtr hwnd)
1070                 {
1071                         throw new NotImplementedException ();
1072                 }
1073
1074                 [MonoTODO]
1075                 public static Graphics FromImage (Image image)
1076                 {
1077                         if (image == null) throw new ArgumentException ();
1078                         int graphics;
1079                         GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1080                         Graphics result = new Graphics ((IntPtr) graphics);
1081                         return result;
1082                 }
1083
1084                 [MonoTODO]
1085                 public static IntPtr GetHalftonePalette ()
1086                 {
1087                         throw new NotImplementedException ();
1088                 }
1089
1090                 [MonoTODO]
1091                 public IntPtr GetHdc ()
1092                 {
1093                         int hdc;
1094                         GDIPlus.GdipGetDC (nativeObject, out hdc);
1095                         return (IntPtr) hdc;
1096                 }
1097
1098                 
1099                 public Color GetNearestColor (Color color)
1100                 {
1101                         int argb;
1102                         
1103                         GDIPlus.GdipGetNearestColor (nativeObject, out argb);                   
1104                         return Color.FromArgb (argb);
1105                 }
1106
1107                 [MonoTODO]
1108                 public void IntersectClip (Region region)
1109                 {
1110                         throw new NotImplementedException ();
1111                 }
1112                 
1113                 public void IntersectClip (RectangleF rect)
1114                 {
1115                         GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1116                 }
1117
1118                 public void IntersectClip (Rectangle rect)
1119                 {                       
1120                         GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1121                 }
1122
1123                 public bool IsVisible (Point point)
1124                 {
1125                         bool isVisible = false;
1126
1127                         GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1128
1129                         return isVisible;
1130                 }
1131
1132                 
1133                 public bool IsVisible (RectangleF rect)
1134                 {
1135                         bool isVisible = false;
1136
1137                         GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1138
1139                         return isVisible;
1140                 }
1141
1142                 public bool IsVisible (PointF point)
1143                 {
1144                         bool isVisible = false;
1145
1146                         GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1147
1148                         return isVisible;
1149                 }
1150                 
1151                 public bool IsVisible (Rectangle rect)
1152                 {
1153                         bool isVisible = false;
1154
1155                         GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1156
1157                         return isVisible;
1158                 }
1159                 
1160                 public bool IsVisible (float x, float y)
1161                 {
1162                         return IsVisible (new PointF (x, y));
1163                 }
1164                 
1165                 public bool IsVisible (int x, int y)
1166                 {
1167                         return IsVisible (new Point (x, y));
1168                 }
1169                 
1170                 public bool IsVisible (float x, float y, float width, float height)
1171                 {
1172                         return IsVisible (new RectangleF (x, y, width, height));
1173                 }
1174
1175                 
1176                 public bool IsVisible (int x, int y, int width, int height)
1177                 {
1178                         return IsVisible (new Rectangle (x, y, width, height));
1179                 }
1180
1181                 [MonoTODO]
1182                 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1183                 {
1184                         throw new NotImplementedException ();
1185                 }
1186
1187                 [MonoTODO]
1188                 public SizeF MeasureString (string text, Font font)
1189                 {
1190                         throw new NotImplementedException ();
1191                 }
1192
1193                 [MonoTODO]
1194                 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1195                 {
1196                         throw new NotImplementedException ();
1197                 }
1198
1199                 [MonoTODO]
1200                 public SizeF MeasureString (string text, Font font, int width)
1201                 {
1202                         throw new NotImplementedException ();
1203                 }
1204
1205                 [MonoTODO]
1206                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
1207                 {
1208                         throw new NotImplementedException ();
1209                 }
1210
1211                 [MonoTODO]
1212                 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1213                 {
1214                         throw new NotImplementedException ();
1215                 }
1216
1217                 [MonoTODO]
1218                 public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
1219                 {
1220                         throw new NotImplementedException ();
1221                 }
1222
1223                 [MonoTODO]
1224                 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, 
1225                                 out int charactersFitted, out int linesFilled)
1226                 {
1227                         throw new NotImplementedException ();
1228                 }
1229
1230                 public void MultiplyTransform (Matrix matrix)
1231                 {
1232                         MultiplyTransform (matrix, MatrixOrder.Prepend);
1233                 }
1234
1235                 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
1236                 {
1237                         GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
1238                 }
1239                 
1240                 public void ReleaseHdc (IntPtr hdc)
1241                 {
1242                         GDIPlus.GdipReleaseDC (nativeObject, hdc);
1243                 }
1244
1245                 [MonoTODO]
1246                 public void ReleaseHdcInternal (IntPtr hdc)
1247                 {
1248                         throw new NotImplementedException ();
1249                 }
1250
1251                 
1252                 public void ResetClip ()
1253                 {
1254                         GDIPlus.GdipResetClip(nativeObject);
1255                 }
1256
1257                 public void ResetTransform ()
1258                 {
1259                         GDIPlus.GdipResetWorldTransform (nativeObject);
1260                 }
1261
1262                 [MonoTODO]
1263                 public void Restore (GraphicsState gstate)
1264                 {
1265                         Transform = gstate.matrix.Clone();
1266                         GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
1267                 }
1268
1269                 [MonoTODO]
1270                 public void RotateTransform (float angle)
1271                 {
1272                         RotateTransform(angle, MatrixOrder.Prepend);
1273                 }
1274
1275                 [MonoTODO]
1276                 public void RotateTransform (float angle, MatrixOrder order)
1277                 {
1278                         //transform.Rotate(angle, order);
1279                         GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
1280                 }
1281
1282                 [MonoTODO]
1283                 public GraphicsState Save ()
1284                 {
1285                         //return implementation.Save();
1286                         GraphicsState state = new GraphicsState();
1287                         state.matrix = Transform.Clone ();
1288                         uint saveState;
1289                         GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
1290                         state.nativeState = saveState;
1291                         return state;
1292                 }
1293
1294                 public void ScaleTransform (float sx, float sy)
1295                 {
1296                         ScaleTransform (sx, sy, MatrixOrder.Prepend);
1297                 }
1298
1299                 public void ScaleTransform (float sx, float sy, MatrixOrder order)
1300                 {
1301                         GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
1302                 }
1303
1304                 
1305                 public void SetClip (RectangleF rect)
1306                 {
1307                         SetClip (rect, CombineMode.Replace);
1308                 }
1309
1310                 
1311                 public void SetClip (GraphicsPath path)
1312                 {
1313                         SetClip (path, CombineMode.Replace);
1314                 }
1315
1316                 
1317                 public void SetClip (Rectangle rect)
1318                 {
1319                         SetClip (rect, CombineMode.Replace);
1320                 }
1321
1322                 
1323                 public void SetClip (Graphics g)
1324                 {
1325                         SetClip (g, CombineMode.Replace);
1326                 }
1327
1328                 
1329                 public void SetClip (Graphics g, CombineMode combineMode)
1330                 {
1331                         GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
1332                 }
1333
1334                 
1335                 public void SetClip (Rectangle rect, CombineMode combineMode)
1336                 {
1337                         GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1338                 }
1339
1340                 
1341                 public void SetClip (RectangleF rect, CombineMode combineMode)
1342                 {
1343                         GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);           
1344                 }
1345
1346                 [MonoTODO]
1347                 public void SetClip (Region region, CombineMode combineMode)
1348                 {
1349                         //GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode); //TODO: Region not implemented yet
1350                 }
1351
1352                 
1353                 public void SetClip (GraphicsPath path, CombineMode combineMode)
1354                 {
1355                         GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
1356                 }
1357
1358                 
1359                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1360                 {
1361                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
1362             
1363                         Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
1364                         
1365                         GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
1366                 }
1367
1368                                 
1369                 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1370                 {                                               
1371                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
1372             
1373                         Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1374                         
1375                         GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
1376                 }
1377
1378                 
1379                 public void TranslateClip (int dx, int dy)
1380                 {
1381                         GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);                      
1382                 }
1383
1384                 
1385                 public void TranslateClip (float dx, float dy)
1386                 {
1387                         GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
1388                 }
1389
1390                 public void TranslateTransform (float dx, float dy)
1391                 {
1392                         TranslateTransform (dx, dy, MatrixOrder.Prepend);
1393                 }
1394
1395                 
1396                 public void TranslateTransform (float dx, float dy, MatrixOrder order)
1397                 {                       
1398                         GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
1399                 }
1400
1401                 public Region Clip {
1402                         get {
1403                                 throw new NotImplementedException ();
1404                         }
1405                         set {
1406                                 //throw new NotImplementedException ();
1407                         }
1408                 }
1409
1410                 public RectangleF ClipBounds {
1411                         get {
1412                                 RectangleF rect = new RectangleF ();                                    
1413                                 GDIPlus.GdipGetClipBounds (nativeObject, out rect);
1414                                 return rect;
1415                         }
1416                 }
1417
1418                 public CompositingMode CompositingMode {
1419                         get {
1420                                 CompositingMode mode;
1421                                 GDIPlus.GdipGetCompositingMode (nativeObject, out mode);    
1422                                 return mode;
1423                         }
1424                         set {
1425                                 
1426                                 GDIPlus.GdipSetCompositingMode (nativeObject, value);    
1427                         }
1428
1429                 }
1430
1431                 public CompositingQuality CompositingQuality {
1432                         get {
1433                                 CompositingQuality quality;
1434
1435                                 GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
1436                                 return quality;
1437                         }
1438                         set {
1439                                 GDIPlus.GdipSetCompositingQuality (nativeObject, value); 
1440                         }
1441                 }
1442
1443                 public float DpiX {
1444                         get {
1445                                 float x;
1446
1447                                 GDIPlus.GdipGetDpiX (nativeObject, out x);
1448                                 return x;
1449                         }
1450                 }
1451
1452                 public float DpiY {
1453                         get {
1454                                 float y;
1455
1456                                 GDIPlus.GdipGetDpiY (nativeObject, out y);
1457                                 return y;
1458                         }
1459                 }
1460
1461                 public InterpolationMode InterpolationMode {
1462                         get {                           
1463                                 InterpolationMode imode = InterpolationMode.Invalid;
1464                                 GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
1465                                 return imode;
1466                         }
1467                         set {
1468                                 GDIPlus.GdipSetInterpolationMode (nativeObject, value);
1469                         }
1470                 }
1471
1472                 public bool IsClipEmpty {
1473                         get {
1474                                 bool isEmpty = false;
1475
1476                                 GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
1477                                 return isEmpty;
1478                         }
1479                 }
1480
1481                 public bool IsVisibleClipEmpty {
1482                         get {
1483                                 bool isEmpty = false;
1484
1485                                 GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
1486                                 return isEmpty;
1487                         }
1488                 }
1489
1490                 public float PageScale {
1491                         get {
1492                                 float scale;
1493
1494                                 GDIPlus.GdipGetPageScale (nativeObject, out scale);
1495                                 return scale;
1496                         }
1497                         set {
1498                                 GDIPlus.GdipSetPageScale (nativeObject, value);
1499                         }
1500                 }
1501
1502                 public GraphicsUnit PageUnit {
1503                         get {
1504                                 GraphicsUnit unit;
1505                                 
1506                                 GDIPlus.GdipGetPageUnit (nativeObject, out unit);
1507                                 return unit;
1508                         }
1509                         set {
1510                                 GDIPlus.GdipSetPageUnit (nativeObject, value);
1511                         }
1512                 }
1513
1514                 public PixelOffsetMode PixelOffsetMode {
1515                         get {
1516                                 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
1517                                 
1518                                 GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
1519
1520                                 return pixelOffset;
1521                         }
1522                         set {
1523                                 GDIPlus.GdipSetPixelOffsetMode (nativeObject, value); 
1524                         }
1525                 }
1526
1527                 public Point RenderingOrigin {
1528                         get {
1529                                 int x, y;
1530                                 GDIPlus.GdipGetRenderingOrigin (
1531                                         nativeObject, out x, out y);
1532
1533                                 return new Point (x, y);
1534                         }
1535
1536                         set {
1537                                 GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
1538                         }
1539                 }
1540
1541                 public SmoothingMode SmoothingMode {
1542                         get {
1543                                 SmoothingMode mode = SmoothingMode.Invalid;
1544
1545                                 GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
1546                                 
1547                                 return mode;
1548                         }
1549
1550                         set {
1551                                 GDIPlus.GdipSetSmoothingMode (nativeObject, value);
1552                         }
1553                 }
1554
1555                 public int TextContrast {
1556                         get {   
1557                                 int contrast;
1558                                         
1559                                 GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
1560                                 return contrast;
1561                         }
1562
1563                         set {
1564                                 GDIPlus.GdipSetTextContrast (nativeObject, value);
1565                         }
1566                 }
1567
1568                 public TextRenderingHint TextRenderingHint {
1569                         get {
1570                                 TextRenderingHint hint;
1571
1572                                 GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
1573                                 return hint;        
1574                         }
1575
1576                         set {
1577                                 GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
1578                         }
1579                 }
1580
1581                 public Matrix Transform {
1582                         get {
1583                                 Matrix matrix = new Matrix ();
1584                                 GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
1585
1586                                 return matrix;
1587                         }
1588                         set {
1589                                 GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
1590                         }
1591                 }
1592
1593                 public RectangleF VisibleClipBounds {
1594                         get {
1595                                 RectangleF rect;
1596                                         
1597                                 GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
1598                                 return rect;
1599                         }
1600                 }
1601         }
1602 }
1603