GraphicsPath.cs 32 KB

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