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;
59 public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
63 PlayRecordCallback callbackData);
68 public delegate bool DrawImageAbort (IntPtr callbackData);
70 internal Graphics (IntPtr nativeGraphics)
72 nativeObject = nativeGraphics;
80 static internal float systemDpiX {
83 Bitmap bmp = new Bitmap (1, 1);
84 Graphics g = Graphics.FromImage (bmp);
92 static internal float systemDpiY {
95 Bitmap bmp = new Bitmap (1, 1);
96 Graphics g = Graphics.FromImage (bmp);
104 internal IntPtr NativeObject {
110 nativeObject = value;
115 public void AddMetafileComment (byte [] data)
117 throw new NotImplementedException ();
120 public GraphicsContainer BeginContainer ()
124 status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
125 GDIPlus.CheckStatus (status);
127 return new GraphicsContainer(state);
130 [MonoTODO ("rectangles and unit aren't supported in libgdiplus")]
131 public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
135 status = GDIPlus.GdipBeginContainerI (nativeObject, ref dstrect, ref srcrect, unit, out state);
136 GDIPlus.CheckStatus (status);
138 return new GraphicsContainer (state);
141 [MonoTODO ("rectangles and unit aren't supported in libgdiplus")]
142 public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
146 status = GDIPlus.GdipBeginContainer (nativeObject, ref dstrect, ref srcrect, unit, out state);
147 GDIPlus.CheckStatus (status);
149 return new GraphicsContainer (state);
153 public void Clear (Color color)
156 status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
157 GDIPlus.CheckStatus (status);
160 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
162 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
163 blockRegionSize, CopyPixelOperation.SourceCopy);
166 public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
168 CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
169 blockRegionSize, copyPixelOperation);
172 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
174 CopyFromScreen (sourceX, sourceY, destinationX, destinationY, blockRegionSize,
175 CopyPixelOperation.SourceCopy);
178 public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
\r
182 if (!Enum.IsDefined (typeof (CopyPixelOperation), copyPixelOperation))
183 throw new InvalidEnumArgumentException (string.Format("Enum argument value '{0}' is not valid for CopyPixelOperation", copyPixelOperation));
185 if (GDIPlus.UseCocoaDrawable || GDIPlus.UseQuartzDrawable) {
186 throw new NotImplementedException ();
189 if (GDIPlus.UseX11Drawable) { // X11 implementation
190 IntPtr image, defvisual, vPtr;
191 int AllPlanes = ~0, nitems = 0, pixel;
193 if (copyPixelOperation != CopyPixelOperation.SourceCopy)
194 throw new NotImplementedException ("Operation not implemented under X11");
196 if (GDIPlus.Display == IntPtr.Zero) {
197 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
200 window = GDIPlus.XRootWindow (GDIPlus.Display, 0);
201 defvisual = GDIPlus.XDefaultVisual (GDIPlus.Display, 0);
202 XVisualInfo visual = new XVisualInfo ();
204 /* Get XVisualInfo for this visual */
205 visual.visualid = GDIPlus.XVisualIDFromVisual(defvisual);
206 vPtr = GDIPlus.XGetVisualInfo (GDIPlus.Display, 0x1 /* VisualIDMask */, ref visual, ref nitems);
207 visual = (XVisualInfo) Marshal.PtrToStructure(vPtr, typeof (XVisualInfo));
209 /* Sorry I do not have access to a computer with > deepth. Fell free to add more pixel formats */
210 image = GDIPlus.XGetImage (GDIPlus.Display, window, sourceX, sourceY, blockRegionSize.Width,
211 blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/);
213 Bitmap bmp = new Bitmap (blockRegionSize.Width, blockRegionSize.Height);
214 int red, blue, green;
215 for (int y = sourceY; y < sourceY + blockRegionSize.Height; y++) {
216 for (int x = sourceX; x < sourceX + blockRegionSize.Width; x++) {
217 pixel = GDIPlus.XGetPixel (image, x, y);
219 switch (visual.depth) {
220 case 16: /* 16bbp pixel transformation */
221 red = (int) ((pixel & visual.red_mask ) >> 8) & 0xff;
222 green = (int) (((pixel & visual.green_mask ) >> 3 )) & 0xff;
223 blue = (int) ((pixel & visual.blue_mask ) << 3 ) & 0xff;
227 red = (int) ((pixel & visual.red_mask ) >> 16) & 0xff;
228 green = (int) (((pixel & visual.green_mask ) >> 8 )) & 0xff;
229 blue = (int) ((pixel & visual.blue_mask )) & 0xff;
232 throw new NotImplementedException ("Deepth not supported right now");
235 bmp.SetPixel (x, y, Color.FromArgb (255, red, green, blue));
239 DrawImage (bmp, 0, 0);
241 GDIPlus.XDestroyImage (image);
242 GDIPlus.XFree (vPtr);
246 // Win32 implementation
247 window = GDIPlus.GetDesktopWindow ();
248 IntPtr srcDC = GDIPlus.GetDC (window);
249 IntPtr dstDC = GetHdc ();
250 GDIPlus.BitBlt (dstDC, destinationX, destinationY, blockRegionSize.Width,
251 blockRegionSize.Height, srcDC, sourceX, sourceY, (int) copyPixelOperation);
253 GDIPlus.ReleaseDC (srcDC);
258 public void Dispose ()
262 status = GDIPlus.GdipDeleteGraphics (nativeObject);
263 nativeObject = IntPtr.Zero;
264 GDIPlus.CheckStatus (status);
267 GC.SuppressFinalize(this);
271 public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
273 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
277 public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
279 DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
283 public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
287 throw new ArgumentNullException ("pen");
289 status = GDIPlus.GdipDrawArc (nativeObject, pen.nativeObject,
290 x, y, width, height, startAngle, sweepAngle);
291 GDIPlus.CheckStatus (status);
294 // Microsoft documentation states that the signature for this member should be
295 // public void DrawArc( Pen pen, int x, int y, int width, int height, int startAngle,
296 // int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
297 public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
301 throw new ArgumentNullException ("pen");
302 status = GDIPlus.GdipDrawArcI (nativeObject, pen.nativeObject,
303 x, y, width, height, startAngle, sweepAngle);
304 GDIPlus.CheckStatus (status);
307 public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
311 throw new ArgumentNullException ("pen");
312 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject,
313 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
314 pt3.Y, pt4.X, pt4.Y);
315 GDIPlus.CheckStatus (status);
318 public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
322 throw new ArgumentNullException ("pen");
323 status = GDIPlus.GdipDrawBezierI (nativeObject, pen.nativeObject,
324 pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
325 pt3.Y, pt4.X, pt4.Y);
326 GDIPlus.CheckStatus (status);
329 public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
333 throw new ArgumentNullException ("pen");
334 status = GDIPlus.GdipDrawBezier (nativeObject, pen.nativeObject, x1,
335 y1, x2, y2, x3, y3, x4, y4);
336 GDIPlus.CheckStatus (status);
339 public void DrawBeziers (Pen pen, Point [] points)
342 throw new ArgumentNullException ("pen");
344 throw new ArgumentNullException ("points");
346 int length = points.Length;
352 for (int i = 0; i < length - 1; i += 3) {
353 Point p1 = points [i];
354 Point p2 = points [i + 1];
355 Point p3 = points [i + 2];
356 Point p4 = points [i + 3];
358 status = GDIPlus.GdipDrawBezier (nativeObject,
360 p1.X, p1.Y, p2.X, p2.Y,
361 p3.X, p3.Y, p4.X, p4.Y);
362 GDIPlus.CheckStatus (status);
366 public void DrawBeziers (Pen pen, PointF [] points)
369 throw new ArgumentNullException ("pen");
371 throw new ArgumentNullException ("points");
373 int length = points.Length;
379 for (int i = 0; i < length - 1; i += 3) {
380 PointF p1 = points [i];
381 PointF p2 = points [i + 1];
382 PointF p3 = points [i + 2];
383 PointF p4 = points [i + 3];
385 status = GDIPlus.GdipDrawBezier (nativeObject,
387 p1.X, p1.Y, p2.X, p2.Y,
388 p3.X, p3.Y, p4.X, p4.Y);
389 GDIPlus.CheckStatus (status);
394 public void DrawClosedCurve (Pen pen, PointF [] points)
397 throw new ArgumentNullException ("pen");
399 throw new ArgumentNullException ("points");
402 status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.nativeObject, points, points.Length);
403 GDIPlus.CheckStatus (status);
406 public void DrawClosedCurve (Pen pen, Point [] points)
409 throw new ArgumentNullException ("pen");
411 throw new ArgumentNullException ("points");
414 status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.nativeObject, points, points.Length);
415 GDIPlus.CheckStatus (status);
418 public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
421 throw new ArgumentNullException ("pen");
423 throw new ArgumentNullException ("points");
426 status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
427 GDIPlus.CheckStatus (status);
430 public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
433 throw new ArgumentNullException ("pen");
435 throw new ArgumentNullException ("points");
438 status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
439 GDIPlus.CheckStatus (status);
442 public void DrawCurve (Pen pen, Point [] points)
445 throw new ArgumentNullException ("pen");
447 throw new ArgumentNullException ("points");
450 status = GDIPlus.GdipDrawCurveI (nativeObject, pen.nativeObject, points, points.Length);
451 GDIPlus.CheckStatus (status);
454 public void DrawCurve (Pen pen, PointF [] points)
457 throw new ArgumentNullException ("pen");
459 throw new ArgumentNullException ("points");
462 status = GDIPlus.GdipDrawCurve (nativeObject, pen.nativeObject, points, points.Length);
463 GDIPlus.CheckStatus (status);
466 public void DrawCurve (Pen pen, PointF [] points, float tension)
469 throw new ArgumentNullException ("pen");
471 throw new ArgumentNullException ("points");
474 status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.nativeObject, points, points.Length, tension);
475 GDIPlus.CheckStatus (status);
478 public void DrawCurve (Pen pen, Point [] points, float tension)
481 throw new ArgumentNullException ("pen");
483 throw new ArgumentNullException ("points");
486 status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.nativeObject, points, points.Length, tension);
487 GDIPlus.CheckStatus (status);
490 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
493 throw new ArgumentNullException ("pen");
495 throw new ArgumentNullException ("points");
498 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
499 points, points.Length, offset,
500 numberOfSegments, 0.5f);
501 GDIPlus.CheckStatus (status);
504 public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
507 throw new ArgumentNullException ("pen");
509 throw new ArgumentNullException ("points");
512 status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.nativeObject,
513 points, points.Length, offset,
514 numberOfSegments, tension);
515 GDIPlus.CheckStatus (status);
518 public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
521 throw new ArgumentNullException ("pen");
523 throw new ArgumentNullException ("points");
526 status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.nativeObject,
527 points, points.Length, offset,
528 numberOfSegments, tension);
529 GDIPlus.CheckStatus (status);
532 public void DrawEllipse (Pen pen, Rectangle rect)
535 throw new ArgumentNullException ("pen");
537 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
540 public void DrawEllipse (Pen pen, RectangleF rect)
543 throw new ArgumentNullException ("pen");
544 DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
547 public void DrawEllipse (Pen pen, int x, int y, int width, int height)
550 throw new ArgumentNullException ("pen");
552 status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.nativeObject, x, y, width, height);
553 GDIPlus.CheckStatus (status);
556 public void DrawEllipse (Pen pen, float x, float y, float width, float height)
559 throw new ArgumentNullException ("pen");
560 Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.nativeObject, x, y, width, height);
561 GDIPlus.CheckStatus (status);
564 public void DrawIcon (Icon icon, Rectangle targetRect)
566 using (Image img = icon.ToBitmap ()) {
567 DrawImage (img, targetRect);
571 public void DrawIcon (Icon icon, int x, int y)
573 using (Image img = icon.ToBitmap ()) {
574 DrawImage (img, x, y);
578 public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
580 using (Image img = icon.ToBitmap ()) {
581 DrawImageUnscaled (img, targetRect);
585 public void DrawImage (Image image, RectangleF rect)
588 throw new ArgumentNullException ("image");
590 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
591 GDIPlus.CheckStatus (status);
595 public void DrawImage (Image image, PointF point)
598 throw new ArgumentNullException ("image");
600 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
601 GDIPlus.CheckStatus (status);
605 public void DrawImage (Image image, Point [] destPoints)
608 throw new ArgumentNullException ("image");
609 if (destPoints == null)
610 throw new ArgumentNullException ("destPoints");
612 Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
613 GDIPlus.CheckStatus (status);
617 public void DrawImage (Image image, Point point)
620 throw new ArgumentNullException ("image");
621 DrawImage (image, point.X, point.Y);
625 public void DrawImage (Image image, Rectangle rect)
628 throw new ArgumentNullException ("image");
629 DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
633 public void DrawImage (Image image, PointF [] destPoints)
636 throw new ArgumentNullException ("image");
637 if (destPoints == null)
638 throw new ArgumentNullException ("destPoints");
639 Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
640 GDIPlus.CheckStatus (status);
644 public void DrawImage (Image image, int x, int y)
647 throw new ArgumentNullException ("image");
648 Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
649 GDIPlus.CheckStatus (status);
653 public void DrawImage (Image image, float x, float y)
656 throw new ArgumentNullException ("image");
657 Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
658 GDIPlus.CheckStatus (status);
662 public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
665 throw new ArgumentNullException ("image");
666 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
667 destRect.X, destRect.Y, destRect.Width, destRect.Height,
668 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
669 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
670 GDIPlus.CheckStatus (status);
673 public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
676 throw new ArgumentNullException ("image");
677 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
678 destRect.X, destRect.Y, destRect.Width, destRect.Height,
679 srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
680 srcUnit, IntPtr.Zero, null, IntPtr.Zero);
681 GDIPlus.CheckStatus (status);
685 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
688 throw new ArgumentNullException ("image");
689 if (destPoints == null)
690 throw new ArgumentNullException ("destPoints");
692 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
693 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
694 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
696 GDIPlus.CheckStatus (status);
700 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
703 throw new ArgumentNullException ("image");
704 if (destPoints == null)
705 throw new ArgumentNullException ("destPoints");
707 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
708 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
709 srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
711 GDIPlus.CheckStatus (status);
715 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
716 ImageAttributes imageAttr)
719 throw new ArgumentNullException ("image");
720 if (destPoints == null)
721 throw new ArgumentNullException ("destPoints");
722 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
723 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
724 srcRect.Width, srcRect.Height, srcUnit,
725 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
726 GDIPlus.CheckStatus (status);
729 public void DrawImage (Image image, float x, float y, float width, float height)
732 throw new ArgumentNullException ("image");
733 Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
735 GDIPlus.CheckStatus (status);
739 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
740 ImageAttributes imageAttr)
743 throw new ArgumentNullException ("image");
744 if (destPoints == null)
745 throw new ArgumentNullException ("destPoints");
746 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
747 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
748 srcRect.Width, srcRect.Height, srcUnit,
749 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
750 GDIPlus.CheckStatus (status);
754 public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
757 throw new ArgumentNullException ("image");
758 Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
759 GDIPlus.CheckStatus (status);
762 public void DrawImage (Image image, int x, int y, int width, int height)
765 throw new ArgumentNullException ("image");
766 Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
767 GDIPlus.CheckStatus (status);
770 public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
773 throw new ArgumentNullException ("image");
774 Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
775 GDIPlus.CheckStatus (status);
779 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
782 throw new ArgumentNullException ("image");
783 if (destPoints == null)
784 throw new ArgumentNullException ("destPoints");
785 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
786 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
787 srcRect.Width, srcRect.Height, srcUnit,
788 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
789 GDIPlus.CheckStatus (status);
793 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
796 throw new ArgumentNullException ("image");
797 if (destPoints == null)
798 throw new ArgumentNullException ("destPoints");
800 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
801 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
802 srcRect.Width, srcRect.Height, srcUnit,
803 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, IntPtr.Zero);
804 GDIPlus.CheckStatus (status);
808 public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
811 throw new ArgumentNullException ("image");
812 if (destPoints == null)
813 throw new ArgumentNullException ("destPoints");
815 Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
816 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
817 srcRect.Width, srcRect.Height, srcUnit,
818 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
819 GDIPlus.CheckStatus (status);
823 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
826 throw new ArgumentNullException ("image");
827 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
828 destRect.X, destRect.Y, destRect.Width, destRect.Height,
829 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
831 GDIPlus.CheckStatus (status);
834 public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
836 Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
837 destPoints, destPoints.Length , srcRect.X, srcRect.Y,
838 srcRect.Width, srcRect.Height, srcUnit,
839 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, (IntPtr) callbackData);
840 GDIPlus.CheckStatus (status);
844 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
847 throw new ArgumentNullException ("image");
848 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
849 destRect.X, destRect.Y, destRect.Width, destRect.Height,
850 srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
852 GDIPlus.CheckStatus (status);
856 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
859 throw new ArgumentNullException ("image");
860 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
861 destRect.X, destRect.Y, destRect.Width, destRect.Height,
862 srcX, srcY, srcWidth, srcHeight, srcUnit,
863 imageAttrs != null ? imageAttrs.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
864 GDIPlus.CheckStatus (status);
867 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
870 throw new ArgumentNullException ("image");
871 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
872 destRect.X, destRect.Y, destRect.Width,
873 destRect.Height, srcX, srcY, srcWidth, srcHeight,
874 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, null, IntPtr.Zero);
875 GDIPlus.CheckStatus (status);
878 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
881 throw new ArgumentNullException ("image");
882 Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
883 destRect.X, destRect.Y, destRect.Width,
884 destRect.Height, srcX, srcY, srcWidth, srcHeight,
885 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback,
887 GDIPlus.CheckStatus (status);
890 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
893 throw new ArgumentNullException ("image");
894 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
895 destRect.X, destRect.Y, destRect.Width,
896 destRect.Height, srcX, srcY, srcWidth, srcHeight,
897 srcUnit, imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero,
898 callback, IntPtr.Zero);
899 GDIPlus.CheckStatus (status);
903 public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
906 throw new ArgumentNullException ("image");
907 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
908 destRect.X, destRect.Y, destRect.Width, destRect.Height,
909 srcX, srcY, srcWidth, srcHeight, srcUnit,
910 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
911 GDIPlus.CheckStatus (status);
915 public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, IntPtr callbackData)
918 throw new ArgumentNullException ("image");
919 Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
920 destRect.X, destRect.Y, destRect.Width, destRect.Height,
921 srcX, srcY, srcWidth, srcHeight, srcUnit,
922 imageAttr != null ? imageAttr.NativeObject : IntPtr.Zero, callback, callbackData);
923 GDIPlus.CheckStatus (status);
926 public void DrawImageUnscaled (Image image, Point point)
929 throw new ArgumentNullException ("image");
930 DrawImageUnscaled (image, point.X, point.Y);
933 public void DrawImageUnscaled (Image image, Rectangle rect)
936 throw new ArgumentNullException ("image");
937 DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
940 public void DrawImageUnscaled (Image image, int x, int y)
943 throw new ArgumentNullException ("image");
944 DrawImage (image, x, y, image.Width, image.Height);
947 public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
950 throw new ArgumentNullException ("image");
951 Image tmpImg = new Bitmap (width, height);
952 Graphics g = FromImage (tmpImg);
953 g.DrawImage (image, 0, 0, image.Width, image.Height);
954 this.DrawImage (tmpImg, x, y, width, height);
960 public void DrawImageUnscaledAndClipped (Image image, Rectangle rect)
963 width = (image.Width > rect.Width) ? rect.Width : image.Width;
964 height = (image.Height > rect.Height) ? rect.Height : image.Height;
966 DrawImageUnscaled (image, rect.X, rect.Y, width, height);
970 public void DrawLine (Pen pen, PointF pt1, PointF pt2)
973 throw new ArgumentNullException ("pen");
974 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject,
975 pt1.X, pt1.Y, pt2.X, pt2.Y);
976 GDIPlus.CheckStatus (status);
979 public void DrawLine (Pen pen, Point pt1, Point pt2)
982 throw new ArgumentNullException ("pen");
983 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject,
984 pt1.X, pt1.Y, pt2.X, pt2.Y);
985 GDIPlus.CheckStatus (status);
988 public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
991 throw new ArgumentNullException ("pen");
992 Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.nativeObject, x1, y1, x2, y2);
993 GDIPlus.CheckStatus (status);
996 public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
999 throw new ArgumentNullException ("pen");
1000 Status status = GDIPlus.GdipDrawLine (nativeObject, pen.nativeObject, x1, y1, x2, y2);
1001 GDIPlus.CheckStatus (status);
1004 public void DrawLines (Pen pen, PointF [] points)
1007 throw new ArgumentNullException ("pen");
1009 throw new ArgumentNullException ("points");
1010 Status status = GDIPlus.GdipDrawLines (nativeObject, pen.nativeObject, points, points.Length);
1011 GDIPlus.CheckStatus (status);
1014 public void DrawLines (Pen pen, Point [] points)
1017 throw new ArgumentNullException ("pen");
1019 throw new ArgumentNullException ("points");
1020 Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.nativeObject, points, points.Length);
1021 GDIPlus.CheckStatus (status);
1024 public void DrawPath (Pen pen, GraphicsPath path)
1027 throw new ArgumentNullException ("pen");
1029 throw new ArgumentNullException ("path");
1030 Status status = GDIPlus.GdipDrawPath (nativeObject, pen.nativeObject, path.nativePath);
1031 GDIPlus.CheckStatus (status);
1034 public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
1037 throw new ArgumentNullException ("pen");
1038 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1041 public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
1044 throw new ArgumentNullException ("pen");
1045 DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1048 public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
1051 throw new ArgumentNullException ("pen");
1052 Status status = GDIPlus.GdipDrawPie (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1053 GDIPlus.CheckStatus (status);
1056 // Microsoft documentation states that the signature for this member should be
1057 // public void DrawPie(Pen pen, int x, int y, int width, int height, int startAngle
1058 // int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
1059 public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
1062 throw new ArgumentNullException ("pen");
1063 Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.nativeObject, x, y, width, height, startAngle, sweepAngle);
1064 GDIPlus.CheckStatus (status);
1067 public void DrawPolygon (Pen pen, Point [] points)
1070 throw new ArgumentNullException ("pen");
1072 throw new ArgumentNullException ("points");
1073 Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.nativeObject, points, points.Length);
1074 GDIPlus.CheckStatus (status);
1077 public void DrawPolygon (Pen pen, PointF [] points)
1080 throw new ArgumentNullException ("pen");
1082 throw new ArgumentNullException ("points");
1083 Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.nativeObject, points, points.Length);
1084 GDIPlus.CheckStatus (status);
1087 internal void DrawRectangle (Pen pen, RectangleF rect)
1090 throw new ArgumentNullException ("pen");
1091 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1094 public void DrawRectangle (Pen pen, Rectangle rect)
1097 throw new ArgumentNullException ("pen");
1098 DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1101 public void DrawRectangle (Pen pen, float x, float y, float width, float height)
1104 throw new ArgumentNullException ("pen");
1105 Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.nativeObject, x, y, width, height);
1106 GDIPlus.CheckStatus (status);
1109 public void DrawRectangle (Pen pen, int x, int y, int width, int height)
1112 throw new ArgumentNullException ("pen");
1113 Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.nativeObject, x, y, width, height);
1114 GDIPlus.CheckStatus (status);
1117 public void DrawRectangles (Pen pen, RectangleF [] rects)
1120 throw new ArgumentNullException ("image");
1122 throw new ArgumentNullException ("rects");
1123 Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.nativeObject, rects, rects.Length);
1124 GDIPlus.CheckStatus (status);
1127 public void DrawRectangles (Pen pen, Rectangle [] rects)
1130 throw new ArgumentNullException ("image");
1132 throw new ArgumentNullException ("rects");
1133 Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.nativeObject, rects, rects.Length);
1134 GDIPlus.CheckStatus (status);
1137 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
1139 DrawString (s, font, brush, layoutRectangle, null);
1142 public void DrawString (string s, Font font, Brush brush, PointF point)
1144 DrawString (s, font, brush, new RectangleF (point.X, point.Y, 0, 0), null);
1147 public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
1149 DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
1152 public void DrawString (string s, Font font, Brush brush, float x, float y)
1154 DrawString (s, font, brush, new RectangleF (x, y, 0, 0), null);
1157 public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
1159 DrawString (s, font, brush, new RectangleF(x, y, 0, 0), format);
1162 public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
1165 throw new ArgumentNullException ("font");
1167 throw new ArgumentNullException ("brush");
1168 if (s == null || s.Length == 0)
1171 Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.nativeObject);
1172 GDIPlus.CheckStatus (status);
1175 public void EndContainer (GraphicsContainer container)
1178 if (container == null)
1179 throw new ArgumentNullException ("container");
1181 Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
1182 GDIPlus.CheckStatus (status);
1186 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
1188 throw new NotImplementedException ();
1192 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
1194 throw new NotImplementedException ();
1198 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
1200 throw new NotImplementedException ();
1204 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
1206 throw new NotImplementedException ();
1210 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
1212 throw new NotImplementedException ();
1216 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
1218 throw new NotImplementedException ();
1222 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1224 throw new NotImplementedException ();
1228 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1230 throw new NotImplementedException ();
1234 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1236 throw new NotImplementedException ();
1240 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1242 throw new NotImplementedException ();
1246 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1248 throw new NotImplementedException ();
1252 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1254 throw new NotImplementedException ();
1258 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1260 throw new NotImplementedException ();
1264 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1266 throw new NotImplementedException ();
1270 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1272 throw new NotImplementedException ();
1276 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1278 throw new NotImplementedException ();
1282 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1284 throw new NotImplementedException ();
1288 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1290 throw new NotImplementedException ();
1294 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1296 throw new NotImplementedException ();
1300 public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1302 throw new NotImplementedException ();
1306 public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1308 throw new NotImplementedException ();
1312 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1314 throw new NotImplementedException ();
1318 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1320 throw new NotImplementedException ();
1324 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1326 throw new NotImplementedException ();
1330 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1332 throw new NotImplementedException ();
1336 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1338 throw new NotImplementedException ();
1342 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1344 throw new NotImplementedException ();
1348 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1350 throw new NotImplementedException ();
1354 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1356 throw new NotImplementedException ();
1360 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1362 throw new NotImplementedException ();
1366 public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1368 throw new NotImplementedException ();
1372 public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1374 throw new NotImplementedException ();
1378 public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1380 throw new NotImplementedException ();
1384 public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1386 throw new NotImplementedException ();
1390 public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1392 throw new NotImplementedException ();
1396 public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1398 throw new NotImplementedException ();
1401 public void ExcludeClip (Rectangle rect)
1403 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1404 GDIPlus.CheckStatus (status);
1407 public void ExcludeClip (Region region)
1410 throw new ArgumentNullException ("region");
1411 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1412 GDIPlus.CheckStatus (status);
1416 public void FillClosedCurve (Brush brush, PointF [] points)
1419 throw new ArgumentNullException ("brush");
1421 throw new ArgumentNullException ("points");
1422 Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length);
1423 GDIPlus.CheckStatus (status);
1427 public void FillClosedCurve (Brush brush, Point [] points)
1430 throw new ArgumentNullException ("brush");
1432 throw new ArgumentNullException ("points");
1433 Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length);
1434 GDIPlus.CheckStatus (status);
1438 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1441 throw new ArgumentNullException ("brush");
1443 throw new ArgumentNullException ("points");
1444 FillClosedCurve (brush, points, fillmode, 0.5f);
1447 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1450 throw new ArgumentNullException ("brush");
1452 throw new ArgumentNullException ("points");
1453 FillClosedCurve (brush, points, fillmode, 0.5f);
1456 public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1459 throw new ArgumentNullException ("brush");
1461 throw new ArgumentNullException ("points");
1462 Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1463 GDIPlus.CheckStatus (status);
1466 public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1469 throw new ArgumentNullException ("brush");
1471 throw new ArgumentNullException ("points");
1472 Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode);
1473 GDIPlus.CheckStatus (status);
1476 public void FillEllipse (Brush brush, Rectangle rect)
1479 throw new ArgumentNullException ("brush");
1480 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1483 public void FillEllipse (Brush brush, RectangleF rect)
1486 throw new ArgumentNullException ("brush");
1487 FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1490 public void FillEllipse (Brush brush, float x, float y, float width, float height)
1493 throw new ArgumentNullException ("brush");
1494 Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height);
1495 GDIPlus.CheckStatus (status);
1498 public void FillEllipse (Brush brush, int x, int y, int width, int height)
1501 throw new ArgumentNullException ("brush");
1502 Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height);
1503 GDIPlus.CheckStatus (status);
1506 public void FillPath (Brush brush, GraphicsPath path)
1509 throw new ArgumentNullException ("brush");
1511 throw new ArgumentNullException ("path");
1512 Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject);
1513 GDIPlus.CheckStatus (status);
1516 public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1519 throw new ArgumentNullException ("brush");
1520 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1521 GDIPlus.CheckStatus (status);
1524 public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1527 throw new ArgumentNullException ("brush");
1528 Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1529 GDIPlus.CheckStatus (status);
1532 public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1535 throw new ArgumentNullException ("brush");
1536 Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle);
1537 GDIPlus.CheckStatus (status);
1540 public void FillPolygon (Brush brush, PointF [] points)
1543 throw new ArgumentNullException ("brush");
1545 throw new ArgumentNullException ("points");
1546 Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length);
1547 GDIPlus.CheckStatus (status);
1550 public void FillPolygon (Brush brush, Point [] points)
1553 throw new ArgumentNullException ("brush");
1555 throw new ArgumentNullException ("points");
1556 Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length);
1557 GDIPlus.CheckStatus (status);
1560 public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1563 throw new ArgumentNullException ("brush");
1565 throw new ArgumentNullException ("points");
1566 Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1567 GDIPlus.CheckStatus (status);
1570 public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1573 throw new ArgumentNullException ("brush");
1575 throw new ArgumentNullException ("points");
1576 Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode);
1577 GDIPlus.CheckStatus (status);
1580 public void FillRectangle (Brush brush, RectangleF rect)
1583 throw new ArgumentNullException ("brush");
1584 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1587 public void FillRectangle (Brush brush, Rectangle rect)
1590 throw new ArgumentNullException ("brush");
1591 FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1594 public void FillRectangle (Brush brush, int x, int y, int width, int height)
1597 throw new ArgumentNullException ("brush");
1599 Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height);
1600 GDIPlus.CheckStatus (status);
1603 public void FillRectangle (Brush brush, float x, float y, float width, float height)
1606 throw new ArgumentNullException ("brush");
1608 Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height);
1609 GDIPlus.CheckStatus (status);
1612 public void FillRectangles (Brush brush, Rectangle [] rects)
1615 throw new ArgumentNullException ("brush");
1617 throw new ArgumentNullException ("rects");
1619 Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length);
1620 GDIPlus.CheckStatus (status);
1623 public void FillRectangles (Brush brush, RectangleF [] rects)
1626 throw new ArgumentNullException ("brush");
1628 throw new ArgumentNullException ("rects");
1630 Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length);
1631 GDIPlus.CheckStatus (status);
1635 public void FillRegion (Brush brush, Region region)
1638 throw new ArgumentNullException ("brush");
1640 throw new ArgumentNullException ("region");
1642 Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject);
1643 GDIPlus.CheckStatus(status);
1647 public void Flush ()
1649 Flush (FlushIntention.Flush);
1653 public void Flush (FlushIntention intention)
1655 if (nativeObject == IntPtr.Zero) {
1659 Status status = GDIPlus.GdipFlush (nativeObject, intention);
1660 GDIPlus.CheckStatus (status);
1661 if (GDIPlus.UseQuartzDrawable || GDIPlus.UseCocoaDrawable)
1662 Carbon.CGContextSynchronize (GDIPlus.Display);
1665 [EditorBrowsable (EditorBrowsableState.Advanced)]
1666 public static Graphics FromHdc (IntPtr hdc)
1669 Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1670 GDIPlus.CheckStatus (status);
1671 return new Graphics (graphics);
1675 [EditorBrowsable (EditorBrowsableState.Advanced)]
1676 public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1678 throw new NotImplementedException ();
1681 [EditorBrowsable (EditorBrowsableState.Advanced)]
1682 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1683 public static Graphics FromHdcInternal (IntPtr hdc)
1685 GDIPlus.Display = hdc;
1689 [EditorBrowsable (EditorBrowsableState.Advanced)]
1690 public static Graphics FromHwnd (IntPtr hwnd)
1694 if (GDIPlus.UseCocoaDrawable) {
1695 CarbonContext cgContext = Carbon.GetCGContextForNSView (hwnd);
1696 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1698 GDIPlus.Display = cgContext.ctx;
1699 return new Graphics (graphics);
1701 if (GDIPlus.UseQuartzDrawable) {
1702 CarbonContext cgContext = Carbon.GetCGContextForView (hwnd);
1703 GDIPlus.GdipCreateFromQuartz_macosx (cgContext.ctx, cgContext.width, cgContext.height, out graphics);
1705 GDIPlus.Display = cgContext.ctx;
1706 return new Graphics (graphics);
1708 if (GDIPlus.UseX11Drawable) {
1709 if (GDIPlus.Display == IntPtr.Zero) {
1710 GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
1713 return FromXDrawable (hwnd, GDIPlus.Display);
1717 Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
1718 GDIPlus.CheckStatus (status);
1720 return new Graphics (graphics);
1723 [EditorBrowsable (EditorBrowsableState.Advanced)]
1724 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
1725 public static Graphics FromHwndInternal (IntPtr hwnd)
1727 return FromHwnd (hwnd);
1730 public static Graphics FromImage (Image image)
1735 throw new ArgumentNullException ("image");
1737 Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1738 GDIPlus.CheckStatus (status);
1739 Graphics result = new Graphics (graphics);
1741 // check for Unix platforms - see FAQ for more details
1742 // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
1743 int platform = (int) Environment.OSVersion.Platform;
1744 if ((platform == 4) || (platform == 128)) {
1745 Rectangle rect = new Rectangle (0,0, image.Width, image.Height);
1746 GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1752 internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1756 Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1757 GDIPlus.CheckStatus (s);
1758 return new Graphics (graphics);
1762 public static IntPtr GetHalftonePalette ()
1764 throw new NotImplementedException ();
1768 [EditorBrowsable (EditorBrowsableState.Advanced)]
1770 public IntPtr GetHdc ()
1773 GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out hdc));
1778 public Color GetNearestColor (Color color)
1782 Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1783 GDIPlus.CheckStatus (status);
1785 return Color.FromArgb (argb);
1789 public void IntersectClip (Region region)
1792 throw new ArgumentNullException ("region");
1793 Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1794 GDIPlus.CheckStatus (status);
1797 public void IntersectClip (RectangleF rect)
1799 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1800 GDIPlus.CheckStatus (status);
1803 public void IntersectClip (Rectangle rect)
1805 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1806 GDIPlus.CheckStatus (status);
1809 public bool IsVisible (Point point)
1811 bool isVisible = false;
1813 Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1814 GDIPlus.CheckStatus (status);
1820 public bool IsVisible (RectangleF rect)
1822 bool isVisible = false;
1824 Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1825 GDIPlus.CheckStatus (status);
1830 public bool IsVisible (PointF point)
1832 bool isVisible = false;
1834 Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1835 GDIPlus.CheckStatus (status);
1840 public bool IsVisible (Rectangle rect)
1842 bool isVisible = false;
1844 Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1845 GDIPlus.CheckStatus (status);
1850 public bool IsVisible (float x, float y)
1852 return IsVisible (new PointF (x, y));
1855 public bool IsVisible (int x, int y)
1857 return IsVisible (new Point (x, y));
1860 public bool IsVisible (float x, float y, float width, float height)
1862 return IsVisible (new RectangleF (x, y, width, height));
1866 public bool IsVisible (int x, int y, int width, int height)
1868 return IsVisible (new Rectangle (x, y, width, height));
1872 public Region [] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1875 int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1876 IntPtr[] native_regions = new IntPtr [regcount];
1877 Region[] regions = new Region [regcount];
1879 for (int i = 0; i < regcount; i++) {
1880 regions[i] = new Region ();
1881 native_regions[i] = regions[i].NativeObject;
1884 status = GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1885 font.NativeObject, ref layoutRect, stringFormat.NativeObject,
1886 regcount, out native_regions[0]);
1888 GDIPlus.CheckStatus (status);
1894 public SizeF MeasureString (string text, Font font)
1896 return MeasureString (text, font, new Size (0, 0));
1900 public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1902 int charactersFitted, linesFilled;
1903 RectangleF boundingBox = new RectangleF ();
1904 RectangleF rect = new RectangleF (0, 0, layoutArea.Width,
1907 if (text == null || text.Length == 0)
1911 throw new ArgumentNullException ("font");
1913 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1914 font.NativeObject, ref rect,
1915 IntPtr.Zero, out boundingBox,
1916 out charactersFitted, out linesFilled);
1917 GDIPlus.CheckStatus (status);
1919 return new SizeF (boundingBox.Width, boundingBox.Height);
1923 public SizeF MeasureString (string text, Font font, int width)
1925 RectangleF boundingBox = new RectangleF ();
1926 RectangleF rect = new RectangleF (0, 0, width, 999999);
1927 int charactersFitted, linesFilled;
1929 if (text == null || text.Length == 0)
1933 throw new ArgumentNullException ("font");
1935 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1936 font.NativeObject, ref rect,
1937 IntPtr.Zero, out boundingBox,
1938 out charactersFitted, out linesFilled);
1939 GDIPlus.CheckStatus (status);
1941 return new SizeF (boundingBox.Width, boundingBox.Height);
1945 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1946 StringFormat stringFormat)
1948 int charactersFitted, linesFilled;
1949 return MeasureString (text, font, layoutArea, stringFormat,
1950 out charactersFitted, out linesFilled);
1954 public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1956 int charactersFitted, linesFilled;
1957 return MeasureString (text, font, new SizeF (width, 999999),
1958 format, out charactersFitted, out linesFilled);
1962 public SizeF MeasureString (string text, Font font, PointF origin,
1963 StringFormat stringFormat)
1965 RectangleF boundingBox = new RectangleF ();
1966 RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
1967 int charactersFitted, linesFilled;
1969 if (text == null || text.Length == 0)
1973 throw new ArgumentNullException ("font");
1975 if (stringFormat == null)
1976 stringFormat = new StringFormat ();
1978 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
1979 font.NativeObject, ref rect,
1980 stringFormat.NativeObject,
1982 out charactersFitted,
1984 GDIPlus.CheckStatus (status);
1986 return new SizeF (boundingBox.Width, boundingBox.Height);
1990 public SizeF MeasureString (string text, Font font, SizeF layoutArea,
1991 StringFormat stringFormat, out int charactersFitted,
1992 out int linesFilled)
1994 RectangleF boundingBox = new RectangleF ();
1995 RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1996 charactersFitted = 0;
1999 if (text == null || text.Length == 0)
2003 throw new ArgumentNullException ("font");
2005 if (stringFormat == null)
2006 stringFormat = new StringFormat ();
2008 Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
2009 font.NativeObject, ref rect,
2010 stringFormat.NativeObject,
2012 out charactersFitted,
2014 GDIPlus.CheckStatus (status);
2016 return new SizeF (boundingBox.Width, boundingBox.Height);
2019 public void MultiplyTransform (Matrix matrix)
2021 MultiplyTransform (matrix, MatrixOrder.Prepend);
2024 public void MultiplyTransform (Matrix matrix, MatrixOrder order)
2026 Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject,
2027 matrix.nativeMatrix,
2029 GDIPlus.CheckStatus (status);
2032 [EditorBrowsable (EditorBrowsableState.Advanced)]
2033 public void ReleaseHdc (IntPtr hdc)
2035 Status status = GDIPlus.GdipReleaseDC (nativeObject, hdc);
2036 GDIPlus.CheckStatus (status);
2039 public void ReleaseHdc()
\r
2046 [EditorBrowsable (EditorBrowsableState.Never)]
2048 [EditorBrowsable (EditorBrowsableState.Advanced)]
2050 [SecurityPermission (SecurityAction.LinkDemand, UnmanagedCode = true)]
2051 public void ReleaseHdcInternal (IntPtr hdc)
2053 throw new NotImplementedException ();
2057 public void ResetClip ()
2059 Status status = GDIPlus.GdipResetClip (nativeObject);
2060 GDIPlus.CheckStatus (status);
2063 public void ResetTransform ()
2065 Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
2066 GDIPlus.CheckStatus (status);
2069 public void Restore (GraphicsState gstate)
2071 Status status = GDIPlus.GdipRestoreGraphics (nativeObject, gstate.nativeState);
2072 GDIPlus.CheckStatus (status);
2076 public void RotateTransform (float angle)
2078 RotateTransform (angle, MatrixOrder.Prepend);
2081 public void RotateTransform (float angle, MatrixOrder order)
2084 Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
2085 GDIPlus.CheckStatus (status);
2088 public GraphicsState Save ()
2091 Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
2092 GDIPlus.CheckStatus (status);
2094 GraphicsState state = new GraphicsState ();
2095 state.nativeState = saveState;
2099 public void ScaleTransform (float sx, float sy)
2101 ScaleTransform (sx, sy, MatrixOrder.Prepend);
2104 public void ScaleTransform (float sx, float sy, MatrixOrder order)
2106 Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
2107 GDIPlus.CheckStatus (status);
2111 public void SetClip (RectangleF rect)
2113 SetClip (rect, CombineMode.Replace);
2117 public void SetClip (GraphicsPath path)
2119 SetClip (path, CombineMode.Replace);
2123 public void SetClip (Rectangle rect)
2125 SetClip (rect, CombineMode.Replace);
2129 public void SetClip (Graphics g)
2131 SetClip (g, CombineMode.Replace);
2135 public void SetClip (Graphics g, CombineMode combineMode)
2138 throw new ArgumentNullException ("g");
2140 Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
2141 GDIPlus.CheckStatus (status);
2145 public void SetClip (Rectangle rect, CombineMode combineMode)
2147 Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2148 GDIPlus.CheckStatus (status);
2152 public void SetClip (RectangleF rect, CombineMode combineMode)
2154 Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2155 GDIPlus.CheckStatus (status);
2159 public void SetClip (Region region, CombineMode combineMode)
2162 throw new ArgumentNullException ("region");
2163 Status status = GDIPlus.GdipSetClipRegion(nativeObject, region.NativeObject, combineMode);
2164 GDIPlus.CheckStatus (status);
2168 public void SetClip (GraphicsPath path, CombineMode combineMode)
2171 throw new ArgumentNullException ("path");
2172 Status status = GDIPlus.GdipSetClipPath (nativeObject, path.NativeObject, combineMode);
2173 GDIPlus.CheckStatus (status);
2177 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
2180 throw new ArgumentNullException ("pts");
2182 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemory (pts);
2184 Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2185 GDIPlus.CheckStatus (status);
2187 GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
2191 public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
2194 throw new ArgumentNullException ("pts");
2195 IntPtr ptrPt = GDIPlus.FromPointToUnManagedMemoryI (pts);
2197 Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2198 GDIPlus.CheckStatus (status);
2200 GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
2204 public void TranslateClip (int dx, int dy)
2206 Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
2207 GDIPlus.CheckStatus (status);
2211 public void TranslateClip (float dx, float dy)
2213 Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
2214 GDIPlus.CheckStatus (status);
2217 public void TranslateTransform (float dx, float dy)
2219 TranslateTransform (dx, dy, MatrixOrder.Prepend);
2223 public void TranslateTransform (float dx, float dy, MatrixOrder order)
2225 Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
2226 GDIPlus.CheckStatus (status);
2229 public Region Clip {
2231 Region reg = new Region();
2232 Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
2233 GDIPlus.CheckStatus (status);
2237 SetClip (value, CombineMode.Replace);
2241 public RectangleF ClipBounds {
2243 RectangleF rect = new RectangleF ();
2244 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
2245 GDIPlus.CheckStatus (status);
2250 public CompositingMode CompositingMode {
2252 CompositingMode mode;
2253 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
2254 GDIPlus.CheckStatus (status);
2259 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
2260 GDIPlus.CheckStatus (status);
2265 public CompositingQuality CompositingQuality {
2267 CompositingQuality quality;
2269 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
2270 GDIPlus.CheckStatus (status);
2274 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
2275 GDIPlus.CheckStatus (status);
2283 Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
2284 GDIPlus.CheckStatus (status);
2293 Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
2294 GDIPlus.CheckStatus (status);
2299 public InterpolationMode InterpolationMode {
2301 InterpolationMode imode = InterpolationMode.Invalid;
2302 Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
2303 GDIPlus.CheckStatus (status);
2307 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
2308 GDIPlus.CheckStatus (status);
2312 public bool IsClipEmpty {
2314 bool isEmpty = false;
2316 Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
2317 GDIPlus.CheckStatus (status);
2322 public bool IsVisibleClipEmpty {
2324 bool isEmpty = false;
2326 Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
2327 GDIPlus.CheckStatus (status);
2332 public float PageScale {
2336 Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
2337 GDIPlus.CheckStatus (status);
2341 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
2342 GDIPlus.CheckStatus (status);
2346 public GraphicsUnit PageUnit {
2350 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
2351 GDIPlus.CheckStatus (status);
2355 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
2356 GDIPlus.CheckStatus (status);
2360 [MonoTODO ("not supported by libgdiplus")]
2361 public PixelOffsetMode PixelOffsetMode {
2363 PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
2365 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
2366 GDIPlus.CheckStatus (status);
2370 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
2371 GDIPlus.CheckStatus (status);
2375 public Point RenderingOrigin {
2378 Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
2379 GDIPlus.CheckStatus (status);
2380 return new Point (x, y);
2384 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
2385 GDIPlus.CheckStatus (status);
2389 public SmoothingMode SmoothingMode {
2391 SmoothingMode mode = SmoothingMode.Invalid;
2393 Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
2394 GDIPlus.CheckStatus (status);
2399 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
2400 GDIPlus.CheckStatus (status);
2404 [MonoTODO ("not supported by libgdiplus")]
2405 public int TextContrast {
2409 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
2410 GDIPlus.CheckStatus (status);
2415 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
2416 GDIPlus.CheckStatus (status);
2420 public TextRenderingHint TextRenderingHint {
2422 TextRenderingHint hint;
2424 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
2425 GDIPlus.CheckStatus (status);
2430 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
2431 GDIPlus.CheckStatus (status);
2435 public Matrix Transform {
2437 Matrix matrix = new Matrix ();
2438 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
2439 GDIPlus.CheckStatus (status);
2444 throw new ArgumentNullException ("value");
2446 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
2447 GDIPlus.CheckStatus (status);
2451 public RectangleF VisibleClipBounds {
2455 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
2456 GDIPlus.CheckStatus (status);
2463 [EditorBrowsable (EditorBrowsableState.Never)]
2464 public object GetContextInfo ()
2466 throw new NotImplementedException ();