2 // System.Drawing.Graphics.cs
4 // (C) 2003 Ximian, Inc. http://www.ximian.com
7 // Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
8 // Alexandre Pigolkine(pigolkine@gmx.de)
9 // Jordi Mas i Hernandez (jordi@ximian.com)
12 using System.Drawing.Drawing2D;
13 using System.Drawing.Imaging;
14 using System.Drawing.Text;
15 using System.ComponentModel;
16 using System.Runtime.InteropServices;
19 namespace System.Drawing
22 public sealed class Graphics : MarshalByRefObject, IDisposable
24 internal IntPtr nativeObject = IntPtr.Zero;
26 private static float defDpiX = 0;
27 private static float defDpiY = 0;
30 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
34 PlayRecordCallback callbackData);
37 public delegate bool DrawImageAbort (IntPtr callbackData);
39 private Graphics (IntPtr nativeGraphics)
41 if (nativeGraphics == IntPtr.Zero)
42 Console.WriteLine ("Here: " + Environment.StackTrace);
43 nativeObject = nativeGraphics;
46 static internal float systemDpiX {
49 Bitmap bmp = new Bitmap(1,1);
50 Graphics g = Graphics.FromImage(bmp);
57 static internal float systemDpiY {
60 Bitmap bmp = new Bitmap(1,1);
61 Graphics g = Graphics.FromImage(bmp);
68 internal IntPtr NativeObject {
79 public void AddMetafileComment (byte [] data)
81 throw new NotImplementedException ();
85 public GraphicsContainer BeginContainer ()
89 status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
90 GDIPlus.CheckStatus (status);
92 return new GraphicsContainer(state);
95 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
99 status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
100 GDIPlus.CheckStatus (status);
102 return new GraphicsContainer (state);
106 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
110 status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
111 GDIPlus.CheckStatus (status);
113 return new GraphicsContainer (state);
117 public void Clear (Color color)
120 status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ()); GDIPlus.CheckStatus (status);
124 public void Dispose ()
129 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
131 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
135 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
137 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
141 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
144 status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
145 x, y, width, height, startAngle, sweepAngle);
146 GDIPlus.CheckStatus (status);
149 // Microsoft documentation states that the signature for this member should be
150 // public void DrawArc( Pen pen, int x, int y, int width, int height, int startAngle,
151 // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
152 public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
155 status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
156 x, y, width, height, startAngle, sweepAngle);
157 GDIPlus.CheckStatus (status);
160 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
163 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
164 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
165 pt3.Y, pt4.X, pt4.Y);
166 GDIPlus.CheckStatus (status);
169 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
172 status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
173 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
174 pt3.Y, pt4.X, pt4.Y);
175 GDIPlus.CheckStatus (status);
178 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
181 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
182 y1, x2, y2, x3, y3, x4, y4);
183 GDIPlus.CheckStatus (status);
186 public void DrawBeziers (Pen pen, Point [] points)
188 int length = points.Length;
194 for (int i = 0; i < length; i += 3) {
195 Point p1 = points [i];
196 Point p2 = points [i + 1];
197 Point p3 = points [i + 2];
198 Point p4 = points [i + 3];
200 status = GDIPlus.GdipDrawBezier (nativeObject,
202 p1.X, p1.Y, p2.X, p2.Y,
203 p3.X, p3.Y, p4.X, p4.Y);
204 GDIPlus.CheckStatus (status);
208 public void DrawBeziers (Pen pen, PointF [] points)
210 int length = points.Length;
216 for (int i = 0; i < length; i += 3) {
217 PointF p1 = points [i];
218 PointF p2 = points [i + 1];
219 PointF p3 = points [i + 2];
220 PointF p4 = points [i + 3];
222 status = GDIPlus.GdipDrawBezier (nativeObject,
224 p1.X, p1.Y, p2.X, p2.Y,
225 p3.X, p3.Y, p4.X, p4.Y);
226 GDIPlus.CheckStatus (status);
231 public void DrawClosedCurve (Pen pen, PointF [] points)
234 status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
235 GDIPlus.CheckStatus (status);
238 public void DrawClosedCurve (Pen pen, Point [] points)
241 status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
242 GDIPlus.CheckStatus (status);
245 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
248 status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
249 GDIPlus.CheckStatus (status);
252 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
255 status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
256 GDIPlus.CheckStatus (status);
259 public void DrawCurve (Pen pen, Point [] points)
262 status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
263 GDIPlus.CheckStatus (status);
266 public void DrawCurve (Pen pen, PointF [] points)
269 status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
270 GDIPlus.CheckStatus (status);
273 public void DrawCurve (Pen pen, PointF [] points, float tension)
276 status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
277 GDIPlus.CheckStatus (status);
280 public void DrawCurve (Pen pen, Point [] points, float tension)
283 status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
284 GDIPlus.CheckStatus (status);
288 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
291 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
292 points, points.Length, offset,
293 numberOfSegments, 0.5f);
294 GDIPlus.CheckStatus (status);
297 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
300 status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
301 points, points.Length, offset,
302 numberOfSegments, tension);
303 GDIPlus.CheckStatus (status);
307 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
310 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
311 points, points.Length, offset,
312 numberOfSegments, tension);
313 GDIPlus.CheckStatus (status);
316 public void DrawEllipse (Pen pen, Rectangle rect)
318 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
321 public void DrawEllipse (Pen pen, RectangleF rect)
323 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
326 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
329 status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
330 GDIPlus.CheckStatus (status);
333 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
335 Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
336 GDIPlus.CheckStatus (status);
340 public void DrawIcon (Icon icon, Rectangle targetRect)
342 throw new NotImplementedException ();
346 public void DrawIcon (Icon icon, int x, int y)
348 throw new NotImplementedException ();
352 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
354 throw new NotImplementedException ();
357 public void DrawImage (Image image, RectangleF rect)
359 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
360 GDIPlus.CheckStatus (status);
364 public void DrawImage (Image image, PointF point)
366 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
367 GDIPlus.CheckStatus (status);
371 public void DrawImage (Image image, Point [] destPoints)
373 Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
374 GDIPlus.CheckStatus (status);
378 public void DrawImage (Image image, Point point)
380 DrawImage (image, point.X, point.Y);
384 public void DrawImage (Image image, Rectangle rect)
386 DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
390 public void DrawImage (Image image, PointF [] destPoints)
392 Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
393 GDIPlus.CheckStatus (status);
397 public void DrawImage (Image image, int x, int y)
399 Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
400 GDIPlus.CheckStatus (status);
404 public void DrawImage (Image image, float x, float y)
406 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
407 GDIPlus.CheckStatus (status);
411 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
413 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
414 destRect.X, destRect.Y, destRect.Width, destRect.Height,
415 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
416 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
417 GDIPlus.CheckStatus (status);
420 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
422 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
423 destRect.X, destRect.Y, destRect.Width, destRect.Height,
424 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
425 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
426 GDIPlus.CheckStatus (status);
430 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
432 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
433 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
434 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
436 GDIPlus.CheckStatus (status);
440 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
443 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
444 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
445 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
447 GDIPlus.CheckStatus (status);
451 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
452 ImageAttributes imageAttr)
454 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
455 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
456 srcRect.Width, srcRect.Height, srcUnit,
457 imageAttr.NativeObject, null, IntPtr.Zero);
458 GDIPlus.CheckStatus (status);
461 public void DrawImage (Image image, float x, float y, float width, float height)
463 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
465 GDIPlus.CheckStatus (status);
469 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
470 ImageAttributes imageAttr)
472 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
473 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
474 srcRect.Width, srcRect.Height, srcUnit,
475 imageAttr.NativeObject, null, IntPtr.Zero);
476 GDIPlus.CheckStatus (status);
480 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
482 Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
483 GDIPlus.CheckStatus (status);
486 public void DrawImage (Image image, int x, int y, int width, int height)
488 Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
489 GDIPlus.CheckStatus (status);
492 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
494 Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
495 GDIPlus.CheckStatus (status);
499 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
501 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
502 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
503 srcRect.Width, srcRect.Height, srcUnit,
504 imageAttr.NativeObject, callback, IntPtr.Zero);
505 GDIPlus.CheckStatus (status);
509 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
512 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
513 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
514 srcRect.Width, srcRect.Height, srcUnit,
515 imageAttr.NativeObject, callback, IntPtr.Zero);
516 GDIPlus.CheckStatus (status);
520 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
523 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
524 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
525 srcRect.Width, srcRect.Height, srcUnit,
526 imageAttr.NativeObject, callback, (IntPtr) callbackData);
527 GDIPlus.CheckStatus (status);
531 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
533 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
534 destRect.X, destRect.Y, destRect.Width, destRect.Height,
535 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
537 GDIPlus.CheckStatus (status);
540 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
542 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
543 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
544 srcRect.Width, srcRect.Height, srcUnit,
545 imageAttr.NativeObject, callback, (IntPtr) callbackData);
546 GDIPlus.CheckStatus (status);
550 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
552 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
553 destRect.X, destRect.Y, destRect.Width, destRect.Height,
554 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
556 GDIPlus.CheckStatus (status);
560 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
562 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
563 destRect.X, destRect.Y, destRect.Width, destRect.Height,
564 srcX, srcY, srcWidth, srcHeight, srcUnit,
565 imageAttrs.NativeObject, null, IntPtr.Zero);
566 GDIPlus.CheckStatus (status);
569 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
571 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
572 destRect.X, destRect.Y, destRect.Width,
573 destRect.Height, srcX, srcY, srcWidth, srcHeight,
574 srcUnit, imageAttr.NativeObject, null, IntPtr.Zero);
575 GDIPlus.CheckStatus (status);
578 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
580 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
581 destRect.X, destRect.Y, destRect.Width,
582 destRect.Height, srcX, srcY, srcWidth, srcHeight,
583 srcUnit, imageAttr.NativeObject, callback,
585 GDIPlus.CheckStatus (status);
588 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
590 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
591 destRect.X, destRect.Y, destRect.Width,
592 destRect.Height, srcX, srcY, srcWidth, srcHeight,
593 srcUnit, imageAttr.NativeObject,
594 callback, IntPtr.Zero);
595 GDIPlus.CheckStatus (status);
599 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
601 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
602 destRect.X, destRect.Y, destRect.Width, destRect.Height,
603 srcX, srcY, srcWidth, srcHeight, srcUnit,
604 imageAttr.NativeObject, callback, callbackData);
605 GDIPlus.CheckStatus (status);
609 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
611 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
612 destRect.X, destRect.Y, destRect.Width, destRect.Height,
613 srcX, srcY, srcWidth, srcHeight, srcUnit,
614 imageAttr.NativeObject, callback, callbackData);
615 GDIPlus.CheckStatus (status);
618 public void DrawImageUnscaled (Image image, Point point)
620 DrawImage(image, point.X, point.Y);
623 public void DrawImageUnscaled (Image image, Rectangle rect)
625 DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
628 public void DrawImageUnscaled (Image image, int x, int y)
630 DrawImage(image, x, y);
633 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
635 DrawImage(image, x, y, width, height);
638 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
640 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
641 pt1.X, pt1.Y, pt2.X, pt2.Y);
642 GDIPlus.CheckStatus (status);
645 public void DrawLine (Pen pen, Point pt1, Point pt2)
647 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
648 pt1.X, pt1.Y, pt2.X, pt2.Y);
649 GDIPlus.CheckStatus (status);
652 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
654 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
655 GDIPlus.CheckStatus (status);
658 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
660 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
661 GDIPlus.CheckStatus (status);
664 public void DrawLines (Pen pen, PointF [] points)
666 Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
667 GDIPlus.CheckStatus (status);
670 public void DrawLines (Pen pen, Point [] points)
672 Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
673 GDIPlus.CheckStatus (status);
676 public void DrawPath (Pen pen, GraphicsPath path)
678 Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
679 GDIPlus.CheckStatus (status);
682 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
684 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
687 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
689 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
692 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
694 Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
695 GDIPlus.CheckStatus (status);
698 // Microsoft documentation states that the signature for this member should be
699 // public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle
700 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
701 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
703 Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
704 GDIPlus.CheckStatus (status);
707 public void DrawPolygon (Pen pen, Point [] points)
709 Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
710 GDIPlus.CheckStatus (status);
713 public void DrawPolygon (Pen pen, PointF [] points)
715 Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
716 GDIPlus.CheckStatus (status);
719 internal void DrawRectangle (Pen pen, RectangleF rect)
721 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
724 public void DrawRectangle (Pen pen, Rectangle rect)
726 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
729 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
731 Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
732 GDIPlus.CheckStatus (status);
735 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
737 Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
738 GDIPlus.CheckStatus (status);
741 public void DrawRectangles (Pen pen, RectangleF [] rects)
743 foreach (RectangleF rc in rects)
744 DrawRectangle (pen, rc.Left, rc.Top, rc.Width, rc.Height);
747 public void DrawRectangles (Pen pen, Rectangle [] rects)
749 foreach (RectangleF rc in rects)
750 DrawRectangle(pen, rc.Left, rc.Top, rc.Width, rc.Height);
754 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
756 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, IntPtr.Zero, brush.nativeObject);
757 GDIPlus.CheckStatus (status);
760 public void DrawString (string s, Font font, Brush brush, PointF point)
762 RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
763 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, IntPtr.Zero, brush.nativeObject);
764 GDIPlus.CheckStatus (status);
767 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
769 RectangleF rc = new RectangleF (point.X, point.Y, 0, 0);
770 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref rc, format.NativeObject, brush.nativeObject);
771 GDIPlus.CheckStatus (status);
774 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
776 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format.NativeObject, brush.nativeObject);
777 GDIPlus.CheckStatus (status);
780 public void DrawString (string s, Font font, Brush brush, float x, float y)
782 RectangleF rc = new RectangleF (x, y, 0, 0);
784 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
785 ref rc, IntPtr.Zero, brush.nativeObject);
786 GDIPlus.CheckStatus (status);
789 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
791 RectangleF rc = new RectangleF (x, y, 0, 0);
793 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject,
794 ref rc, format.NativeObject, brush.nativeObject);
795 GDIPlus.CheckStatus (status);
799 public void EndContainer (GraphicsContainer container)
801 Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
802 GDIPlus.CheckStatus (status);
806 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
808 throw new NotImplementedException ();
812 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
814 throw new NotImplementedException ();
818 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
820 throw new NotImplementedException ();
824 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
826 throw new NotImplementedException ();
830 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
832 throw new NotImplementedException ();
836 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
838 throw new NotImplementedException ();
842 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
844 throw new NotImplementedException ();
848 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
850 throw new NotImplementedException ();
854 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
856 throw new NotImplementedException ();
860 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
862 throw new NotImplementedException ();
866 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
868 throw new NotImplementedException ();
872 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
874 throw new NotImplementedException ();
878 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
880 throw new NotImplementedException ();
884 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
886 throw new NotImplementedException ();
890 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
892 throw new NotImplementedException ();
896 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
898 throw new NotImplementedException ();
902 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
904 throw new NotImplementedException ();
908 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
910 throw new NotImplementedException ();
914 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
916 throw new NotImplementedException ();
920 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
922 throw new NotImplementedException ();
926 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
928 throw new NotImplementedException ();
932 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
934 throw new NotImplementedException ();
938 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
940 throw new NotImplementedException ();
944 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
946 throw new NotImplementedException ();
950 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
952 throw new NotImplementedException ();
956 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
958 throw new NotImplementedException ();
962 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
964 throw new NotImplementedException ();
968 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
970 throw new NotImplementedException ();
974 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
976 throw new NotImplementedException ();
980 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
982 throw new NotImplementedException ();
986 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
988 throw new NotImplementedException ();
992 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
994 throw new NotImplementedException ();
998 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1000 throw new NotImplementedException ();
1004 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1006 throw new NotImplementedException ();
1010 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1012 throw new NotImplementedException ();
1016 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1018 throw new NotImplementedException ();
1021 public void ExcludeClip (Rectangle rect)
1023 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1024 GDIPlus.CheckStatus (status);
1028 public void ExcludeClip (Region region)
1030 throw new NotImplementedException ();
1034 public void FillClosedCurve (Brush brush, PointF [] points)
1036 Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1037 GDIPlus.CheckStatus (status);
1041 public void FillClosedCurve (Brush brush, Point [] points)
1043 Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1044 GDIPlus.CheckStatus (status);
1048 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1050 FillClosedCurve (brush, points, fillmode, 0.5f);
1053 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1055 FillClosedCurve (brush, points, fillmode, 0.5f);
1058 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1060 Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1061 GDIPlus.CheckStatus (status);
1064 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1066 Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1067 GDIPlus.CheckStatus (status);
1070 public void FillEllipse (Brush brush, Rectangle rect)
1072 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1075 public void FillEllipse (Brush brush, RectangleF rect)
1077 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1080 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1082 Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1083 GDIPlus.CheckStatus (status);
1086 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1088 Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1089 GDIPlus.CheckStatus (status);
1092 public void FillPath (Brush brush, GraphicsPath path)
1094 Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject);
1095 GDIPlus.CheckStatus (status);
1098 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1100 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1101 GDIPlus.CheckStatus (status);
1104 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1106 Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1107 GDIPlus.CheckStatus (status);
1110 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1112 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1113 GDIPlus.CheckStatus (status);
1116 public void FillPolygon (Brush brush, PointF [] points)
1118 Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1119 GDIPlus.CheckStatus (status);
1122 public void FillPolygon (Brush brush, Point [] points)
1124 Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1125 GDIPlus.CheckStatus (status);
1128 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1130 Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1131 GDIPlus.CheckStatus (status);
1134 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1136 Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1137 GDIPlus.CheckStatus (status);
1140 public void FillRectangle (Brush brush, RectangleF rect)
1142 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1145 public void FillRectangle (Brush brush, Rectangle rect)
1147 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1150 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1152 Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, (float)x, (float)y, (float)width, (float)height);
1153 GDIPlus.CheckStatus (status);
1156 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1158 Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1159 GDIPlus.CheckStatus (status);
1162 public void FillRectangles (Brush brush, Rectangle [] rects)
1164 foreach (Rectangle rc in rects)
1165 FillRectangle(brush, rc);
1168 public void FillRectangles (Brush brush, RectangleF [] rects)
1170 foreach (RectangleF rc in rects)
1171 FillRectangle(brush, rc);
1175 public void FillRegion (Brush brush, Region region)
1177 Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);
1178 GDIPlus.CheckStatus(status);
1182 public void Flush ()
1184 Flush (FlushIntention.Flush);
1188 public void Flush (FlushIntention intention)
1190 Status status = GDIPlus.GdipFlush (nativeObject, intention);
1191 GDIPlus.CheckStatus (status);
1194 [EditorBrowsable (EditorBrowsableState.Advanced)]
1195 public static Graphics FromHdc (IntPtr hdc)
1198 Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics); GDIPlus.CheckStatus (status);
1200 Graphics result = new Graphics ((IntPtr) graphics);
1205 [EditorBrowsable (EditorBrowsableState.Advanced)]
1206 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1208 throw new NotImplementedException ();
1212 [EditorBrowsable (EditorBrowsableState.Advanced)]
1213 public static Graphics FromHdcInternal (IntPtr hdc)
1215 throw new NotImplementedException ();
1218 [EditorBrowsable (EditorBrowsableState.Advanced)]
1219 public static Graphics FromHwnd (IntPtr hwnd)
1223 Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics); GDIPlus.CheckStatus (status);
1225 return new Graphics (graphics);
1229 [EditorBrowsable (EditorBrowsableState.Advanced)]
1230 public static Graphics FromHwndInternal (IntPtr hwnd)
1232 throw new NotImplementedException ();
1236 public static Graphics FromImage (Image image)
1238 if (image == null) throw new ArgumentException ();
1240 Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1241 GDIPlus.CheckStatus (status);
1242 Graphics result = new Graphics ((IntPtr) graphics);
1246 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1249 Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1250 GDIPlus.CheckStatus (s);
1251 return new Graphics (graphics);
1255 public static IntPtr GetHalftonePalette ()
1257 throw new NotImplementedException ();
1261 [EditorBrowsable (EditorBrowsableState.Advanced)]
1262 public IntPtr GetHdc ()
1265 Status status = GDIPlus.GdipGetDC (nativeObject, out hdc);
1266 GDIPlus.CheckStatus (status);
1268 return (IntPtr) hdc;
1272 public Color GetNearestColor (Color color)
1276 Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1277 GDIPlus.CheckStatus (status);
1279 return Color.FromArgb (argb);
1283 public void IntersectClip (Region region)
1285 throw new NotImplementedException ();
1288 public void IntersectClip (RectangleF rect)
1290 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1291 GDIPlus.CheckStatus (status);
1294 public void IntersectClip (Rectangle rect)
1296 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1297 GDIPlus.CheckStatus (status);
1300 public bool IsVisible (Point point)
1302 bool isVisible = false;
1304 Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1305 GDIPlus.CheckStatus (status);
1311 public bool IsVisible (RectangleF rect)
1313 bool isVisible = false;
1315 Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1316 GDIPlus.CheckStatus (status);
1321 public bool IsVisible (PointF point)
1323 bool isVisible = false;
1325 Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1326 GDIPlus.CheckStatus (status);
1331 public bool IsVisible (Rectangle rect)
1333 bool isVisible = false;
1335 Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1336 GDIPlus.CheckStatus (status);
1341 public bool IsVisible (float x, float y)
1343 return IsVisible (new PointF (x, y));
1346 public bool IsVisible (int x, int y)
1348 return IsVisible (new Point (x, y));
1351 public bool IsVisible (float x, float y, float width, float height)
1353 return IsVisible (new RectangleF (x, y, width, height));
1357 public bool IsVisible (int x, int y, int width, int height)
1359 return IsVisible (new Rectangle (x, y, width, height));
1363 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1365 throw new NotImplementedException ();
1369 public SizeF MeasureString (string text, Font font)
1371 return MeasureString (text, font, new Size(0,0));
1375 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1377 int charactersFitted, linesFilled;
1378 RectangleF boundingBox = new RectangleF ();
1379 RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1381 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1382 font.NativeObject, ref rect, IntPtr.Zero, out boundingBox,
1383 out charactersFitted, out linesFilled);
1384 GDIPlus.CheckStatus (status);
1386 return new SizeF(boundingBox.Width, boundingBox.Height);
1390 public SizeF MeasureString (string text, Font font, int width)
1392 throw new NotImplementedException ();
1396 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
1398 int charactersFitted, linesFilled;
1399 return MeasureString (text, font, layoutArea, stringFormat, out charactersFitted, out linesFilled);
1403 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1405 throw new NotImplementedException ();
1409 public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
1411 RectangleF boundingBox = new RectangleF ();
1412 RectangleF rect = new RectangleF (origin.X, origin.Y, 0,0);
1413 int charactersFitted, linesFilled;
1415 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1416 font.NativeObject, ref rect, stringFormat.NativeObject,
1417 out boundingBox, out charactersFitted, out linesFilled);
1418 GDIPlus.CheckStatus (status);
1420 return new SizeF (boundingBox.Width, boundingBox.Height);
1424 public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)
1426 RectangleF boundingBox = new RectangleF ();
1427 RectangleF rect = new RectangleF (0,0,layoutArea.Width, layoutArea.Height);
1428 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1429 font.NativeObject, ref rect, stringFormat.NativeObject,
1430 out boundingBox, out charactersFitted, out linesFilled);
1431 GDIPlus.CheckStatus (status);
1433 return new SizeF (boundingBox.Width, boundingBox.Height);
1436 public void MultiplyTransform (Matrix matrix)
1438 MultiplyTransform (matrix, MatrixOrder.Prepend);
1441 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
1443 Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
1444 GDIPlus.CheckStatus (status);
1447 [EditorBrowsable (EditorBrowsableState.Advanced)]
1448 public void ReleaseHdc (IntPtr hdc)
1450 Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
1451 GDIPlus.CheckStatus (status);
1455 [EditorBrowsable (EditorBrowsableState.Advanced)]
1456 public void ReleaseHdcInternal (IntPtr hdc)
1458 throw new NotImplementedException ();
1462 public void ResetClip ()
1464 Status status = GDIPlus.GdipResetClip (nativeObject);
1465 GDIPlus.CheckStatus (status);
1468 public void ResetTransform ()
1470 Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
1471 GDIPlus.CheckStatus (status);
1474 public void Restore (GraphicsState gstate)
1476 Transform = gstate.matrix.Clone ();
1477 Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
1478 GDIPlus.CheckStatus (status);
1482 public void RotateTransform (float angle)
1484 RotateTransform (angle, MatrixOrder.Prepend);
1487 public void RotateTransform (float angle, MatrixOrder order)
1490 Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
1491 GDIPlus.CheckStatus (status);
1494 public GraphicsState Save ()
1496 GraphicsState state = new GraphicsState ();
1497 state.matrix = Transform.Clone ();
1499 Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
1500 GDIPlus.CheckStatus (status);
1502 state.nativeState = saveState;
1506 public void ScaleTransform (float sx, float sy)
1508 ScaleTransform (sx, sy, MatrixOrder.Prepend);
1511 public void ScaleTransform (float sx, float sy, MatrixOrder order)
1513 Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
1514 GDIPlus.CheckStatus (status);
1518 public void SetClip (RectangleF rect)
1520 SetClip (rect, CombineMode.Replace);
1524 public void SetClip (GraphicsPath path)
1526 SetClip (path, CombineMode.Replace);
1530 public void SetClip (Rectangle rect)
1532 SetClip (rect, CombineMode.Replace);
1536 public void SetClip (Graphics g)
1538 SetClip (g, CombineMode.Replace);
1542 public void SetClip (Graphics g, CombineMode combineMode)
1544 Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
1545 GDIPlus.CheckStatus (status);
1549 public void SetClip (Rectangle rect, CombineMode combineMode)
1551 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1552 GDIPlus.CheckStatus (status);
1556 public void SetClip (RectangleF rect, CombineMode combineMode)
1558 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
1559 GDIPlus.CheckStatus (status);
1563 public void SetClip (Region region, CombineMode combineMode)
1565 //GDIPlus.GdipSetClipRegion(nativeObject, region.NativeObject, combineMode); //TODO: Region not implemented yet
1566 throw new NotImplementedException();
1570 public void SetClip (GraphicsPath path, CombineMode combineMode)
1572 Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
1573 GDIPlus.CheckStatus (status);
1577 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
1579 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemory (pts);
1581 Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1582 GDIPlus.CheckStatus (status);
1584 GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
1588 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
1590 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemoryI (pts);
1592 Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
1593 GDIPlus.CheckStatus (status);
1595 GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
1599 public void TranslateClip (int dx, int dy)
1601 Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
1602 GDIPlus.CheckStatus (status);
1606 public void TranslateClip (float dx, float dy)
1608 Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
1609 GDIPlus.CheckStatus (status);
1612 public void TranslateTransform (float dx, float dy)
1614 TranslateTransform (dx, dy, MatrixOrder.Prepend);
1618 public void TranslateTransform (float dx, float dy, MatrixOrder order)
1620 Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
1621 GDIPlus.CheckStatus (status);
1624 public Region Clip {
1626 throw new NotImplementedException ();
1629 //throw new NotImplementedException ();
1633 public RectangleF ClipBounds {
1635 RectangleF rect = new RectangleF ();
1636 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
1637 GDIPlus.CheckStatus (status);
1642 public CompositingMode CompositingMode {
1644 CompositingMode mode;
1645 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
1646 GDIPlus.CheckStatus (status);
1651 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
1652 GDIPlus.CheckStatus (status);
1657 public CompositingQuality CompositingQuality {
1659 CompositingQuality quality;
1661 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
1662 GDIPlus.CheckStatus (status);
1666 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
1667 GDIPlus.CheckStatus (status);
1675 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
1676 GDIPlus.CheckStatus (status);
1685 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
1686 GDIPlus.CheckStatus (status);
1691 public InterpolationMode InterpolationMode {
1693 InterpolationMode imode = InterpolationMode.Invalid;
1694 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
1695 GDIPlus.CheckStatus (status);
1699 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
1700 GDIPlus.CheckStatus (status);
1704 public bool IsClipEmpty {
1706 bool isEmpty = false;
1708 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
1709 GDIPlus.CheckStatus (status);
1714 public bool IsVisibleClipEmpty {
1716 bool isEmpty = false;
1718 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
1719 GDIPlus.CheckStatus (status);
1724 public float PageScale {
1728 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
1729 GDIPlus.CheckStatus (status);
1733 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
1734 GDIPlus.CheckStatus (status);
1738 public GraphicsUnit PageUnit {
1742 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
1743 GDIPlus.CheckStatus (status);
1747 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
1748 GDIPlus.CheckStatus (status);
1752 public PixelOffsetMode PixelOffsetMode {
1754 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
1756 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
1757 GDIPlus.CheckStatus (status);
1761 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
1762 GDIPlus.CheckStatus (status);
1766 public Point RenderingOrigin {
1769 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
1770 GDIPlus.CheckStatus (status);
1771 return new Point (x, y);
1775 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
1776 GDIPlus.CheckStatus (status);
1780 public SmoothingMode SmoothingMode {
1782 SmoothingMode mode = SmoothingMode.Invalid;
1784 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
1785 GDIPlus.CheckStatus (status);
1790 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
1791 GDIPlus.CheckStatus (status);
1795 public int TextContrast {
1799 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
1800 GDIPlus.CheckStatus (status);
1805 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
1806 GDIPlus.CheckStatus (status);
1810 public TextRenderingHint TextRenderingHint {
1812 TextRenderingHint hint;
1814 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
1815 GDIPlus.CheckStatus (status);
1820 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
1821 GDIPlus.CheckStatus (status);
1825 public Matrix Transform {
1827 Matrix matrix = new Matrix ();
1828 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
1829 GDIPlus.CheckStatus (status);
1833 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
1834 GDIPlus.CheckStatus (status);
1838 public RectangleF VisibleClipBounds {
1842 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
1843 GDIPlus.CheckStatus (status);