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);
87 static internal float systemDpiY {
90 Bitmap bmp = new Bitmap (1, 1);
91 Graphics g = Graphics.FromImage (bmp);
98 internal IntPtr NativeObject {
104 nativeObject = value;
109 public void AddMetafileComment (byte [] data)
111 throw new NotImplementedException ();
115 public GraphicsContainer BeginContainer ()
119 status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
120 GDIPlus.CheckStatus (status);
122 return new GraphicsContainer(state);
125 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
129 status = GDIPlus.GdipBeginContainerI (nativeObject, dstrect, srcrect, unit, out state);
130 GDIPlus.CheckStatus (status);
132 return new GraphicsContainer (state);
136 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
140 status = GDIPlus.GdipBeginContainer (nativeObject, dstrect, srcrect, unit, out state);
141 GDIPlus.CheckStatus (status);
143 return new GraphicsContainer (state);
147 public void Clear (Color color)
150 status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
151 GDIPlus.CheckStatus (status);
154 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
156 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
157 blockRegionSize, CopyPixelOperation.SourceCopy);
160 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
162 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
163 blockRegionSize, copyPixelOperation);
166 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
168 CopyFromScreen (sourceX, sourceY, destinationX, destinationY, blockRegionSize,
169 CopyPixelOperation.SourceCopy);
172 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
\r
176 if (!Enum.IsDefined (typeof (CopyPixelOperation), copyPixelOperation))
177 throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for CopyPixelOperation", copyPixelOperation));
179 if (GDIPlus.UseCocoaDrawable || GDIPlus.UseQuartzDrawable) {
180 throw new NotImplementedException ();
183 if (GDIPlus.UseX11Drawable) { // X11 implementation
184 IntPtr image, defvisual, vPtr;
185 int AllPlanes = ~0, nitems = 0, pixel;
187 if (copyPixelOperation != CopyPixelOperation.SourceCopy)
188 throw new NotImplementedException ("Operation not implemented under X11");
190 if (GDIPlus.Display == IntPtr.Zero) {
191 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
194 window = GDIPlus.XRootWindow (GDIPlus.Display, 0);
195 defvisual = GDIPlus.XDefaultVisual (GDIPlus.Display, 0);
196 XVisualInfo visual = new XVisualInfo ();
198 /* Get XVisualInfo for this visual */
199 visual.visualid = GDIPlus.XVisualIDFromVisual(defvisual);
200 vPtr = GDIPlus.XGetVisualInfo (GDIPlus.Display, 0x1 /* VisualIDMask */, ref visual, ref nitems);
201 visual = (XVisualInfo) Marshal.PtrToStructure(vPtr, typeof (XVisualInfo));
203 /* Sorry I do not have access to a computer with > deepth. Fell free to add more pixel formats */
204 image = GDIPlus.XGetImage (GDIPlus.Display, window, sourceX, sourceY, blockRegionSize.Width,
205 blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/);
207 Bitmap bmp = new Bitmap (blockRegionSize.Width, blockRegionSize.Height);
208 int red, blue, green;
209 for (int y = sourceY; y < sourceY + blockRegionSize.Height; y++) {
210 for (int x = sourceX; x < sourceX + blockRegionSize.Width; x++) {
211 pixel = GDIPlus.XGetPixel (image, x, y);
213 switch (visual.depth) {
214 case 16: /* 16bbp pixel transformation */
215 red = (int) ((pixel & visual.red_mask ) >> 8) & 0xff;
216 green = (int) (((pixel & visual.green_mask ) >> 3 )) & 0xff;
217 blue = (int) ((pixel & visual.blue_mask ) << 3 ) & 0xff;
221 red = (int) ((pixel & visual.red_mask ) >> 16) & 0xff;
222 green = (int) (((pixel & visual.green_mask ) >> 8 )) & 0xff;
223 blue = (int) ((pixel & visual.blue_mask )) & 0xff;
226 throw new NotImplementedException ("Deepth not supported right now");
229 bmp.SetPixel (x, y, Color.FromArgb (255, red, green, blue));
233 DrawImage (bmp, 0, 0);
235 GDIPlus.XDestroyImage (image);
239 // Win32 implementation
240 window = GDIPlus.GetDesktopWindow ();
241 IntPtr srcDC = GDIPlus.GetDC (window);
242 IntPtr dstDC = GetHdc ();
243 GDIPlus.BitBlt (dstDC, destinationX, destinationY, blockRegionSize.Width,
244 blockRegionSize.Height, srcDC, sourceX, sourceY, (int) copyPixelOperation);
246 GDIPlus.ReleaseDC (srcDC);
251 public void Dispose ()
255 status = GDIPlus.GdipDeleteGraphics (nativeObject);
256 nativeObject = IntPtr.Zero;
257 GDIPlus.CheckStatus (status);
260 GC.SuppressFinalize(this);
264 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
266 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
270 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
272 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
276 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
280 throw new ArgumentNullException ("pen");
282 status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
283 x, y, width, height, startAngle, sweepAngle);
284 GDIPlus.CheckStatus (status);
287 // Microsoft documentation states that the signature for this member should be
288 // public void DrawArc( Pen pen, int x, int y, int width, int height, int startAngle,
289 // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
290 public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
294 throw new ArgumentNullException ("pen");
295 status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
296 x, y, width, height, startAngle, sweepAngle);
297 GDIPlus.CheckStatus (status);
300 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
304 throw new ArgumentNullException ("pen");
305 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
306 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
307 pt3.Y, pt4.X, pt4.Y);
308 GDIPlus.CheckStatus (status);
311 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
315 throw new ArgumentNullException ("pen");
316 status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
317 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
318 pt3.Y, pt4.X, pt4.Y);
319 GDIPlus.CheckStatus (status);
322 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
326 throw new ArgumentNullException ("pen");
327 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
328 y1, x2, y2, x3, y3, x4, y4);
329 GDIPlus.CheckStatus (status);
332 public void DrawBeziers (Pen pen, Point [] points)
335 throw new ArgumentNullException ("pen");
337 throw new ArgumentNullException ("points");
339 int length = points.Length;
345 for (int i = 0; i < length; i += 3) {
346 Point p1 = points [i];
347 Point p2 = points [i + 1];
348 Point p3 = points [i + 2];
349 Point p4 = points [i + 3];
351 status = GDIPlus.GdipDrawBezier (nativeObject,
353 p1.X, p1.Y, p2.X, p2.Y,
354 p3.X, p3.Y, p4.X, p4.Y);
355 GDIPlus.CheckStatus (status);
359 public void DrawBeziers (Pen pen, PointF [] points)
362 throw new ArgumentNullException ("pen");
364 throw new ArgumentNullException ("points");
366 int length = points.Length;
372 for (int i = 0; i < length; i += 3) {
373 PointF p1 = points [i];
374 PointF p2 = points [i + 1];
375 PointF p3 = points [i + 2];
376 PointF p4 = points [i + 3];
378 status = GDIPlus.GdipDrawBezier (nativeObject,
380 p1.X, p1.Y, p2.X, p2.Y,
381 p3.X, p3.Y, p4.X, p4.Y);
382 GDIPlus.CheckStatus (status);
387 public void DrawClosedCurve (Pen pen, PointF [] points)
390 throw new ArgumentNullException ("pen");
392 throw new ArgumentNullException ("points");
395 status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
396 GDIPlus.CheckStatus (status);
399 public void DrawClosedCurve (Pen pen, Point [] points)
402 throw new ArgumentNullException ("pen");
404 throw new ArgumentNullException ("points");
407 status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
408 GDIPlus.CheckStatus (status);
411 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
414 throw new ArgumentNullException ("pen");
416 throw new ArgumentNullException ("points");
419 status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
420 GDIPlus.CheckStatus (status);
423 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
426 throw new ArgumentNullException ("pen");
428 throw new ArgumentNullException ("points");
431 status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
432 GDIPlus.CheckStatus (status);
435 public void DrawCurve (Pen pen, Point [] points)
438 throw new ArgumentNullException ("pen");
440 throw new ArgumentNullException ("points");
443 status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
444 GDIPlus.CheckStatus (status);
447 public void DrawCurve (Pen pen, PointF [] points)
450 throw new ArgumentNullException ("pen");
452 throw new ArgumentNullException ("points");
455 status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
456 GDIPlus.CheckStatus (status);
459 public void DrawCurve (Pen pen, PointF [] points, float tension)
462 throw new ArgumentNullException ("pen");
464 throw new ArgumentNullException ("points");
467 status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
468 GDIPlus.CheckStatus (status);
471 public void DrawCurve (Pen pen, Point [] points, float tension)
474 throw new ArgumentNullException ("pen");
476 throw new ArgumentNullException ("points");
479 status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
480 GDIPlus.CheckStatus (status);
484 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
487 throw new ArgumentNullException ("pen");
489 throw new ArgumentNullException ("points");
492 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
493 points, points.Length, offset,
494 numberOfSegments, 0.5f);
495 GDIPlus.CheckStatus (status);
498 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
501 throw new ArgumentNullException ("pen");
503 throw new ArgumentNullException ("points");
506 status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
507 points, points.Length, offset,
508 numberOfSegments, tension);
509 GDIPlus.CheckStatus (status);
513 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
516 throw new ArgumentNullException ("pen");
518 throw new ArgumentNullException ("points");
521 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
522 points, points.Length, offset,
523 numberOfSegments, tension);
524 GDIPlus.CheckStatus (status);
527 public void DrawEllipse (Pen pen, Rectangle rect)
530 throw new ArgumentNullException ("pen");
532 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
535 public void DrawEllipse (Pen pen, RectangleF rect)
538 throw new ArgumentNullException ("pen");
539 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
542 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
545 throw new ArgumentNullException ("pen");
547 status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
548 GDIPlus.CheckStatus (status);
551 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
554 throw new ArgumentNullException ("pen");
555 Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
556 GDIPlus.CheckStatus (status);
559 public void DrawIcon (Icon icon, Rectangle targetRect)
561 Image img = icon.ToBitmap ();
562 DrawImage (img, targetRect);
565 public void DrawIcon (Icon icon, int x, int y)
567 Image img = icon.ToBitmap ();
568 DrawImage (img, x, y);
571 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
573 Image img = icon.ToBitmap ();
574 DrawImageUnscaled (img, targetRect);
577 public void DrawImage (Image image, RectangleF rect)
580 throw new ArgumentNullException ("image");
582 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
583 GDIPlus.CheckStatus (status);
587 public void DrawImage (Image image, PointF point)
590 throw new ArgumentNullException ("image");
592 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
593 GDIPlus.CheckStatus (status);
597 public void DrawImage (Image image, Point [] destPoints)
600 throw new ArgumentNullException ("image");
601 if (destPoints == null)
602 throw new ArgumentNullException ("destPoints");
604 Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
605 GDIPlus.CheckStatus (status);
609 public void DrawImage (Image image, Point point)
612 throw new ArgumentNullException ("image");
613 DrawImage (image, point.X, point.Y);
617 public void DrawImage (Image image, Rectangle rect)
620 throw new ArgumentNullException ("image");
621 DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
625 public void DrawImage (Image image, PointF [] destPoints)
628 throw new ArgumentNullException ("image");
629 if (destPoints == null)
630 throw new ArgumentNullException ("destPoints");
631 Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
632 GDIPlus.CheckStatus (status);
636 public void DrawImage (Image image, int x, int y)
639 throw new ArgumentNullException ("image");
640 Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
641 GDIPlus.CheckStatus (status);
645 public void DrawImage (Image image, float x, float y)
648 throw new ArgumentNullException ("image");
649 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
650 GDIPlus.CheckStatus (status);
654 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
657 throw new ArgumentNullException ("image");
658 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
659 destRect.X, destRect.Y, destRect.Width, destRect.Height,
660 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
661 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
662 GDIPlus.CheckStatus (status);
665 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
668 throw new ArgumentNullException ("image");
669 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
670 destRect.X, destRect.Y, destRect.Width, destRect.Height,
671 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
672 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
673 GDIPlus.CheckStatus (status);
677 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
680 throw new ArgumentNullException ("image");
681 if (destPoints == null)
682 throw new ArgumentNullException ("destPoints");
684 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
685 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
686 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
688 GDIPlus.CheckStatus (status);
692 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
695 throw new ArgumentNullException ("image");
696 if (destPoints == null)
697 throw new ArgumentNullException ("destPoints");
699 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
700 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
701 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
703 GDIPlus.CheckStatus (status);
707 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
708 ImageAttributes imageAttr)
711 throw new ArgumentNullException ("image");
712 if (destPoints == null)
713 throw new ArgumentNullException ("destPoints");
714 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
715 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
716 srcRect.Width, srcRect.Height, srcUnit,
717 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
718 GDIPlus.CheckStatus (status);
721 public void DrawImage (Image image, float x, float y, float width, float height)
724 throw new ArgumentNullException ("image");
725 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
727 GDIPlus.CheckStatus (status);
731 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
732 ImageAttributes imageAttr)
735 throw new ArgumentNullException ("image");
736 if (destPoints == null)
737 throw new ArgumentNullException ("destPoints");
738 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
739 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
740 srcRect.Width, srcRect.Height, srcUnit,
741 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
742 GDIPlus.CheckStatus (status);
746 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
749 throw new ArgumentNullException ("image");
750 Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
751 GDIPlus.CheckStatus (status);
754 public void DrawImage (Image image, int x, int y, int width, int height)
757 throw new ArgumentNullException ("image");
758 Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
759 GDIPlus.CheckStatus (status);
762 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
765 throw new ArgumentNullException ("image");
766 Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
767 GDIPlus.CheckStatus (status);
771 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
774 throw new ArgumentNullException ("image");
775 if (destPoints == null)
776 throw new ArgumentNullException ("destPoints");
777 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
778 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
779 srcRect.Width, srcRect.Height, srcUnit,
780 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
781 GDIPlus.CheckStatus (status);
785 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
788 throw new ArgumentNullException ("image");
789 if (destPoints == null)
790 throw new ArgumentNullException ("destPoints");
792 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
793 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
794 srcRect.Width, srcRect.Height, srcUnit,
795 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
796 GDIPlus.CheckStatus (status);
800 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
803 throw new ArgumentNullException ("image");
804 if (destPoints == null)
805 throw new ArgumentNullException ("destPoints");
807 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
808 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
809 srcRect.Width, srcRect.Height, srcUnit,
810 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
811 GDIPlus.CheckStatus (status);
815 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
818 throw new ArgumentNullException ("image");
819 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
820 destRect.X, destRect.Y, destRect.Width, destRect.Height,
821 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
823 GDIPlus.CheckStatus (status);
826 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
828 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
829 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
830 srcRect.Width, srcRect.Height, srcUnit,
831 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
832 GDIPlus.CheckStatus (status);
836 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
839 throw new ArgumentNullException ("image");
840 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
841 destRect.X, destRect.Y, destRect.Width, destRect.Height,
842 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
844 GDIPlus.CheckStatus (status);
848 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
851 throw new ArgumentNullException ("image");
852 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
853 destRect.X, destRect.Y, destRect.Width, destRect.Height,
854 srcX, srcY, srcWidth, srcHeight, srcUnit,
855 imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
856 GDIPlus.CheckStatus (status);
859 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
862 throw new ArgumentNullException ("image");
863 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
864 destRect.X, destRect.Y, destRect.Width,
865 destRect.Height, srcX, srcY, srcWidth, srcHeight,
866 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
867 GDIPlus.CheckStatus (status);
870 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
873 throw new ArgumentNullException ("image");
874 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
875 destRect.X, destRect.Y, destRect.Width,
876 destRect.Height, srcX, srcY, srcWidth, srcHeight,
877 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback,
879 GDIPlus.CheckStatus (status);
882 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
885 throw new ArgumentNullException ("image");
886 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
887 destRect.X, destRect.Y, destRect.Width,
888 destRect.Height, srcX, srcY, srcWidth, srcHeight,
889 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero,
890 callback, IntPtr.Zero);
891 GDIPlus.CheckStatus (status);
895 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
898 throw new ArgumentNullException ("image");
899 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
900 destRect.X, destRect.Y, destRect.Width, destRect.Height,
901 srcX, srcY, srcWidth, srcHeight, srcUnit,
902 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
903 GDIPlus.CheckStatus (status);
907 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
910 throw new ArgumentNullException ("image");
911 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
912 destRect.X, destRect.Y, destRect.Width, destRect.Height,
913 srcX, srcY, srcWidth, srcHeight, srcUnit,
914 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
915 GDIPlus.CheckStatus (status);
918 public void DrawImageUnscaled (Image image, Point point)
921 throw new ArgumentNullException ("image");
922 DrawImageUnscaled (image, point.X, point.Y);
925 public void DrawImageUnscaled (Image image, Rectangle rect)
928 throw new ArgumentNullException ("image");
929 DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
932 public void DrawImageUnscaled (Image image, int x, int y)
935 throw new ArgumentNullException ("image");
936 DrawImage (image, x, y, image.Width, image.Height);
939 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
942 throw new ArgumentNullException ("image");
943 Image tmpImg = new Bitmap (width, height);
944 Graphics g = FromImage (tmpImg);
945 g.DrawImage (image, 0, 0, image.Width, image.Height);
946 this.DrawImage (tmpImg, x, y, width, height);
952 public void DrawImageUnscaledAndClipped (Image image, Rectangle rect)
955 width = (image.Width > rect.Width) ? rect.Width : image.Width;
956 height = (image.Height > rect.Height) ? rect.Height : image.Height;
958 DrawImageUnscaled (image, rect.X, rect.Y, width, height);
962 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
965 throw new ArgumentNullException ("pen");
966 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
967 pt1.X, pt1.Y, pt2.X, pt2.Y);
968 GDIPlus.CheckStatus (status);
971 public void DrawLine (Pen pen, Point pt1, Point pt2)
974 throw new ArgumentNullException ("pen");
975 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
976 pt1.X, pt1.Y, pt2.X, pt2.Y);
977 GDIPlus.CheckStatus (status);
980 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
983 throw new ArgumentNullException ("pen");
984 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
985 GDIPlus.CheckStatus (status);
988 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
991 throw new ArgumentNullException ("pen");
992 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
993 GDIPlus.CheckStatus (status);
996 public void DrawLines (Pen pen, PointF [] points)
999 throw new ArgumentNullException ("pen");
1001 throw new ArgumentNullException ("points");
1002 Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
1003 GDIPlus.CheckStatus (status);
1006 public void DrawLines (Pen pen, Point [] points)
1009 throw new ArgumentNullException ("pen");
1011 throw new ArgumentNullException ("points");
1012 Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
1013 GDIPlus.CheckStatus (status);
1016 public void DrawPath (Pen pen, GraphicsPath path)
1019 throw new ArgumentNullException ("pen");
1021 throw new ArgumentNullException ("path");
1022 Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
1023 GDIPlus.CheckStatus (status);
1026 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
1029 throw new ArgumentNullException ("pen");
1030 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1033 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
1036 throw new ArgumentNullException ("pen");
1037 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1040 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
1043 throw new ArgumentNullException ("pen");
1044 Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1045 GDIPlus.CheckStatus (status);
1048 // Microsoft documentation states that the signature for this member should be
1049 // public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle
1050 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
1051 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
1054 throw new ArgumentNullException ("pen");
1055 Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1056 GDIPlus.CheckStatus (status);
1059 public void DrawPolygon (Pen pen, Point [] points)
1062 throw new ArgumentNullException ("pen");
1064 throw new ArgumentNullException ("points");
1065 Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
1066 GDIPlus.CheckStatus (status);
1069 public void DrawPolygon (Pen pen, PointF [] points)
1072 throw new ArgumentNullException ("pen");
1074 throw new ArgumentNullException ("points");
1075 Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
1076 GDIPlus.CheckStatus (status);
1079 internal void DrawRectangle (Pen pen, RectangleF rect)
1082 throw new ArgumentNullException ("pen");
1083 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1086 public void DrawRectangle (Pen pen, Rectangle rect)
1089 throw new ArgumentNullException ("pen");
1090 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1093 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
1096 throw new ArgumentNullException ("pen");
1097 Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
1098 GDIPlus.CheckStatus (status);
1101 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
1104 throw new ArgumentNullException ("pen");
1105 Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
1106 GDIPlus.CheckStatus (status);
1109 public void DrawRectangles (Pen pen, RectangleF [] rects)
1112 throw new ArgumentNullException ("image");
1114 throw new ArgumentNullException ("rects");
1115 Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
1116 GDIPlus.CheckStatus (status);
1119 public void DrawRectangles (Pen pen, Rectangle [] rects)
1122 throw new ArgumentNullException ("image");
1124 throw new ArgumentNullException ("rects");
1125 Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
1126 GDIPlus.CheckStatus (status);
1129 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
1131 DrawString (s, font, brush, layoutRectangle, null);
1134 public void DrawString (string s, Font font, Brush brush, PointF point)
1136 DrawString (s, font, brush, new RectangleF (point.X, point.Y, 0, 0), null);
1139 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
1141 DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
1144 public void DrawString (string s, Font font, Brush brush, float x, float y)
1146 DrawString (s, font, brush, new RectangleF (x, y, 0, 0), null);
1149 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
1151 DrawString (s, font, brush, new RectangleF(x, y, 0, 0), format);
1154 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
1157 throw new ArgumentNullException ("font");
1159 throw new ArgumentNullException ("brush");
1160 if (s == null || s.Length == 0)
1163 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.nativeObject);
1164 GDIPlus.CheckStatus (status);
1167 public void EndContainer (GraphicsContainer container)
1169 if (container == null)
1170 throw new ArgumentNullException ("container");
1171 Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
1172 GDIPlus.CheckStatus (status);
1176 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
1178 throw new NotImplementedException ();
1182 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
1184 throw new NotImplementedException ();
1188 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
1190 throw new NotImplementedException ();
1194 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
1196 throw new NotImplementedException ();
1200 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
1202 throw new NotImplementedException ();
1206 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
1208 throw new NotImplementedException ();
1212 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1214 throw new NotImplementedException ();
1218 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1220 throw new NotImplementedException ();
1224 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1226 throw new NotImplementedException ();
1230 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1232 throw new NotImplementedException ();
1236 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1238 throw new NotImplementedException ();
1242 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1244 throw new NotImplementedException ();
1248 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1250 throw new NotImplementedException ();
1254 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1256 throw new NotImplementedException ();
1260 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1262 throw new NotImplementedException ();
1266 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1268 throw new NotImplementedException ();
1272 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1274 throw new NotImplementedException ();
1278 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1280 throw new NotImplementedException ();
1284 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1286 throw new NotImplementedException ();
1290 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1292 throw new NotImplementedException ();
1296 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1298 throw new NotImplementedException ();
1302 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1304 throw new NotImplementedException ();
1308 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1310 throw new NotImplementedException ();
1314 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1316 throw new NotImplementedException ();
1320 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1322 throw new NotImplementedException ();
1326 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1328 throw new NotImplementedException ();
1332 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1334 throw new NotImplementedException ();
1338 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1340 throw new NotImplementedException ();
1344 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1346 throw new NotImplementedException ();
1350 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1352 throw new NotImplementedException ();
1356 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1358 throw new NotImplementedException ();
1362 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1364 throw new NotImplementedException ();
1368 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1370 throw new NotImplementedException ();
1374 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1376 throw new NotImplementedException ();
1380 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1382 throw new NotImplementedException ();
1386 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1388 throw new NotImplementedException ();
1391 public void ExcludeClip (Rectangle rect)
1393 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1394 GDIPlus.CheckStatus (status);
1397 public void ExcludeClip (Region region)
1400 throw new ArgumentNullException ("region");
1401 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1402 GDIPlus.CheckStatus (status);
1406 public void FillClosedCurve (Brush brush, PointF [] points)
1409 throw new ArgumentNullException ("brush");
1411 throw new ArgumentNullException ("points");
1412 Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1413 GDIPlus.CheckStatus (status);
1417 public void FillClosedCurve (Brush brush, Point [] points)
1420 throw new ArgumentNullException ("brush");
1422 throw new ArgumentNullException ("points");
1423 Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1424 GDIPlus.CheckStatus (status);
1428 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1431 throw new ArgumentNullException ("brush");
1433 throw new ArgumentNullException ("points");
1434 FillClosedCurve (brush, points, fillmode, 0.5f);
1437 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1440 throw new ArgumentNullException ("brush");
1442 throw new ArgumentNullException ("points");
1443 FillClosedCurve (brush, points, fillmode, 0.5f);
1446 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1449 throw new ArgumentNullException ("brush");
1451 throw new ArgumentNullException ("points");
1452 Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1453 GDIPlus.CheckStatus (status);
1456 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1459 throw new ArgumentNullException ("brush");
1461 throw new ArgumentNullException ("points");
1462 Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1463 GDIPlus.CheckStatus (status);
1466 public void FillEllipse (Brush brush, Rectangle rect)
1469 throw new ArgumentNullException ("brush");
1470 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1473 public void FillEllipse (Brush brush, RectangleF rect)
1476 throw new ArgumentNullException ("brush");
1477 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1480 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1483 throw new ArgumentNullException ("brush");
1484 Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1485 GDIPlus.CheckStatus (status);
1488 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1491 throw new ArgumentNullException ("brush");
1492 Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1493 GDIPlus.CheckStatus (status);
1496 public void FillPath (Brush brush, GraphicsPath path)
1499 throw new ArgumentNullException ("brush");
1501 throw new ArgumentNullException ("path");
1502 Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject);
1503 GDIPlus.CheckStatus (status);
1506 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1509 throw new ArgumentNullException ("brush");
1510 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1511 GDIPlus.CheckStatus (status);
1514 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1517 throw new ArgumentNullException ("brush");
1518 Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1519 GDIPlus.CheckStatus (status);
1522 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1525 throw new ArgumentNullException ("brush");
1526 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1527 GDIPlus.CheckStatus (status);
1530 public void FillPolygon (Brush brush, PointF [] points)
1533 throw new ArgumentNullException ("brush");
1535 throw new ArgumentNullException ("points");
1536 Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1537 GDIPlus.CheckStatus (status);
1540 public void FillPolygon (Brush brush, Point [] points)
1543 throw new ArgumentNullException ("brush");
1545 throw new ArgumentNullException ("points");
1546 Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1547 GDIPlus.CheckStatus (status);
1550 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1553 throw new ArgumentNullException ("brush");
1555 throw new ArgumentNullException ("points");
1556 Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1557 GDIPlus.CheckStatus (status);
1560 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1563 throw new ArgumentNullException ("brush");
1565 throw new ArgumentNullException ("points");
1566 Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1567 GDIPlus.CheckStatus (status);
1570 public void FillRectangle (Brush brush, RectangleF rect)
1573 throw new ArgumentNullException ("brush");
1574 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1577 public void FillRectangle (Brush brush, Rectangle rect)
1580 throw new ArgumentNullException ("brush");
1581 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1584 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1587 throw new ArgumentNullException ("brush");
1589 Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
1590 GDIPlus.CheckStatus (status);
1593 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1596 throw new ArgumentNullException ("brush");
1598 Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1599 GDIPlus.CheckStatus (status);
1602 public void FillRectangles (Brush brush, Rectangle [] rects)
1605 throw new ArgumentNullException ("brush");
1607 Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
1608 GDIPlus.CheckStatus (status);
1611 public void FillRectangles (Brush brush, RectangleF [] rects)
1614 throw new ArgumentNullException ("brush");
1616 Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
1617 GDIPlus.CheckStatus (status);
1621 public void FillRegion (Brush brush, Region region)
1624 throw new ArgumentNullException ("brush");
1626 throw new ArgumentNullException ("region");
1628 Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);
1629 GDIPlus.CheckStatus(status);
1633 public void Flush ()
1635 Flush (FlushIntention.Flush);
1639 public void Flush (FlushIntention intention)
1641 if (nativeObject == IntPtr.Zero) {
1645 Status status = GDIPlus.GdipFlush (nativeObject, intention);
1646 GDIPlus.CheckStatus (status);
1647 if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
1648 Carbon.CGContextSynchronize (GDIPlus.Display);
1651 [EditorBrowsable (EditorBrowsableState.Advanced)]
1652 public static Graphics FromHdc (IntPtr hdc)
1655 Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1656 GDIPlus.CheckStatus (status);
1657 return new Graphics (graphics);
1661 [EditorBrowsable (EditorBrowsableState.Advanced)]
1662 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1664 throw new NotImplementedException ();
1667 [EditorBrowsable (EditorBrowsableState.Advanced)]
1668 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1669 public static Graphics FromHdcInternal (IntPtr hdc)
1671 GDIPlus.Display = hdc;
1675 [EditorBrowsable (EditorBrowsableState.Advanced)]
1676 public static Graphics FromHwnd (IntPtr hwnd)
1680 if (GDIPlus.UseCocoaDrawable) {
1681 CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
1682 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1684 GDIPlus.Display = cgContext.ctx;
1685 return new Graphics (graphics);
1687 if (GDIPlus.UseQuartzDrawable) {
1688 CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
1689 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1691 GDIPlus.Display = cgContext.ctx;
1692 return new Graphics (graphics);
1694 if (GDIPlus.UseX11Drawable) {
1695 if (GDIPlus.Display == IntPtr.Zero) {
1696 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
1699 return FromXDrawable (hwnd, GDIPlus.Display);
1703 Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
1704 GDIPlus.CheckStatus (status);
1706 return new Graphics (graphics);
1709 [EditorBrowsable (EditorBrowsableState.Advanced)]
1710 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1711 public static Graphics FromHwndInternal (IntPtr hwnd)
1713 return FromHwnd (hwnd);
1716 public static Graphics FromImage (Image image)
1721 throw new ArgumentNullException ("image");
1723 Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1724 GDIPlus.CheckStatus (status);
1725 Graphics result = new Graphics (graphics);
1727 // check for Unix platforms - see FAQ for more details
1728 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1729 int platform = (int) Environment.OSVersion.Platform;
1730 if ((platform == 4) || (platform == 128)) {
1731 Rectangle rect = new Rectangle (0,0, image.Width, image.Height);
1732 GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1738 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1742 Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1743 GDIPlus.CheckStatus (s);
1744 return new Graphics (graphics);
1748 public static IntPtr GetHalftonePalette ()
1750 throw new NotImplementedException ();
1754 [EditorBrowsable (EditorBrowsableState.Advanced)]
1756 public IntPtr GetHdc ()
1759 GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
1764 public Color GetNearestColor (Color color)
1768 Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1769 GDIPlus.CheckStatus (status);
1771 return Color.FromArgb (argb);
1775 public void IntersectClip (Region region)
1778 throw new ArgumentNullException ("region");
1779 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1780 GDIPlus.CheckStatus (status);
1783 public void IntersectClip (RectangleF rect)
1785 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1786 GDIPlus.CheckStatus (status);
1789 public void IntersectClip (Rectangle rect)
1791 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1792 GDIPlus.CheckStatus (status);
1795 public bool IsVisible (Point point)
1797 bool isVisible = false;
1799 Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1800 GDIPlus.CheckStatus (status);
1806 public bool IsVisible (RectangleF rect)
1808 bool isVisible = false;
1810 Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1811 GDIPlus.CheckStatus (status);
1816 public bool IsVisible (PointF point)
1818 bool isVisible = false;
1820 Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1821 GDIPlus.CheckStatus (status);
1826 public bool IsVisible (Rectangle rect)
1828 bool isVisible = false;
1830 Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1831 GDIPlus.CheckStatus (status);
1836 public bool IsVisible (float x, float y)
1838 return IsVisible (new PointF (x, y));
1841 public bool IsVisible (int x, int y)
1843 return IsVisible (new Point (x, y));
1846 public bool IsVisible (float x, float y, float width, float height)
1848 return IsVisible (new RectangleF (x, y, width, height));
1852 public bool IsVisible (int x, int y, int width, int height)
1854 return IsVisible (new Rectangle (x, y, width, height));
1858 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1861 int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1862 IntPtr[] native_regions = new IntPtr [regcount];
1863 Region[] regions = new Region [regcount];
1865 for (int i = 0; i < regcount; i++) {
1866 regions[i] = new Region ();
1867 native_regions[i] = regions[i].NativeObject;
1870 status = GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1871 font.NativeObject, ref layoutRect, stringFormat.NativeObject,
1872 regcount, out native_regions[0]);
1874 GDIPlus.CheckStatus (status);
1880 public SizeF MeasureString (string text, Font font)
1882 return MeasureString (text, font, new Size (0, 0));
1886 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1888 int charactersFitted, linesFilled;
1889 RectangleF boundingBox = new RectangleF ();
1890 RectangleF rect = new RectangleF (0, 0, layoutArea.Width,
1893 if (text == null || text.Length == 0)
1897 throw new ArgumentNullException ("font");
1899 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1900 font.NativeObject, ref rect,
1901 IntPtr.Zero, out boundingBox,
1902 out charactersFitted, out linesFilled);
1903 GDIPlus.CheckStatus (status);
1905 return new SizeF (boundingBox.Width, boundingBox.Height);
1909 public SizeF MeasureString (string text, Font font, int width)
1911 RectangleF boundingBox = new RectangleF ();
1912 RectangleF rect = new RectangleF (0, 0, width, 999999);
1913 int charactersFitted, linesFilled;
1915 if (text == null || text.Length == 0)
1919 throw new ArgumentNullException ("font");
1921 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1922 font.NativeObject, ref rect,
1923 IntPtr.Zero, out boundingBox,
1924 out charactersFitted, out linesFilled);
1925 GDIPlus.CheckStatus (status);
1927 return new SizeF (boundingBox.Width, boundingBox.Height);
1931 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1932 StringFormat stringFormat)
1934 int charactersFitted, linesFilled;
1935 return MeasureString (text, font, layoutArea, stringFormat,
1936 out charactersFitted, out linesFilled);
1940 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1942 int charactersFitted, linesFilled;
1943 return MeasureString (text, font, new SizeF (width, 999999),
1944 format, out charactersFitted, out linesFilled);
1948 public SizeF MeasureString (string text, Font font, PointF origin,
1949 StringFormat stringFormat)
1951 RectangleF boundingBox = new RectangleF ();
1952 RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
1953 int charactersFitted, linesFilled;
1955 if (text == null || text.Length == 0)
1959 throw new ArgumentNullException ("font");
1961 if (stringFormat == null)
1962 stringFormat = new StringFormat ();
1964 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1965 font.NativeObject, ref rect,
1966 stringFormat.NativeObject,
1968 out charactersFitted,
1970 GDIPlus.CheckStatus (status);
1972 return new SizeF (boundingBox.Width, boundingBox.Height);
1976 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1977 StringFormat stringFormat, out int charactersFitted,
1978 out int linesFilled)
1980 RectangleF boundingBox = new RectangleF ();
1981 RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1982 charactersFitted = 0;
1985 if (text == null || text.Length == 0)
1989 throw new ArgumentNullException ("font");
1991 if (stringFormat == null)
1992 stringFormat = new StringFormat ();
1994 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1995 font.NativeObject, ref rect,
1996 stringFormat.NativeObject,
1998 out charactersFitted,
2000 GDIPlus.CheckStatus (status);
2002 return new SizeF (boundingBox.Width, boundingBox.Height);
2005 public void MultiplyTransform (Matrix matrix)
2007 MultiplyTransform (matrix, MatrixOrder.Prepend);
2010 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
2012 Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject,
2013 matrix.nativeMatrix,
2015 GDIPlus.CheckStatus (status);
2018 [EditorBrowsable (EditorBrowsableState.Advanced)]
2019 public void ReleaseHdc (IntPtr hdc)
2021 Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
2022 GDIPlus.CheckStatus (status);
2025 public void ReleaseHdc()
\r
2032 [EditorBrowsable (EditorBrowsableState.Never)]
2034 [EditorBrowsable (EditorBrowsableState.Advanced)]
2036 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
2037 public void ReleaseHdcInternal (IntPtr hdc)
2039 throw new NotImplementedException ();
2043 public void ResetClip ()
2045 Status status = GDIPlus.GdipResetClip (nativeObject);
2046 GDIPlus.CheckStatus (status);
2049 public void ResetTransform ()
2051 Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
2052 GDIPlus.CheckStatus (status);
2055 public void Restore (GraphicsState gstate)
2057 Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
2058 GDIPlus.CheckStatus (status);
2062 public void RotateTransform (float angle)
2064 RotateTransform (angle, MatrixOrder.Prepend);
2067 public void RotateTransform (float angle, MatrixOrder order)
2070 Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
2071 GDIPlus.CheckStatus (status);
2074 public GraphicsState Save ()
2077 Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
2078 GDIPlus.CheckStatus (status);
2080 GraphicsState state = new GraphicsState ();
2081 state.nativeState = saveState;
2085 public void ScaleTransform (float sx, float sy)
2087 ScaleTransform (sx, sy, MatrixOrder.Prepend);
2090 public void ScaleTransform (float sx, float sy, MatrixOrder order)
2092 Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
2093 GDIPlus.CheckStatus (status);
2097 public void SetClip (RectangleF rect)
2099 SetClip (rect, CombineMode.Replace);
2103 public void SetClip (GraphicsPath path)
2105 SetClip (path, CombineMode.Replace);
2109 public void SetClip (Rectangle rect)
2111 SetClip (rect, CombineMode.Replace);
2115 public void SetClip (Graphics g)
2117 SetClip (g, CombineMode.Replace);
2121 public void SetClip (Graphics g, CombineMode combineMode)
2124 throw new ArgumentNullException ("g");
2126 Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
2127 GDIPlus.CheckStatus (status);
2131 public void SetClip (Rectangle rect, CombineMode combineMode)
2133 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2134 GDIPlus.CheckStatus (status);
2138 public void SetClip (RectangleF rect, CombineMode combineMode)
2140 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2141 GDIPlus.CheckStatus (status);
2145 public void SetClip (Region region, CombineMode combineMode)
2148 throw new ArgumentNullException ("region");
2149 Status status = GDIPlus.GdipSetClipRegion(nativeObject, region.NativeObject, combineMode);
2150 GDIPlus.CheckStatus (status);
2154 public void SetClip (GraphicsPath path, CombineMode combineMode)
2157 throw new ArgumentNullException ("path");
2158 Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
2159 GDIPlus.CheckStatus (status);
2163 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
2166 throw new ArgumentNullException ("pts");
2168 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemory (pts);
2170 Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2171 GDIPlus.CheckStatus (status);
2173 GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
2177 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
2180 throw new ArgumentNullException ("pts");
2181 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemoryI (pts);
2183 Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2184 GDIPlus.CheckStatus (status);
2186 GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
2190 public void TranslateClip (int dx, int dy)
2192 Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
2193 GDIPlus.CheckStatus (status);
2197 public void TranslateClip (float dx, float dy)
2199 Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
2200 GDIPlus.CheckStatus (status);
2203 public void TranslateTransform (float dx, float dy)
2205 TranslateTransform (dx, dy, MatrixOrder.Prepend);
2209 public void TranslateTransform (float dx, float dy, MatrixOrder order)
2211 Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
2212 GDIPlus.CheckStatus (status);
2215 public Region Clip {
2217 Region reg = new Region();
2218 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
2219 GDIPlus.CheckStatus (status);
2223 SetClip (value, CombineMode.Replace);
2227 public RectangleF ClipBounds {
2229 RectangleF rect = new RectangleF ();
2230 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
2231 GDIPlus.CheckStatus (status);
2236 public CompositingMode CompositingMode {
2238 CompositingMode mode;
2239 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
2240 GDIPlus.CheckStatus (status);
2245 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
2246 GDIPlus.CheckStatus (status);
2251 public CompositingQuality CompositingQuality {
2253 CompositingQuality quality;
2255 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
2256 GDIPlus.CheckStatus (status);
2260 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
2261 GDIPlus.CheckStatus (status);
2269 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
2270 GDIPlus.CheckStatus (status);
2279 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
2280 GDIPlus.CheckStatus (status);
2285 public InterpolationMode InterpolationMode {
2287 InterpolationMode imode = InterpolationMode.Invalid;
2288 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
2289 GDIPlus.CheckStatus (status);
2293 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
2294 GDIPlus.CheckStatus (status);
2298 public bool IsClipEmpty {
2300 bool isEmpty = false;
2302 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
2303 GDIPlus.CheckStatus (status);
2308 public bool IsVisibleClipEmpty {
2310 bool isEmpty = false;
2312 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
2313 GDIPlus.CheckStatus (status);
2318 public float PageScale {
2322 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
2323 GDIPlus.CheckStatus (status);
2327 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
2328 GDIPlus.CheckStatus (status);
2332 public GraphicsUnit PageUnit {
2336 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
2337 GDIPlus.CheckStatus (status);
2341 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
2342 GDIPlus.CheckStatus (status);
2346 public PixelOffsetMode PixelOffsetMode {
2348 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
2350 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
2351 GDIPlus.CheckStatus (status);
2355 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
2356 GDIPlus.CheckStatus (status);
2360 public Point RenderingOrigin {
2363 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
2364 GDIPlus.CheckStatus (status);
2365 return new Point (x, y);
2369 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
2370 GDIPlus.CheckStatus (status);
2374 public SmoothingMode SmoothingMode {
2376 SmoothingMode mode = SmoothingMode.Invalid;
2378 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
2379 GDIPlus.CheckStatus (status);
2384 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
2385 GDIPlus.CheckStatus (status);
2389 public int TextContrast {
2393 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
2394 GDIPlus.CheckStatus (status);
2399 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
2400 GDIPlus.CheckStatus (status);
2404 public TextRenderingHint TextRenderingHint {
2406 TextRenderingHint hint;
2408 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
2409 GDIPlus.CheckStatus (status);
2414 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
2415 GDIPlus.CheckStatus (status);
2419 public Matrix Transform {
2421 Matrix matrix = new Matrix ();
2422 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
2423 GDIPlus.CheckStatus (status);
2428 throw new ArgumentNullException ("value");
2430 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
2431 GDIPlus.CheckStatus (status);
2435 public RectangleF VisibleClipBounds {
2439 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
2440 GDIPlus.CheckStatus (status);