-//\r
-// System.Drawing.Drawing2D.GraphicsPath.cs\r
-//\r
-// Authors:\r
-//\r
-// Miguel de Icaza (miguel@ximian.com)\r
-// Duncan Mak (duncan@ximian.com)\r
-// Jordi Mas i Hernandez (jordi@ximian.com)\r
-//\r
-// (C) 2004 Novell, Inc\r
-//\r
-
//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// System.Drawing.Drawing2D.GraphicsPath.cs
+//
+// Authors:
+//
+// Miguel de Icaza (miguel@ximian.com)
+// Duncan Mak (duncan@ximian.com)
+// Jordi Mas i Hernandez (jordi@ximian.com)
+// Ravindra (rkumar@novell.com)
+// Sebastien Pouliot <sebastien@ximian.com>
+//
+// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-\r
-using System;\r
-using System.Drawing;\r
-using System.Runtime.InteropServices;\r
-\r
-namespace System.Drawing.Drawing2D\r
-{\r
- public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable {\r
-\r
- internal IntPtr nativePath = IntPtr.Zero;\r
-\r
- GraphicsPath (IntPtr ptr)\r
- {\r
- nativePath = ptr;\r
- }\r
- \r
- public GraphicsPath ()\r
- {\r
- Status status = GDIPlus.GdipCreatePath (FillMode.Alternate, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
- \r
- public GraphicsPath (FillMode fillMode)\r
- {\r
- Status status = GDIPlus.GdipCreatePath (fillMode, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
- \r
- public GraphicsPath (Point[] pts, byte[] types)\r
- {\r
- Status status = GDIPlus.GdipCreatePath2I (\r
- pts, types, pts.Length, FillMode.Alternate, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
- \r
- public GraphicsPath (PointF[] pts, byte[] types)\r
- {\r
- Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, FillMode.Alternate, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
- \r
- public GraphicsPath (Point[] pts, byte[] types, FillMode fillMode)\r
- {\r
- Status status = GDIPlus.GdipCreatePath2I (\r
- pts, types, pts.Length, fillMode, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
-\r
- public GraphicsPath (PointF[] pts, byte[] types, FillMode fillMode)\r
- {\r
- Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, fillMode, out nativePath);\r
- GDIPlus.CheckStatus (status);\r
- }\r
- \r
- public object Clone ()\r
- {\r
- IntPtr clone;\r
-\r
- Status status = GDIPlus.GdipClonePath (nativePath, out clone);\r
- GDIPlus.CheckStatus (status); \r
-\r
- return new GraphicsPath (clone);\r
- }\r
-\r
- public void Dispose ()\r
- {\r
- Dispose (true);\r
- System.GC.SuppressFinalize (this);\r
- }\r
-\r
- ~GraphicsPath ()\r
- {\r
- Dispose (false);\r
- }\r
- \r
- void Dispose (bool disposing)\r
- {\r
- \r
- }\r
-\r
-\r
- public FillMode FillMode {\r
- get {\r
-\r
- FillMode mode;\r
- Status status = GDIPlus.GdipGetPathFillMode (nativePath, out mode);\r
- GDIPlus.CheckStatus (status); \r
- \r
- return mode;\r
- }\r
-\r
- set {\r
- Status status = GDIPlus.GdipSetPathFillMode (nativePath, value);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- }\r
-\r
- public PathData PathData {\r
-\r
- get {\r
- IntPtr tmp;\r
- Status status = GDIPlus.GdipGetPathData (nativePath, out tmp);\r
- GDIPlus.CheckStatus (status); \r
-\r
- throw new Exception ();\r
- }\r
- }\r
-\r
- public PointF [] PathPoints {\r
-\r
- get {\r
- int count;\r
- \r
- Status status = GDIPlus.GdipGetPointCount (nativePath, out count);\r
- GDIPlus.CheckStatus (status); \r
-\r
- PointF [] points = new PointF [count];\r
-\r
- status = GDIPlus.GdipGetPathPoints (nativePath, points, count); \r
- GDIPlus.CheckStatus (status); \r
-\r
- return points;\r
- }\r
- }\r
-\r
- public byte [] PathTypes {\r
-\r
- get {\r
- int count;\r
- Status status = GDIPlus.GdipGetPointCount (nativePath, out count);\r
- GDIPlus.CheckStatus (status); \r
-\r
- byte [] types = new byte [count];\r
- status = GDIPlus.GdipGetPathTypes (nativePath, types, count);\r
- GDIPlus.CheckStatus (status); \r
-\r
- return types;\r
- }\r
- }\r
-\r
- public int PointCount {\r
-\r
- get {\r
- int count;\r
-\r
- Status status = GDIPlus.GdipGetPointCount (nativePath, out count);\r
- GDIPlus.CheckStatus (status); \r
-\r
- return count;\r
- }\r
- }\r
- \r
- internal IntPtr NativeObject{\r
- \r
- get {\r
- return nativePath;\r
- }\r
- set {\r
- nativePath = value;\r
- }\r
- }\r
- \r
- //\r
- // AddArc\r
- //\r
- public void AddArc (Rectangle rect, float start_angle, float sweep_angle)\r
- {\r
- Status status = GDIPlus.GdipAddPathArcI (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddArc (RectangleF rect, float start_angle, float sweep_angle)\r
- {\r
- Status status = GDIPlus.GdipAddPathArc (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)\r
- {\r
- Status status = GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddArc (float x, float y, float width, float height, float start_angle, float sweep_angle)\r
- {\r
- Status status = GDIPlus.GdipAddPathArc (nativePath, x, y, width, height, start_angle, sweep_angle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddBezier\r
- //\r
- public void AddBezier (Point pt1, Point pt2, Point pt3, Point pt4)\r
- {\r
- Status status = GDIPlus.GdipAddPathBezierI (nativePath, pt1.X, pt1.Y,\r
- pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);\r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddBezier (PointF pt1, PointF pt2, PointF pt3, PointF pt4)\r
- {\r
- Status status = GDIPlus.GdipAddPathBezier (nativePath, pt1.X, pt1.Y,\r
- pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);\r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddBezier (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)\r
- {\r
- Status status = GDIPlus.GdipAddPathBezierI (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddBezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)\r
- {\r
- Status status = GDIPlus.GdipAddPathBezier (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddBeziers\r
- //\r
- public void AddBeziers (Point [] pts)\r
- {\r
- Status status = GDIPlus.GdipAddPathBeziersI (nativePath, pts, pts.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddBeziers (PointF [] pts)\r
- {\r
- Status status = GDIPlus.GdipAddPathBeziers (nativePath, pts, pts.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddEllipse\r
- //\r
- public void AddEllipse (RectangleF r)\r
- {\r
- Status status = GDIPlus.GdipAddPathEllipse (nativePath, r.X, r.Y, r.Width, r.Height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddEllipse (float x, float y, float width, float height)\r
- {\r
- Status status = GDIPlus.GdipAddPathEllipse (nativePath, x, y, width, height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddEllipse (Rectangle r)\r
- {\r
- Status status = GDIPlus.GdipAddPathEllipseI (nativePath, r.X, r.Y, r.Width, r.Height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddEllipse (int x, int y, int width, int height)\r
- {\r
- Status status = GDIPlus.GdipAddPathEllipseI (nativePath, x, y, width, height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
-\r
- //\r
- // AddLine\r
- //\r
- public void AddLine (Point a, Point b)\r
- {\r
- Status status = GDIPlus.GdipAddPathLineI (nativePath, a.X, a.Y, b.X, b.Y);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddLine (PointF a, PointF b)\r
- {\r
- Status status = GDIPlus.GdipAddPathLine (nativePath, a.X, a.Y, b.X,\r
- b.Y);\r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddLine (int x1, int y1, int x2, int y2)\r
- {\r
- Status status = GDIPlus.GdipAddPathLineI (nativePath, x1, y1, x2, y2);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddLine (float x1, float y1, float x2, float y2)\r
- {\r
- Status status = GDIPlus.GdipAddPathLine (nativePath, x1, y1, x2,\r
- y2); \r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddLines\r
- //\r
- public void AddLines (Point [] points)\r
- {\r
- int length = points.Length;\r
-\r
- for (int i = 0; i < length - 2; i += 2) {\r
- int j = i + 1;\r
- Status status = GDIPlus.GdipAddPathLineI (\r
- nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- }\r
-\r
- public void AddLines (PointF [] points)\r
- {\r
- int length = points.Length;\r
-\r
- for (int i = 0; i < length - 2; i += 2) {\r
- int j = i + 1;\r
- Status status = GDIPlus.GdipAddPathLine (\r
- nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- }\r
- \r
- //\r
- // AddPie\r
- //\r
- public void AddPie (Rectangle rect, float startAngle, float sweepAngle)\r
- {\r
- Status status = GDIPlus.GdipAddPathPie (\r
- nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddPie (int x, int y, int width, int height, float startAngle, float sweepAngle)\r
- {\r
- Status status = GDIPlus.GdipAddPathPieI (nativePath, x, y, width, height, startAngle, sweepAngle);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle)\r
- {\r
- Status status = GDIPlus.GdipAddPathPie (nativePath, x, y, width, height, startAngle, sweepAngle); \r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddPolygon\r
- //\r
- public void AddPolygon (Point [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathPolygonI (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddPolygon (PointF [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathPolygon (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddRectangle\r
- //\r
- public void AddRectangle (Rectangle rect)\r
- {\r
- Status status = GDIPlus.GdipAddPathRectangleI (nativePath, rect.X, rect.Y, rect.Width, rect.Height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddRectangle (RectangleF rect)\r
- {\r
- Status status = GDIPlus.GdipAddPathRectangle (nativePath, rect.X, rect.Y, rect.Width, rect.Height);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddRectangles\r
- //\r
- public void AddRectangles (Rectangle [] rects)\r
- {\r
- Status status = GDIPlus.GdipAddPathRectanglesI (nativePath, rects, rects.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddRectangles (RectangleF [] rects)\r
- {\r
- Status status = GDIPlus.GdipAddPathRectangles (nativePath, rects, rects.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddPath\r
- //\r
- public void AddPath (GraphicsPath addingPath, bool connect)\r
- {\r
- Status status = GDIPlus.GdipAddPathPath (nativePath, addingPath.nativePath, connect);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public PointF GetLastPoint ()\r
- {\r
- PointF pt;\r
- Status status = GDIPlus.GdipGetPathLastPoint (nativePath, out pt);\r
- GDIPlus.CheckStatus (status); \r
-\r
- return pt;\r
- }\r
-\r
- //\r
- // AddClosedCurve\r
- //\r
- public void AddClosedCurve (Point [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathClosedCurveI (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddClosedCurve (PointF [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathClosedCurve (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddClosedCurve (Point [] points, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathClosedCurve2I (nativePath, points, points.Length, tension);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddClosedCurve (PointF [] points, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathClosedCurve2 (nativePath, points, points.Length, tension);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- //\r
- // AddCurve\r
- //\r
- public void AddCurve (Point [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurveI (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddCurve (PointF [] points)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurve (nativePath, points, points.Length);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddCurve (Point [] points, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurve2I (nativePath, points, points.Length, tension);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddCurve (PointF [] points, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurve2 (nativePath, points, points.Length, tension);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void AddCurve (Point [] points, int offset, int numberOfSegments, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurve3I (nativePath, points, points.Length,\r
- offset, numberOfSegments, tension);\r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void AddCurve (PointF [] points, int offset, int numberOfSegments, float tension)\r
- {\r
- Status status = GDIPlus.GdipAddPathCurve3 (nativePath, points, points.Length,\r
- offset, numberOfSegments, tension);\r
- \r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- public void Reset ()\r
- {\r
- Status status = GDIPlus.GdipResetPath (nativePath);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void Reverse ()\r
- {\r
- Status status = GDIPlus.GdipReversePath (nativePath);\r
- GDIPlus.CheckStatus (status); \r
- }\r
-\r
- public void Transform (Matrix matrix)\r
- {\r
- Status status = GDIPlus.GdipTransformPath (nativePath, matrix.nativeMatrix);\r
- GDIPlus.CheckStatus (status); \r
- }\r
- \r
- [MonoTODO]\r
- public void AddString (string s, FontFamily family, int style, float emSize, Point origin, StringFormat format)\r
- {\r
- throw new NotImplementedException ();\r
- } \r
- \r
- [MonoTODO]\r
- public void AddString (string s, FontFamily family, int style, float emSize, PointF origin, StringFormat format)\r
- {\r
- throw new NotImplementedException ();\r
- } \r
- \r
- [MonoTODO]\r
- public void AddString (string s, FontFamily family, int style, float emSize, Rectangle layoutRect, StringFormat format)\r
- {\r
- throw new NotImplementedException ();\r
- } \r
- \r
- [MonoTODO]\r
- public void AddString (string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat format)\r
- {\r
- throw new NotImplementedException ();\r
- } \r
- \r
- public void ClearMarkers() \r
- {\r
- Status s = GDIPlus.GdipClearPathMarkers (nativePath);\r
-\r
- GDIPlus.CheckStatus (s);\r
- }\r
- \r
- public void CloseAllFigures()\r
- {\r
- Status s = GDIPlus.GdipClosePathFigures (nativePath);\r
-\r
- GDIPlus.CheckStatus (s);\r
- } \r
- \r
- public void CloseFigure()\r
- {\r
- Status s = GDIPlus.GdipClosePathFigure (nativePath);\r
-\r
- GDIPlus.CheckStatus (s);\r
- } \r
-\r
- public void Flatten ()\r
- {\r
- // 1/4 is the FlatnessDefault as defined in GdiPlusEnums.h\r
- Flatten (null, 1.0f / 4.0f); \r
- } \r
- \r
- public void Flatten (Matrix matrix)\r
- {\r
- Flatten (matrix, 1.0f / 4.0f);\r
- }\r
- \r
- public void Flatten (Matrix matrix, float flatness)\r
- {\r
- Status status = GDIPlus.GdipFlattenPath (nativePath, matrix.nativeMatrix, flatness);\r
-\r
- GDIPlus.CheckStatus (status);\r
- } \r
- \r
- public RectangleF GetBounds ()\r
- {\r
- return GetBounds (null, null);\r
- } \r
-\r
- public RectangleF GetBounds (Matrix matrix)\r
- {\r
- return GetBounds (matrix, null);\r
- }\r
-\r
- [MonoTODO]\r
- public RectangleF GetBounds (Matrix matrix, Pen pen)\r
- {\r
- RectangleF retval;\r
- IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;\r
- IntPtr p = (pen == null) ? IntPtr.Zero : pen.nativeObject;\r
- \r
- Status s = GDIPlus.GdipGetPathWorldBounds (nativePath, out retval, m, p);\r
-\r
- GDIPlus.CheckStatus (s);\r
-\r
- return retval;\r
- }\r
- \r
- public bool IsOutlineVisible (Point point, Pen pen)\r
- {\r
- return IsOutlineVisible (point.X, point.Y, pen, null);\r
- } \r
- \r
- public bool IsOutlineVisible (PointF point, Pen pen)\r
- {\r
- return IsOutlineVisible (point.X, point.Y, pen, null);\r
- } \r
- \r
- public bool IsOutlineVisible (int x, int y, Pen pen)\r
- {\r
- return IsOutlineVisible (x, y, pen, null);\r
- }\r
-\r
- public bool IsOutlineVisible (float x, float y, Pen pen)\r
- {\r
- return IsOutlineVisible (x, y, pen, null);\r
- } \r
- \r
- public bool IsOutlineVisible (Point pt, Pen pen, Graphics graphics)\r
- {\r
- return IsOutlineVisible (pt.X, pt.Y, pen, graphics);\r
- } \r
- \r
- public bool IsOutlineVisible (PointF pt, Pen pen, Graphics graphics)\r
- {\r
- return IsOutlineVisible (pt.X, pt.Y, pen, graphics);\r
- } \r
- \r
- [MonoTODO]\r
- public bool IsOutlineVisible (int x, int y, Pen pen, Graphics graphics)\r
- {\r
- bool result;\r
- IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;\r
- \r
- Status s = GDIPlus.GdipIsOutlineVisiblePathPointI (nativePath, x, y, g, out result);\r
- GDIPlus.CheckStatus (s);\r
-\r
- return result;\r
- } \r
- \r
- [MonoTODO]\r
- public bool IsOutlineVisible (float x, float y, Pen pen, Graphics graphics)\r
- {\r
- bool result;\r
- IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;\r
- \r
- Status s = GDIPlus.GdipIsOutlineVisiblePathPoint (nativePath, x, y, g, out result);\r
- GDIPlus.CheckStatus (s);\r
-\r
- return result;\r
- } \r
- \r
- public bool IsVisible (Point point)\r
- {\r
- return IsVisible (point.X, point.Y, null);\r
- } \r
- \r
- public bool IsVisible (PointF point)\r
- {\r
- return IsVisible (point.X, point.Y, null);\r
- } \r
- \r
- public bool IsVisible (int x, int y)\r
- {\r
- return IsVisible (x, y, null);\r
- }\r
-\r
- public bool IsVisible (float x, float y)\r
- {\r
- return IsVisible (x, y, null);\r
- } \r
- \r
- public bool IsVisible (Point pt, Graphics graphics)\r
- {\r
- return IsVisible (pt.X, pt.Y, graphics);\r
- } \r
- \r
- public bool IsVisible (PointF pt, Graphics graphics)\r
- {\r
- return IsVisible (pt.X, pt.Y, graphics);\r
- } \r
- \r
- [MonoTODO]\r
- public bool IsVisible (int x, int y, Graphics graphics)\r
- {\r
- bool retval;\r
-\r
- IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;\r
-\r
- Status s = GDIPlus.GdipIsVisiblePathPointI (nativePath, x, y, g, out retval);\r
-\r
- GDIPlus.CheckStatus (s);\r
-\r
- return retval;\r
- } \r
- \r
- [MonoTODO]\r
- public bool IsVisible (float x, float y, Graphics graphics)\r
- {\r
- bool retval;\r
-\r
- IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;\r
-\r
- Status s = GDIPlus.GdipIsVisiblePathPoint (nativePath, x, y, g, out retval);\r
-\r
- GDIPlus.CheckStatus (s);\r
-\r
- return retval;\r
- } \r
- \r
- public void SetMarkers ()\r
- {\r
- Status s = GDIPlus.GdipSetPathMarker (nativePath);\r
-\r
- GDIPlus.CheckStatus (s);\r
- }\r
- \r
- public void StartFigure()\r
- {\r
- Status s = GDIPlus.GdipStartPathFigure (nativePath);\r
-\r
- GDIPlus.CheckStatus (s);\r
- } \r
- \r
- public void Warp (PointF[] destPoints, RectangleF srcRect)\r
- {\r
- Warp (destPoints, srcRect, null, WarpMode.Perspective, 1.0f / 4.0f);\r
- } \r
-\r
- public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix)\r
- {\r
- Warp (destPoints, srcRect, matrix, WarpMode.Perspective, 1.0f / 4.0f);\r
- } \r
-\r
- public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode)\r
- {\r
- Warp (destPoints, srcRect, matrix, warpMode, 1.0f / 4.0f);\r
- } \r
-\r
- [MonoTODO]\r
- public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode, float flatness)\r
- {\r
- IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;\r
-\r
- Status s = GDIPlus.GdipWarpPath (nativePath, m, destPoints, destPoints.Length,\r
- srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode, flatness);\r
-\r
- GDIPlus.CheckStatus (s);\r
- }\r
- \r
- public void Widen (Pen pen)\r
- {\r
- Widen (pen, null, 1.0f / 4.0f);\r
- } \r
- \r
- public void Widen (Pen pen, Matrix matrix)\r
- { \r
- Widen (pen, matrix, 1.0f / 4.0f);\r
- } \r
- \r
- [MonoTODO]\r
- public void Widen (Pen pen, Matrix matrix, float flatness)\r
- {\r
- IntPtr p = (pen == null) ? IntPtr.Zero : pen.nativeObject;\r
- IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;\r
-\r
- Status s = GDIPlus.GdipWidenPath (nativePath, p, m, flatness);\r
-\r
- GDIPlus.CheckStatus (s);\r
- } \r
- }\r
-}\r
-\r
-\r
+
+using System.ComponentModel;
+using System.Runtime.InteropServices;
+
+namespace System.Drawing.Drawing2D
+{
+ public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable
+ {
+ // 1/4 is the FlatnessDefault as defined in GdiPlusEnums.h
+ private const float FlatnessDefault = 1.0f / 4.0f;
+
+ internal IntPtr nativePath = IntPtr.Zero;
+
+ GraphicsPath (IntPtr ptr)
+ {
+ nativePath = ptr;
+ }
+
+ public GraphicsPath ()
+ {
+ Status status = GDIPlus.GdipCreatePath (FillMode.Alternate, out nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public GraphicsPath (FillMode fillMode)
+ {
+ Status status = GDIPlus.GdipCreatePath (fillMode, out nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public GraphicsPath (Point[] pts, byte[] types)
+ : this (pts, types, FillMode.Alternate)
+ {
+ }
+
+ public GraphicsPath (PointF[] pts, byte[] types)
+ : this (pts, types, FillMode.Alternate)
+ {
+ }
+
+ public GraphicsPath (Point[] pts, byte[] types, FillMode fillMode)
+ {
+ if (pts == null)
+ throw new ArgumentNullException ("pts");
+ if (pts.Length != types.Length)
+ throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
+
+ Status status = GDIPlus.GdipCreatePath2I (pts, types, pts.Length, fillMode, out nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public GraphicsPath (PointF[] pts, byte[] types, FillMode fillMode)
+ {
+ if (pts == null)
+ throw new ArgumentNullException ("pts");
+ if (pts.Length != types.Length)
+ throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
+
+ Status status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, fillMode, out nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public object Clone ()
+ {
+ IntPtr clone;
+
+ Status status = GDIPlus.GdipClonePath (nativePath, out clone);
+ GDIPlus.CheckStatus (status);
+
+ return new GraphicsPath (clone);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ System.GC.SuppressFinalize (this);
+ }
+
+ ~GraphicsPath ()
+ {
+ Dispose (false);
+ }
+
+ void Dispose (bool disposing)
+ {
+ Status status;
+ if (nativePath != IntPtr.Zero) {
+ status = GDIPlus.GdipDeletePath (nativePath);
+ GDIPlus.CheckStatus (status);
+
+ nativePath = IntPtr.Zero;
+ }
+ }
+
+ public FillMode FillMode {
+ get {
+ FillMode mode;
+ Status status = GDIPlus.GdipGetPathFillMode (nativePath, out mode);
+ GDIPlus.CheckStatus (status);
+
+ return mode;
+ }
+ set {
+ if ((value < FillMode.Alternate) || (value > FillMode.Winding))
+ throw new InvalidEnumArgumentException ("FillMode", (int)value, typeof (FillMode));
+
+ Status status = GDIPlus.GdipSetPathFillMode (nativePath, value);
+ GDIPlus.CheckStatus (status);
+ }
+ }
+
+ public PathData PathData {
+ get {
+ int count;
+ Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
+ GDIPlus.CheckStatus (status);
+
+ PointF [] points = new PointF [count];
+ byte [] types = new byte [count];
+
+ // status would fail if we ask points or types with a 0 count
+ // anyway that would only mean two unrequired unmanaged calls
+ if (count > 0) {
+ status = GDIPlus.GdipGetPathPoints (nativePath, points, count);
+ GDIPlus.CheckStatus (status);
+
+ status = GDIPlus.GdipGetPathTypes (nativePath, types, count);
+ GDIPlus.CheckStatus (status);
+ }
+
+ PathData pdata = new PathData ();
+ pdata.Points = points;
+ pdata.Types = types;
+ return pdata;
+ }
+ }
+
+ public PointF [] PathPoints {
+ get {
+ int count;
+ Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
+ GDIPlus.CheckStatus (status);
+ if (count == 0)
+ throw new ArgumentException ("PathPoints");
+
+ PointF [] points = new PointF [count];
+ status = GDIPlus.GdipGetPathPoints (nativePath, points, count);
+ GDIPlus.CheckStatus (status);
+
+ return points;
+ }
+ }
+
+ public byte [] PathTypes {
+ get {
+ int count;
+ Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
+ GDIPlus.CheckStatus (status);
+ if (count == 0)
+ throw new ArgumentException ("PathTypes");
+
+ byte [] types = new byte [count];
+ status = GDIPlus.GdipGetPathTypes (nativePath, types, count);
+ GDIPlus.CheckStatus (status);
+
+ return types;
+ }
+ }
+
+ public int PointCount {
+ get {
+ int count;
+ Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
+ GDIPlus.CheckStatus (status);
+
+ return count;
+ }
+ }
+
+ internal IntPtr NativeObject {
+ get {
+ return nativePath;
+ }
+ set {
+ nativePath = value;
+ }
+ }
+
+ //
+ // AddArc
+ //
+ public void AddArc (Rectangle rect, float start_angle, float sweep_angle)
+ {
+ Status status = GDIPlus.GdipAddPathArcI (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddArc (RectangleF rect, float start_angle, float sweep_angle)
+ {
+ Status status = GDIPlus.GdipAddPathArc (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)
+ {
+ Status status = GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddArc (float x, float y, float width, float height, float start_angle, float sweep_angle)
+ {
+ Status status = GDIPlus.GdipAddPathArc (nativePath, x, y, width, height, start_angle, sweep_angle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddBezier
+ //
+ public void AddBezier (Point pt1, Point pt2, Point pt3, Point pt4)
+ {
+ Status status = GDIPlus.GdipAddPathBezierI (nativePath, pt1.X, pt1.Y,
+ pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddBezier (PointF pt1, PointF pt2, PointF pt3, PointF pt4)
+ {
+ Status status = GDIPlus.GdipAddPathBezier (nativePath, pt1.X, pt1.Y,
+ pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddBezier (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
+ {
+ Status status = GDIPlus.GdipAddPathBezierI (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddBezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
+ {
+ Status status = GDIPlus.GdipAddPathBezier (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddBeziers
+ //
+ public void AddBeziers (Point [] pts)
+ {
+ if (pts == null)
+ throw new ArgumentNullException ("pts");
+ Status status = GDIPlus.GdipAddPathBeziersI (nativePath, pts, pts.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddBeziers (PointF [] pts)
+ {
+ if (pts == null)
+ throw new ArgumentNullException ("pts");
+ Status status = GDIPlus.GdipAddPathBeziers (nativePath, pts, pts.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddEllipse
+ //
+ public void AddEllipse (RectangleF r)
+ {
+ Status status = GDIPlus.GdipAddPathEllipse (nativePath, r.X, r.Y, r.Width, r.Height);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddEllipse (float x, float y, float width, float height)
+ {
+ Status status = GDIPlus.GdipAddPathEllipse (nativePath, x, y, width, height);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddEllipse (Rectangle r)
+ {
+ Status status = GDIPlus.GdipAddPathEllipseI (nativePath, r.X, r.Y, r.Width, r.Height);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddEllipse (int x, int y, int width, int height)
+ {
+ Status status = GDIPlus.GdipAddPathEllipseI (nativePath, x, y, width, height);
+ GDIPlus.CheckStatus (status);
+ }
+
+
+ //
+ // AddLine
+ //
+ public void AddLine (Point a, Point b)
+ {
+ Status status = GDIPlus.GdipAddPathLineI (nativePath, a.X, a.Y, b.X, b.Y);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddLine (PointF a, PointF b)
+ {
+ Status status = GDIPlus.GdipAddPathLine (nativePath, a.X, a.Y, b.X,
+ b.Y);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddLine (int x1, int y1, int x2, int y2)
+ {
+ Status status = GDIPlus.GdipAddPathLineI (nativePath, x1, y1, x2, y2);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddLine (float x1, float y1, float x2, float y2)
+ {
+ Status status = GDIPlus.GdipAddPathLine (nativePath, x1, y1, x2,
+ y2);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddLines
+ //
+ public void AddLines (Point[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+ if (points.Length == 0)
+ throw new ArgumentException ("points");
+
+ Status status = GDIPlus.GdipAddPathLine2I (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddLines (PointF[] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+ if (points.Length == 0)
+ throw new ArgumentException ("points");
+
+ Status status = GDIPlus.GdipAddPathLine2 (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddPie
+ //
+ public void AddPie (Rectangle rect, float startAngle, float sweepAngle)
+ {
+ Status status = GDIPlus.GdipAddPathPie (
+ nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddPie (int x, int y, int width, int height, float startAngle, float sweepAngle)
+ {
+ Status status = GDIPlus.GdipAddPathPieI (nativePath, x, y, width, height, startAngle, sweepAngle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle)
+ {
+ Status status = GDIPlus.GdipAddPathPie (nativePath, x, y, width, height, startAngle, sweepAngle);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddPolygon
+ //
+ public void AddPolygon (Point [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathPolygonI (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddPolygon (PointF [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathPolygon (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddRectangle
+ //
+ public void AddRectangle (Rectangle rect)
+ {
+ Status status = GDIPlus.GdipAddPathRectangleI (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddRectangle (RectangleF rect)
+ {
+ Status status = GDIPlus.GdipAddPathRectangle (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddRectangles
+ //
+ public void AddRectangles (Rectangle [] rects)
+ {
+ if (rects == null)
+ throw new ArgumentNullException ("rects");
+ if (rects.Length == 0)
+ throw new ArgumentException ("rects");
+
+ Status status = GDIPlus.GdipAddPathRectanglesI (nativePath, rects, rects.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddRectangles (RectangleF [] rects)
+ {
+ if (rects == null)
+ throw new ArgumentNullException ("rects");
+ if (rects.Length == 0)
+ throw new ArgumentException ("rects");
+
+ Status status = GDIPlus.GdipAddPathRectangles (nativePath, rects, rects.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddPath
+ //
+ public void AddPath (GraphicsPath addingPath, bool connect)
+ {
+ if (addingPath == null)
+ throw new ArgumentNullException ("addingPath");
+
+ Status status = GDIPlus.GdipAddPathPath (nativePath, addingPath.nativePath, connect);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public PointF GetLastPoint ()
+ {
+ PointF pt;
+ Status status = GDIPlus.GdipGetPathLastPoint (nativePath, out pt);
+ GDIPlus.CheckStatus (status);
+
+ return pt;
+ }
+
+ //
+ // AddClosedCurve
+ //
+ public void AddClosedCurve (Point [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathClosedCurveI (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddClosedCurve (PointF [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathClosedCurve (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddClosedCurve (Point [] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathClosedCurve2I (nativePath, points, points.Length, tension);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddClosedCurve (PointF [] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathClosedCurve2 (nativePath, points, points.Length, tension);
+ GDIPlus.CheckStatus (status);
+ }
+
+ //
+ // AddCurve
+ //
+ public void AddCurve (Point [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurveI (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddCurve (PointF [] points)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurve (nativePath, points, points.Length);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddCurve (Point [] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurve2I (nativePath, points, points.Length, tension);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddCurve (PointF [] points, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurve2 (nativePath, points, points.Length, tension);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddCurve (Point [] points, int offset, int numberOfSegments, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurve3I (nativePath, points, points.Length,
+ offset, numberOfSegments, tension);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void AddCurve (PointF [] points, int offset, int numberOfSegments, float tension)
+ {
+ if (points == null)
+ throw new ArgumentNullException ("points");
+
+ Status status = GDIPlus.GdipAddPathCurve3 (nativePath, points, points.Length,
+ offset, numberOfSegments, tension);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void Reset ()
+ {
+ Status status = GDIPlus.GdipResetPath (nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void Reverse ()
+ {
+ Status status = GDIPlus.GdipReversePath (nativePath);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void Transform (Matrix matrix)
+ {
+ if (matrix == null)
+ throw new ArgumentNullException ("matrix");
+
+ Status status = GDIPlus.GdipTransformPath (nativePath, matrix.nativeMatrix);
+ GDIPlus.CheckStatus (status);
+ }
+
+ [MonoTODO ("The StringFormat parameter is ignored when using libgdiplus.")]
+ public void AddString (string s, FontFamily family, int style, float emSize, Point origin, StringFormat format)
+ {
+ Rectangle layout = new Rectangle ();
+ layout.X = origin.X;
+ layout.Y = origin.Y;
+ AddString (s, family, style, emSize, layout, format);
+ }
+
+ [MonoTODO ("The StringFormat parameter is ignored when using libgdiplus.")]
+ public void AddString (string s, FontFamily family, int style, float emSize, PointF origin, StringFormat format)
+ {
+ RectangleF layout = new RectangleF ();
+ layout.X = origin.X;
+ layout.Y = origin.Y;
+ AddString (s, family, style, emSize, layout, format);
+ }
+
+ [MonoTODO ("The layoutRect and StringFormat parameters are ignored when using libgdiplus.")]
+ public void AddString (string s, FontFamily family, int style, float emSize, Rectangle layoutRect, StringFormat format)
+ {
+ if (family == null)
+ throw new ArgumentException ("family");
+
+ IntPtr sformat = (format == null) ? IntPtr.Zero : format.NativeObject;
+ // note: the NullReferenceException on s.Length is the expected (MS) exception
+ Status status = GDIPlus.GdipAddPathStringI (nativePath, s, s.Length, family.NativeObject, style, emSize, ref layoutRect, sformat);
+ GDIPlus.CheckStatus (status);
+ }
+
+ [MonoTODO ("The layoutRect and StringFormat parameters are ignored when using libgdiplus.")]
+ public void AddString (string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat format)
+ {
+ if (family == null)
+ throw new ArgumentException ("family");
+
+ IntPtr sformat = (format == null) ? IntPtr.Zero : format.NativeObject;
+ // note: the NullReferenceException on s.Length is the expected (MS) exception
+ Status status = GDIPlus.GdipAddPathString (nativePath, s, s.Length, family.NativeObject, style, emSize, ref layoutRect, sformat);
+ GDIPlus.CheckStatus (status);
+ }
+
+ public void ClearMarkers()
+ {
+ Status s = GDIPlus.GdipClearPathMarkers (nativePath);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ public void CloseAllFigures()
+ {
+ Status s = GDIPlus.GdipClosePathFigures (nativePath);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ public void CloseFigure()
+ {
+ Status s = GDIPlus.GdipClosePathFigure (nativePath);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ public void Flatten ()
+ {
+ Flatten (null, FlatnessDefault);
+ }
+
+ public void Flatten (Matrix matrix)
+ {
+ Flatten (matrix, FlatnessDefault);
+ }
+
+ public void Flatten (Matrix matrix, float flatness)
+ {
+ IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
+ Status status = GDIPlus.GdipFlattenPath (nativePath, m, flatness);
+
+ GDIPlus.CheckStatus (status);
+ }
+
+ public RectangleF GetBounds ()
+ {
+ return GetBounds (null, null);
+ }
+
+ public RectangleF GetBounds (Matrix matrix)
+ {
+ return GetBounds (matrix, null);
+ }
+
+ public RectangleF GetBounds (Matrix matrix, Pen pen)
+ {
+ RectangleF retval;
+ IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
+ IntPtr p = (pen == null) ? IntPtr.Zero : pen.nativeObject;
+
+ Status s = GDIPlus.GdipGetPathWorldBounds (nativePath, out retval, m, p);
+
+ GDIPlus.CheckStatus (s);
+
+ return retval;
+ }
+
+ public bool IsOutlineVisible (Point point, Pen pen)
+ {
+ return IsOutlineVisible (point.X, point.Y, pen, null);
+ }
+
+ public bool IsOutlineVisible (PointF point, Pen pen)
+ {
+ return IsOutlineVisible (point.X, point.Y, pen, null);
+ }
+
+ public bool IsOutlineVisible (int x, int y, Pen pen)
+ {
+ return IsOutlineVisible (x, y, pen, null);
+ }
+
+ public bool IsOutlineVisible (float x, float y, Pen pen)
+ {
+ return IsOutlineVisible (x, y, pen, null);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsOutlineVisible (Point pt, Pen pen, Graphics graphics)
+ {
+ return IsOutlineVisible (pt.X, pt.Y, pen, graphics);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsOutlineVisible (PointF pt, Pen pen, Graphics graphics)
+ {
+ return IsOutlineVisible (pt.X, pt.Y, pen, graphics);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsOutlineVisible (int x, int y, Pen pen, Graphics graphics)
+ {
+ if (pen == null)
+ throw new ArgumentNullException ("pen");
+
+ bool result;
+ IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
+
+ Status s = GDIPlus.GdipIsOutlineVisiblePathPointI (nativePath, x, y, pen.nativeObject, g, out result);
+ GDIPlus.CheckStatus (s);
+
+ return result;
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsOutlineVisible (float x, float y, Pen pen, Graphics graphics)
+ {
+ if (pen == null)
+ throw new ArgumentNullException ("pen");
+
+ bool result;
+ IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
+
+ Status s = GDIPlus.GdipIsOutlineVisiblePathPoint (nativePath, x, y, pen.nativeObject, g, out result);
+ GDIPlus.CheckStatus (s);
+
+ return result;
+ }
+
+ public bool IsVisible (Point point)
+ {
+ return IsVisible (point.X, point.Y, null);
+ }
+
+ public bool IsVisible (PointF point)
+ {
+ return IsVisible (point.X, point.Y, null);
+ }
+
+ public bool IsVisible (int x, int y)
+ {
+ return IsVisible (x, y, null);
+ }
+
+ public bool IsVisible (float x, float y)
+ {
+ return IsVisible (x, y, null);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsVisible (Point pt, Graphics graphics)
+ {
+ return IsVisible (pt.X, pt.Y, graphics);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsVisible (PointF pt, Graphics graphics)
+ {
+ return IsVisible (pt.X, pt.Y, graphics);
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsVisible (int x, int y, Graphics graphics)
+ {
+ bool retval;
+
+ IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
+
+ Status s = GDIPlus.GdipIsVisiblePathPointI (nativePath, x, y, g, out retval);
+
+ GDIPlus.CheckStatus (s);
+
+ return retval;
+ }
+
+ [MonoTODO ("The Graphics parameter is ignored when using libgdiplus.")]
+ public bool IsVisible (float x, float y, Graphics graphics)
+ {
+ bool retval;
+
+ IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
+
+ Status s = GDIPlus.GdipIsVisiblePathPoint (nativePath, x, y, g, out retval);
+
+ GDIPlus.CheckStatus (s);
+
+ return retval;
+ }
+
+ public void SetMarkers ()
+ {
+ Status s = GDIPlus.GdipSetPathMarker (nativePath);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ public void StartFigure()
+ {
+ Status s = GDIPlus.GdipStartPathFigure (nativePath);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ [MonoTODO ("GdipWarpPath isn't implemented in libgdiplus")]
+ public void Warp (PointF[] destPoints, RectangleF srcRect)
+ {
+ Warp (destPoints, srcRect, null, WarpMode.Perspective, FlatnessDefault);
+ }
+
+ [MonoTODO ("GdipWarpPath isn't implemented in libgdiplus")]
+ public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix)
+ {
+ Warp (destPoints, srcRect, matrix, WarpMode.Perspective, FlatnessDefault);
+ }
+
+ [MonoTODO ("GdipWarpPath isn't implemented in libgdiplus")]
+ public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode)
+ {
+ Warp (destPoints, srcRect, matrix, warpMode, FlatnessDefault);
+ }
+
+ [MonoTODO ("GdipWarpPath isn't implemented in libgdiplus")]
+ public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode, float flatness)
+ {
+ if (destPoints == null)
+ throw new ArgumentNullException ("destPoints");
+
+ IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
+
+ Status s = GDIPlus.GdipWarpPath (nativePath, m, destPoints, destPoints.Length,
+ srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode, flatness);
+
+ GDIPlus.CheckStatus (s);
+ }
+
+ [MonoTODO ("GdipWidenPath isn't implemented in libgdiplus")]
+ public void Widen (Pen pen)
+ {
+ Widen (pen, null, FlatnessDefault);
+ }
+
+ [MonoTODO ("GdipWidenPath isn't implemented in libgdiplus")]
+ public void Widen (Pen pen, Matrix matrix)
+ {
+ Widen (pen, matrix, FlatnessDefault);
+ }
+
+ [MonoTODO ("GdipWidenPath isn't implemented in libgdiplus")]
+ public void Widen (Pen pen, Matrix matrix, float flatness)
+ {
+ if (pen == null)
+ throw new ArgumentNullException ("pen");
+#if NET_2_0
+ if (PointCount == 0)
+ return;
+#endif
+ IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
+
+ Status s = GDIPlus.GdipWidenPath (nativePath, pen.nativeObject, m, flatness);
+ GDIPlus.CheckStatus (s);
+ }
+ }
+}