2 // System.Drawing.Graphics.cs
5 // Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
6 // Alexandre Pigolkine(pigolkine@gmx.de)
7 // Jordi Mas i Hernandez (jordi@ximian.com)
9 // Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
11 // Copyright (C) 2004-2005 Novell, Inc. (http://www.novell.com)
13 // Permission is hereby granted, free of charge, to any person obtaining
14 // a copy of this software and associated documentation files (the
15 // "Software"), to deal in the Software without restriction, including
16 // without limitation the rights to use, copy, modify, merge, publish,
17 // distribute, sublicense, and/or sell copies of the Software, and to
18 // permit persons to whom the Software is furnished to do so, subject to
19 // the following conditions:
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 using System.Drawing.Drawing2D;
34 using System.Drawing.Imaging;
35 using System.Drawing.Text;
36 using System.ComponentModel;
37 using System.Runtime.InteropServices;
38 using System.Security.Permissions;
41 namespace System.Drawing
46 public sealed class Graphics : MarshalByRefObject, IDisposable
51 internal IntPtr nativeObject = IntPtr.Zero;
52 private bool disposed = false;
53 private static float defDpiX = 0;
54 private static float defDpiY = 0;
57 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
61 PlayRecordCallback callbackData);
64 public delegate bool DrawImageAbort (IntPtr callbackData);
66 internal Graphics (IntPtr nativeGraphics)
68 nativeObject = nativeGraphics;
76 static internal float systemDpiX {
79 Bitmap bmp = new Bitmap (1, 1);
80 Graphics g = Graphics.FromImage (bmp);
88 static internal float systemDpiY {
91 Bitmap bmp = new Bitmap (1, 1);
92 Graphics g = Graphics.FromImage (bmp);
100 internal IntPtr NativeObject {
106 nativeObject = value;
111 public void AddMetafileComment (byte [] data)
113 throw new NotImplementedException ();
117 public GraphicsContainer BeginContainer ()
121 status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
122 GDIPlus.CheckStatus (status);
124 return new GraphicsContainer(state);
127 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
131 status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
132 GDIPlus.CheckStatus (status);
134 return new GraphicsContainer (state);
138 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
142 status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
143 GDIPlus.CheckStatus (status);
145 return new GraphicsContainer (state);
149 public void Clear (Color color)
152 status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
153 GDIPlus.CheckStatus (status);
156 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
158 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
159 blockRegionSize, CopyPixelOperation.SourceCopy);
162 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
164 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
165 blockRegionSize, copyPixelOperation);
168 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
170 CopyFromScreen (sourceX, sourceY, destinationX, destinationY, blockRegionSize,
171 CopyPixelOperation.SourceCopy);
174 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
\r
178 if (!Enum.IsDefined (typeof (CopyPixelOperation), copyPixelOperation))
179 throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for CopyPixelOperation", copyPixelOperation));
181 if (GDIPlus.UseCocoaDrawable || GDIPlus.UseQuartzDrawable) {
182 throw new NotImplementedException ();
185 if (GDIPlus.UseX11Drawable) { // X11 implementation
186 IntPtr image, defvisual, vPtr;
187 int AllPlanes = ~0, nitems = 0, pixel;
189 if (copyPixelOperation != CopyPixelOperation.SourceCopy)
190 throw new NotImplementedException ("Operation not implemented under X11");
192 if (GDIPlus.Display == IntPtr.Zero) {
193 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
196 window = GDIPlus.XRootWindow (GDIPlus.Display, 0);
197 defvisual = GDIPlus.XDefaultVisual (GDIPlus.Display, 0);
198 XVisualInfo visual = new XVisualInfo ();
200 /* Get XVisualInfo for this visual */
201 visual.visualid = GDIPlus.XVisualIDFromVisual(defvisual);
202 vPtr = GDIPlus.XGetVisualInfo (GDIPlus.Display, 0x1 /* VisualIDMask */, ref visual, ref nitems);
203 visual = (XVisualInfo) Marshal.PtrToStructure(vPtr, typeof (XVisualInfo));
205 /* Sorry I do not have access to a computer with > deepth. Fell free to add more pixel formats */
206 image = GDIPlus.XGetImage (GDIPlus.Display, window, sourceX, sourceY, blockRegionSize.Width,
207 blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/);
209 Bitmap bmp = new Bitmap (blockRegionSize.Width, blockRegionSize.Height);
210 int red, blue, green;
211 for (int y = sourceY; y < sourceY + blockRegionSize.Height; y++) {
212 for (int x = sourceX; x < sourceX + blockRegionSize.Width; x++) {
213 pixel = GDIPlus.XGetPixel (image, x, y);
215 switch (visual.depth) {
216 case 16: /* 16bbp pixel transformation */
217 red = (int) ((pixel & visual.red_mask ) >> 8) & 0xff;
218 green = (int) (((pixel & visual.green_mask ) >> 3 )) & 0xff;
219 blue = (int) ((pixel & visual.blue_mask ) << 3 ) & 0xff;
223 red = (int) ((pixel & visual.red_mask ) >> 16) & 0xff;
224 green = (int) (((pixel & visual.green_mask ) >> 8 )) & 0xff;
225 blue = (int) ((pixel & visual.blue_mask )) & 0xff;
228 throw new NotImplementedException ("Deepth not supported right now");
231 bmp.SetPixel (x, y, Color.FromArgb (255, red, green, blue));
235 DrawImage (bmp, 0, 0);
237 GDIPlus.XDestroyImage (image);
241 // Win32 implementation
242 window = GDIPlus.GetDesktopWindow ();
243 IntPtr srcDC = GDIPlus.GetDC (window);
244 IntPtr dstDC = GetHdc ();
245 GDIPlus.BitBlt (dstDC, destinationX, destinationY, blockRegionSize.Width,
246 blockRegionSize.Height, srcDC, sourceX, sourceY, (int) copyPixelOperation);
248 GDIPlus.ReleaseDC (srcDC);
253 public void Dispose ()
257 status = GDIPlus.GdipDeleteGraphics (nativeObject);
258 nativeObject = IntPtr.Zero;
259 GDIPlus.CheckStatus (status);
262 GC.SuppressFinalize(this);
266 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
268 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
272 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
274 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
278 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
282 throw new ArgumentNullException ("pen");
284 status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
285 x, y, width, height, startAngle, sweepAngle);
286 GDIPlus.CheckStatus (status);
289 // Microsoft documentation states that the signature for this member should be
290 // public void DrawArc( Pen pen, int x, int y, int width, int height, int startAngle,
291 // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
292 public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
296 throw new ArgumentNullException ("pen");
297 status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
298 x, y, width, height, startAngle, sweepAngle);
299 GDIPlus.CheckStatus (status);
302 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
306 throw new ArgumentNullException ("pen");
307 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
308 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
309 pt3.Y, pt4.X, pt4.Y);
310 GDIPlus.CheckStatus (status);
313 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
317 throw new ArgumentNullException ("pen");
318 status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
319 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
320 pt3.Y, pt4.X, pt4.Y);
321 GDIPlus.CheckStatus (status);
324 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
328 throw new ArgumentNullException ("pen");
329 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
330 y1, x2, y2, x3, y3, x4, y4);
331 GDIPlus.CheckStatus (status);
334 public void DrawBeziers (Pen pen, Point [] points)
337 throw new ArgumentNullException ("pen");
339 throw new ArgumentNullException ("points");
341 int length = points.Length;
347 for (int i = 0; i < length - 1; i += 3) {
348 Point p1 = points [i];
349 Point p2 = points [i + 1];
350 Point p3 = points [i + 2];
351 Point p4 = points [i + 3];
353 status = GDIPlus.GdipDrawBezier (nativeObject,
355 p1.X, p1.Y, p2.X, p2.Y,
356 p3.X, p3.Y, p4.X, p4.Y);
357 GDIPlus.CheckStatus (status);
361 public void DrawBeziers (Pen pen, PointF [] points)
364 throw new ArgumentNullException ("pen");
366 throw new ArgumentNullException ("points");
368 int length = points.Length;
374 for (int i = 0; i < length - 1; i += 3) {
375 PointF p1 = points [i];
376 PointF p2 = points [i + 1];
377 PointF p3 = points [i + 2];
378 PointF p4 = points [i + 3];
380 status = GDIPlus.GdipDrawBezier (nativeObject,
382 p1.X, p1.Y, p2.X, p2.Y,
383 p3.X, p3.Y, p4.X, p4.Y);
384 GDIPlus.CheckStatus (status);
389 public void DrawClosedCurve (Pen pen, PointF [] points)
392 throw new ArgumentNullException ("pen");
394 throw new ArgumentNullException ("points");
397 status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
398 GDIPlus.CheckStatus (status);
401 public void DrawClosedCurve (Pen pen, Point [] points)
404 throw new ArgumentNullException ("pen");
406 throw new ArgumentNullException ("points");
409 status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
410 GDIPlus.CheckStatus (status);
413 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
416 throw new ArgumentNullException ("pen");
418 throw new ArgumentNullException ("points");
421 status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
422 GDIPlus.CheckStatus (status);
425 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
428 throw new ArgumentNullException ("pen");
430 throw new ArgumentNullException ("points");
433 status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
434 GDIPlus.CheckStatus (status);
437 public void DrawCurve (Pen pen, Point [] points)
440 throw new ArgumentNullException ("pen");
442 throw new ArgumentNullException ("points");
445 status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
446 GDIPlus.CheckStatus (status);
449 public void DrawCurve (Pen pen, PointF [] points)
452 throw new ArgumentNullException ("pen");
454 throw new ArgumentNullException ("points");
457 status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
458 GDIPlus.CheckStatus (status);
461 public void DrawCurve (Pen pen, PointF [] points, float tension)
464 throw new ArgumentNullException ("pen");
466 throw new ArgumentNullException ("points");
469 status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
470 GDIPlus.CheckStatus (status);
473 public void DrawCurve (Pen pen, Point [] points, float tension)
476 throw new ArgumentNullException ("pen");
478 throw new ArgumentNullException ("points");
481 status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
482 GDIPlus.CheckStatus (status);
486 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
489 throw new ArgumentNullException ("pen");
491 throw new ArgumentNullException ("points");
494 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
495 points, points.Length, offset,
496 numberOfSegments, 0.5f);
497 GDIPlus.CheckStatus (status);
500 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
503 throw new ArgumentNullException ("pen");
505 throw new ArgumentNullException ("points");
508 status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
509 points, points.Length, offset,
510 numberOfSegments, tension);
511 GDIPlus.CheckStatus (status);
515 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
518 throw new ArgumentNullException ("pen");
520 throw new ArgumentNullException ("points");
523 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
524 points, points.Length, offset,
525 numberOfSegments, tension);
526 GDIPlus.CheckStatus (status);
529 public void DrawEllipse (Pen pen, Rectangle rect)
532 throw new ArgumentNullException ("pen");
534 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
537 public void DrawEllipse (Pen pen, RectangleF rect)
540 throw new ArgumentNullException ("pen");
541 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
544 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
547 throw new ArgumentNullException ("pen");
549 status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
550 GDIPlus.CheckStatus (status);
553 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
556 throw new ArgumentNullException ("pen");
557 Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
558 GDIPlus.CheckStatus (status);
561 public void DrawIcon (Icon icon, Rectangle targetRect)
563 Image img = icon.ToBitmap ();
564 DrawImage (img, targetRect);
567 public void DrawIcon (Icon icon, int x, int y)
569 Image img = icon.ToBitmap ();
570 DrawImage (img, x, y);
573 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
575 Image img = icon.ToBitmap ();
576 DrawImageUnscaled (img, targetRect);
579 public void DrawImage (Image image, RectangleF rect)
582 throw new ArgumentNullException ("image");
584 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
585 GDIPlus.CheckStatus (status);
589 public void DrawImage (Image image, PointF point)
592 throw new ArgumentNullException ("image");
594 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
595 GDIPlus.CheckStatus (status);
599 public void DrawImage (Image image, Point [] destPoints)
602 throw new ArgumentNullException ("image");
603 if (destPoints == null)
604 throw new ArgumentNullException ("destPoints");
606 Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
607 GDIPlus.CheckStatus (status);
611 public void DrawImage (Image image, Point point)
614 throw new ArgumentNullException ("image");
615 DrawImage (image, point.X, point.Y);
619 public void DrawImage (Image image, Rectangle rect)
622 throw new ArgumentNullException ("image");
623 DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
627 public void DrawImage (Image image, PointF [] destPoints)
630 throw new ArgumentNullException ("image");
631 if (destPoints == null)
632 throw new ArgumentNullException ("destPoints");
633 Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
634 GDIPlus.CheckStatus (status);
638 public void DrawImage (Image image, int x, int y)
641 throw new ArgumentNullException ("image");
642 Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
643 GDIPlus.CheckStatus (status);
647 public void DrawImage (Image image, float x, float y)
650 throw new ArgumentNullException ("image");
651 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
652 GDIPlus.CheckStatus (status);
656 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
659 throw new ArgumentNullException ("image");
660 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
661 destRect.X, destRect.Y, destRect.Width, destRect.Height,
662 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
663 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
664 GDIPlus.CheckStatus (status);
667 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
670 throw new ArgumentNullException ("image");
671 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
672 destRect.X, destRect.Y, destRect.Width, destRect.Height,
673 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
674 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
675 GDIPlus.CheckStatus (status);
679 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
682 throw new ArgumentNullException ("image");
683 if (destPoints == null)
684 throw new ArgumentNullException ("destPoints");
686 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
687 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
688 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
690 GDIPlus.CheckStatus (status);
694 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
697 throw new ArgumentNullException ("image");
698 if (destPoints == null)
699 throw new ArgumentNullException ("destPoints");
701 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
702 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
703 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
705 GDIPlus.CheckStatus (status);
709 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
710 ImageAttributes imageAttr)
713 throw new ArgumentNullException ("image");
714 if (destPoints == null)
715 throw new ArgumentNullException ("destPoints");
716 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
717 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
718 srcRect.Width, srcRect.Height, srcUnit,
719 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
720 GDIPlus.CheckStatus (status);
723 public void DrawImage (Image image, float x, float y, float width, float height)
726 throw new ArgumentNullException ("image");
727 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
729 GDIPlus.CheckStatus (status);
733 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
734 ImageAttributes imageAttr)
737 throw new ArgumentNullException ("image");
738 if (destPoints == null)
739 throw new ArgumentNullException ("destPoints");
740 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
741 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
742 srcRect.Width, srcRect.Height, srcUnit,
743 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
744 GDIPlus.CheckStatus (status);
748 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
751 throw new ArgumentNullException ("image");
752 Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
753 GDIPlus.CheckStatus (status);
756 public void DrawImage (Image image, int x, int y, int width, int height)
759 throw new ArgumentNullException ("image");
760 Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
761 GDIPlus.CheckStatus (status);
764 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
767 throw new ArgumentNullException ("image");
768 Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
769 GDIPlus.CheckStatus (status);
773 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
776 throw new ArgumentNullException ("image");
777 if (destPoints == null)
778 throw new ArgumentNullException ("destPoints");
779 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
780 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
781 srcRect.Width, srcRect.Height, srcUnit,
782 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
783 GDIPlus.CheckStatus (status);
787 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
790 throw new ArgumentNullException ("image");
791 if (destPoints == null)
792 throw new ArgumentNullException ("destPoints");
794 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
795 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
796 srcRect.Width, srcRect.Height, srcUnit,
797 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
798 GDIPlus.CheckStatus (status);
802 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
805 throw new ArgumentNullException ("image");
806 if (destPoints == null)
807 throw new ArgumentNullException ("destPoints");
809 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
810 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
811 srcRect.Width, srcRect.Height, srcUnit,
812 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
813 GDIPlus.CheckStatus (status);
817 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
820 throw new ArgumentNullException ("image");
821 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
822 destRect.X, destRect.Y, destRect.Width, destRect.Height,
823 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
825 GDIPlus.CheckStatus (status);
828 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
830 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
831 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
832 srcRect.Width, srcRect.Height, srcUnit,
833 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
834 GDIPlus.CheckStatus (status);
838 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
841 throw new ArgumentNullException ("image");
842 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
843 destRect.X, destRect.Y, destRect.Width, destRect.Height,
844 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
846 GDIPlus.CheckStatus (status);
850 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
853 throw new ArgumentNullException ("image");
854 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
855 destRect.X, destRect.Y, destRect.Width, destRect.Height,
856 srcX, srcY, srcWidth, srcHeight, srcUnit,
857 imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
858 GDIPlus.CheckStatus (status);
861 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
864 throw new ArgumentNullException ("image");
865 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
866 destRect.X, destRect.Y, destRect.Width,
867 destRect.Height, srcX, srcY, srcWidth, srcHeight,
868 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
869 GDIPlus.CheckStatus (status);
872 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
875 throw new ArgumentNullException ("image");
876 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
877 destRect.X, destRect.Y, destRect.Width,
878 destRect.Height, srcX, srcY, srcWidth, srcHeight,
879 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback,
881 GDIPlus.CheckStatus (status);
884 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
887 throw new ArgumentNullException ("image");
888 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
889 destRect.X, destRect.Y, destRect.Width,
890 destRect.Height, srcX, srcY, srcWidth, srcHeight,
891 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero,
892 callback, IntPtr.Zero);
893 GDIPlus.CheckStatus (status);
897 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
900 throw new ArgumentNullException ("image");
901 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
902 destRect.X, destRect.Y, destRect.Width, destRect.Height,
903 srcX, srcY, srcWidth, srcHeight, srcUnit,
904 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
905 GDIPlus.CheckStatus (status);
909 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
912 throw new ArgumentNullException ("image");
913 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
914 destRect.X, destRect.Y, destRect.Width, destRect.Height,
915 srcX, srcY, srcWidth, srcHeight, srcUnit,
916 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
917 GDIPlus.CheckStatus (status);
920 public void DrawImageUnscaled (Image image, Point point)
923 throw new ArgumentNullException ("image");
924 DrawImageUnscaled (image, point.X, point.Y);
927 public void DrawImageUnscaled (Image image, Rectangle rect)
930 throw new ArgumentNullException ("image");
931 DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
934 public void DrawImageUnscaled (Image image, int x, int y)
937 throw new ArgumentNullException ("image");
938 DrawImage (image, x, y, image.Width, image.Height);
941 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
944 throw new ArgumentNullException ("image");
945 Image tmpImg = new Bitmap (width, height);
946 Graphics g = FromImage (tmpImg);
947 g.DrawImage (image, 0, 0, image.Width, image.Height);
948 this.DrawImage (tmpImg, x, y, width, height);
954 public void DrawImageUnscaledAndClipped (Image image, Rectangle rect)
957 width = (image.Width > rect.Width) ? rect.Width : image.Width;
958 height = (image.Height > rect.Height) ? rect.Height : image.Height;
960 DrawImageUnscaled (image, rect.X, rect.Y, width, height);
964 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
967 throw new ArgumentNullException ("pen");
968 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
969 pt1.X, pt1.Y, pt2.X, pt2.Y);
970 GDIPlus.CheckStatus (status);
973 public void DrawLine (Pen pen, Point pt1, Point pt2)
976 throw new ArgumentNullException ("pen");
977 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
978 pt1.X, pt1.Y, pt2.X, pt2.Y);
979 GDIPlus.CheckStatus (status);
982 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
985 throw new ArgumentNullException ("pen");
986 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
987 GDIPlus.CheckStatus (status);
990 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
993 throw new ArgumentNullException ("pen");
994 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
995 GDIPlus.CheckStatus (status);
998 public void DrawLines (Pen pen, PointF [] points)
1001 throw new ArgumentNullException ("pen");
1003 throw new ArgumentNullException ("points");
1004 Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
1005 GDIPlus.CheckStatus (status);
1008 public void DrawLines (Pen pen, Point [] points)
1011 throw new ArgumentNullException ("pen");
1013 throw new ArgumentNullException ("points");
1014 Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
1015 GDIPlus.CheckStatus (status);
1018 public void DrawPath (Pen pen, GraphicsPath path)
1021 throw new ArgumentNullException ("pen");
1023 throw new ArgumentNullException ("path");
1024 Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
1025 GDIPlus.CheckStatus (status);
1028 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
1031 throw new ArgumentNullException ("pen");
1032 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1035 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
1038 throw new ArgumentNullException ("pen");
1039 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1042 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
1045 throw new ArgumentNullException ("pen");
1046 Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1047 GDIPlus.CheckStatus (status);
1050 // Microsoft documentation states that the signature for this member should be
1051 // public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle
1052 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
1053 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
1056 throw new ArgumentNullException ("pen");
1057 Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1058 GDIPlus.CheckStatus (status);
1061 public void DrawPolygon (Pen pen, Point [] points)
1064 throw new ArgumentNullException ("pen");
1066 throw new ArgumentNullException ("points");
1067 Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
1068 GDIPlus.CheckStatus (status);
1071 public void DrawPolygon (Pen pen, PointF [] points)
1074 throw new ArgumentNullException ("pen");
1076 throw new ArgumentNullException ("points");
1077 Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
1078 GDIPlus.CheckStatus (status);
1081 internal void DrawRectangle (Pen pen, RectangleF rect)
1084 throw new ArgumentNullException ("pen");
1085 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1088 public void DrawRectangle (Pen pen, Rectangle rect)
1091 throw new ArgumentNullException ("pen");
1092 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1095 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
1098 throw new ArgumentNullException ("pen");
1099 Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
1100 GDIPlus.CheckStatus (status);
1103 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
1106 throw new ArgumentNullException ("pen");
1107 Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
1108 GDIPlus.CheckStatus (status);
1111 public void DrawRectangles (Pen pen, RectangleF [] rects)
1114 throw new ArgumentNullException ("image");
1116 throw new ArgumentNullException ("rects");
1117 Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
1118 GDIPlus.CheckStatus (status);
1121 public void DrawRectangles (Pen pen, Rectangle [] rects)
1124 throw new ArgumentNullException ("image");
1126 throw new ArgumentNullException ("rects");
1127 Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
1128 GDIPlus.CheckStatus (status);
1131 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
1133 DrawString (s, font, brush, layoutRectangle, null);
1136 public void DrawString (string s, Font font, Brush brush, PointF point)
1138 DrawString (s, font, brush, new RectangleF (point.X, point.Y, 0, 0), null);
1141 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
1143 DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
1146 public void DrawString (string s, Font font, Brush brush, float x, float y)
1148 DrawString (s, font, brush, new RectangleF (x, y, 0, 0), null);
1151 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
1153 DrawString (s, font, brush, new RectangleF(x, y, 0, 0), format);
1156 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
1159 throw new ArgumentNullException ("font");
1161 throw new ArgumentNullException ("brush");
1162 if (s == null || s.Length == 0)
1165 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.nativeObject);
1166 GDIPlus.CheckStatus (status);
1169 public void EndContainer (GraphicsContainer container)
1171 if (container == null)
1172 throw new ArgumentNullException ("container");
1173 Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
1174 GDIPlus.CheckStatus (status);
1178 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
1180 throw new NotImplementedException ();
1184 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
1186 throw new NotImplementedException ();
1190 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
1192 throw new NotImplementedException ();
1196 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
1198 throw new NotImplementedException ();
1202 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
1204 throw new NotImplementedException ();
1208 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
1210 throw new NotImplementedException ();
1214 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1216 throw new NotImplementedException ();
1220 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1222 throw new NotImplementedException ();
1226 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1228 throw new NotImplementedException ();
1232 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1234 throw new NotImplementedException ();
1238 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1240 throw new NotImplementedException ();
1244 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1246 throw new NotImplementedException ();
1250 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1252 throw new NotImplementedException ();
1256 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1258 throw new NotImplementedException ();
1262 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1264 throw new NotImplementedException ();
1268 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1270 throw new NotImplementedException ();
1274 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1276 throw new NotImplementedException ();
1280 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1282 throw new NotImplementedException ();
1286 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1288 throw new NotImplementedException ();
1292 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1294 throw new NotImplementedException ();
1298 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1300 throw new NotImplementedException ();
1304 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1306 throw new NotImplementedException ();
1310 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1312 throw new NotImplementedException ();
1316 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1318 throw new NotImplementedException ();
1322 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1324 throw new NotImplementedException ();
1328 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1330 throw new NotImplementedException ();
1334 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1336 throw new NotImplementedException ();
1340 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1342 throw new NotImplementedException ();
1346 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1348 throw new NotImplementedException ();
1352 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1354 throw new NotImplementedException ();
1358 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1360 throw new NotImplementedException ();
1364 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1366 throw new NotImplementedException ();
1370 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1372 throw new NotImplementedException ();
1376 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1378 throw new NotImplementedException ();
1382 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1384 throw new NotImplementedException ();
1388 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1390 throw new NotImplementedException ();
1393 public void ExcludeClip (Rectangle rect)
1395 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1396 GDIPlus.CheckStatus (status);
1399 public void ExcludeClip (Region region)
1402 throw new ArgumentNullException ("region");
1403 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1404 GDIPlus.CheckStatus (status);
1408 public void FillClosedCurve (Brush brush, PointF [] points)
1411 throw new ArgumentNullException ("brush");
1413 throw new ArgumentNullException ("points");
1414 Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1415 GDIPlus.CheckStatus (status);
1419 public void FillClosedCurve (Brush brush, Point [] points)
1422 throw new ArgumentNullException ("brush");
1424 throw new ArgumentNullException ("points");
1425 Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1426 GDIPlus.CheckStatus (status);
1430 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1433 throw new ArgumentNullException ("brush");
1435 throw new ArgumentNullException ("points");
1436 FillClosedCurve (brush, points, fillmode, 0.5f);
1439 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1442 throw new ArgumentNullException ("brush");
1444 throw new ArgumentNullException ("points");
1445 FillClosedCurve (brush, points, fillmode, 0.5f);
1448 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1451 throw new ArgumentNullException ("brush");
1453 throw new ArgumentNullException ("points");
1454 Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1455 GDIPlus.CheckStatus (status);
1458 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1461 throw new ArgumentNullException ("brush");
1463 throw new ArgumentNullException ("points");
1464 Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1465 GDIPlus.CheckStatus (status);
1468 public void FillEllipse (Brush brush, Rectangle rect)
1471 throw new ArgumentNullException ("brush");
1472 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1475 public void FillEllipse (Brush brush, RectangleF rect)
1478 throw new ArgumentNullException ("brush");
1479 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1482 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1485 throw new ArgumentNullException ("brush");
1486 Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1487 GDIPlus.CheckStatus (status);
1490 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1493 throw new ArgumentNullException ("brush");
1494 Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1495 GDIPlus.CheckStatus (status);
1498 public void FillPath (Brush brush, GraphicsPath path)
1501 throw new ArgumentNullException ("brush");
1503 throw new ArgumentNullException ("path");
1504 Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject);
1505 GDIPlus.CheckStatus (status);
1508 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1511 throw new ArgumentNullException ("brush");
1512 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1513 GDIPlus.CheckStatus (status);
1516 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1519 throw new ArgumentNullException ("brush");
1520 Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1521 GDIPlus.CheckStatus (status);
1524 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1527 throw new ArgumentNullException ("brush");
1528 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1529 GDIPlus.CheckStatus (status);
1532 public void FillPolygon (Brush brush, PointF [] points)
1535 throw new ArgumentNullException ("brush");
1537 throw new ArgumentNullException ("points");
1538 Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1539 GDIPlus.CheckStatus (status);
1542 public void FillPolygon (Brush brush, Point [] points)
1545 throw new ArgumentNullException ("brush");
1547 throw new ArgumentNullException ("points");
1548 Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1549 GDIPlus.CheckStatus (status);
1552 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1555 throw new ArgumentNullException ("brush");
1557 throw new ArgumentNullException ("points");
1558 Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1559 GDIPlus.CheckStatus (status);
1562 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1565 throw new ArgumentNullException ("brush");
1567 throw new ArgumentNullException ("points");
1568 Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1569 GDIPlus.CheckStatus (status);
1572 public void FillRectangle (Brush brush, RectangleF rect)
1575 throw new ArgumentNullException ("brush");
1576 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1579 public void FillRectangle (Brush brush, Rectangle rect)
1582 throw new ArgumentNullException ("brush");
1583 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1586 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1589 throw new ArgumentNullException ("brush");
1591 Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
1592 GDIPlus.CheckStatus (status);
1595 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1598 throw new ArgumentNullException ("brush");
1600 Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1601 GDIPlus.CheckStatus (status);
1604 public void FillRectangles (Brush brush, Rectangle [] rects)
1607 throw new ArgumentNullException ("brush");
1609 Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
1610 GDIPlus.CheckStatus (status);
1613 public void FillRectangles (Brush brush, RectangleF [] rects)
1616 throw new ArgumentNullException ("brush");
1618 Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
1619 GDIPlus.CheckStatus (status);
1623 public void FillRegion (Brush brush, Region region)
1626 throw new ArgumentNullException ("brush");
1628 throw new ArgumentNullException ("region");
1630 Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);
1631 GDIPlus.CheckStatus(status);
1635 public void Flush ()
1637 Flush (FlushIntention.Flush);
1641 public void Flush (FlushIntention intention)
1643 if (nativeObject == IntPtr.Zero) {
1647 Status status = GDIPlus.GdipFlush (nativeObject, intention);
1648 GDIPlus.CheckStatus (status);
1649 if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
1650 Carbon.CGContextSynchronize (GDIPlus.Display);
1653 [EditorBrowsable (EditorBrowsableState.Advanced)]
1654 public static Graphics FromHdc (IntPtr hdc)
1657 Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1658 GDIPlus.CheckStatus (status);
1659 return new Graphics (graphics);
1663 [EditorBrowsable (EditorBrowsableState.Advanced)]
1664 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1666 throw new NotImplementedException ();
1669 [EditorBrowsable (EditorBrowsableState.Advanced)]
1670 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1671 public static Graphics FromHdcInternal (IntPtr hdc)
1673 GDIPlus.Display = hdc;
1677 [EditorBrowsable (EditorBrowsableState.Advanced)]
1678 public static Graphics FromHwnd (IntPtr hwnd)
1682 if (GDIPlus.UseCocoaDrawable) {
1683 CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
1684 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1686 GDIPlus.Display = cgContext.ctx;
1687 return new Graphics (graphics);
1689 if (GDIPlus.UseQuartzDrawable) {
1690 CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
1691 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1693 GDIPlus.Display = cgContext.ctx;
1694 return new Graphics (graphics);
1696 if (GDIPlus.UseX11Drawable) {
1697 if (GDIPlus.Display == IntPtr.Zero) {
1698 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
1701 return FromXDrawable (hwnd, GDIPlus.Display);
1705 Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
1706 GDIPlus.CheckStatus (status);
1708 return new Graphics (graphics);
1711 [EditorBrowsable (EditorBrowsableState.Advanced)]
1712 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1713 public static Graphics FromHwndInternal (IntPtr hwnd)
1715 return FromHwnd (hwnd);
1718 public static Graphics FromImage (Image image)
1723 throw new ArgumentNullException ("image");
1725 Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1726 GDIPlus.CheckStatus (status);
1727 Graphics result = new Graphics (graphics);
1729 // check for Unix platforms - see FAQ for more details
1730 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1731 int platform = (int) Environment.OSVersion.Platform;
1732 if ((platform == 4) || (platform == 128)) {
1733 Rectangle rect = new Rectangle (0,0, image.Width, image.Height);
1734 GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1740 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1744 Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1745 GDIPlus.CheckStatus (s);
1746 return new Graphics (graphics);
1750 public static IntPtr GetHalftonePalette ()
1752 throw new NotImplementedException ();
1756 [EditorBrowsable (EditorBrowsableState.Advanced)]
1758 public IntPtr GetHdc ()
1761 GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
1766 public Color GetNearestColor (Color color)
1770 Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1771 GDIPlus.CheckStatus (status);
1773 return Color.FromArgb (argb);
1777 public void IntersectClip (Region region)
1780 throw new ArgumentNullException ("region");
1781 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1782 GDIPlus.CheckStatus (status);
1785 public void IntersectClip (RectangleF rect)
1787 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1788 GDIPlus.CheckStatus (status);
1791 public void IntersectClip (Rectangle rect)
1793 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1794 GDIPlus.CheckStatus (status);
1797 public bool IsVisible (Point point)
1799 bool isVisible = false;
1801 Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1802 GDIPlus.CheckStatus (status);
1808 public bool IsVisible (RectangleF rect)
1810 bool isVisible = false;
1812 Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1813 GDIPlus.CheckStatus (status);
1818 public bool IsVisible (PointF point)
1820 bool isVisible = false;
1822 Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1823 GDIPlus.CheckStatus (status);
1828 public bool IsVisible (Rectangle rect)
1830 bool isVisible = false;
1832 Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1833 GDIPlus.CheckStatus (status);
1838 public bool IsVisible (float x, float y)
1840 return IsVisible (new PointF (x, y));
1843 public bool IsVisible (int x, int y)
1845 return IsVisible (new Point (x, y));
1848 public bool IsVisible (float x, float y, float width, float height)
1850 return IsVisible (new RectangleF (x, y, width, height));
1854 public bool IsVisible (int x, int y, int width, int height)
1856 return IsVisible (new Rectangle (x, y, width, height));
1860 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1863 int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1864 IntPtr[] native_regions = new IntPtr [regcount];
1865 Region[] regions = new Region [regcount];
1867 for (int i = 0; i < regcount; i++) {
1868 regions[i] = new Region ();
1869 native_regions[i] = regions[i].NativeObject;
1872 status = GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1873 font.NativeObject, ref layoutRect, stringFormat.NativeObject,
1874 regcount, out native_regions[0]);
1876 GDIPlus.CheckStatus (status);
1882 public SizeF MeasureString (string text, Font font)
1884 return MeasureString (text, font, new Size (0, 0));
1888 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1890 int charactersFitted, linesFilled;
1891 RectangleF boundingBox = new RectangleF ();
1892 RectangleF rect = new RectangleF (0, 0, layoutArea.Width,
1895 if (text == null || text.Length == 0)
1899 throw new ArgumentNullException ("font");
1901 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1902 font.NativeObject, ref rect,
1903 IntPtr.Zero, out boundingBox,
1904 out charactersFitted, out linesFilled);
1905 GDIPlus.CheckStatus (status);
1907 return new SizeF (boundingBox.Width, boundingBox.Height);
1911 public SizeF MeasureString (string text, Font font, int width)
1913 RectangleF boundingBox = new RectangleF ();
1914 RectangleF rect = new RectangleF (0, 0, width, 999999);
1915 int charactersFitted, linesFilled;
1917 if (text == null || text.Length == 0)
1921 throw new ArgumentNullException ("font");
1923 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1924 font.NativeObject, ref rect,
1925 IntPtr.Zero, out boundingBox,
1926 out charactersFitted, out linesFilled);
1927 GDIPlus.CheckStatus (status);
1929 return new SizeF (boundingBox.Width, boundingBox.Height);
1933 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1934 StringFormat stringFormat)
1936 int charactersFitted, linesFilled;
1937 return MeasureString (text, font, layoutArea, stringFormat,
1938 out charactersFitted, out linesFilled);
1942 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1944 int charactersFitted, linesFilled;
1945 return MeasureString (text, font, new SizeF (width, 999999),
1946 format, out charactersFitted, out linesFilled);
1950 public SizeF MeasureString (string text, Font font, PointF origin,
1951 StringFormat stringFormat)
1953 RectangleF boundingBox = new RectangleF ();
1954 RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
1955 int charactersFitted, linesFilled;
1957 if (text == null || text.Length == 0)
1961 throw new ArgumentNullException ("font");
1963 if (stringFormat == null)
1964 stringFormat = new StringFormat ();
1966 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1967 font.NativeObject, ref rect,
1968 stringFormat.NativeObject,
1970 out charactersFitted,
1972 GDIPlus.CheckStatus (status);
1974 return new SizeF (boundingBox.Width, boundingBox.Height);
1978 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1979 StringFormat stringFormat, out int charactersFitted,
1980 out int linesFilled)
1982 RectangleF boundingBox = new RectangleF ();
1983 RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1984 charactersFitted = 0;
1987 if (text == null || text.Length == 0)
1991 throw new ArgumentNullException ("font");
1993 if (stringFormat == null)
1994 stringFormat = new StringFormat ();
1996 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1997 font.NativeObject, ref rect,
1998 stringFormat.NativeObject,
2000 out charactersFitted,
2002 GDIPlus.CheckStatus (status);
2004 return new SizeF (boundingBox.Width, boundingBox.Height);
2007 public void MultiplyTransform (Matrix matrix)
2009 MultiplyTransform (matrix, MatrixOrder.Prepend);
2012 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
2014 Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject,
2015 matrix.nativeMatrix,
2017 GDIPlus.CheckStatus (status);
2020 [EditorBrowsable (EditorBrowsableState.Advanced)]
2021 public void ReleaseHdc (IntPtr hdc)
2023 Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
2024 GDIPlus.CheckStatus (status);
2027 public void ReleaseHdc()
\r
2034 [EditorBrowsable (EditorBrowsableState.Never)]
2036 [EditorBrowsable (EditorBrowsableState.Advanced)]
2038 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
2039 public void ReleaseHdcInternal (IntPtr hdc)
2041 throw new NotImplementedException ();
2045 public void ResetClip ()
2047 Status status = GDIPlus.GdipResetClip (nativeObject);
2048 GDIPlus.CheckStatus (status);
2051 public void ResetTransform ()
2053 Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
2054 GDIPlus.CheckStatus (status);
2057 public void Restore (GraphicsState gstate)
2059 Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
2060 GDIPlus.CheckStatus (status);
2064 public void RotateTransform (float angle)
2066 RotateTransform (angle, MatrixOrder.Prepend);
2069 public void RotateTransform (float angle, MatrixOrder order)
2072 Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
2073 GDIPlus.CheckStatus (status);
2076 public GraphicsState Save ()
2079 Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
2080 GDIPlus.CheckStatus (status);
2082 GraphicsState state = new GraphicsState ();
2083 state.nativeState = saveState;
2087 public void ScaleTransform (float sx, float sy)
2089 ScaleTransform (sx, sy, MatrixOrder.Prepend);
2092 public void ScaleTransform (float sx, float sy, MatrixOrder order)
2094 Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
2095 GDIPlus.CheckStatus (status);
2099 public void SetClip (RectangleF rect)
2101 SetClip (rect, CombineMode.Replace);
2105 public void SetClip (GraphicsPath path)
2107 SetClip (path, CombineMode.Replace);
2111 public void SetClip (Rectangle rect)
2113 SetClip (rect, CombineMode.Replace);
2117 public void SetClip (Graphics g)
2119 SetClip (g, CombineMode.Replace);
2123 public void SetClip (Graphics g, CombineMode combineMode)
2126 throw new ArgumentNullException ("g");
2128 Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
2129 GDIPlus.CheckStatus (status);
2133 public void SetClip (Rectangle rect, CombineMode combineMode)
2135 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2136 GDIPlus.CheckStatus (status);
2140 public void SetClip (RectangleF rect, CombineMode combineMode)
2142 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2143 GDIPlus.CheckStatus (status);
2147 public void SetClip (Region region, CombineMode combineMode)
2150 throw new ArgumentNullException ("region");
2151 Status status = GDIPlus.GdipSetClipRegion(nativeObject, region.NativeObject, combineMode);
2152 GDIPlus.CheckStatus (status);
2156 public void SetClip (GraphicsPath path, CombineMode combineMode)
2159 throw new ArgumentNullException ("path");
2160 Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
2161 GDIPlus.CheckStatus (status);
2165 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
2168 throw new ArgumentNullException ("pts");
2170 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemory (pts);
2172 Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2173 GDIPlus.CheckStatus (status);
2175 GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
2179 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
2182 throw new ArgumentNullException ("pts");
2183 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemoryI (pts);
2185 Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2186 GDIPlus.CheckStatus (status);
2188 GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
2192 public void TranslateClip (int dx, int dy)
2194 Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
2195 GDIPlus.CheckStatus (status);
2199 public void TranslateClip (float dx, float dy)
2201 Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
2202 GDIPlus.CheckStatus (status);
2205 public void TranslateTransform (float dx, float dy)
2207 TranslateTransform (dx, dy, MatrixOrder.Prepend);
2211 public void TranslateTransform (float dx, float dy, MatrixOrder order)
2213 Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
2214 GDIPlus.CheckStatus (status);
2217 public Region Clip {
2219 Region reg = new Region();
2220 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
2221 GDIPlus.CheckStatus (status);
2225 SetClip (value, CombineMode.Replace);
2229 public RectangleF ClipBounds {
2231 RectangleF rect = new RectangleF ();
2232 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
2233 GDIPlus.CheckStatus (status);
2238 public CompositingMode CompositingMode {
2240 CompositingMode mode;
2241 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
2242 GDIPlus.CheckStatus (status);
2247 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
2248 GDIPlus.CheckStatus (status);
2253 public CompositingQuality CompositingQuality {
2255 CompositingQuality quality;
2257 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
2258 GDIPlus.CheckStatus (status);
2262 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
2263 GDIPlus.CheckStatus (status);
2271 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
2272 GDIPlus.CheckStatus (status);
2281 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
2282 GDIPlus.CheckStatus (status);
2287 public InterpolationMode InterpolationMode {
2289 InterpolationMode imode = InterpolationMode.Invalid;
2290 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
2291 GDIPlus.CheckStatus (status);
2295 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
2296 GDIPlus.CheckStatus (status);
2300 public bool IsClipEmpty {
2302 bool isEmpty = false;
2304 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
2305 GDIPlus.CheckStatus (status);
2310 public bool IsVisibleClipEmpty {
2312 bool isEmpty = false;
2314 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
2315 GDIPlus.CheckStatus (status);
2320 public float PageScale {
2324 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
2325 GDIPlus.CheckStatus (status);
2329 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
2330 GDIPlus.CheckStatus (status);
2334 public GraphicsUnit PageUnit {
2338 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
2339 GDIPlus.CheckStatus (status);
2343 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
2344 GDIPlus.CheckStatus (status);
2348 public PixelOffsetMode PixelOffsetMode {
2350 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
2352 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
2353 GDIPlus.CheckStatus (status);
2357 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
2358 GDIPlus.CheckStatus (status);
2362 public Point RenderingOrigin {
2365 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
2366 GDIPlus.CheckStatus (status);
2367 return new Point (x, y);
2371 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
2372 GDIPlus.CheckStatus (status);
2376 public SmoothingMode SmoothingMode {
2378 SmoothingMode mode = SmoothingMode.Invalid;
2380 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
2381 GDIPlus.CheckStatus (status);
2386 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
2387 GDIPlus.CheckStatus (status);
2391 public int TextContrast {
2395 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
2396 GDIPlus.CheckStatus (status);
2401 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
2402 GDIPlus.CheckStatus (status);
2406 public TextRenderingHint TextRenderingHint {
2408 TextRenderingHint hint;
2410 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
2411 GDIPlus.CheckStatus (status);
2416 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
2417 GDIPlus.CheckStatus (status);
2421 public Matrix Transform {
2423 Matrix matrix = new Matrix ();
2424 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
2425 GDIPlus.CheckStatus (status);
2430 throw new ArgumentNullException ("value");
2432 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
2433 GDIPlus.CheckStatus (status);
2437 public RectangleF VisibleClipBounds {
2441 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
2442 GDIPlus.CheckStatus (status);