GraphicsPath.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. //
  2. // System.Drawing.Drawing2D.GraphicsPath.cs
  3. //
  4. // Authors:
  5. //
  6. // Miguel de Icaza ([email protected])
  7. // Duncan Mak ([email protected])
  8. // Jordi Mas i Hernandez ([email protected])
  9. // Ravindra ([email protected])
  10. //
  11. //
  12. // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
  13. //
  14. // Permission is hereby granted, free of charge, to any person obtaining
  15. // a copy of this software and associated documentation files (the
  16. // "Software"), to deal in the Software without restriction, including
  17. // without limitation the rights to use, copy, modify, merge, publish,
  18. // distribute, sublicense, and/or sell copies of the Software, and to
  19. // permit persons to whom the Software is furnished to do so, subject to
  20. // the following conditions:
  21. //
  22. // The above copyright notice and this permission notice shall be
  23. // included in all copies or substantial portions of the Software.
  24. //
  25. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  29. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  30. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  31. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  32. //
  33. using System;
  34. using System.Drawing;
  35. using System.Runtime.InteropServices;
  36. namespace System.Drawing.Drawing2D
  37. {
  38. public sealed class GraphicsPath : MarshalByRefObject, ICloneable, IDisposable
  39. {
  40. internal IntPtr nativePath = IntPtr.Zero;
  41. GraphicsPath (IntPtr ptr)
  42. {
  43. nativePath = ptr;
  44. }
  45. public GraphicsPath ()
  46. {
  47. Status status = GDIPlus.GdipCreatePath (FillMode.Alternate, out nativePath);
  48. GDIPlus.CheckStatus (status);
  49. }
  50. public GraphicsPath (FillMode fillMode)
  51. {
  52. Status status = GDIPlus.GdipCreatePath (fillMode, out nativePath);
  53. GDIPlus.CheckStatus (status);
  54. }
  55. public GraphicsPath (Point[] pts, byte[] types)
  56. {
  57. Status status;
  58. if (pts.Length != types.Length)
  59. throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
  60. status = GDIPlus.GdipCreatePath2I (pts, types, pts.Length, FillMode.Alternate, out nativePath);
  61. GDIPlus.CheckStatus (status);
  62. }
  63. public GraphicsPath (PointF[] pts, byte[] types)
  64. {
  65. Status status;
  66. if (pts.Length != types.Length)
  67. throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
  68. status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, FillMode.Alternate, out nativePath);
  69. GDIPlus.CheckStatus (status);
  70. }
  71. public GraphicsPath (Point[] pts, byte[] types, FillMode fillMode)
  72. {
  73. Status status;
  74. if (pts.Length != types.Length)
  75. throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
  76. status = GDIPlus.GdipCreatePath2I (pts, types, pts.Length, fillMode, out nativePath);
  77. GDIPlus.CheckStatus (status);
  78. }
  79. public GraphicsPath (PointF[] pts, byte[] types, FillMode fillMode)
  80. {
  81. Status status;
  82. if (pts.Length != types.Length)
  83. throw new ArgumentException ("Invalid parameter passed. Number of points and types must be same.");
  84. status = GDIPlus.GdipCreatePath2 (pts, types, pts.Length, fillMode, out nativePath);
  85. GDIPlus.CheckStatus (status);
  86. }
  87. public object Clone ()
  88. {
  89. IntPtr clone;
  90. Status status = GDIPlus.GdipClonePath (nativePath, out clone);
  91. GDIPlus.CheckStatus (status);
  92. return new GraphicsPath (clone);
  93. }
  94. public void Dispose ()
  95. {
  96. Dispose (true);
  97. System.GC.SuppressFinalize (this);
  98. }
  99. ~GraphicsPath ()
  100. {
  101. Dispose (false);
  102. }
  103. void Dispose (bool disposing)
  104. {
  105. Status status;
  106. if (nativePath != IntPtr.Zero) {
  107. status = GDIPlus.GdipDeletePath (nativePath);
  108. GDIPlus.CheckStatus (status);
  109. nativePath = IntPtr.Zero;
  110. }
  111. }
  112. public FillMode FillMode {
  113. get {
  114. FillMode mode;
  115. Status status = GDIPlus.GdipGetPathFillMode (nativePath, out mode);
  116. GDIPlus.CheckStatus (status);
  117. return mode;
  118. }
  119. set {
  120. Status status = GDIPlus.GdipSetPathFillMode (nativePath, value);
  121. GDIPlus.CheckStatus (status);
  122. }
  123. }
  124. public PathData PathData {
  125. get {
  126. PathData pdata = new PathData ();
  127. pdata.Points = PathPoints;
  128. pdata.Types = PathTypes;
  129. return pdata;
  130. }
  131. }
  132. public PointF [] PathPoints {
  133. get {
  134. int count;
  135. Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
  136. GDIPlus.CheckStatus (status);
  137. PointF [] points = new PointF [count];
  138. status = GDIPlus.GdipGetPathPoints (nativePath, points, count);
  139. GDIPlus.CheckStatus (status);
  140. return points;
  141. }
  142. }
  143. public byte [] PathTypes {
  144. get {
  145. int count;
  146. Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
  147. GDIPlus.CheckStatus (status);
  148. byte [] types = new byte [count];
  149. status = GDIPlus.GdipGetPathTypes (nativePath, types, count);
  150. GDIPlus.CheckStatus (status);
  151. return types;
  152. }
  153. }
  154. public int PointCount {
  155. get {
  156. int count;
  157. Status status = GDIPlus.GdipGetPointCount (nativePath, out count);
  158. GDIPlus.CheckStatus (status);
  159. return count;
  160. }
  161. }
  162. internal IntPtr NativeObject {
  163. get {
  164. return nativePath;
  165. }
  166. set {
  167. nativePath = value;
  168. }
  169. }
  170. //
  171. // AddArc
  172. //
  173. public void AddArc (Rectangle rect, float start_angle, float sweep_angle)
  174. {
  175. Status status = GDIPlus.GdipAddPathArcI (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
  176. GDIPlus.CheckStatus (status);
  177. }
  178. public void AddArc (RectangleF rect, float start_angle, float sweep_angle)
  179. {
  180. Status status = GDIPlus.GdipAddPathArc (nativePath, rect.X, rect.Y, rect.Width, rect.Height, start_angle, sweep_angle);
  181. GDIPlus.CheckStatus (status);
  182. }
  183. public void AddArc (int x, int y, int width, int height, float start_angle, float sweep_angle)
  184. {
  185. Status status = GDIPlus.GdipAddPathArcI (nativePath, x, y, width, height, start_angle, sweep_angle);
  186. GDIPlus.CheckStatus (status);
  187. }
  188. public void AddArc (float x, float y, float width, float height, float start_angle, float sweep_angle)
  189. {
  190. Status status = GDIPlus.GdipAddPathArc (nativePath, x, y, width, height, start_angle, sweep_angle);
  191. GDIPlus.CheckStatus (status);
  192. }
  193. //
  194. // AddBezier
  195. //
  196. public void AddBezier (Point pt1, Point pt2, Point pt3, Point pt4)
  197. {
  198. Status status = GDIPlus.GdipAddPathBezierI (nativePath, pt1.X, pt1.Y,
  199. pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
  200. GDIPlus.CheckStatus (status);
  201. }
  202. public void AddBezier (PointF pt1, PointF pt2, PointF pt3, PointF pt4)
  203. {
  204. Status status = GDIPlus.GdipAddPathBezier (nativePath, pt1.X, pt1.Y,
  205. pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y);
  206. GDIPlus.CheckStatus (status);
  207. }
  208. public void AddBezier (int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  209. {
  210. Status status = GDIPlus.GdipAddPathBezierI (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
  211. GDIPlus.CheckStatus (status);
  212. }
  213. public void AddBezier (float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
  214. {
  215. Status status = GDIPlus.GdipAddPathBezier (nativePath, x1, y1, x2, y2, x3, y3, x4, y4);
  216. GDIPlus.CheckStatus (status);
  217. }
  218. //
  219. // AddBeziers
  220. //
  221. public void AddBeziers (Point [] pts)
  222. {
  223. Status status = GDIPlus.GdipAddPathBeziersI (nativePath, pts, pts.Length);
  224. GDIPlus.CheckStatus (status);
  225. }
  226. public void AddBeziers (PointF [] pts)
  227. {
  228. Status status = GDIPlus.GdipAddPathBeziers (nativePath, pts, pts.Length);
  229. GDIPlus.CheckStatus (status);
  230. }
  231. //
  232. // AddEllipse
  233. //
  234. public void AddEllipse (RectangleF r)
  235. {
  236. Status status = GDIPlus.GdipAddPathEllipse (nativePath, r.X, r.Y, r.Width, r.Height);
  237. GDIPlus.CheckStatus (status);
  238. }
  239. public void AddEllipse (float x, float y, float width, float height)
  240. {
  241. Status status = GDIPlus.GdipAddPathEllipse (nativePath, x, y, width, height);
  242. GDIPlus.CheckStatus (status);
  243. }
  244. public void AddEllipse (Rectangle r)
  245. {
  246. Status status = GDIPlus.GdipAddPathEllipseI (nativePath, r.X, r.Y, r.Width, r.Height);
  247. GDIPlus.CheckStatus (status);
  248. }
  249. public void AddEllipse (int x, int y, int width, int height)
  250. {
  251. Status status = GDIPlus.GdipAddPathEllipseI (nativePath, x, y, width, height);
  252. GDIPlus.CheckStatus (status);
  253. }
  254. //
  255. // AddLine
  256. //
  257. public void AddLine (Point a, Point b)
  258. {
  259. Status status = GDIPlus.GdipAddPathLineI (nativePath, a.X, a.Y, b.X, b.Y);
  260. GDIPlus.CheckStatus (status);
  261. }
  262. public void AddLine (PointF a, PointF b)
  263. {
  264. Status status = GDIPlus.GdipAddPathLine (nativePath, a.X, a.Y, b.X,
  265. b.Y);
  266. GDIPlus.CheckStatus (status);
  267. }
  268. public void AddLine (int x1, int y1, int x2, int y2)
  269. {
  270. Status status = GDIPlus.GdipAddPathLineI (nativePath, x1, y1, x2, y2);
  271. GDIPlus.CheckStatus (status);
  272. }
  273. public void AddLine (float x1, float y1, float x2, float y2)
  274. {
  275. Status status = GDIPlus.GdipAddPathLine (nativePath, x1, y1, x2,
  276. y2);
  277. GDIPlus.CheckStatus (status);
  278. }
  279. //
  280. // AddLines
  281. //
  282. public void AddLines (Point [] points)
  283. {
  284. int length = points.Length;
  285. for (int i = 0; i < length - 1; i++) {
  286. int j = i + 1;
  287. Status status = GDIPlus.GdipAddPathLineI (
  288. nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);
  289. GDIPlus.CheckStatus (status);
  290. }
  291. }
  292. public void AddLines (PointF [] points)
  293. {
  294. int length = points.Length;
  295. for (int i = 0; i < length - 1; i++) {
  296. int j = i + 1;
  297. Status status = GDIPlus.GdipAddPathLine (
  298. nativePath, points [i].X, points [i].Y, points [j].X, points [j].Y);
  299. GDIPlus.CheckStatus (status);
  300. }
  301. }
  302. //
  303. // AddPie
  304. //
  305. public void AddPie (Rectangle rect, float startAngle, float sweepAngle)
  306. {
  307. Status status = GDIPlus.GdipAddPathPie (
  308. nativePath, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle);
  309. GDIPlus.CheckStatus (status);
  310. }
  311. public void AddPie (int x, int y, int width, int height, float startAngle, float sweepAngle)
  312. {
  313. Status status = GDIPlus.GdipAddPathPieI (nativePath, x, y, width, height, startAngle, sweepAngle);
  314. GDIPlus.CheckStatus (status);
  315. }
  316. public void AddPie (float x, float y, float width, float height, float startAngle, float sweepAngle)
  317. {
  318. Status status = GDIPlus.GdipAddPathPie (nativePath, x, y, width, height, startAngle, sweepAngle);
  319. GDIPlus.CheckStatus (status);
  320. }
  321. //
  322. // AddPolygon
  323. //
  324. public void AddPolygon (Point [] points)
  325. {
  326. Status status = GDIPlus.GdipAddPathPolygonI (nativePath, points, points.Length);
  327. GDIPlus.CheckStatus (status);
  328. }
  329. public void AddPolygon (PointF [] points)
  330. {
  331. Status status = GDIPlus.GdipAddPathPolygon (nativePath, points, points.Length);
  332. GDIPlus.CheckStatus (status);
  333. }
  334. //
  335. // AddRectangle
  336. //
  337. public void AddRectangle (Rectangle rect)
  338. {
  339. Status status = GDIPlus.GdipAddPathRectangleI (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
  340. GDIPlus.CheckStatus (status);
  341. }
  342. public void AddRectangle (RectangleF rect)
  343. {
  344. Status status = GDIPlus.GdipAddPathRectangle (nativePath, rect.X, rect.Y, rect.Width, rect.Height);
  345. GDIPlus.CheckStatus (status);
  346. }
  347. //
  348. // AddRectangles
  349. //
  350. public void AddRectangles (Rectangle [] rects)
  351. {
  352. Status status = GDIPlus.GdipAddPathRectanglesI (nativePath, rects, rects.Length);
  353. GDIPlus.CheckStatus (status);
  354. }
  355. public void AddRectangles (RectangleF [] rects)
  356. {
  357. Status status = GDIPlus.GdipAddPathRectangles (nativePath, rects, rects.Length);
  358. GDIPlus.CheckStatus (status);
  359. }
  360. //
  361. // AddPath
  362. //
  363. public void AddPath (GraphicsPath addingPath, bool connect)
  364. {
  365. Status status = GDIPlus.GdipAddPathPath (nativePath, addingPath.nativePath, connect);
  366. GDIPlus.CheckStatus (status);
  367. }
  368. public PointF GetLastPoint ()
  369. {
  370. PointF pt;
  371. Status status = GDIPlus.GdipGetPathLastPoint (nativePath, out pt);
  372. GDIPlus.CheckStatus (status);
  373. return pt;
  374. }
  375. //
  376. // AddClosedCurve
  377. //
  378. public void AddClosedCurve (Point [] points)
  379. {
  380. Status status = GDIPlus.GdipAddPathClosedCurveI (nativePath, points, points.Length);
  381. GDIPlus.CheckStatus (status);
  382. }
  383. public void AddClosedCurve (PointF [] points)
  384. {
  385. Status status = GDIPlus.GdipAddPathClosedCurve (nativePath, points, points.Length);
  386. GDIPlus.CheckStatus (status);
  387. }
  388. public void AddClosedCurve (Point [] points, float tension)
  389. {
  390. Status status = GDIPlus.GdipAddPathClosedCurve2I (nativePath, points, points.Length, tension);
  391. GDIPlus.CheckStatus (status);
  392. }
  393. public void AddClosedCurve (PointF [] points, float tension)
  394. {
  395. Status status = GDIPlus.GdipAddPathClosedCurve2 (nativePath, points, points.Length, tension);
  396. GDIPlus.CheckStatus (status);
  397. }
  398. //
  399. // AddCurve
  400. //
  401. public void AddCurve (Point [] points)
  402. {
  403. Status status = GDIPlus.GdipAddPathCurveI (nativePath, points, points.Length);
  404. GDIPlus.CheckStatus (status);
  405. }
  406. public void AddCurve (PointF [] points)
  407. {
  408. Status status = GDIPlus.GdipAddPathCurve (nativePath, points, points.Length);
  409. GDIPlus.CheckStatus (status);
  410. }
  411. public void AddCurve (Point [] points, float tension)
  412. {
  413. Status status = GDIPlus.GdipAddPathCurve2I (nativePath, points, points.Length, tension);
  414. GDIPlus.CheckStatus (status);
  415. }
  416. public void AddCurve (PointF [] points, float tension)
  417. {
  418. Status status = GDIPlus.GdipAddPathCurve2 (nativePath, points, points.Length, tension);
  419. GDIPlus.CheckStatus (status);
  420. }
  421. public void AddCurve (Point [] points, int offset, int numberOfSegments, float tension)
  422. {
  423. Status status = GDIPlus.GdipAddPathCurve3I (nativePath, points, points.Length,
  424. offset, numberOfSegments, tension);
  425. GDIPlus.CheckStatus (status);
  426. }
  427. public void AddCurve (PointF [] points, int offset, int numberOfSegments, float tension)
  428. {
  429. Status status = GDIPlus.GdipAddPathCurve3 (nativePath, points, points.Length,
  430. offset, numberOfSegments, tension);
  431. GDIPlus.CheckStatus (status);
  432. }
  433. public void Reset ()
  434. {
  435. Status status = GDIPlus.GdipResetPath (nativePath);
  436. GDIPlus.CheckStatus (status);
  437. }
  438. public void Reverse ()
  439. {
  440. Status status = GDIPlus.GdipReversePath (nativePath);
  441. GDIPlus.CheckStatus (status);
  442. }
  443. public void Transform (Matrix matrix)
  444. {
  445. Status status = GDIPlus.GdipTransformPath (nativePath, matrix.nativeMatrix);
  446. GDIPlus.CheckStatus (status);
  447. }
  448. [MonoTODO]
  449. public void AddString (string s, FontFamily family, int style, float emSize, Point origin, StringFormat format)
  450. {
  451. throw new NotImplementedException ();
  452. }
  453. [MonoTODO]
  454. public void AddString (string s, FontFamily family, int style, float emSize, PointF origin, StringFormat format)
  455. {
  456. throw new NotImplementedException ();
  457. }
  458. [MonoTODO]
  459. public void AddString (string s, FontFamily family, int style, float emSize, Rectangle layoutRect, StringFormat format)
  460. {
  461. throw new NotImplementedException ();
  462. }
  463. [MonoTODO]
  464. public void AddString (string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat format)
  465. {
  466. throw new NotImplementedException ();
  467. }
  468. public void ClearMarkers()
  469. {
  470. Status s = GDIPlus.GdipClearPathMarkers (nativePath);
  471. GDIPlus.CheckStatus (s);
  472. }
  473. public void CloseAllFigures()
  474. {
  475. Status s = GDIPlus.GdipClosePathFigures (nativePath);
  476. GDIPlus.CheckStatus (s);
  477. }
  478. public void CloseFigure()
  479. {
  480. Status s = GDIPlus.GdipClosePathFigure (nativePath);
  481. GDIPlus.CheckStatus (s);
  482. }
  483. public void Flatten ()
  484. {
  485. // 1/4 is the FlatnessDefault as defined in GdiPlusEnums.h
  486. Flatten (null, 1.0f / 4.0f);
  487. }
  488. public void Flatten (Matrix matrix)
  489. {
  490. Flatten (matrix, 1.0f / 4.0f);
  491. }
  492. public void Flatten (Matrix matrix, float flatness)
  493. {
  494. Status status = GDIPlus.GdipFlattenPath (nativePath, matrix.nativeMatrix, flatness);
  495. GDIPlus.CheckStatus (status);
  496. }
  497. public RectangleF GetBounds ()
  498. {
  499. return GetBounds (null, null);
  500. }
  501. public RectangleF GetBounds (Matrix matrix)
  502. {
  503. return GetBounds (matrix, null);
  504. }
  505. [MonoTODO]
  506. public RectangleF GetBounds (Matrix matrix, Pen pen)
  507. {
  508. RectangleF retval;
  509. IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
  510. IntPtr p = (pen == null) ? IntPtr.Zero : pen.nativeObject;
  511. Status s = GDIPlus.GdipGetPathWorldBounds (nativePath, out retval, m, p);
  512. GDIPlus.CheckStatus (s);
  513. return retval;
  514. }
  515. public bool IsOutlineVisible (Point point, Pen pen)
  516. {
  517. return IsOutlineVisible (point.X, point.Y, pen, null);
  518. }
  519. public bool IsOutlineVisible (PointF point, Pen pen)
  520. {
  521. return IsOutlineVisible (point.X, point.Y, pen, null);
  522. }
  523. public bool IsOutlineVisible (int x, int y, Pen pen)
  524. {
  525. return IsOutlineVisible (x, y, pen, null);
  526. }
  527. public bool IsOutlineVisible (float x, float y, Pen pen)
  528. {
  529. return IsOutlineVisible (x, y, pen, null);
  530. }
  531. public bool IsOutlineVisible (Point pt, Pen pen, Graphics graphics)
  532. {
  533. return IsOutlineVisible (pt.X, pt.Y, pen, graphics);
  534. }
  535. public bool IsOutlineVisible (PointF pt, Pen pen, Graphics graphics)
  536. {
  537. return IsOutlineVisible (pt.X, pt.Y, pen, graphics);
  538. }
  539. [MonoTODO]
  540. public bool IsOutlineVisible (int x, int y, Pen pen, Graphics graphics)
  541. {
  542. bool result;
  543. IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
  544. Status s = GDIPlus.GdipIsOutlineVisiblePathPointI (nativePath, x, y, g, out result);
  545. GDIPlus.CheckStatus (s);
  546. return result;
  547. }
  548. [MonoTODO]
  549. public bool IsOutlineVisible (float x, float y, Pen pen, Graphics graphics)
  550. {
  551. bool result;
  552. IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
  553. Status s = GDIPlus.GdipIsOutlineVisiblePathPoint (nativePath, x, y, g, out result);
  554. GDIPlus.CheckStatus (s);
  555. return result;
  556. }
  557. public bool IsVisible (Point point)
  558. {
  559. return IsVisible (point.X, point.Y, null);
  560. }
  561. public bool IsVisible (PointF point)
  562. {
  563. return IsVisible (point.X, point.Y, null);
  564. }
  565. public bool IsVisible (int x, int y)
  566. {
  567. return IsVisible (x, y, null);
  568. }
  569. public bool IsVisible (float x, float y)
  570. {
  571. return IsVisible (x, y, null);
  572. }
  573. public bool IsVisible (Point pt, Graphics graphics)
  574. {
  575. return IsVisible (pt.X, pt.Y, graphics);
  576. }
  577. public bool IsVisible (PointF pt, Graphics graphics)
  578. {
  579. return IsVisible (pt.X, pt.Y, graphics);
  580. }
  581. [MonoTODO]
  582. public bool IsVisible (int x, int y, Graphics graphics)
  583. {
  584. bool retval;
  585. IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
  586. Status s = GDIPlus.GdipIsVisiblePathPointI (nativePath, x, y, g, out retval);
  587. GDIPlus.CheckStatus (s);
  588. return retval;
  589. }
  590. [MonoTODO]
  591. public bool IsVisible (float x, float y, Graphics graphics)
  592. {
  593. bool retval;
  594. IntPtr g = (graphics == null) ? IntPtr.Zero : graphics.nativeObject;
  595. Status s = GDIPlus.GdipIsVisiblePathPoint (nativePath, x, y, g, out retval);
  596. GDIPlus.CheckStatus (s);
  597. return retval;
  598. }
  599. public void SetMarkers ()
  600. {
  601. Status s = GDIPlus.GdipSetPathMarker (nativePath);
  602. GDIPlus.CheckStatus (s);
  603. }
  604. public void StartFigure()
  605. {
  606. Status s = GDIPlus.GdipStartPathFigure (nativePath);
  607. GDIPlus.CheckStatus (s);
  608. }
  609. public void Warp (PointF[] destPoints, RectangleF srcRect)
  610. {
  611. Warp (destPoints, srcRect, null, WarpMode.Perspective, 1.0f / 4.0f);
  612. }
  613. public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix)
  614. {
  615. Warp (destPoints, srcRect, matrix, WarpMode.Perspective, 1.0f / 4.0f);
  616. }
  617. public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode)
  618. {
  619. Warp (destPoints, srcRect, matrix, warpMode, 1.0f / 4.0f);
  620. }
  621. [MonoTODO]
  622. public void Warp (PointF[] destPoints, RectangleF srcRect, Matrix matrix, WarpMode warpMode, float flatness)
  623. {
  624. IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
  625. Status s = GDIPlus.GdipWarpPath (nativePath, m, destPoints, destPoints.Length,
  626. srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, warpMode, flatness);
  627. GDIPlus.CheckStatus (s);
  628. }
  629. public void Widen (Pen pen)
  630. {
  631. Widen (pen, null, 1.0f / 4.0f);
  632. }
  633. public void Widen (Pen pen, Matrix matrix)
  634. {
  635. Widen (pen, matrix, 1.0f / 4.0f);
  636. }
  637. [MonoTODO]
  638. public void Widen (Pen pen, Matrix matrix, float flatness)
  639. {
  640. IntPtr p = (pen == null) ? IntPtr.Zero : pen.nativeObject;
  641. IntPtr m = (matrix == null) ? IntPtr.Zero : matrix.nativeMatrix;
  642. Status s = GDIPlus.GdipWidenPath (nativePath, p, m, flatness);
  643. GDIPlus.CheckStatus (s);
  644. }
  645. }
  646. }