1 //
2 // System.Drawing.Graphics.cs
3 //
4 // Authors:
5 //	Gonzalo Paniagua Javier (gonzalo@ximian.com) (stubbed out)
6 //      Alexandre Pigolkine(pigolkine@gmx.de)
7 //	Jordi Mas i Hernandez (jordi@ximian.com)
8 //	Sebastien Pouliot  <sebastien@ximian.com>
9 //
10 // Copyright (C) 2003 Ximian, Inc. (http://www.ximian.com)
11 // Copyright (C) 2004-2006 Novell, Inc. (http://www.novell.com)
12 //
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:
20 //
21 // The above copyright notice and this permission notice shall be
22 // included in all copies or substantial portions of the Software.
23 //
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.
31 //
32 
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.Text;
39 
40 namespace System.Drawing
41 {
42 	public sealed class Graphics : MarshalByRefObject, IDisposable
43 	, IDeviceContext
44 	{
45 		internal IntPtr nativeObject = IntPtr.Zero;
46 		internal IMacContext maccontext;
47 		private bool disposed = false;
48 		private static float defDpiX = 0;
49 		private static float defDpiY = 0;
50 		private IntPtr deviceContextHdc;
51 
EnumerateMetafileProc(EmfPlusRecordType recordType, int flags, int dataSize, IntPtr data, PlayRecordCallback callbackData)52 		public delegate bool EnumerateMetafileProc (EmfPlusRecordType recordType,
53 							    int flags,
54 							    int dataSize,
55 							    IntPtr data,
56 							    PlayRecordCallback callbackData);
57 
DrawImageAbort(IntPtr callbackdata)58 		public delegate bool DrawImageAbort (IntPtr callbackdata);
59 
Graphics(IntPtr nativeGraphics)60 		internal Graphics (IntPtr nativeGraphics)
61 		{
62 			nativeObject = nativeGraphics;
63 		}
64 
~Graphics()65 		~Graphics ()
66 		{
67 			Dispose ();
68 		}
69 
70 		static internal float systemDpiX {
71 			get {
72 				if (defDpiX == 0) {
73 					Bitmap bmp = new Bitmap (1, 1);
74 					Graphics g = Graphics.FromImage (bmp);
75 					defDpiX = g.DpiX;
76 					defDpiY = g.DpiY;
77 				}
78 				return defDpiX;
79 			}
80 		}
81 
82 		static internal float systemDpiY {
83 			get {
84 				if (defDpiY == 0) {
85 					Bitmap bmp = new Bitmap (1, 1);
86 					Graphics g = Graphics.FromImage (bmp);
87 					defDpiX = g.DpiX;
88 					defDpiY = g.DpiY;
89 				}
90 				return defDpiY;
91 			}
92 		}
93 
94 		// For CoreFX compatibility
95 		internal IntPtr NativeGraphics {
96 			get {
97 				return nativeObject;
98 			}
99 		}
100 
101 		internal IntPtr NativeObject {
102 			get {
103 				return nativeObject;
104 			}
105 
106 			set {
107 				nativeObject = value;
108 			}
109 		}
110 
111 		[MonoTODO ("Metafiles, both WMF and EMF formats, aren't supported.")]
AddMetafileComment(byte [] data)112 		public void AddMetafileComment (byte [] data)
113 		{
114 			throw new NotImplementedException ();
115 		}
116 
BeginContainer()117 		public GraphicsContainer BeginContainer ()
118 		{
119 			uint state;
120 			Status status;
121 			status = GDIPlus.GdipBeginContainer2 (nativeObject, out state);
122         		GDIPlus.CheckStatus (status);
123 
124                         return new GraphicsContainer(state);
125 		}
126 
127 		[MonoTODO ("The rectangles and unit parameters aren't supported in libgdiplus")]
BeginContainer(Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)128 		public GraphicsContainer BeginContainer (Rectangle dstrect, Rectangle srcrect, GraphicsUnit unit)
129 		{
130 			uint state;
131 			Status status;
132 			status = GDIPlus.GdipBeginContainerI (nativeObject, ref dstrect, ref srcrect, unit, out state);
133 			GDIPlus.CheckStatus (status);
134 
135 			return new GraphicsContainer (state);
136 		}
137 
138 		[MonoTODO ("The rectangles and unit parameters aren't supported in libgdiplus")]
BeginContainer(RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)139 		public GraphicsContainer BeginContainer (RectangleF dstrect, RectangleF srcrect, GraphicsUnit unit)
140 		{
141 			uint state;
142 			Status status;
143 			status = GDIPlus.GdipBeginContainer (nativeObject, ref dstrect, ref srcrect, unit, out state);
144 			GDIPlus.CheckStatus (status);
145 
146 			return new GraphicsContainer (state);
147 		}
148 
149 
Clear(Color color)150 		public void Clear (Color color)
151 		{
152 			Status status;
153  			status = GDIPlus.GdipGraphicsClear (nativeObject, color.ToArgb ());
154  			GDIPlus.CheckStatus (status);
155 		}
156 		[MonoLimitation ("Works on Win32 and on X11 (but not on Cocoa and Quartz)")]
CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)157 		public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize)
158 		{
159 			CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
160 				blockRegionSize, CopyPixelOperation.SourceCopy);
161 		}
162 
163 		[MonoLimitation ("Works on Win32 and (for CopyPixelOperation.SourceCopy only) on X11 but not on Cocoa and Quartz")]
CopyFromScreen(Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)164 		public void CopyFromScreen (Point upperLeftSource, Point upperLeftDestination, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
165 		{
166 			CopyFromScreen (upperLeftSource.X, upperLeftSource.Y, upperLeftDestination.X, upperLeftDestination.Y,
167 				blockRegionSize, copyPixelOperation);
168 		}
169 
170 		[MonoLimitation ("Works on Win32 and on X11 (but not on Cocoa and Quartz)")]
CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)171 		public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize)
172 		{
173 			CopyFromScreen (sourceX, sourceY, destinationX, destinationY, blockRegionSize,
174 				CopyPixelOperation.SourceCopy);
175 		}
176 
177 		[MonoLimitation ("Works on Win32 and (for CopyPixelOperation.SourceCopy only) on X11 but not on Cocoa and Quartz")]
CopyFromScreen(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)178 		public void CopyFromScreen (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
179 		{
180 			if (!Enum.IsDefined (typeof (CopyPixelOperation), copyPixelOperation))
181 				throw new InvalidEnumArgumentException (Locale.GetText ("Enum argument value '{0}' is not valid for CopyPixelOperation", copyPixelOperation));
182 
183 			if (GDIPlus.UseX11Drawable) {
184 				CopyFromScreenX11 (sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation);
185 			} else if (GDIPlus.UseCarbonDrawable) {
186 				CopyFromScreenMac (sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation);
187 			} else if (GDIPlus.UseCocoaDrawable) {
188 				CopyFromScreenMac (sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation);
189 			} else {
190 				CopyFromScreenWin32 (sourceX, sourceY, destinationX, destinationY, blockRegionSize, copyPixelOperation);
191 			}
192 		}
193 
CopyFromScreenWin32(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)194 		private void CopyFromScreenWin32 (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
195 		{
196 			IntPtr window = GDIPlus.GetDesktopWindow ();
197 			IntPtr srcDC = GDIPlus.GetDC (window);
198 			IntPtr dstDC = GetHdc ();
199 			GDIPlus.BitBlt (dstDC, destinationX, destinationY, blockRegionSize.Width,
200 				blockRegionSize.Height, srcDC, sourceX, sourceY, (int) copyPixelOperation);
201 
202 			GDIPlus.ReleaseDC (IntPtr.Zero, srcDC);
203 			ReleaseHdc (dstDC);
204 		}
205 
CopyFromScreenMac(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)206 		private void CopyFromScreenMac (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
207 		{
208 			throw new NotImplementedException ();
209 		}
210 
CopyFromScreenX11(int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)211 		private void CopyFromScreenX11 (int sourceX, int sourceY, int destinationX, int destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
212 		{
213 			IntPtr window, image, defvisual, vPtr;
214 			int AllPlanes = ~0, nitems = 0, pixel;
215 
216 			if (copyPixelOperation != CopyPixelOperation.SourceCopy)
217 				throw new NotImplementedException ("Operation not implemented under X11");
218 
219 			if (GDIPlus.Display == IntPtr.Zero) {
220 				GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
221 			}
222 
223 			window = GDIPlus.XRootWindow (GDIPlus.Display, 0);
224 			defvisual = GDIPlus.XDefaultVisual (GDIPlus.Display, 0);
225 			XVisualInfo visual = new XVisualInfo ();
226 
227 			/* Get XVisualInfo for this visual */
228 			visual.visualid = GDIPlus.XVisualIDFromVisual(defvisual);
229 			vPtr = GDIPlus.XGetVisualInfo (GDIPlus.Display, 0x1 /* VisualIDMask */, ref visual, ref nitems);
230 			visual = (XVisualInfo) Marshal.PtrToStructure(vPtr, typeof (XVisualInfo));
231 #if false
232 			Console.WriteLine ("visual\t{0}", visual.visual);
233 			Console.WriteLine ("visualid\t{0}", visual.visualid);
234 			Console.WriteLine ("screen\t{0}", visual.screen);
235 			Console.WriteLine ("depth\t{0}", visual.depth);
236 			Console.WriteLine ("klass\t{0}", visual.klass);
237 			Console.WriteLine ("red_mask\t{0:X}", visual.red_mask);
238 			Console.WriteLine ("green_mask\t{0:X}", visual.green_mask);
239 			Console.WriteLine ("blue_mask\t{0:X}", visual.blue_mask);
240 			Console.WriteLine ("colormap_size\t{0}", visual.colormap_size);
241 			Console.WriteLine ("bits_per_rgb\t{0}", visual.bits_per_rgb);
242 #endif
243 			image = GDIPlus.XGetImage (GDIPlus.Display, window, sourceX, sourceY, blockRegionSize.Width,
244 				blockRegionSize.Height, AllPlanes, 2 /* ZPixmap*/);
245 			if (image == IntPtr.Zero) {
246 				string s = String.Format ("XGetImage returned NULL when asked to for a {0}x{1} region block",
247 					blockRegionSize.Width, blockRegionSize.Height);
248 				throw new InvalidOperationException (s);
249 			}
250 
251 			Bitmap bmp = new Bitmap (blockRegionSize.Width, blockRegionSize.Height);
252 			int red, blue, green;
253 			int red_mask = (int) visual.red_mask;
254 			int blue_mask = (int) visual.blue_mask;
255 			int green_mask = (int) visual.green_mask;
256 			for (int y = 0; y < blockRegionSize.Height; y++) {
257 				for (int x = 0; x < blockRegionSize.Width; x++) {
258 					pixel = GDIPlus.XGetPixel (image, x, y);
259 
260 					switch (visual.depth) {
261 						case 16: /* 16bbp pixel transformation */
262 							red = (int) ((pixel & red_mask ) >> 8) & 0xff;
263 							green = (int) (((pixel & green_mask ) >> 3 )) & 0xff;
264 							blue = (int) ((pixel & blue_mask ) << 3 ) & 0xff;
265 							break;
266 						case 24:
267 						case 32:
268 							red = (int) ((pixel & red_mask ) >> 16) & 0xff;
269 							green = (int) (((pixel & green_mask ) >> 8 )) & 0xff;
270 							blue = (int) ((pixel & blue_mask )) & 0xff;
271 							break;
272 						default:
273 							string text = Locale.GetText ("{0}bbp depth not supported.", visual.depth);
274 							throw new NotImplementedException (text);
275 					}
276 
277 					bmp.SetPixel (x, y, Color.FromArgb (255, red, green, blue));
278 				}
279 			}
280 
281 			DrawImage (bmp, destinationX, destinationY);
282 			bmp.Dispose ();
283 			GDIPlus.XDestroyImage (image);
284 			GDIPlus.XFree (vPtr);
285 		}
286 
Dispose()287 		public void Dispose ()
288 		{
289 			Status status;
290 			if (! disposed) {
291 				if (GDIPlus.UseCarbonDrawable || GDIPlus.UseCocoaDrawable) {
292 					Flush ();
293 					if (maccontext != null)
294 						maccontext.Release ();
295 				}
296 
297 				status = GDIPlus.GdipDeleteGraphics (nativeObject);
298 				nativeObject = IntPtr.Zero;
299 				GDIPlus.CheckStatus (status);
300 				disposed = true;
301 			}
302 
303 			GC.SuppressFinalize(this);
304 		}
305 
306 
DrawArc(Pen pen, Rectangle rect, float startAngle, float sweepAngle)307 		public void DrawArc (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
308 		{
309 			DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
310 		}
311 
312 
DrawArc(Pen pen, RectangleF rect, float startAngle, float sweepAngle)313 		public void DrawArc (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
314 		{
315 			DrawArc (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
316 		}
317 
318 
DrawArc(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)319 		public void DrawArc (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
320 		{
321 			Status status;
322 			if (pen == null)
323 				throw new ArgumentNullException ("pen");
324 
325 			status = GDIPlus.GdipDrawArc (nativeObject, pen.NativePen,
326                                         x, y, width, height, startAngle, sweepAngle);
327 			GDIPlus.CheckStatus (status);
328 		}
329 
330 		// Microsoft documentation states that the signature for this member should be
331 		// public void DrawArc( Pen pen,  int x,  int y,  int width,  int height,   int startAngle,
332    		// int sweepAngle. However, GdipDrawArcI uses also float for the startAngle and sweepAngle params
DrawArc(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)333    		public void DrawArc (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
334 		{
335 			Status status;
336 			if (pen == null)
337 				throw new ArgumentNullException ("pen");
338 			status = GDIPlus.GdipDrawArcI (nativeObject, pen.NativePen,
339 						x, y, width, height, startAngle, sweepAngle);
340 			GDIPlus.CheckStatus (status);
341 		}
342 
DrawBezier(Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)343 		public void DrawBezier (Pen pen, PointF pt1, PointF pt2, PointF pt3, PointF pt4)
344 		{
345 			Status status;
346 			if (pen == null)
347 				throw new ArgumentNullException ("pen");
348 			status = GDIPlus.GdipDrawBezier (nativeObject, pen.NativePen,
349 							pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
350 							pt3.Y, pt4.X, pt4.Y);
351 			GDIPlus.CheckStatus (status);
352 		}
353 
DrawBezier(Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)354 		public void DrawBezier (Pen pen, Point pt1, Point pt2, Point pt3, Point pt4)
355 		{
356 			Status status;
357 			if (pen == null)
358 				throw new ArgumentNullException ("pen");
359 			status = GDIPlus.GdipDrawBezierI (nativeObject, pen.NativePen,
360 							pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X,
361 							pt3.Y, pt4.X, pt4.Y);
362 			GDIPlus.CheckStatus (status);
363 		}
364 
DrawBezier(Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)365 		public void DrawBezier (Pen pen, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
366 		{
367 			Status status;
368 			if (pen == null)
369 				throw new ArgumentNullException ("pen");
370 			status = GDIPlus.GdipDrawBezier (nativeObject, pen.NativePen, x1,
371 							y1, x2, y2, x3, y3, x4, y4);
372 			GDIPlus.CheckStatus (status);
373 		}
374 
DrawBeziers(Pen pen, Point [] points)375 		public void DrawBeziers (Pen pen, Point [] points)
376 		{
377 			if (pen == null)
378 				throw new ArgumentNullException ("pen");
379 			if (points == null)
380 				throw new ArgumentNullException ("points");
381 
382                         int length = points.Length;
383 			Status status;
384 
385                         if (length < 4)
386                                 return;
387 
388 			for (int i = 0; i < length - 1; i += 3) {
389                                 Point p1 = points [i];
390                                 Point p2 = points [i + 1];
391                                 Point p3 = points [i + 2];
392                                 Point p4 = points [i + 3];
393 
394                                 status = GDIPlus.GdipDrawBezier (nativeObject,
395 							pen.NativePen,
396                                                         p1.X, p1.Y, p2.X, p2.Y,
397                                                         p3.X, p3.Y, p4.X, p4.Y);
398 				GDIPlus.CheckStatus (status);
399                         }
400 		}
401 
DrawBeziers(Pen pen, PointF [] points)402 		public void DrawBeziers (Pen pen, PointF [] points)
403 		{
404 			if (pen == null)
405 				throw new ArgumentNullException ("pen");
406 			if (points == null)
407 				throw new ArgumentNullException ("points");
408 
409 			int length = points.Length;
410 			Status status;
411 
412                         if (length < 4)
413                                 return;
414 
415 			for (int i = 0; i < length - 1; i += 3) {
416                                 PointF p1 = points [i];
417                                 PointF p2 = points [i + 1];
418                                 PointF p3 = points [i + 2];
419                                 PointF p4 = points [i + 3];
420 
421                                 status = GDIPlus.GdipDrawBezier (nativeObject,
422 							pen.NativePen,
423                                                         p1.X, p1.Y, p2.X, p2.Y,
424                                                         p3.X, p3.Y, p4.X, p4.Y);
425 				GDIPlus.CheckStatus (status);
426                         }
427 		}
428 
429 
DrawClosedCurve(Pen pen, PointF [] points)430 		public void DrawClosedCurve (Pen pen, PointF [] points)
431 		{
432 			if (pen == null)
433 				throw new ArgumentNullException ("pen");
434 			if (points == null)
435 				throw new ArgumentNullException ("points");
436 
437 			Status status;
438 			status = GDIPlus.GdipDrawClosedCurve (nativeObject, pen.NativePen, points, points.Length);
439 			GDIPlus.CheckStatus (status);
440 		}
441 
DrawClosedCurve(Pen pen, Point [] points)442 		public void DrawClosedCurve (Pen pen, Point [] points)
443 		{
444 			if (pen == null)
445 				throw new ArgumentNullException ("pen");
446 			if (points == null)
447 				throw new ArgumentNullException ("points");
448 
449 			Status status;
450 			status = GDIPlus.GdipDrawClosedCurveI (nativeObject, pen.NativePen, points, points.Length);
451 			GDIPlus.CheckStatus (status);
452 		}
453 
454 		// according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
455 		// GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
DrawClosedCurve(Pen pen, Point [] points, float tension, FillMode fillmode)456 		public void DrawClosedCurve (Pen pen, Point [] points, float tension, FillMode fillmode)
457 		{
458 			if (pen == null)
459 				throw new ArgumentNullException ("pen");
460 			if (points == null)
461 				throw new ArgumentNullException ("points");
462 
463 			Status status;
464 			status = GDIPlus.GdipDrawClosedCurve2I (nativeObject, pen.NativePen, points, points.Length, tension);
465 			GDIPlus.CheckStatus (status);
466 		}
467 
468 		// according to MSDN fillmode "is required but ignored" which makes _some_ sense since the unmanaged
469 		// GDI+ call doesn't support it (issue spotted using Gendarme's AvoidUnusedParametersRule)
DrawClosedCurve(Pen pen, PointF [] points, float tension, FillMode fillmode)470 		public void DrawClosedCurve (Pen pen, PointF [] points, float tension, FillMode fillmode)
471 		{
472 			if (pen == null)
473 				throw new ArgumentNullException ("pen");
474 			if (points == null)
475 				throw new ArgumentNullException ("points");
476 
477 			Status status;
478 			status = GDIPlus.GdipDrawClosedCurve2 (nativeObject, pen.NativePen, points, points.Length, tension);
479 			GDIPlus.CheckStatus (status);
480 		}
481 
DrawCurve(Pen pen, Point [] points)482 		public void DrawCurve (Pen pen, Point [] points)
483 		{
484 			if (pen == null)
485 				throw new ArgumentNullException ("pen");
486 			if (points == null)
487 				throw new ArgumentNullException ("points");
488 
489 			Status status;
490 			status = GDIPlus.GdipDrawCurveI (nativeObject, pen.NativePen, points, points.Length);
491 			GDIPlus.CheckStatus (status);
492 		}
493 
DrawCurve(Pen pen, PointF [] points)494 		public void DrawCurve (Pen pen, PointF [] points)
495 		{
496 			if (pen == null)
497 				throw new ArgumentNullException ("pen");
498 			if (points == null)
499 				throw new ArgumentNullException ("points");
500 
501 			Status status;
502 			status = GDIPlus.GdipDrawCurve (nativeObject, pen.NativePen, points, points.Length);
503 			GDIPlus.CheckStatus (status);
504 		}
505 
DrawCurve(Pen pen, PointF [] points, float tension)506 		public void DrawCurve (Pen pen, PointF [] points, float tension)
507 		{
508 			if (pen == null)
509 				throw new ArgumentNullException ("pen");
510 			if (points == null)
511 				throw new ArgumentNullException ("points");
512 
513 			Status status;
514 			status = GDIPlus.GdipDrawCurve2 (nativeObject, pen.NativePen, points, points.Length, tension);
515 			GDIPlus.CheckStatus (status);
516 		}
517 
DrawCurve(Pen pen, Point [] points, float tension)518 		public void DrawCurve (Pen pen, Point [] points, float tension)
519 		{
520 			if (pen == null)
521 				throw new ArgumentNullException ("pen");
522 			if (points == null)
523 				throw new ArgumentNullException ("points");
524 
525 			Status status;
526 			status = GDIPlus.GdipDrawCurve2I (nativeObject, pen.NativePen, points, points.Length, tension);
527 			GDIPlus.CheckStatus (status);
528 		}
529 
DrawCurve(Pen pen, PointF [] points, int offset, int numberOfSegments)530 		public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments)
531 		{
532 			if (pen == null)
533 				throw new ArgumentNullException ("pen");
534 			if (points == null)
535 				throw new ArgumentNullException ("points");
536 
537 			Status status;
538 			status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.NativePen,
539 							points, points.Length, offset,
540 							numberOfSegments, 0.5f);
541 			GDIPlus.CheckStatus (status);
542 		}
543 
DrawCurve(Pen pen, Point [] points, int offset, int numberOfSegments, float tension)544 		public void DrawCurve (Pen pen, Point [] points, int offset, int numberOfSegments, float tension)
545 		{
546 			if (pen == null)
547 				throw new ArgumentNullException ("pen");
548 			if (points == null)
549 				throw new ArgumentNullException ("points");
550 
551 			Status status;
552 			status = GDIPlus.GdipDrawCurve3I (nativeObject, pen.NativePen,
553 							points, points.Length, offset,
554 							numberOfSegments, tension);
555 			GDIPlus.CheckStatus (status);
556 		}
557 
DrawCurve(Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)558 		public void DrawCurve (Pen pen, PointF [] points, int offset, int numberOfSegments, float tension)
559 		{
560 			if (pen == null)
561 				throw new ArgumentNullException ("pen");
562 			if (points == null)
563 				throw new ArgumentNullException ("points");
564 
565 			Status status;
566 			status = GDIPlus.GdipDrawCurve3 (nativeObject, pen.NativePen,
567 							points, points.Length, offset,
568 							numberOfSegments, tension);
569 			GDIPlus.CheckStatus (status);
570 		}
571 
DrawEllipse(Pen pen, Rectangle rect)572 		public void DrawEllipse (Pen pen, Rectangle rect)
573 		{
574 			if (pen == null)
575 				throw new ArgumentNullException ("pen");
576 
577 			DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
578 		}
579 
DrawEllipse(Pen pen, RectangleF rect)580 		public void DrawEllipse (Pen pen, RectangleF rect)
581 		{
582 			if (pen == null)
583 				throw new ArgumentNullException ("pen");
584 			DrawEllipse (pen, rect.X, rect.Y, rect.Width, rect.Height);
585 		}
586 
DrawEllipse(Pen pen, int x, int y, int width, int height)587 		public void DrawEllipse (Pen pen, int x, int y, int width, int height)
588 		{
589 			if (pen == null)
590 				throw new ArgumentNullException ("pen");
591 			Status status;
592 			status = GDIPlus.GdipDrawEllipseI (nativeObject, pen.NativePen, x, y, width, height);
593 			GDIPlus.CheckStatus (status);
594 		}
595 
DrawEllipse(Pen pen, float x, float y, float width, float height)596 		public void DrawEllipse (Pen pen, float x, float y, float width, float height)
597 		{
598 			if (pen == null)
599 				throw new ArgumentNullException ("pen");
600 			Status status = GDIPlus.GdipDrawEllipse (nativeObject, pen.NativePen, x, y, width, height);
601 			GDIPlus.CheckStatus (status);
602 		}
603 
DrawIcon(Icon icon, Rectangle targetRect)604 		public void DrawIcon (Icon icon, Rectangle targetRect)
605 		{
606 			if (icon == null)
607 				throw new ArgumentNullException ("icon");
608 
609 			DrawImage (icon.GetInternalBitmap (), targetRect);
610 		}
611 
DrawIcon(Icon icon, int x, int y)612 		public void DrawIcon (Icon icon, int x, int y)
613 		{
614 			if (icon == null)
615 				throw new ArgumentNullException ("icon");
616 
617 			DrawImage (icon.GetInternalBitmap (), x, y);
618 		}
619 
DrawIconUnstretched(Icon icon, Rectangle targetRect)620 		public void DrawIconUnstretched (Icon icon, Rectangle targetRect)
621 		{
622 			if (icon == null)
623 				throw new ArgumentNullException ("icon");
624 
625 			DrawImageUnscaled (icon.GetInternalBitmap (), targetRect);
626 		}
627 
DrawImage(Image image, RectangleF rect)628 		public void DrawImage (Image image, RectangleF rect)
629 		{
630 			if (image == null)
631 				throw new ArgumentNullException ("image");
632 
633 			Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, rect.X, rect.Y, rect.Width, rect.Height);
634 			GDIPlus.CheckStatus (status);
635 		}
636 
DrawImage(Image image, PointF point)637 		public void DrawImage (Image image, PointF point)
638 		{
639 			if (image == null)
640 				throw new ArgumentNullException ("image");
641 
642 			Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, point.X, point.Y);
643 			GDIPlus.CheckStatus (status);
644 		}
645 
DrawImage(Image image, Point [] destPoints)646 		public void DrawImage (Image image, Point [] destPoints)
647 		{
648 			if (image == null)
649 				throw new ArgumentNullException ("image");
650 			if (destPoints == null)
651 				throw new ArgumentNullException ("destPoints");
652 
653 			Status status = GDIPlus.GdipDrawImagePointsI (nativeObject, image.NativeObject, destPoints, destPoints.Length);
654 			GDIPlus.CheckStatus (status);
655 		}
656 
DrawImage(Image image, Point point)657 		public void DrawImage (Image image, Point point)
658 		{
659 			if (image == null)
660 				throw new ArgumentNullException ("image");
661 			DrawImage (image, point.X, point.Y);
662 		}
663 
DrawImage(Image image, Rectangle rect)664 		public void DrawImage (Image image, Rectangle rect)
665 		{
666 			if (image == null)
667 				throw new ArgumentNullException ("image");
668 			DrawImage (image, rect.X, rect.Y, rect.Width, rect.Height);
669 		}
670 
DrawImage(Image image, PointF [] destPoints)671 		public void DrawImage (Image image, PointF [] destPoints)
672 		{
673 			if (image == null)
674 				throw new ArgumentNullException ("image");
675 			if (destPoints == null)
676 				throw new ArgumentNullException ("destPoints");
677 			Status status = GDIPlus.GdipDrawImagePoints (nativeObject, image.NativeObject, destPoints, destPoints.Length);
678 			GDIPlus.CheckStatus (status);
679 		}
680 
DrawImage(Image image, int x, int y)681 		public void DrawImage (Image image, int x, int y)
682 		{
683 			if (image == null)
684 				throw new ArgumentNullException ("image");
685 			Status status = GDIPlus.GdipDrawImageI (nativeObject, image.NativeObject, x, y);
686 			GDIPlus.CheckStatus (status);
687 		}
688 
DrawImage(Image image, float x, float y)689 		public void DrawImage (Image image, float x, float y)
690 		{
691 			if (image == null)
692 				throw new ArgumentNullException ("image");
693 			Status status = GDIPlus.GdipDrawImage (nativeObject, image.NativeObject, x, y);
694 			GDIPlus.CheckStatus (status);
695 		}
696 
DrawImage(Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)697 		public void DrawImage (Image image, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit)
698 		{
699 			if (image == null)
700 				throw new ArgumentNullException ("image");
701 			Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
702 				destRect.X, destRect.Y, destRect.Width, destRect.Height,
703 				srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
704 				srcUnit, IntPtr.Zero, null, IntPtr.Zero);
705 			GDIPlus.CheckStatus (status);
706 		}
707 
DrawImage(Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)708 		public void DrawImage (Image image, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit)
709 		{
710 			if (image == null)
711 				throw new ArgumentNullException ("image");
712 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
713 				destRect.X, destRect.Y, destRect.Width, destRect.Height,
714 				srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height,
715 				srcUnit, IntPtr.Zero, null, IntPtr.Zero);
716 			GDIPlus.CheckStatus (status);
717 		}
718 
DrawImage(Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)719 		public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit)
720 		{
721 			if (image == null)
722 				throw new ArgumentNullException ("image");
723 			if (destPoints == null)
724 				throw new ArgumentNullException ("destPoints");
725 
726 			Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
727 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
728 				srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
729 				null, IntPtr.Zero);
730 			GDIPlus.CheckStatus (status);
731 		}
732 
DrawImage(Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)733 		public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
734 		{
735 			if (image == null)
736 				throw new ArgumentNullException ("image");
737 			if (destPoints == null)
738 				throw new ArgumentNullException ("destPoints");
739 
740 			Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
741 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
742 				srcRect.Width, srcRect.Height, srcUnit, IntPtr.Zero,
743 				null, IntPtr.Zero);
744 			GDIPlus.CheckStatus (status);
745 		}
746 
DrawImage(Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)747 		public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit,
748                                 ImageAttributes imageAttr)
749 		{
750 			if (image == null)
751 				throw new ArgumentNullException ("image");
752 			if (destPoints == null)
753 				throw new ArgumentNullException ("destPoints");
754 			Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
755 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
756 				srcRect.Width, srcRect.Height, srcUnit,
757 				imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
758 			GDIPlus.CheckStatus (status);
759 		}
760 
DrawImage(Image image, float x, float y, float width, float height)761 		public void DrawImage (Image image, float x, float y, float width, float height)
762 		{
763 			if (image == null)
764 				throw new ArgumentNullException ("image");
765 			Status status = GDIPlus.GdipDrawImageRect(nativeObject, image.NativeObject, x, y,
766                            width, height);
767 			GDIPlus.CheckStatus (status);
768 		}
769 
DrawImage(Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr)770 		public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit,
771                                 ImageAttributes imageAttr)
772 		{
773 			if (image == null)
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.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
781 			GDIPlus.CheckStatus (status);
782 		}
783 
DrawImage(Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)784 		public void DrawImage (Image image, int x, int y, Rectangle srcRect, GraphicsUnit srcUnit)
785 		{
786 			if (image == null)
787 				throw new ArgumentNullException ("image");
788 			Status status = GDIPlus.GdipDrawImagePointRectI(nativeObject, image.NativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
789 			GDIPlus.CheckStatus (status);
790 		}
791 
DrawImage(Image image, int x, int y, int width, int height)792 		public void DrawImage (Image image, int x, int y, int width, int height)
793 		{
794 			if (image == null)
795 				throw new ArgumentNullException ("image");
796 			Status status = GDIPlus.GdipDrawImageRectI (nativeObject, image.nativeObject, x, y, width, height);
797 			GDIPlus.CheckStatus (status);
798 		}
799 
DrawImage(Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)800 		public void DrawImage (Image image, float x, float y, RectangleF srcRect, GraphicsUnit srcUnit)
801 		{
802 			if (image == null)
803 				throw new ArgumentNullException ("image");
804 			Status status = GDIPlus.GdipDrawImagePointRect (nativeObject, image.nativeObject, x, y, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit);
805 			GDIPlus.CheckStatus (status);
806 		}
807 
DrawImage(Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)808 		public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
809 		{
810 			if (image == null)
811 				throw new ArgumentNullException ("image");
812 			if (destPoints == null)
813 				throw new ArgumentNullException ("destPoints");
814 			Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
815 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
816 				srcRect.Width, srcRect.Height, srcUnit,
817 				imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero);
818 			GDIPlus.CheckStatus (status);
819 		}
820 
DrawImage(Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)821 		public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
822 		{
823 			if (image == null)
824 				throw new ArgumentNullException ("image");
825 			if (destPoints == null)
826 				throw new ArgumentNullException ("destPoints");
827 
828 			Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
829 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
830 				srcRect.Width, srcRect.Height, srcUnit,
831 				imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, IntPtr.Zero);
832 			GDIPlus.CheckStatus (status);
833 		}
834 
DrawImage(Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)835 		public void DrawImage (Image image, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
836 		{
837 			if (image == null)
838 				throw new ArgumentNullException ("image");
839 			if (destPoints == null)
840 				throw new ArgumentNullException ("destPoints");
841 
842 			Status status = GDIPlus.GdipDrawImagePointsRectI (nativeObject, image.NativeObject,
843 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
844 				srcRect.Width, srcRect.Height, srcUnit,
845 				imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr) callbackData);
846 			GDIPlus.CheckStatus (status);
847 		}
848 
DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)849 		public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit)
850 		{
851 			if (image == null)
852 				throw new ArgumentNullException ("image");
853 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
854                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
855                        		srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
856                        		null, IntPtr.Zero);
857 			GDIPlus.CheckStatus (status);
858 		}
859 
DrawImage(Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)860 		public void DrawImage (Image image, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback, int callbackData)
861 		{
862 			Status status = GDIPlus.GdipDrawImagePointsRect (nativeObject, image.NativeObject,
863 				destPoints, destPoints.Length , srcRect.X, srcRect.Y,
864 				srcRect.Width, srcRect.Height, srcUnit,
865 				imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback, (IntPtr) callbackData);
866 			GDIPlus.CheckStatus (status);
867 		}
868 
DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)869 		public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit)
870 		{
871 			if (image == null)
872 				throw new ArgumentNullException ("image");
873 			Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
874                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
875                        		srcX, srcY, srcWidth, srcHeight, srcUnit, IntPtr.Zero,
876                        		null, IntPtr.Zero);
877 			GDIPlus.CheckStatus (status);
878 		}
879 
DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)880 		public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs)
881 		{
882 			if (image == null)
883 				throw new ArgumentNullException ("image");
884 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
885                                 destRect.X, destRect.Y, destRect.Width, destRect.Height,
886                        		srcX, srcY, srcWidth, srcHeight, srcUnit,
887 				imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
888 			GDIPlus.CheckStatus (status);
889 		}
890 
DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)891 		public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr)
892 		{
893 			if (image == null)
894 				throw new ArgumentNullException ("image");
895 			Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
896                                         destRect.X, destRect.Y, destRect.Width,
897 					destRect.Height, srcX, srcY, srcWidth, srcHeight,
898 					srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, null, IntPtr.Zero);
899 			GDIPlus.CheckStatus (status);
900 		}
901 
DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)902 		public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback)
903 		{
904 			if (image == null)
905 				throw new ArgumentNullException ("image");
906 			Status status = GDIPlus.GdipDrawImageRectRectI (nativeObject, image.NativeObject,
907                                         destRect.X, destRect.Y, destRect.Width,
908 					destRect.Height, srcX, srcY, srcWidth, srcHeight,
909 					srcUnit, imageAttr != null ? imageAttr.nativeImageAttributes : IntPtr.Zero, callback,
910 					IntPtr.Zero);
911 			GDIPlus.CheckStatus (status);
912 		}
913 
DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)914 		public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback)
915 		{
916 			if (image == null)
917 				throw new ArgumentNullException ("image");
918 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
919                                         destRect.X, destRect.Y, destRect.Width,
920 					destRect.Height, srcX, srcY, srcWidth, srcHeight,
921 					srcUnit, imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero,
922 					callback, IntPtr.Zero);
923 			GDIPlus.CheckStatus (status);
924 		}
925 
DrawImage(Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)926 		public void DrawImage (Image image, Rectangle destRect, float srcX, float srcY, float srcWidth, float srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
927 		{
928 			if (image == null)
929 				throw new ArgumentNullException ("image");
930 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
931 				destRect.X, destRect.Y, destRect.Width, destRect.Height,
932 				srcX, srcY, srcWidth, srcHeight, srcUnit,
933 				imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData);
934 			GDIPlus.CheckStatus (status);
935 		}
936 
DrawImage(Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)937 		public void DrawImage (Image image, Rectangle destRect, int srcX, int srcY, int srcWidth, int srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData)
938 		{
939 			if (image == null)
940 				throw new ArgumentNullException ("image");
941 			Status status = GDIPlus.GdipDrawImageRectRect (nativeObject, image.NativeObject,
942                        		destRect.X, destRect.Y, destRect.Width, destRect.Height,
943 				srcX, srcY, srcWidth, srcHeight, srcUnit,
944 				imageAttrs != null ? imageAttrs.nativeImageAttributes : IntPtr.Zero, callback, callbackData);
945 			GDIPlus.CheckStatus (status);
946 		}
947 
DrawImageUnscaled(Image image, Point point)948 		public void DrawImageUnscaled (Image image, Point point)
949 		{
950 			DrawImageUnscaled (image, point.X, point.Y);
951 		}
952 
DrawImageUnscaled(Image image, Rectangle rect)953 		public void DrawImageUnscaled (Image image, Rectangle rect)
954 		{
955 			DrawImageUnscaled (image, rect.X, rect.Y, rect.Width, rect.Height);
956 		}
957 
DrawImageUnscaled(Image image, int x, int y)958 		public void DrawImageUnscaled (Image image, int x, int y)
959 		{
960 			if (image == null)
961 				throw new ArgumentNullException ("image");
962 			DrawImage (image, x, y, image.Width, image.Height);
963 		}
964 
DrawImageUnscaled(Image image, int x, int y, int width, int height)965 		public void DrawImageUnscaled (Image image, int x, int y, int width, int height)
966 		{
967 			if (image == null)
968 				throw new ArgumentNullException ("image");
969 
970 			// avoid creating an empty, or negative w/h, bitmap...
971 			if ((width <= 0) || (height <= 0))
972 				return;
973 
974 			using (Image tmpImg = new Bitmap (width, height)) {
975 				using (Graphics g = FromImage (tmpImg)) {
976 					g.DrawImage (image, 0, 0, image.Width, image.Height);
977 					DrawImage (tmpImg, x, y, width, height);
978 				}
979 			}
980 		}
981 
DrawImageUnscaledAndClipped(Image image, Rectangle rect)982 		public void DrawImageUnscaledAndClipped (Image image, Rectangle rect)
983 		{
984 			if (image == null)
985 				throw new ArgumentNullException ("image");
986 
987 			int width = (image.Width > rect.Width) ? rect.Width : image.Width;
988 			int height = (image.Height > rect.Height) ? rect.Height : image.Height;
989 
990 			DrawImageUnscaled (image, rect.X, rect.Y, width, height);
991 		}
992 
DrawLine(Pen pen, PointF pt1, PointF pt2)993 		public void DrawLine (Pen pen, PointF pt1, PointF pt2)
994 		{
995 			if (pen == null)
996 				throw new ArgumentNullException ("pen");
997                         Status status = GDIPlus.GdipDrawLine (nativeObject, pen.NativePen,
998 		                                pt1.X, pt1.Y, pt2.X, pt2.Y);
999 			GDIPlus.CheckStatus (status);
1000 		}
1001 
DrawLine(Pen pen, Point pt1, Point pt2)1002 		public void DrawLine (Pen pen, Point pt1, Point pt2)
1003 		{
1004 			if (pen == null)
1005 				throw new ArgumentNullException ("pen");
1006                         Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.NativePen,
1007 		                                pt1.X, pt1.Y, pt2.X, pt2.Y);
1008 			GDIPlus.CheckStatus (status);
1009 		}
1010 
DrawLine(Pen pen, int x1, int y1, int x2, int y2)1011 		public void DrawLine (Pen pen, int x1, int y1, int x2, int y2)
1012 		{
1013 			if (pen == null)
1014 				throw new ArgumentNullException ("pen");
1015 			Status status = GDIPlus.GdipDrawLineI (nativeObject, pen.NativePen, x1, y1, x2, y2);
1016 			GDIPlus.CheckStatus (status);
1017 		}
1018 
DrawLine(Pen pen, float x1, float y1, float x2, float y2)1019 		public void DrawLine (Pen pen, float x1, float y1, float x2, float y2)
1020 		{
1021 			if (pen == null)
1022 				throw new ArgumentNullException ("pen");
1023 			if (!float.IsNaN(x1) && !float.IsNaN(y1) &&
1024 			    !float.IsNaN(x2) && !float.IsNaN(y2)) {
1025 				Status status = GDIPlus.GdipDrawLine (nativeObject, pen.NativePen, x1, y1, x2, y2);
1026 				GDIPlus.CheckStatus (status);
1027 			}
1028 		}
1029 
DrawLines(Pen pen, PointF [] points)1030 		public void DrawLines (Pen pen, PointF [] points)
1031 		{
1032 			if (pen == null)
1033 				throw new ArgumentNullException ("pen");
1034 			if (points == null)
1035 				throw new ArgumentNullException ("points");
1036 			Status status = GDIPlus.GdipDrawLines (nativeObject, pen.NativePen, points, points.Length);
1037 			GDIPlus.CheckStatus (status);
1038 		}
1039 
DrawLines(Pen pen, Point [] points)1040 		public void DrawLines (Pen pen, Point [] points)
1041 		{
1042 			if (pen == null)
1043 				throw new ArgumentNullException ("pen");
1044 			if (points == null)
1045 				throw new ArgumentNullException ("points");
1046 			Status status = GDIPlus.GdipDrawLinesI (nativeObject, pen.NativePen, points, points.Length);
1047 			GDIPlus.CheckStatus (status);
1048 		}
1049 
DrawPath(Pen pen, GraphicsPath path)1050 		public void DrawPath (Pen pen, GraphicsPath path)
1051 		{
1052 			if (pen == null)
1053 				throw new ArgumentNullException ("pen");
1054 			if (path == null)
1055 				throw new ArgumentNullException ("path");
1056 			Status status = GDIPlus.GdipDrawPath (nativeObject, pen.NativePen, path.nativePath);
1057 			GDIPlus.CheckStatus (status);
1058 		}
1059 
DrawPie(Pen pen, Rectangle rect, float startAngle, float sweepAngle)1060 		public void DrawPie (Pen pen, Rectangle rect, float startAngle, float sweepAngle)
1061 		{
1062 			if (pen == null)
1063 				throw new ArgumentNullException ("pen");
1064 			DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1065 		}
1066 
DrawPie(Pen pen, RectangleF rect, float startAngle, float sweepAngle)1067 		public void DrawPie (Pen pen, RectangleF rect, float startAngle, float sweepAngle)
1068 		{
1069 			if (pen == null)
1070 				throw new ArgumentNullException ("pen");
1071 			DrawPie (pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1072 		}
1073 
DrawPie(Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)1074 		public void DrawPie (Pen pen, float x, float y, float width, float height, float startAngle, float sweepAngle)
1075 		{
1076 			if (pen == null)
1077 				throw new ArgumentNullException ("pen");
1078 			Status status = GDIPlus.GdipDrawPie (nativeObject, pen.NativePen, x, y, width, height, startAngle, sweepAngle);
1079 			GDIPlus.CheckStatus (status);
1080 		}
1081 
1082 		// Microsoft documentation states that the signature for this member should be
1083 		// public void DrawPie(Pen pen, int x,  int y,  int width,   int height,   int startAngle
1084    		// int sweepAngle. However, GdipDrawPieI uses also float for the startAngle and sweepAngle params
DrawPie(Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)1085    		public void DrawPie (Pen pen, int x, int y, int width, int height, int startAngle, int sweepAngle)
1086 		{
1087 			if (pen == null)
1088 				throw new ArgumentNullException ("pen");
1089 			Status status = GDIPlus.GdipDrawPieI (nativeObject, pen.NativePen, x, y, width, height, startAngle, sweepAngle);
1090 			GDIPlus.CheckStatus (status);
1091 		}
1092 
DrawPolygon(Pen pen, Point [] points)1093 		public void DrawPolygon (Pen pen, Point [] points)
1094 		{
1095 			if (pen == null)
1096 				throw new ArgumentNullException ("pen");
1097 			if (points == null)
1098 				throw new ArgumentNullException ("points");
1099 			Status status = GDIPlus.GdipDrawPolygonI (nativeObject, pen.NativePen, points, points.Length);
1100 			GDIPlus.CheckStatus (status);
1101 		}
1102 
DrawPolygon(Pen pen, PointF [] points)1103 		public void DrawPolygon (Pen pen, PointF [] points)
1104 		{
1105 			if (pen == null)
1106 				throw new ArgumentNullException ("pen");
1107 			if (points == null)
1108 				throw new ArgumentNullException ("points");
1109 			Status status = GDIPlus.GdipDrawPolygon (nativeObject, pen.NativePen, points, points.Length);
1110 			GDIPlus.CheckStatus (status);
1111 		}
1112 
DrawRectangle(Pen pen, Rectangle rect)1113 		public void DrawRectangle (Pen pen, Rectangle rect)
1114 		{
1115 			if (pen == null)
1116 				throw new ArgumentNullException ("pen");
1117 			DrawRectangle (pen, rect.Left, rect.Top, rect.Width, rect.Height);
1118 		}
1119 
DrawRectangle(Pen pen, float x, float y, float width, float height)1120 		public void DrawRectangle (Pen pen, float x, float y, float width, float height)
1121 		{
1122 			if (pen == null)
1123 				throw new ArgumentNullException ("pen");
1124 			Status status = GDIPlus.GdipDrawRectangle (nativeObject, pen.NativePen, x, y, width, height);
1125 			GDIPlus.CheckStatus (status);
1126 		}
1127 
DrawRectangle(Pen pen, int x, int y, int width, int height)1128 		public void DrawRectangle (Pen pen, int x, int y, int width, int height)
1129 		{
1130 			if (pen == null)
1131 				throw new ArgumentNullException ("pen");
1132 			Status status = GDIPlus.GdipDrawRectangleI (nativeObject, pen.NativePen, x, y, width, height);
1133 			GDIPlus.CheckStatus (status);
1134 		}
1135 
DrawRectangles(Pen pen, RectangleF [] rects)1136 		public void DrawRectangles (Pen pen, RectangleF [] rects)
1137 		{
1138 			if (pen == null)
1139 				throw new ArgumentNullException ("image");
1140 			if (rects == null)
1141 				throw new ArgumentNullException ("rects");
1142 			Status status = GDIPlus.GdipDrawRectangles (nativeObject, pen.NativePen, rects, rects.Length);
1143 			GDIPlus.CheckStatus (status);
1144 		}
1145 
DrawRectangles(Pen pen, Rectangle [] rects)1146 		public void DrawRectangles (Pen pen, Rectangle [] rects)
1147 		{
1148 			if (pen == null)
1149 				throw new ArgumentNullException ("image");
1150 			if (rects == null)
1151 				throw new ArgumentNullException ("rects");
1152 			Status status = GDIPlus.GdipDrawRectanglesI (nativeObject, pen.NativePen, rects, rects.Length);
1153 			GDIPlus.CheckStatus (status);
1154 		}
1155 
DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle)1156 		public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle)
1157 		{
1158 			DrawString (s, font, brush, layoutRectangle, null);
1159 		}
1160 
DrawString(string s, Font font, Brush brush, PointF point)1161 		public void DrawString (string s, Font font, Brush brush, PointF point)
1162 		{
1163 			DrawString (s, font, brush, new RectangleF (point.X, point.Y, 0, 0), null);
1164 		}
1165 
DrawString(string s, Font font, Brush brush, PointF point, StringFormat format)1166 		public void DrawString (string s, Font font, Brush brush, PointF point, StringFormat format)
1167 		{
1168 			DrawString(s, font, brush, new RectangleF(point.X, point.Y, 0, 0), format);
1169 		}
1170 
DrawString(string s, Font font, Brush brush, float x, float y)1171 		public void DrawString (string s, Font font, Brush brush, float x, float y)
1172 		{
1173 			DrawString (s, font, brush, new RectangleF (x, y, 0, 0), null);
1174 		}
1175 
DrawString(string s, Font font, Brush brush, float x, float y, StringFormat format)1176 		public void DrawString (string s, Font font, Brush brush, float x, float y, StringFormat format)
1177 		{
1178 			DrawString (s, font, brush, new RectangleF(x, y, 0, 0), format);
1179 		}
1180 
DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)1181 		public void DrawString (string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
1182 		{
1183 			if (font == null)
1184 				throw new ArgumentNullException ("font");
1185 			if (brush == null)
1186 				throw new ArgumentNullException ("brush");
1187 			if (s == null || s.Length == 0)
1188 				return;
1189 
1190 			Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.NativeBrush);
1191 			GDIPlus.CheckStatus (status);
1192 		}
1193 
EndContainer(GraphicsContainer container)1194 		public void EndContainer (GraphicsContainer container)
1195 		{
1196 			if (container == null)
1197 				throw new ArgumentNullException ("container");
1198 			Status status = GDIPlus.GdipEndContainer(nativeObject, container.NativeObject);
1199 			GDIPlus.CheckStatus (status);
1200 		}
1201 
1202 		private const string MetafileEnumeration = "Metafiles enumeration, for both WMF and EMF formats, isn't supported.";
1203 
1204 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)1205 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback)
1206 		{
1207 			throw new NotImplementedException ();
1208 		}
1209 
1210 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)1211 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback)
1212 		{
1213 			throw new NotImplementedException ();
1214 		}
1215 
1216 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)1217 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback)
1218 		{
1219 			throw new NotImplementedException ();
1220 		}
1221 
1222 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)1223 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback)
1224 		{
1225 			throw new NotImplementedException ();
1226 		}
1227 
1228 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback)1229 		public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback)
1230 		{
1231 			throw new NotImplementedException ();
1232 		}
1233 
1234 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)1235 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback)
1236 		{
1237 			throw new NotImplementedException ();
1238 		}
1239 
1240 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)1241 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1242 		{
1243 			throw new NotImplementedException ();
1244 		}
1245 
1246 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)1247 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1248 		{
1249 			throw new NotImplementedException ();
1250 		}
1251 
1252 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)1253 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1254 		{
1255 			throw new NotImplementedException ();
1256 		}
1257 
1258 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)1259 		public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData)
1260 		{
1261 			throw new NotImplementedException ();
1262 		}
1263 
1264 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)1265 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData)
1266 		{
1267 			throw new NotImplementedException ();
1268 		}
1269 
1270 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)1271 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData)
1272 		{
1273 			throw new NotImplementedException ();
1274 		}
1275 
1276 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1277 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1278 		{
1279 			throw new NotImplementedException ();
1280 		}
1281 
1282 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1283 		public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1284 		{
1285 			throw new NotImplementedException ();
1286 		}
1287 
1288 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1289 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1290 		{
1291 			throw new NotImplementedException ();
1292 		}
1293 
1294 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1295 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1296 		{
1297 			throw new NotImplementedException ();
1298 		}
1299 
1300 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1301 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1302 		{
1303 			throw new NotImplementedException ();
1304 		}
1305 
1306 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)1307 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback)
1308 		{
1309 			throw new NotImplementedException ();
1310 		}
1311 
1312 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1313 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1314 		{
1315 			throw new NotImplementedException ();
1316 		}
1317 
1318 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1319 		public void EnumerateMetafile (Metafile metafile, Point destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1320 		{
1321 			throw new NotImplementedException ();
1322 		}
1323 
1324 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1325 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1326 		{
1327 			throw new NotImplementedException ();
1328 		}
1329 
1330 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1331 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1332 		{
1333 			throw new NotImplementedException ();
1334 		}
1335 
1336 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1337 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1338 		{
1339 			throw new NotImplementedException ();
1340 		}
1341 
1342 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1343 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1344 		{
1345 			throw new NotImplementedException ();
1346 		}
1347 
1348 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1349 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1350 		{
1351 			throw new NotImplementedException ();
1352 		}
1353 
1354 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1355 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1356 		{
1357 			throw new NotImplementedException ();
1358 		}
1359 
1360 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1361 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1362 		{
1363 			throw new NotImplementedException ();
1364 		}
1365 
1366 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1367 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1368 		{
1369 			throw new NotImplementedException ();
1370 		}
1371 
1372 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1373 		public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1374 		{
1375 			throw new NotImplementedException ();
1376 		}
1377 
1378 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)1379 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit srcUnit, EnumerateMetafileProc callback, IntPtr callbackData)
1380 		{
1381 			throw new NotImplementedException ();
1382 		}
1383 
1384 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1385 		public void EnumerateMetafile (Metafile metafile, Point [] destPoints, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1386 		{
1387 			throw new NotImplementedException ();
1388 		}
1389 
1390 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1391 		public void EnumerateMetafile (Metafile metafile, Rectangle destRect, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1392 		{
1393 			throw new NotImplementedException ();
1394 		}
1395 
1396 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1397 		public void EnumerateMetafile (Metafile metafile, Point destPoint, Rectangle srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1398 		{
1399 			throw new NotImplementedException ();
1400 		}
1401 
1402 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1403 		public void EnumerateMetafile (Metafile metafile, RectangleF destRect, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1404 		{
1405 			throw new NotImplementedException ();
1406 		}
1407 
1408 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1409 		public void EnumerateMetafile (Metafile metafile, PointF [] destPoints, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1410 		{
1411 			throw new NotImplementedException ();
1412 		}
1413 
1414 		[MonoTODO (MetafileEnumeration)]
EnumerateMetafile(Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)1415 		public void EnumerateMetafile (Metafile metafile, PointF destPoint, RectangleF srcRect, GraphicsUnit unit, EnumerateMetafileProc callback, IntPtr callbackData, ImageAttributes imageAttr)
1416 		{
1417 			throw new NotImplementedException ();
1418 		}
1419 
ExcludeClip(Rectangle rect)1420 		public void ExcludeClip (Rectangle rect)
1421 		{
1422 			Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Exclude);
1423 			GDIPlus.CheckStatus (status);
1424 		}
1425 
ExcludeClip(Region region)1426 		public void ExcludeClip (Region region)
1427 		{
1428 			if (region == null)
1429 				throw new ArgumentNullException ("region");
1430 			Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Exclude);
1431 			GDIPlus.CheckStatus (status);
1432 		}
1433 
1434 
FillClosedCurve(Brush brush, PointF [] points)1435 		public void FillClosedCurve (Brush brush, PointF [] points)
1436 		{
1437 			if (brush == null)
1438 				throw new ArgumentNullException ("brush");
1439 			if (points == null)
1440 				throw new ArgumentNullException ("points");
1441 			Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeBrush, points, points.Length);
1442 			GDIPlus.CheckStatus (status);
1443 		}
1444 
FillClosedCurve(Brush brush, Point [] points)1445 		public void FillClosedCurve (Brush brush, Point [] points)
1446 		{
1447 			if (brush == null)
1448 				throw new ArgumentNullException ("brush");
1449 			if (points == null)
1450 				throw new ArgumentNullException ("points");
1451 			Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeBrush, points, points.Length);
1452 			GDIPlus.CheckStatus (status);
1453 		}
1454 
1455 
FillClosedCurve(Brush brush, PointF [] points, FillMode fillmode)1456 		public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode)
1457 		{
1458 			if (brush == null)
1459 				throw new ArgumentNullException ("brush");
1460 			if (points == null)
1461 				throw new ArgumentNullException ("points");
1462 			FillClosedCurve (brush, points, fillmode, 0.5f);
1463 		}
1464 
FillClosedCurve(Brush brush, Point [] points, FillMode fillmode)1465 		public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode)
1466 		{
1467 			if (brush == null)
1468 				throw new ArgumentNullException ("brush");
1469 			if (points == null)
1470 				throw new ArgumentNullException ("points");
1471 			FillClosedCurve (brush, points, fillmode, 0.5f);
1472 		}
1473 
FillClosedCurve(Brush brush, PointF [] points, FillMode fillmode, float tension)1474 		public void FillClosedCurve (Brush brush, PointF [] points, FillMode fillmode, float tension)
1475 		{
1476 			if (brush == null)
1477 				throw new ArgumentNullException ("brush");
1478 			if (points == null)
1479 				throw new ArgumentNullException ("points");
1480 			Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode);
1481 			GDIPlus.CheckStatus (status);
1482 		}
1483 
FillClosedCurve(Brush brush, Point [] points, FillMode fillmode, float tension)1484 		public void FillClosedCurve (Brush brush, Point [] points, FillMode fillmode, float tension)
1485 		{
1486 			if (brush == null)
1487 				throw new ArgumentNullException ("brush");
1488 			if (points == null)
1489 				throw new ArgumentNullException ("points");
1490 			Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode);
1491 			GDIPlus.CheckStatus (status);
1492 		}
1493 
FillEllipse(Brush brush, Rectangle rect)1494 		public void FillEllipse (Brush brush, Rectangle rect)
1495 		{
1496 			if (brush == null)
1497 				throw new ArgumentNullException ("brush");
1498 			FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1499 		}
1500 
FillEllipse(Brush brush, RectangleF rect)1501 		public void FillEllipse (Brush brush, RectangleF rect)
1502 		{
1503 			if (brush == null)
1504 				throw new ArgumentNullException ("brush");
1505 			FillEllipse (brush, rect.X, rect.Y, rect.Width, rect.Height);
1506 		}
1507 
FillEllipse(Brush brush, float x, float y, float width, float height)1508 		public void FillEllipse (Brush brush, float x, float y, float width, float height)
1509 		{
1510 			if (brush == null)
1511 				throw new ArgumentNullException ("brush");
1512                         Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.NativeBrush, x, y, width, height);
1513 			GDIPlus.CheckStatus (status);
1514 		}
1515 
FillEllipse(Brush brush, int x, int y, int width, int height)1516 		public void FillEllipse (Brush brush, int x, int y, int width, int height)
1517 		{
1518 			if (brush == null)
1519 				throw new ArgumentNullException ("brush");
1520 			Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.NativeBrush, x, y, width, height);
1521 			GDIPlus.CheckStatus (status);
1522 		}
1523 
FillPath(Brush brush, GraphicsPath path)1524 		public void FillPath (Brush brush, GraphicsPath path)
1525 		{
1526 			if (brush == null)
1527 				throw new ArgumentNullException ("brush");
1528 			if (path == null)
1529 				throw new ArgumentNullException ("path");
1530 			Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeBrush,  path.nativePath);
1531 			GDIPlus.CheckStatus (status);
1532 		}
1533 
FillPie(Brush brush, Rectangle rect, float startAngle, float sweepAngle)1534 		public void FillPie (Brush brush, Rectangle rect, float startAngle, float sweepAngle)
1535 		{
1536 			if (brush == null)
1537 				throw new ArgumentNullException ("brush");
1538 			Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeBrush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
1539 			GDIPlus.CheckStatus (status);
1540 		}
1541 
FillPie(Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)1542 		public void FillPie (Brush brush, int x, int y, int width, int height, int startAngle, int sweepAngle)
1543 		{
1544 			if (brush == null)
1545 				throw new ArgumentNullException ("brush");
1546 			Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle);
1547 			GDIPlus.CheckStatus (status);
1548 		}
1549 
FillPie(Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)1550 		public void FillPie (Brush brush, float x, float y, float width, float height, float startAngle, float sweepAngle)
1551 		{
1552 			if (brush == null)
1553 				throw new ArgumentNullException ("brush");
1554 			Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle);
1555 			GDIPlus.CheckStatus (status);
1556 		}
1557 
FillPolygon(Brush brush, PointF [] points)1558 		public void FillPolygon (Brush brush, PointF [] points)
1559 		{
1560 			if (brush == null)
1561 				throw new ArgumentNullException ("brush");
1562 			if (points == null)
1563 				throw new ArgumentNullException ("points");
1564 			Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.NativeBrush, points, points.Length);
1565 			GDIPlus.CheckStatus (status);
1566 		}
1567 
FillPolygon(Brush brush, Point [] points)1568 		public void FillPolygon (Brush brush, Point [] points)
1569 		{
1570 			if (brush == null)
1571 				throw new ArgumentNullException ("brush");
1572 			if (points == null)
1573 				throw new ArgumentNullException ("points");
1574 			Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.NativeBrush, points, points.Length);
1575 			GDIPlus.CheckStatus (status);
1576 		}
1577 
FillPolygon(Brush brush, Point [] points, FillMode fillMode)1578 		public void FillPolygon (Brush brush, Point [] points, FillMode fillMode)
1579 		{
1580 			if (brush == null)
1581 				throw new ArgumentNullException ("brush");
1582 			if (points == null)
1583 				throw new ArgumentNullException ("points");
1584 			Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.NativeBrush, points, points.Length, fillMode);
1585 			GDIPlus.CheckStatus (status);
1586 		}
1587 
FillPolygon(Brush brush, PointF [] points, FillMode fillMode)1588 		public void FillPolygon (Brush brush, PointF [] points, FillMode fillMode)
1589 		{
1590 			if (brush == null)
1591 				throw new ArgumentNullException ("brush");
1592 			if (points == null)
1593 				throw new ArgumentNullException ("points");
1594 			Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.NativeBrush, points, points.Length, fillMode);
1595 			GDIPlus.CheckStatus (status);
1596 		}
1597 
FillRectangle(Brush brush, RectangleF rect)1598 		public void FillRectangle (Brush brush, RectangleF rect)
1599 		{
1600 			if (brush == null)
1601 				throw new ArgumentNullException ("brush");
1602                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1603 		}
1604 
FillRectangle(Brush brush, Rectangle rect)1605 		public void FillRectangle (Brush brush, Rectangle rect)
1606 		{
1607 			if (brush == null)
1608 				throw new ArgumentNullException ("brush");
1609                         FillRectangle (brush, rect.Left, rect.Top, rect.Width, rect.Height);
1610 		}
1611 
FillRectangle(Brush brush, int x, int y, int width, int height)1612 		public void FillRectangle (Brush brush, int x, int y, int width, int height)
1613 		{
1614 			if (brush == null)
1615 				throw new ArgumentNullException ("brush");
1616 
1617 			Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.NativeBrush, x, y, width, height);
1618 			GDIPlus.CheckStatus (status);
1619 		}
1620 
FillRectangle(Brush brush, float x, float y, float width, float height)1621 		public void FillRectangle (Brush brush, float x, float y, float width, float height)
1622 		{
1623 			if (brush == null)
1624 				throw new ArgumentNullException ("brush");
1625 
1626 			Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.NativeBrush, x, y, width, height);
1627 			GDIPlus.CheckStatus (status);
1628 		}
1629 
FillRectangles(Brush brush, Rectangle [] rects)1630 		public void FillRectangles (Brush brush, Rectangle [] rects)
1631 		{
1632 			if (brush == null)
1633 				throw new ArgumentNullException ("brush");
1634 			if (rects == null)
1635 				throw new ArgumentNullException ("rects");
1636 
1637 			Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.NativeBrush, rects, rects.Length);
1638 			GDIPlus.CheckStatus (status);
1639 		}
1640 
FillRectangles(Brush brush, RectangleF [] rects)1641 		public void FillRectangles (Brush brush, RectangleF [] rects)
1642 		{
1643 			if (brush == null)
1644 				throw new ArgumentNullException ("brush");
1645 			if (rects == null)
1646 				throw new ArgumentNullException ("rects");
1647 
1648 			Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.NativeBrush, rects, rects.Length);
1649 			GDIPlus.CheckStatus (status);
1650 		}
1651 
1652 
FillRegion(Brush brush, Region region)1653 		public void FillRegion (Brush brush, Region region)
1654 		{
1655 			if (brush == null)
1656 				throw new ArgumentNullException ("brush");
1657 			if (region == null)
1658 				throw new ArgumentNullException ("region");
1659 
1660 			Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeBrush, region.NativeObject);
1661                         GDIPlus.CheckStatus(status);
1662 		}
1663 
1664 
Flush()1665 		public void Flush ()
1666 		{
1667 			Flush (FlushIntention.Flush);
1668 		}
1669 
1670 
Flush(FlushIntention intention)1671 		public void Flush (FlushIntention intention)
1672 		{
1673 			if (nativeObject == IntPtr.Zero) {
1674 				return;
1675 			}
1676 
1677 			Status status = GDIPlus.GdipFlush (nativeObject, intention);
1678                         GDIPlus.CheckStatus (status);
1679 
1680 			if (maccontext != null)
1681 				maccontext.Synchronize ();
1682 		}
1683 
1684 		[EditorBrowsable (EditorBrowsableState.Advanced)]
FromHdc(IntPtr hdc)1685 		public static Graphics FromHdc (IntPtr hdc)
1686 		{
1687 			IntPtr graphics;
1688 			Status status = GDIPlus.GdipCreateFromHDC (hdc, out graphics);
1689 			GDIPlus.CheckStatus (status);
1690 			return new Graphics (graphics);
1691 		}
1692 
1693 		[MonoTODO]
1694 		[EditorBrowsable (EditorBrowsableState.Advanced)]
FromHdc(IntPtr hdc, IntPtr hdevice)1695 		public static Graphics FromHdc (IntPtr hdc, IntPtr hdevice)
1696 		{
1697 			throw new NotImplementedException ();
1698 		}
1699 
1700 		[EditorBrowsable (EditorBrowsableState.Advanced)]
FromHdcInternal(IntPtr hdc)1701 		public static Graphics FromHdcInternal (IntPtr hdc)
1702 		{
1703 			GDIPlus.Display = hdc;
1704 			return null;
1705 		}
1706 
1707 		[EditorBrowsable (EditorBrowsableState.Advanced)]
FromHwnd(IntPtr hwnd)1708 		public static Graphics FromHwnd (IntPtr hwnd)
1709 		{
1710 			IntPtr graphics;
1711 
1712 			if (GDIPlus.UseCocoaDrawable) {
1713 				CocoaContext context = MacSupport.GetCGContextForNSView (hwnd);
1714 				GDIPlus.GdipCreateFromContext_macosx (context.ctx, context.width, context.height, out graphics);
1715 
1716 				Graphics g = new Graphics (graphics);
1717 				g.maccontext = context;
1718 
1719 				return g;
1720 			}
1721 
1722 			if (GDIPlus.UseCarbonDrawable) {
1723 				CarbonContext context = MacSupport.GetCGContextForView (hwnd);
1724 				GDIPlus.GdipCreateFromContext_macosx (context.ctx, context.width, context.height, out graphics);
1725 
1726 				Graphics g = new Graphics (graphics);
1727 				g.maccontext = context;
1728 
1729 				return g;
1730 			}
1731 			if (GDIPlus.UseX11Drawable) {
1732 				if (GDIPlus.Display == IntPtr.Zero) {
1733 					GDIPlus.Display = GDIPlus.XOpenDisplay (IntPtr.Zero);
1734 					if (GDIPlus.Display == IntPtr.Zero)
1735 						throw new NotSupportedException ("Could not open display (X-Server required. Check your DISPLAY environment variable)");
1736 				}
1737 				if (hwnd == IntPtr.Zero) {
1738 					hwnd = GDIPlus.XRootWindow (GDIPlus.Display, GDIPlus.XDefaultScreen (GDIPlus.Display));
1739 				}
1740 
1741 				return FromXDrawable (hwnd, GDIPlus.Display);
1742 
1743 			}
1744 
1745 			Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
1746 			GDIPlus.CheckStatus (status);
1747 
1748 			return new Graphics (graphics);
1749 		}
1750 
1751 		[EditorBrowsable (EditorBrowsableState.Advanced)]
FromHwndInternal(IntPtr hwnd)1752 		public static Graphics FromHwndInternal (IntPtr hwnd)
1753 		{
1754 			return FromHwnd (hwnd);
1755 		}
1756 
FromImage(Image image)1757 		public static Graphics FromImage (Image image)
1758 		{
1759 			IntPtr graphics;
1760 
1761 			if (image == null)
1762 				throw new ArgumentNullException ("image");
1763 
1764 			if ((image.PixelFormat & PixelFormat.Indexed) != 0)
1765 				throw new Exception (Locale.GetText ("Cannot create Graphics from an indexed bitmap."));
1766 
1767 			Status status = GDIPlus.GdipGetImageGraphicsContext (image.nativeObject, out graphics);
1768 			GDIPlus.CheckStatus (status);
1769 			Graphics result = new Graphics (graphics);
1770 
1771 			if (GDIPlus.RunningOnUnix ()) {
1772 				Rectangle rect  = new Rectangle (0,0, image.Width, image.Height);
1773 				GDIPlus.GdipSetVisibleClip_linux (result.NativeObject, ref rect);
1774 			}
1775 
1776 			return result;
1777 		}
1778 
FromXDrawable(IntPtr drawable, IntPtr display)1779 		internal static Graphics FromXDrawable (IntPtr drawable, IntPtr display)
1780 		{
1781 			IntPtr graphics;
1782 
1783 			Status s = GDIPlus.GdipCreateFromXDrawable_linux (drawable, display, out graphics);
1784 			GDIPlus.CheckStatus (s);
1785 			return new Graphics (graphics);
1786 		}
1787 
1788 		[MonoTODO]
GetHalftonePalette()1789 		public static IntPtr GetHalftonePalette ()
1790 		{
1791 			throw new NotImplementedException ();
1792 		}
1793 
GetHdc()1794 		public IntPtr GetHdc ()
1795 		{
1796 			GDIPlus.CheckStatus (GDIPlus.GdipGetDC (this.nativeObject, out deviceContextHdc));
1797 			return deviceContextHdc;
1798 		}
1799 
GetNearestColor(Color color)1800 		public Color GetNearestColor (Color color)
1801 		{
1802 			int argb;
1803 
1804 			Status status = GDIPlus.GdipGetNearestColor (nativeObject, out argb);
1805 			GDIPlus.CheckStatus (status);
1806 
1807 			return Color.FromArgb (argb);
1808 		}
1809 
1810 
IntersectClip(Region region)1811 		public void IntersectClip (Region region)
1812 		{
1813 			if (region == null)
1814 				throw new ArgumentNullException ("region");
1815 			Status status = GDIPlus.GdipSetClipRegion (nativeObject, region.NativeObject, CombineMode.Intersect);
1816 			GDIPlus.CheckStatus (status);
1817 		}
1818 
IntersectClip(RectangleF rect)1819 		public void IntersectClip (RectangleF rect)
1820 		{
1821 			Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1822 			GDIPlus.CheckStatus (status);
1823 		}
1824 
IntersectClip(Rectangle rect)1825 		public void IntersectClip (Rectangle rect)
1826 		{
1827 			Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, CombineMode.Intersect);
1828 			GDIPlus.CheckStatus (status);
1829 		}
1830 
IsVisible(Point point)1831 		public bool IsVisible (Point point)
1832 		{
1833 			bool isVisible = false;
1834 
1835 			Status status = GDIPlus.GdipIsVisiblePointI (nativeObject, point.X, point.Y, out isVisible);
1836 			GDIPlus.CheckStatus (status);
1837 
1838                         return isVisible;
1839 		}
1840 
1841 
IsVisible(RectangleF rect)1842 		public bool IsVisible (RectangleF rect)
1843 		{
1844 			bool isVisible = false;
1845 
1846 			Status status = GDIPlus.GdipIsVisibleRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1847 			GDIPlus.CheckStatus (status);
1848 
1849                         return isVisible;
1850 		}
1851 
IsVisible(PointF point)1852 		public bool IsVisible (PointF point)
1853 		{
1854 			bool isVisible = false;
1855 
1856 			Status status = GDIPlus.GdipIsVisiblePoint (nativeObject, point.X, point.Y, out isVisible);
1857 			GDIPlus.CheckStatus (status);
1858 
1859                         return isVisible;
1860 		}
1861 
IsVisible(Rectangle rect)1862 		public bool IsVisible (Rectangle rect)
1863 		{
1864 			bool isVisible = false;
1865 
1866 			Status status = GDIPlus.GdipIsVisibleRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, out isVisible);
1867 			GDIPlus.CheckStatus (status);
1868 
1869                         return isVisible;
1870 		}
1871 
IsVisible(float x, float y)1872 		public bool IsVisible (float x, float y)
1873 		{
1874 			return IsVisible (new PointF (x, y));
1875 		}
1876 
IsVisible(int x, int y)1877 		public bool IsVisible (int x, int y)
1878 		{
1879 			return IsVisible (new Point (x, y));
1880 		}
1881 
IsVisible(float x, float y, float width, float height)1882 		public bool IsVisible (float x, float y, float width, float height)
1883 		{
1884 			return IsVisible (new RectangleF (x, y, width, height));
1885 		}
1886 
1887 
IsVisible(int x, int y, int width, int height)1888 		public bool IsVisible (int x, int y, int width, int height)
1889 		{
1890 			return IsVisible (new Rectangle (x, y, width, height));
1891 		}
1892 
1893 
MeasureCharacterRanges(string text, Font font, RectangleF layoutRect, StringFormat stringFormat)1894 		public Region[] MeasureCharacterRanges (string text, Font font, RectangleF layoutRect, StringFormat stringFormat)
1895 		{
1896 			if ((text == null) || (text.Length == 0))
1897 				return new Region [0];
1898 
1899 			if (font == null)
1900 				throw new ArgumentNullException ("font");
1901 
1902 			if (stringFormat == null)
1903 				throw new ArgumentException ("stringFormat");
1904 
1905 			int regcount = stringFormat.GetMeasurableCharacterRangeCount ();
1906 			if (regcount == 0)
1907 				return new Region[0];
1908 
1909 			IntPtr[] native_regions = new IntPtr [regcount];
1910 			Region[] regions = new Region [regcount];
1911 
1912 			for (int i = 0; i < regcount; i++) {
1913 				regions[i] = new Region ();
1914 				native_regions[i] = regions[i].NativeObject;
1915 			}
1916 
1917 			Status status = GDIPlus.GdipMeasureCharacterRanges (nativeObject, text, text.Length,
1918 				font.NativeObject, ref layoutRect, stringFormat.NativeObject, regcount, out native_regions[0]);
1919 			GDIPlus.CheckStatus (status);
1920 
1921 			return regions;
1922 		}
1923 
GdipMeasureString(IntPtr graphics, string text, Font font, ref RectangleF layoutRect, IntPtr stringFormat)1924 		private unsafe SizeF GdipMeasureString (IntPtr graphics, string text, Font font, ref RectangleF layoutRect,
1925 			IntPtr stringFormat)
1926 		{
1927 			if ((text == null) || (text.Length == 0))
1928 				return SizeF.Empty;
1929 
1930 			if (font == null)
1931 				throw new ArgumentNullException ("font");
1932 
1933 			RectangleF boundingBox = new RectangleF ();
1934 
1935 			Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length, font.NativeObject,
1936 				ref layoutRect, stringFormat, out boundingBox, null, null);
1937 			GDIPlus.CheckStatus (status);
1938 
1939 			return new SizeF (boundingBox.Width, boundingBox.Height);
1940 		}
1941 
MeasureString(string text, Font font)1942 		public SizeF MeasureString (string text, Font font)
1943 		{
1944 			return MeasureString (text, font, SizeF.Empty);
1945 		}
1946 
MeasureString(string text, Font font, SizeF layoutArea)1947 		public SizeF MeasureString (string text, Font font, SizeF layoutArea)
1948 		{
1949 			RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1950 			return GdipMeasureString (nativeObject, text, font, ref rect, IntPtr.Zero);
1951 		}
1952 
MeasureString(string text, Font font, int width)1953 		public SizeF MeasureString (string text, Font font, int width)
1954 		{
1955 			RectangleF rect = new RectangleF (0, 0, width, Int32.MaxValue);
1956 			return GdipMeasureString (nativeObject, text, font, ref rect, IntPtr.Zero);
1957 		}
1958 
MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat)1959 		public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat)
1960 		{
1961 			RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1962 			IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.NativeObject;
1963 			return GdipMeasureString (nativeObject, text, font, ref rect, format);
1964 		}
1965 
MeasureString(string text, Font font, int width, StringFormat format)1966 		public SizeF MeasureString (string text, Font font, int width, StringFormat format)
1967 		{
1968 			RectangleF rect = new RectangleF (0, 0, width, Int32.MaxValue);
1969 			IntPtr stringFormat = (format == null) ? IntPtr.Zero : format.NativeObject;
1970 			return GdipMeasureString (nativeObject, text, font, ref rect, stringFormat);
1971 		}
1972 
MeasureString(string text, Font font, PointF origin, StringFormat stringFormat)1973 		public SizeF MeasureString (string text, Font font, PointF origin, StringFormat stringFormat)
1974 		{
1975 			RectangleF rect = new RectangleF (origin.X, origin.Y, 0, 0);
1976 			IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.NativeObject;
1977 			return GdipMeasureString (nativeObject, text, font, ref rect, format);
1978 		}
1979 
MeasureString(string text, Font font, SizeF layoutArea, StringFormat stringFormat, out int charactersFitted, out int linesFilled)1980 		public SizeF MeasureString (string text, Font font, SizeF layoutArea, StringFormat stringFormat,
1981 			out int charactersFitted, out int linesFilled)
1982 		{
1983 			charactersFitted = 0;
1984 			linesFilled = 0;
1985 
1986 			if ((text == null) || (text.Length == 0))
1987 				return SizeF.Empty;
1988 
1989 			if (font == null)
1990 				throw new ArgumentNullException ("font");
1991 
1992 			RectangleF boundingBox = new RectangleF ();
1993 			RectangleF rect = new RectangleF (0, 0, layoutArea.Width, layoutArea.Height);
1994 
1995 			IntPtr format = (stringFormat == null) ? IntPtr.Zero : stringFormat.NativeObject;
1996 
1997 			unsafe {
1998 				fixed (int* pc = &charactersFitted, pl = &linesFilled) {
1999 					Status status = GDIPlus.GdipMeasureString (nativeObject, text, text.Length,
2000 					font.NativeObject, ref rect, format, out boundingBox, pc, pl);
2001 					GDIPlus.CheckStatus (status);
2002 				}
2003 			}
2004 			return new SizeF (boundingBox.Width, boundingBox.Height);
2005 		}
2006 
MultiplyTransform(Matrix matrix)2007 		public void MultiplyTransform (Matrix matrix)
2008 		{
2009 			MultiplyTransform (matrix, MatrixOrder.Prepend);
2010 		}
2011 
MultiplyTransform(Matrix matrix, MatrixOrder order)2012 		public void MultiplyTransform (Matrix matrix, MatrixOrder order)
2013 		{
2014 			if (matrix == null)
2015 				throw new ArgumentNullException ("matrix");
2016 
2017 			Status status = GDIPlus.GdipMultiplyWorldTransform (nativeObject, matrix.nativeMatrix, order);
2018 			GDIPlus.CheckStatus (status);
2019 		}
2020 
2021 		[EditorBrowsable (EditorBrowsableState.Advanced)]
ReleaseHdc(IntPtr hdc)2022 		public void ReleaseHdc (IntPtr hdc)
2023 		{
2024 			ReleaseHdcInternal (hdc);
2025 		}
2026 
ReleaseHdc()2027 		public void ReleaseHdc ()
2028 		{
2029 			ReleaseHdcInternal (deviceContextHdc);
2030 		}
2031 
2032 		[MonoLimitation ("Can only be used when hdc was provided by Graphics.GetHdc() method")]
2033 		[EditorBrowsable (EditorBrowsableState.Never)]
ReleaseHdcInternal(IntPtr hdc)2034 		public void ReleaseHdcInternal (IntPtr hdc)
2035 		{
2036 			Status status = Status.InvalidParameter;
2037 			if (hdc == deviceContextHdc) {
2038 				status = GDIPlus.GdipReleaseDC (nativeObject, deviceContextHdc);
2039 				deviceContextHdc = IntPtr.Zero;
2040 			}
2041 			GDIPlus.CheckStatus (status);
2042 		}
2043 
ResetClip()2044 		public void ResetClip ()
2045 		{
2046 			Status status = GDIPlus.GdipResetClip (nativeObject);
2047 			GDIPlus.CheckStatus (status);
2048 		}
2049 
ResetTransform()2050 		public void ResetTransform ()
2051 		{
2052 			Status status = GDIPlus.GdipResetWorldTransform (nativeObject);
2053 			GDIPlus.CheckStatus (status);
2054 		}
2055 
Restore(GraphicsState gstate)2056 		public void Restore (GraphicsState gstate)
2057 		{
2058 			// the possible NRE thrown by gstate.nativeState match MS behaviour
2059 			Status status = GDIPlus.GdipRestoreGraphics (nativeObject, (uint)gstate.nativeState);
2060 			GDIPlus.CheckStatus (status);
2061 		}
2062 
RotateTransform(float angle)2063 		public void RotateTransform (float angle)
2064 		{
2065 			RotateTransform (angle, MatrixOrder.Prepend);
2066 		}
2067 
RotateTransform(float angle, MatrixOrder order)2068 		public void RotateTransform (float angle, MatrixOrder order)
2069 		{
2070 			Status status = GDIPlus.GdipRotateWorldTransform (nativeObject, angle, order);
2071 			GDIPlus.CheckStatus (status);
2072 		}
2073 
Save()2074 		public GraphicsState Save ()
2075 		{
2076 			uint saveState;
2077 			Status status = GDIPlus.GdipSaveGraphics (nativeObject, out saveState);
2078 			GDIPlus.CheckStatus (status);
2079 
2080 			GraphicsState state = new GraphicsState ((int)saveState);
2081 			return state;
2082 		}
2083 
ScaleTransform(float sx, float sy)2084 		public void ScaleTransform (float sx, float sy)
2085 		{
2086 			ScaleTransform (sx, sy, MatrixOrder.Prepend);
2087 		}
2088 
ScaleTransform(float sx, float sy, MatrixOrder order)2089 		public void ScaleTransform (float sx, float sy, MatrixOrder order)
2090 		{
2091                         Status status = GDIPlus.GdipScaleWorldTransform (nativeObject, sx, sy, order);
2092 			GDIPlus.CheckStatus (status);
2093 		}
2094 
2095 
SetClip(RectangleF rect)2096 		public void SetClip (RectangleF rect)
2097 		{
2098                         SetClip (rect, CombineMode.Replace);
2099 		}
2100 
2101 
SetClip(GraphicsPath path)2102 		public void SetClip (GraphicsPath path)
2103 		{
2104 			SetClip (path, CombineMode.Replace);
2105 		}
2106 
2107 
SetClip(Rectangle rect)2108 		public void SetClip (Rectangle rect)
2109 		{
2110 			SetClip (rect, CombineMode.Replace);
2111 		}
2112 
2113 
SetClip(Graphics g)2114 		public void SetClip (Graphics g)
2115 		{
2116 			SetClip (g, CombineMode.Replace);
2117 		}
2118 
2119 
SetClip(Graphics g, CombineMode combineMode)2120 		public void SetClip (Graphics g, CombineMode combineMode)
2121 		{
2122 			if (g == null)
2123 				throw new ArgumentNullException ("g");
2124 
2125 			Status status = GDIPlus.GdipSetClipGraphics (nativeObject, g.NativeObject, combineMode);
2126 			GDIPlus.CheckStatus (status);
2127 		}
2128 
2129 
SetClip(Rectangle rect, CombineMode combineMode)2130 		public void SetClip (Rectangle rect, CombineMode combineMode)
2131 		{
2132 			Status status = GDIPlus.GdipSetClipRectI (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2133 			GDIPlus.CheckStatus (status);
2134 		}
2135 
2136 
SetClip(RectangleF rect, CombineMode combineMode)2137 		public void SetClip (RectangleF rect, CombineMode combineMode)
2138 		{
2139 			Status status = GDIPlus.GdipSetClipRect (nativeObject, rect.X, rect.Y, rect.Width, rect.Height, combineMode);
2140 			GDIPlus.CheckStatus (status);
2141 		}
2142 
2143 
SetClip(Region region, CombineMode combineMode)2144 		public void SetClip (Region region, CombineMode combineMode)
2145 		{
2146 			if (region == null)
2147 				throw new ArgumentNullException ("region");
2148 			Status status =   GDIPlus.GdipSetClipRegion(nativeObject,  region.NativeObject, combineMode);
2149 			GDIPlus.CheckStatus (status);
2150 		}
2151 
2152 
SetClip(GraphicsPath path, CombineMode combineMode)2153 		public void SetClip (GraphicsPath path, CombineMode combineMode)
2154 		{
2155 			if (path == null)
2156 				throw new ArgumentNullException ("path");
2157 			Status status = GDIPlus.GdipSetClipPath (nativeObject, path.nativePath, combineMode);
2158 			GDIPlus.CheckStatus (status);
2159 		}
2160 
2161 
TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)2162 		public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, PointF [] pts)
2163 		{
2164 			if (pts == null)
2165 				throw new ArgumentNullException ("pts");
2166 
2167 			IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemory (pts);
2168 
2169                         Status status = GDIPlus.GdipTransformPoints (nativeObject, destSpace, srcSpace,  ptrPt, pts.Length);
2170 			GDIPlus.CheckStatus (status);
2171 
2172 			GDIPlus.FromUnManagedMemoryToPoint (ptrPt, pts);
2173 		}
2174 
2175 
TransformPoints(CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)2176 		public void TransformPoints (CoordinateSpace destSpace, CoordinateSpace srcSpace, Point [] pts)
2177 		{
2178 			if (pts == null)
2179 				throw new ArgumentNullException ("pts");
2180                         IntPtr ptrPt =  GDIPlus.FromPointToUnManagedMemoryI (pts);
2181 
2182                         Status status = GDIPlus.GdipTransformPointsI (nativeObject, destSpace, srcSpace, ptrPt, pts.Length);
2183 			GDIPlus.CheckStatus (status);
2184 
2185 			GDIPlus.FromUnManagedMemoryToPointI (ptrPt, pts);
2186 		}
2187 
2188 
TranslateClip(int dx, int dy)2189 		public void TranslateClip (int dx, int dy)
2190 		{
2191 			Status status = GDIPlus.GdipTranslateClipI (nativeObject, dx, dy);
2192 			GDIPlus.CheckStatus (status);
2193 		}
2194 
2195 
TranslateClip(float dx, float dy)2196 		public void TranslateClip (float dx, float dy)
2197 		{
2198 			Status status = GDIPlus.GdipTranslateClip (nativeObject, dx, dy);
2199 			GDIPlus.CheckStatus (status);
2200 		}
2201 
TranslateTransform(float dx, float dy)2202 		public void TranslateTransform (float dx, float dy)
2203 		{
2204 			TranslateTransform (dx, dy, MatrixOrder.Prepend);
2205 		}
2206 
2207 
TranslateTransform(float dx, float dy, MatrixOrder order)2208 		public void TranslateTransform (float dx, float dy, MatrixOrder order)
2209 		{
2210 			Status status = GDIPlus.GdipTranslateWorldTransform (nativeObject, dx, dy, order);
2211 			GDIPlus.CheckStatus (status);
2212 		}
2213 
2214 		public Region Clip {
2215 			get {
2216 				Region reg = new Region();
2217 				Status status = GDIPlus.GdipGetClip (nativeObject, reg.NativeObject);
2218 				GDIPlus.CheckStatus (status);
2219 				return reg;
2220 			}
2221 			set {
2222 				SetClip (value, CombineMode.Replace);
2223 			}
2224 		}
2225 
2226 		public RectangleF ClipBounds {
2227 			get {
2228                                 RectangleF rect = new RectangleF ();
2229                                 Status status = GDIPlus.GdipGetClipBounds (nativeObject, out rect);
2230 				GDIPlus.CheckStatus (status);
2231 				return rect;
2232 			}
2233 		}
2234 
2235 		public CompositingMode CompositingMode {
2236 			get {
2237                                 CompositingMode mode;
2238                                 Status status = GDIPlus.GdipGetCompositingMode (nativeObject, out mode);
2239 				GDIPlus.CheckStatus (status);
2240 
2241 				return mode;
2242 			}
2243 			set {
2244                                 Status status = GDIPlus.GdipSetCompositingMode (nativeObject, value);
2245 				GDIPlus.CheckStatus (status);
2246 			}
2247 
2248 		}
2249 
2250 		public CompositingQuality CompositingQuality {
2251 			get {
2252                                 CompositingQuality quality;
2253 
2254                                 Status status = GDIPlus.GdipGetCompositingQuality (nativeObject, out quality);
2255 				GDIPlus.CheckStatus (status);
2256         			return quality;
2257 			}
2258 			set {
2259                                 Status status = GDIPlus.GdipSetCompositingQuality (nativeObject, value);
2260 				GDIPlus.CheckStatus (status);
2261 			}
2262 		}
2263 
2264 		public float DpiX {
2265 			get {
2266                                 float x;
2267 
2268        				Status status = GDIPlus.GdipGetDpiX (nativeObject, out x);
2269 				GDIPlus.CheckStatus (status);
2270         			return x;
2271 			}
2272 		}
2273 
2274 		public float DpiY {
2275 			get {
2276                                 float y;
2277 
2278        				Status status = GDIPlus.GdipGetDpiY (nativeObject, out y);
2279 				GDIPlus.CheckStatus (status);
2280         			return y;
2281 			}
2282 		}
2283 
2284 		public InterpolationMode InterpolationMode {
2285 			get {
2286                                 InterpolationMode imode = InterpolationMode.Invalid;
2287         			Status status = GDIPlus.GdipGetInterpolationMode (nativeObject, out imode);
2288 				GDIPlus.CheckStatus (status);
2289         			return imode;
2290 			}
2291 			set {
2292                                 Status status = GDIPlus.GdipSetInterpolationMode (nativeObject, value);
2293 				GDIPlus.CheckStatus (status);
2294 			}
2295 		}
2296 
2297 		public bool IsClipEmpty {
2298 			get {
2299                                 bool isEmpty = false;
2300 
2301         			Status status = GDIPlus.GdipIsClipEmpty (nativeObject, out isEmpty);
2302 				GDIPlus.CheckStatus (status);
2303         			return isEmpty;
2304 			}
2305 		}
2306 
2307 		public bool IsVisibleClipEmpty {
2308 			get {
2309                                 bool isEmpty = false;
2310 
2311         			Status status = GDIPlus.GdipIsVisibleClipEmpty (nativeObject, out isEmpty);
2312 				GDIPlus.CheckStatus (status);
2313         			return isEmpty;
2314 			}
2315 		}
2316 
2317 		public float PageScale {
2318 			get {
2319                                 float scale;
2320 
2321         			Status status = GDIPlus.GdipGetPageScale (nativeObject, out scale);
2322 				GDIPlus.CheckStatus (status);
2323         			return scale;
2324 			}
2325 			set {
2326                                 Status status = GDIPlus.GdipSetPageScale (nativeObject, value);
2327 				GDIPlus.CheckStatus (status);
2328 			}
2329 		}
2330 
2331 		public GraphicsUnit PageUnit {
2332 			get {
2333                                 GraphicsUnit unit;
2334 
2335                                 Status status = GDIPlus.GdipGetPageUnit (nativeObject, out unit);
2336 				GDIPlus.CheckStatus (status);
2337         			return unit;
2338 			}
2339 			set {
2340                                 Status status = GDIPlus.GdipSetPageUnit (nativeObject, value);
2341 				GDIPlus.CheckStatus (status);
2342 			}
2343 		}
2344 
2345 		[MonoTODO ("This property does not do anything when used with libgdiplus.")]
2346 		public PixelOffsetMode PixelOffsetMode {
2347 			get {
2348 			        PixelOffsetMode pixelOffset = PixelOffsetMode.Invalid;
2349 
2350                                 Status status = GDIPlus.GdipGetPixelOffsetMode (nativeObject, out pixelOffset);
2351 				GDIPlus.CheckStatus (status);
2352         			return pixelOffset;
2353 			}
2354 			set {
2355                                 Status status = GDIPlus.GdipSetPixelOffsetMode (nativeObject, value);
2356 				GDIPlus.CheckStatus (status);
2357 			}
2358 		}
2359 
2360 		public Point RenderingOrigin {
2361 			get {
2362                                 int x, y;
2363 				Status status = GDIPlus.GdipGetRenderingOrigin (nativeObject, out x, out y);
2364 				GDIPlus.CheckStatus (status);
2365                                 return new Point (x, y);
2366 			}
2367 
2368 			set {
2369                                 Status status = GDIPlus.GdipSetRenderingOrigin (nativeObject, value.X, value.Y);
2370 				GDIPlus.CheckStatus (status);
2371 			}
2372 		}
2373 
2374 		public SmoothingMode SmoothingMode {
2375 			get {
2376                                 SmoothingMode mode = SmoothingMode.Invalid;
2377 
2378 				Status status = GDIPlus.GdipGetSmoothingMode (nativeObject, out mode);
2379 				GDIPlus.CheckStatus (status);
2380                                 return mode;
2381 			}
2382 
2383 			set {
2384                                 Status status = GDIPlus.GdipSetSmoothingMode (nativeObject, value);
2385 				GDIPlus.CheckStatus (status);
2386 			}
2387 		}
2388 
2389 		[MonoTODO ("This property does not do anything when used with libgdiplus.")]
2390 		public int TextContrast {
2391 			get {
2392                                 int contrast;
2393 
2394                                 Status status = GDIPlus.GdipGetTextContrast (nativeObject, out contrast);
2395 				GDIPlus.CheckStatus (status);
2396                                 return contrast;
2397 			}
2398 
2399                         set {
2400                                 Status status = GDIPlus.GdipSetTextContrast (nativeObject, value);
2401 				GDIPlus.CheckStatus (status);
2402 			}
2403 		}
2404 
2405 		public TextRenderingHint TextRenderingHint {
2406 			get {
2407                                 TextRenderingHint hint;
2408 
2409                                 Status status = GDIPlus.GdipGetTextRenderingHint (nativeObject, out hint);
2410 				GDIPlus.CheckStatus (status);
2411                                 return hint;
2412 			}
2413 
2414 			set {
2415                                 Status status = GDIPlus.GdipSetTextRenderingHint (nativeObject, value);
2416 				GDIPlus.CheckStatus (status);
2417 			}
2418 		}
2419 
2420 		public Matrix Transform {
2421 			get {
2422                                 Matrix matrix = new Matrix ();
2423                                 Status status = GDIPlus.GdipGetWorldTransform (nativeObject, matrix.nativeMatrix);
2424 				GDIPlus.CheckStatus (status);
2425                                 return matrix;
2426 			}
2427 			set {
2428 				if (value == null)
2429 					throw new ArgumentNullException ("value");
2430 
2431                                 Status status = GDIPlus.GdipSetWorldTransform (nativeObject, value.nativeMatrix);
2432 				GDIPlus.CheckStatus (status);
2433 			}
2434 		}
2435 
2436 		public RectangleF VisibleClipBounds {
2437 			get {
2438                                 RectangleF rect;
2439 
2440                                 Status status = GDIPlus.GdipGetVisibleClipBounds (nativeObject, out rect);
2441 				GDIPlus.CheckStatus (status);
2442                                 return rect;
2443 			}
2444 		}
2445 
2446 		[MonoTODO]
2447 		[EditorBrowsable (EditorBrowsableState.Never)]
GetContextInfo()2448 		public object GetContextInfo ()
2449 		{
2450 			// only known source of information @ http://blogs.wdevs.com/jdunlap/Default.aspx
2451 			throw new NotImplementedException ();
2452 		}
2453 	}
2454 }
2455