GraphicsPath.cs 31 KB

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