Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2496 lines
86 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998-2001, Microsoft Corp. All Rights Reserved.
  4. *
  5. * Module Name:
  6. *
  7. * GdiplusGraphics.h
  8. *
  9. * Abstract:
  10. *
  11. * GDI+ Graphics Object
  12. *
  13. \**************************************************************************/
  14. #ifndef _GDIPLUSGRAPHICS_H
  15. #define _GDIPLUSGRAPHICS_H
  16. class Graphics : public GdiplusBase
  17. {
  18. public:
  19. friend class Region;
  20. friend class GraphicsPath;
  21. friend class Image;
  22. friend class Bitmap;
  23. friend class Metafile;
  24. friend class Font;
  25. friend class FontFamily;
  26. friend class FontCollection;
  27. friend class CachedBitmap;
  28. static Graphics* FromHDC(IN HDC hdc)
  29. {
  30. return new Graphics(hdc);
  31. }
  32. static Graphics* FromHDC(IN HDC hdc,
  33. IN HANDLE hdevice)
  34. {
  35. return new Graphics(hdc, hdevice);
  36. }
  37. static Graphics* FromHWND(IN HWND hwnd,
  38. IN BOOL icm = FALSE)
  39. {
  40. return new Graphics(hwnd, icm);
  41. }
  42. static Graphics* FromImage(IN Image *image)
  43. {
  44. return new Graphics(image);
  45. }
  46. Graphics(IN HDC hdc)
  47. {
  48. GpGraphics *graphics = NULL;
  49. lastResult = DllExports::GdipCreateFromHDC(hdc, &graphics);
  50. SetNativeGraphics(graphics);
  51. }
  52. Graphics(IN HDC hdc,
  53. IN HANDLE hdevice)
  54. {
  55. GpGraphics *graphics = NULL;
  56. lastResult = DllExports::GdipCreateFromHDC2(hdc, hdevice, &graphics);
  57. SetNativeGraphics(graphics);
  58. }
  59. Graphics(IN HWND hwnd,
  60. IN BOOL icm = FALSE)
  61. {
  62. GpGraphics *graphics = NULL;
  63. if (icm)
  64. {
  65. lastResult = DllExports::GdipCreateFromHWNDICM(hwnd, &graphics);
  66. }
  67. else
  68. {
  69. lastResult = DllExports::GdipCreateFromHWND(hwnd, &graphics);
  70. }
  71. SetNativeGraphics(graphics);
  72. }
  73. Graphics(IN Image* image)
  74. {
  75. GpGraphics *graphics = NULL;
  76. if (image != NULL)
  77. {
  78. lastResult = DllExports::GdipGetImageGraphicsContext(
  79. image->nativeImage, &graphics);
  80. }
  81. SetNativeGraphics(graphics);
  82. }
  83. ~Graphics()
  84. {
  85. DllExports::GdipDeleteGraphics(nativeGraphics);
  86. }
  87. VOID Flush(IN FlushIntention intention = FlushIntentionFlush)
  88. {
  89. DllExports::GdipFlush(nativeGraphics, intention);
  90. }
  91. //------------------------------------------------------------------------
  92. // GDI Interop methods
  93. //------------------------------------------------------------------------
  94. // Locks the graphics until ReleaseDC is called
  95. HDC GetHDC()
  96. {
  97. HDC hdc = NULL;
  98. SetStatus(DllExports::GdipGetDC(nativeGraphics, &hdc));
  99. return hdc;
  100. }
  101. VOID ReleaseHDC(IN HDC hdc)
  102. {
  103. SetStatus(DllExports::GdipReleaseDC(nativeGraphics, hdc));
  104. }
  105. //------------------------------------------------------------------------
  106. // Rendering modes
  107. //------------------------------------------------------------------------
  108. Status SetRenderingOrigin(IN INT x, IN INT y)
  109. {
  110. return SetStatus(
  111. DllExports::GdipSetRenderingOrigin(
  112. nativeGraphics, x, y
  113. )
  114. );
  115. }
  116. Status GetRenderingOrigin(OUT INT *x, OUT INT *y) const
  117. {
  118. return SetStatus(
  119. DllExports::GdipGetRenderingOrigin(
  120. nativeGraphics, x, y
  121. )
  122. );
  123. }
  124. Status SetCompositingMode(IN CompositingMode compositingMode)
  125. {
  126. return SetStatus(DllExports::GdipSetCompositingMode(nativeGraphics,
  127. compositingMode));
  128. }
  129. CompositingMode GetCompositingMode() const
  130. {
  131. CompositingMode mode;
  132. SetStatus(DllExports::GdipGetCompositingMode(nativeGraphics,
  133. &mode));
  134. return mode;
  135. }
  136. Status SetCompositingQuality(IN CompositingQuality compositingQuality)
  137. {
  138. return SetStatus(DllExports::GdipSetCompositingQuality(
  139. nativeGraphics,
  140. compositingQuality));
  141. }
  142. CompositingQuality GetCompositingQuality() const
  143. {
  144. CompositingQuality quality;
  145. SetStatus(DllExports::GdipGetCompositingQuality(
  146. nativeGraphics,
  147. &quality));
  148. return quality;
  149. }
  150. Status SetTextRenderingHint(IN TextRenderingHint newMode)
  151. {
  152. return SetStatus(DllExports::GdipSetTextRenderingHint(nativeGraphics,
  153. newMode));
  154. }
  155. TextRenderingHint GetTextRenderingHint() const
  156. {
  157. TextRenderingHint hint;
  158. SetStatus(DllExports::GdipGetTextRenderingHint(nativeGraphics,
  159. &hint));
  160. return hint;
  161. }
  162. Status SetTextContrast(IN UINT contrast)
  163. {
  164. return SetStatus(DllExports::GdipSetTextContrast(nativeGraphics,
  165. contrast));
  166. }
  167. UINT GetTextContrast() const
  168. {
  169. UINT contrast;
  170. SetStatus(DllExports::GdipGetTextContrast(nativeGraphics,
  171. &contrast));
  172. return contrast;
  173. }
  174. InterpolationMode GetInterpolationMode() const
  175. {
  176. InterpolationMode mode = InterpolationModeInvalid;
  177. SetStatus(DllExports::GdipGetInterpolationMode(nativeGraphics,
  178. &mode));
  179. return mode;
  180. }
  181. Status SetInterpolationMode(IN InterpolationMode interpolationMode)
  182. {
  183. return SetStatus(DllExports::GdipSetInterpolationMode(nativeGraphics,
  184. interpolationMode));
  185. }
  186. SmoothingMode GetSmoothingMode() const
  187. {
  188. SmoothingMode smoothingMode = SmoothingModeInvalid;
  189. SetStatus(DllExports::GdipGetSmoothingMode(nativeGraphics,
  190. &smoothingMode));
  191. return smoothingMode;
  192. }
  193. Status SetSmoothingMode(IN SmoothingMode smoothingMode)
  194. {
  195. return SetStatus(DllExports::GdipSetSmoothingMode(nativeGraphics,
  196. smoothingMode));
  197. }
  198. PixelOffsetMode GetPixelOffsetMode() const
  199. {
  200. PixelOffsetMode pixelOffsetMode = PixelOffsetModeInvalid;
  201. SetStatus(DllExports::GdipGetPixelOffsetMode(nativeGraphics,
  202. &pixelOffsetMode));
  203. return pixelOffsetMode;
  204. }
  205. Status SetPixelOffsetMode(IN PixelOffsetMode pixelOffsetMode)
  206. {
  207. return SetStatus(DllExports::GdipSetPixelOffsetMode(nativeGraphics,
  208. pixelOffsetMode));
  209. }
  210. //------------------------------------------------------------------------
  211. // Manipulate current world transform
  212. //------------------------------------------------------------------------
  213. Status SetTransform(IN const Matrix* matrix)
  214. {
  215. return SetStatus(DllExports::GdipSetWorldTransform(nativeGraphics,
  216. matrix->nativeMatrix));
  217. }
  218. Status ResetTransform()
  219. {
  220. return SetStatus(DllExports::GdipResetWorldTransform(nativeGraphics));
  221. }
  222. Status MultiplyTransform(IN const Matrix* matrix,
  223. IN MatrixOrder order = MatrixOrderPrepend)
  224. {
  225. return SetStatus(DllExports::GdipMultiplyWorldTransform(nativeGraphics,
  226. matrix->nativeMatrix,
  227. order));
  228. }
  229. Status TranslateTransform(IN REAL dx,
  230. IN REAL dy,
  231. IN MatrixOrder order = MatrixOrderPrepend)
  232. {
  233. return SetStatus(DllExports::GdipTranslateWorldTransform(nativeGraphics,
  234. dx, dy, order));
  235. }
  236. Status ScaleTransform(IN REAL sx,
  237. IN REAL sy,
  238. IN MatrixOrder order = MatrixOrderPrepend)
  239. {
  240. return SetStatus(DllExports::GdipScaleWorldTransform(nativeGraphics,
  241. sx, sy, order));
  242. }
  243. Status RotateTransform(IN REAL angle,
  244. IN MatrixOrder order = MatrixOrderPrepend)
  245. {
  246. return SetStatus(DllExports::GdipRotateWorldTransform(nativeGraphics,
  247. angle, order));
  248. }
  249. Status GetTransform(OUT Matrix* matrix) const
  250. {
  251. return SetStatus(DllExports::GdipGetWorldTransform(nativeGraphics,
  252. matrix->nativeMatrix));
  253. }
  254. Status SetPageUnit(IN Unit unit)
  255. {
  256. return SetStatus(DllExports::GdipSetPageUnit(nativeGraphics,
  257. unit));
  258. }
  259. Status SetPageScale(IN REAL scale)
  260. {
  261. return SetStatus(DllExports::GdipSetPageScale(nativeGraphics,
  262. scale));
  263. }
  264. Unit GetPageUnit() const
  265. {
  266. Unit unit;
  267. SetStatus(DllExports::GdipGetPageUnit(nativeGraphics, &unit));
  268. return unit;
  269. }
  270. REAL GetPageScale() const
  271. {
  272. REAL scale;
  273. SetStatus(DllExports::GdipGetPageScale(nativeGraphics, &scale));
  274. return scale;
  275. }
  276. REAL GetDpiX() const
  277. {
  278. REAL dpi;
  279. SetStatus(DllExports::GdipGetDpiX(nativeGraphics, &dpi));
  280. return dpi;
  281. }
  282. REAL GetDpiY() const
  283. {
  284. REAL dpi;
  285. SetStatus(DllExports::GdipGetDpiY(nativeGraphics, &dpi));
  286. return dpi;
  287. }
  288. Status TransformPoints(IN CoordinateSpace destSpace,
  289. IN CoordinateSpace srcSpace,
  290. IN OUT PointF* pts,
  291. IN INT count) const
  292. {
  293. return SetStatus(DllExports::GdipTransformPoints(nativeGraphics,
  294. destSpace,
  295. srcSpace,
  296. pts,
  297. count));
  298. }
  299. Status TransformPoints(IN CoordinateSpace destSpace,
  300. IN CoordinateSpace srcSpace,
  301. IN OUT Point* pts,
  302. IN INT count) const
  303. {
  304. return SetStatus(DllExports::GdipTransformPointsI(nativeGraphics,
  305. destSpace,
  306. srcSpace,
  307. pts,
  308. count));
  309. }
  310. //------------------------------------------------------------------------
  311. // GetNearestColor (for <= 8bpp surfaces). Note: Alpha is ignored.
  312. //------------------------------------------------------------------------
  313. Status GetNearestColor(IN OUT Color* color) const
  314. {
  315. if (color == NULL)
  316. {
  317. return SetStatus(InvalidParameter);
  318. }
  319. ARGB argb = color->GetValue();
  320. Status status = SetStatus(DllExports::GdipGetNearestColor(nativeGraphics, &argb));
  321. color->SetValue(argb);
  322. return status;
  323. }
  324. Status DrawLine(IN const Pen* pen,
  325. IN REAL x1,
  326. IN REAL y1,
  327. IN REAL x2,
  328. IN REAL y2)
  329. {
  330. return SetStatus(DllExports::GdipDrawLine(nativeGraphics,
  331. pen->nativePen, x1, y1, x2,
  332. y2));
  333. }
  334. Status DrawLine(IN const Pen* pen,
  335. IN const PointF& pt1,
  336. IN const PointF& pt2)
  337. {
  338. return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y);
  339. }
  340. Status DrawLines(IN const Pen* pen,
  341. IN const PointF* points,
  342. IN INT count)
  343. {
  344. return SetStatus(DllExports::GdipDrawLines(nativeGraphics,
  345. pen->nativePen,
  346. points, count));
  347. }
  348. Status DrawLine(IN const Pen* pen,
  349. IN INT x1,
  350. IN INT y1,
  351. IN INT x2,
  352. IN INT y2)
  353. {
  354. return SetStatus(DllExports::GdipDrawLineI(nativeGraphics,
  355. pen->nativePen,
  356. x1,
  357. y1,
  358. x2,
  359. y2));
  360. }
  361. Status DrawLine(IN const Pen* pen,
  362. IN const Point& pt1,
  363. IN const Point& pt2)
  364. {
  365. return DrawLine(pen,
  366. pt1.X,
  367. pt1.Y,
  368. pt2.X,
  369. pt2.Y);
  370. }
  371. Status DrawLines(IN const Pen* pen,
  372. IN const Point* points,
  373. IN INT count)
  374. {
  375. return SetStatus(DllExports::GdipDrawLinesI(nativeGraphics,
  376. pen->nativePen,
  377. points,
  378. count));
  379. }
  380. Status DrawArc(IN const Pen* pen,
  381. IN REAL x,
  382. IN REAL y,
  383. IN REAL width,
  384. IN REAL height,
  385. IN REAL startAngle,
  386. IN REAL sweepAngle)
  387. {
  388. return SetStatus(DllExports::GdipDrawArc(nativeGraphics,
  389. pen->nativePen,
  390. x,
  391. y,
  392. width,
  393. height,
  394. startAngle,
  395. sweepAngle));
  396. }
  397. Status DrawArc(IN const Pen* pen,
  398. IN const RectF& rect,
  399. IN REAL startAngle,
  400. IN REAL sweepAngle)
  401. {
  402. return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height,
  403. startAngle, sweepAngle);
  404. }
  405. Status DrawArc(IN const Pen* pen,
  406. IN INT x,
  407. IN INT y,
  408. IN INT width,
  409. IN INT height,
  410. IN REAL startAngle,
  411. IN REAL sweepAngle)
  412. {
  413. return SetStatus(DllExports::GdipDrawArcI(nativeGraphics,
  414. pen->nativePen,
  415. x,
  416. y,
  417. width,
  418. height,
  419. startAngle,
  420. sweepAngle));
  421. }
  422. Status DrawArc(IN const Pen* pen,
  423. IN const Rect& rect,
  424. IN REAL startAngle,
  425. IN REAL sweepAngle)
  426. {
  427. return DrawArc(pen,
  428. rect.X,
  429. rect.Y,
  430. rect.Width,
  431. rect.Height,
  432. startAngle,
  433. sweepAngle);
  434. }
  435. Status DrawBezier(IN const Pen* pen,
  436. IN REAL x1,
  437. IN REAL y1,
  438. IN REAL x2,
  439. IN REAL y2,
  440. IN REAL x3,
  441. IN REAL y3,
  442. IN REAL x4,
  443. IN REAL y4)
  444. {
  445. return SetStatus(DllExports::GdipDrawBezier(nativeGraphics,
  446. pen->nativePen, x1, y1,
  447. x2, y2, x3, y3, x4, y4));
  448. }
  449. Status DrawBezier(IN const Pen* pen,
  450. IN const PointF& pt1,
  451. IN const PointF& pt2,
  452. IN const PointF& pt3,
  453. IN const PointF& pt4)
  454. {
  455. return DrawBezier(pen,
  456. pt1.X,
  457. pt1.Y,
  458. pt2.X,
  459. pt2.Y,
  460. pt3.X,
  461. pt3.Y,
  462. pt4.X,
  463. pt4.Y);
  464. }
  465. Status DrawBeziers(IN const Pen* pen,
  466. IN const PointF* points,
  467. IN INT count)
  468. {
  469. return SetStatus(DllExports::GdipDrawBeziers(nativeGraphics,
  470. pen->nativePen,
  471. points,
  472. count));
  473. }
  474. Status DrawBezier(IN const Pen* pen,
  475. IN INT x1,
  476. IN INT y1,
  477. IN INT x2,
  478. IN INT y2,
  479. IN INT x3,
  480. IN INT y3,
  481. IN INT x4,
  482. IN INT y4)
  483. {
  484. return SetStatus(DllExports::GdipDrawBezierI(nativeGraphics,
  485. pen->nativePen,
  486. x1,
  487. y1,
  488. x2,
  489. y2,
  490. x3,
  491. y3,
  492. x4,
  493. y4));
  494. }
  495. Status DrawBezier(IN const Pen* pen,
  496. IN const Point& pt1,
  497. IN const Point& pt2,
  498. IN const Point& pt3,
  499. IN const Point& pt4)
  500. {
  501. return DrawBezier(pen,
  502. pt1.X,
  503. pt1.Y,
  504. pt2.X,
  505. pt2.Y,
  506. pt3.X,
  507. pt3.Y,
  508. pt4.X,
  509. pt4.Y);
  510. }
  511. Status DrawBeziers(IN const Pen* pen,
  512. IN const Point* points,
  513. IN INT count)
  514. {
  515. return SetStatus(DllExports::GdipDrawBeziersI(nativeGraphics,
  516. pen->nativePen,
  517. points,
  518. count));
  519. }
  520. Status DrawRectangle(IN const Pen* pen,
  521. IN const RectF& rect)
  522. {
  523. return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
  524. }
  525. Status DrawRectangle(IN const Pen* pen,
  526. IN REAL x,
  527. IN REAL y,
  528. IN REAL width,
  529. IN REAL height)
  530. {
  531. return SetStatus(DllExports::GdipDrawRectangle(nativeGraphics,
  532. pen->nativePen, x, y,
  533. width, height));
  534. }
  535. Status DrawRectangles(IN const Pen* pen,
  536. IN const RectF* rects,
  537. IN INT count)
  538. {
  539. return SetStatus(DllExports::GdipDrawRectangles(nativeGraphics,
  540. pen->nativePen,
  541. rects, count));
  542. }
  543. Status DrawRectangle(IN const Pen* pen,
  544. IN const Rect& rect)
  545. {
  546. return DrawRectangle(pen,
  547. rect.X,
  548. rect.Y,
  549. rect.Width,
  550. rect.Height);
  551. }
  552. Status DrawRectangle(IN const Pen* pen,
  553. IN INT x,
  554. IN INT y,
  555. IN INT width,
  556. IN INT height)
  557. {
  558. return SetStatus(DllExports::GdipDrawRectangleI(nativeGraphics,
  559. pen->nativePen,
  560. x,
  561. y,
  562. width,
  563. height));
  564. }
  565. Status DrawRectangles(IN const Pen* pen,
  566. IN const Rect* rects,
  567. IN INT count)
  568. {
  569. return SetStatus(DllExports::GdipDrawRectanglesI(nativeGraphics,
  570. pen->nativePen,
  571. rects,
  572. count));
  573. }
  574. Status DrawEllipse(IN const Pen* pen,
  575. IN const RectF& rect)
  576. {
  577. return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height);
  578. }
  579. Status DrawEllipse(IN const Pen* pen,
  580. IN REAL x,
  581. IN REAL y,
  582. IN REAL width,
  583. IN REAL height)
  584. {
  585. return SetStatus(DllExports::GdipDrawEllipse(nativeGraphics,
  586. pen->nativePen,
  587. x,
  588. y,
  589. width,
  590. height));
  591. }
  592. Status DrawEllipse(IN const Pen* pen,
  593. IN const Rect& rect)
  594. {
  595. return DrawEllipse(pen,
  596. rect.X,
  597. rect.Y,
  598. rect.Width,
  599. rect.Height);
  600. }
  601. Status DrawEllipse(IN const Pen* pen,
  602. IN INT x,
  603. IN INT y,
  604. IN INT width,
  605. IN INT height)
  606. {
  607. return SetStatus(DllExports::GdipDrawEllipseI(nativeGraphics,
  608. pen->nativePen,
  609. x,
  610. y,
  611. width,
  612. height));
  613. }
  614. Status DrawPie(IN const Pen* pen,
  615. IN const RectF& rect,
  616. IN REAL startAngle,
  617. IN REAL sweepAngle)
  618. {
  619. return DrawPie(pen,
  620. rect.X,
  621. rect.Y,
  622. rect.Width,
  623. rect.Height,
  624. startAngle,
  625. sweepAngle);
  626. }
  627. Status DrawPie(IN const Pen* pen,
  628. IN REAL x,
  629. IN REAL y,
  630. IN REAL width,
  631. IN REAL height,
  632. IN REAL startAngle,
  633. IN REAL sweepAngle)
  634. {
  635. return SetStatus(DllExports::GdipDrawPie(nativeGraphics,
  636. pen->nativePen,
  637. x,
  638. y,
  639. width,
  640. height,
  641. startAngle,
  642. sweepAngle));
  643. }
  644. Status DrawPie(IN const Pen* pen,
  645. IN const Rect& rect,
  646. IN REAL startAngle,
  647. IN REAL sweepAngle)
  648. {
  649. return DrawPie(pen,
  650. rect.X,
  651. rect.Y,
  652. rect.Width,
  653. rect.Height,
  654. startAngle,
  655. sweepAngle);
  656. }
  657. Status DrawPie(IN const Pen* pen,
  658. IN INT x,
  659. IN INT y,
  660. IN INT width,
  661. IN INT height,
  662. IN REAL startAngle,
  663. IN REAL sweepAngle)
  664. {
  665. return SetStatus(DllExports::GdipDrawPieI(nativeGraphics,
  666. pen->nativePen,
  667. x,
  668. y,
  669. width,
  670. height,
  671. startAngle,
  672. sweepAngle));
  673. }
  674. Status DrawPolygon(IN const Pen* pen,
  675. IN const PointF* points,
  676. IN INT count)
  677. {
  678. return SetStatus(DllExports::GdipDrawPolygon(nativeGraphics,
  679. pen->nativePen,
  680. points,
  681. count));
  682. }
  683. Status DrawPolygon(IN const Pen* pen,
  684. IN const Point* points,
  685. IN INT count)
  686. {
  687. return SetStatus(DllExports::GdipDrawPolygonI(nativeGraphics,
  688. pen->nativePen,
  689. points,
  690. count));
  691. }
  692. Status DrawPath(IN const Pen* pen,
  693. IN const GraphicsPath* path)
  694. {
  695. return SetStatus(DllExports::GdipDrawPath(nativeGraphics,
  696. pen ? pen->nativePen : NULL,
  697. path ? path->nativePath : NULL));
  698. }
  699. Status DrawCurve(IN const Pen* pen,
  700. IN const PointF* points,
  701. IN INT count)
  702. {
  703. return SetStatus(DllExports::GdipDrawCurve(nativeGraphics,
  704. pen->nativePen, points,
  705. count));
  706. }
  707. Status DrawCurve(IN const Pen* pen,
  708. IN const PointF* points,
  709. IN INT count,
  710. IN REAL tension)
  711. {
  712. return SetStatus(DllExports::GdipDrawCurve2(nativeGraphics,
  713. pen->nativePen, points,
  714. count, tension));
  715. }
  716. Status DrawCurve(IN const Pen* pen,
  717. IN const PointF* points,
  718. IN INT count,
  719. IN INT offset,
  720. IN INT numberOfSegments,
  721. IN REAL tension = 0.5f)
  722. {
  723. return SetStatus(DllExports::GdipDrawCurve3(nativeGraphics,
  724. pen->nativePen, points,
  725. count, offset,
  726. numberOfSegments, tension));
  727. }
  728. Status DrawCurve(IN const Pen* pen,
  729. IN const Point* points,
  730. IN INT count)
  731. {
  732. return SetStatus(DllExports::GdipDrawCurveI(nativeGraphics,
  733. pen->nativePen,
  734. points,
  735. count));
  736. }
  737. Status DrawCurve(IN const Pen* pen,
  738. IN const Point* points,
  739. IN INT count,
  740. IN REAL tension)
  741. {
  742. return SetStatus(DllExports::GdipDrawCurve2I(nativeGraphics,
  743. pen->nativePen,
  744. points,
  745. count,
  746. tension));
  747. }
  748. Status DrawCurve(IN const Pen* pen,
  749. IN const Point* points,
  750. IN INT count,
  751. IN INT offset,
  752. IN INT numberOfSegments,
  753. IN REAL tension = 0.5f)
  754. {
  755. return SetStatus(DllExports::GdipDrawCurve3I(nativeGraphics,
  756. pen->nativePen,
  757. points,
  758. count,
  759. offset,
  760. numberOfSegments,
  761. tension));
  762. }
  763. Status DrawClosedCurve(IN const Pen* pen,
  764. IN const PointF* points,
  765. IN INT count)
  766. {
  767. return SetStatus(DllExports::GdipDrawClosedCurve(nativeGraphics,
  768. pen->nativePen,
  769. points, count));
  770. }
  771. Status DrawClosedCurve(IN const Pen *pen,
  772. IN const PointF* points,
  773. IN INT count,
  774. IN REAL tension)
  775. {
  776. return SetStatus(DllExports::GdipDrawClosedCurve2(nativeGraphics,
  777. pen->nativePen,
  778. points, count,
  779. tension));
  780. }
  781. Status DrawClosedCurve(IN const Pen* pen,
  782. IN const Point* points,
  783. IN INT count)
  784. {
  785. return SetStatus(DllExports::GdipDrawClosedCurveI(nativeGraphics,
  786. pen->nativePen,
  787. points,
  788. count));
  789. }
  790. Status DrawClosedCurve(IN const Pen *pen,
  791. IN const Point* points,
  792. IN INT count,
  793. IN REAL tension)
  794. {
  795. return SetStatus(DllExports::GdipDrawClosedCurve2I(nativeGraphics,
  796. pen->nativePen,
  797. points,
  798. count,
  799. tension));
  800. }
  801. Status Clear(IN const Color &color)
  802. {
  803. return SetStatus(DllExports::GdipGraphicsClear(
  804. nativeGraphics,
  805. color.GetValue()));
  806. }
  807. Status FillRectangle(IN const Brush* brush,
  808. IN const RectF& rect)
  809. {
  810. return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height);
  811. }
  812. Status FillRectangle(IN const Brush* brush,
  813. IN REAL x,
  814. IN REAL y,
  815. IN REAL width,
  816. IN REAL height)
  817. {
  818. return SetStatus(DllExports::GdipFillRectangle(nativeGraphics,
  819. brush->nativeBrush, x, y,
  820. width, height));
  821. }
  822. Status FillRectangles(IN const Brush* brush,
  823. IN const RectF* rects,
  824. IN INT count)
  825. {
  826. return SetStatus(DllExports::GdipFillRectangles(nativeGraphics,
  827. brush->nativeBrush,
  828. rects, count));
  829. }
  830. Status FillRectangle(IN const Brush* brush,
  831. IN const Rect& rect)
  832. {
  833. return FillRectangle(brush,
  834. rect.X,
  835. rect.Y,
  836. rect.Width,
  837. rect.Height);
  838. }
  839. Status FillRectangle(IN const Brush* brush,
  840. IN INT x,
  841. IN INT y,
  842. IN INT width,
  843. IN INT height)
  844. {
  845. return SetStatus(DllExports::GdipFillRectangleI(nativeGraphics,
  846. brush->nativeBrush,
  847. x,
  848. y,
  849. width,
  850. height));
  851. }
  852. Status FillRectangles(IN const Brush* brush,
  853. IN const Rect* rects,
  854. IN INT count)
  855. {
  856. return SetStatus(DllExports::GdipFillRectanglesI(nativeGraphics,
  857. brush->nativeBrush,
  858. rects,
  859. count));
  860. }
  861. Status FillPolygon(IN const Brush* brush,
  862. IN const PointF* points,
  863. IN INT count)
  864. {
  865. return FillPolygon(brush, points, count, FillModeAlternate);
  866. }
  867. Status FillPolygon(IN const Brush* brush,
  868. IN const PointF* points,
  869. IN INT count,
  870. IN FillMode fillMode)
  871. {
  872. return SetStatus(DllExports::GdipFillPolygon(nativeGraphics,
  873. brush->nativeBrush,
  874. points, count, fillMode));
  875. }
  876. Status FillPolygon(IN const Brush* brush,
  877. IN const Point* points,
  878. IN INT count)
  879. {
  880. return FillPolygon(brush, points, count, FillModeAlternate);
  881. }
  882. Status FillPolygon(IN const Brush* brush,
  883. IN const Point* points,
  884. IN INT count,
  885. IN FillMode fillMode)
  886. {
  887. return SetStatus(DllExports::GdipFillPolygonI(nativeGraphics,
  888. brush->nativeBrush,
  889. points, count,
  890. fillMode));
  891. }
  892. Status FillEllipse(IN const Brush* brush,
  893. IN const RectF& rect)
  894. {
  895. return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
  896. }
  897. Status FillEllipse(IN const Brush* brush,
  898. IN REAL x,
  899. IN REAL y,
  900. IN REAL width,
  901. IN REAL height)
  902. {
  903. return SetStatus(DllExports::GdipFillEllipse(nativeGraphics,
  904. brush->nativeBrush, x, y,
  905. width, height));
  906. }
  907. Status FillEllipse(IN const Brush* brush,
  908. IN const Rect& rect)
  909. {
  910. return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height);
  911. }
  912. Status FillEllipse(IN const Brush* brush,
  913. IN INT x,
  914. IN INT y,
  915. IN INT width,
  916. IN INT height)
  917. {
  918. return SetStatus(DllExports::GdipFillEllipseI(nativeGraphics,
  919. brush->nativeBrush,
  920. x,
  921. y,
  922. width,
  923. height));
  924. }
  925. Status FillPie(IN const Brush* brush,
  926. IN const RectF& rect,
  927. IN REAL startAngle,
  928. IN REAL sweepAngle)
  929. {
  930. return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height,
  931. startAngle, sweepAngle);
  932. }
  933. Status FillPie(IN const Brush* brush,
  934. IN REAL x,
  935. IN REAL y,
  936. IN REAL width,
  937. IN REAL height,
  938. IN REAL startAngle,
  939. IN REAL sweepAngle)
  940. {
  941. return SetStatus(DllExports::GdipFillPie(nativeGraphics,
  942. brush->nativeBrush, x, y,
  943. width, height, startAngle,
  944. sweepAngle));
  945. }
  946. Status FillPie(IN const Brush* brush,
  947. IN const Rect& rect,
  948. IN REAL startAngle,
  949. IN REAL sweepAngle)
  950. {
  951. return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height,
  952. startAngle, sweepAngle);
  953. }
  954. Status FillPie(IN const Brush* brush,
  955. IN INT x,
  956. IN INT y,
  957. IN INT width,
  958. IN INT height,
  959. IN REAL startAngle,
  960. IN REAL sweepAngle)
  961. {
  962. return SetStatus(DllExports::GdipFillPieI(nativeGraphics,
  963. brush->nativeBrush,
  964. x,
  965. y,
  966. width,
  967. height,
  968. startAngle,
  969. sweepAngle));
  970. }
  971. Status FillPath(IN const Brush* brush,
  972. IN const GraphicsPath* path)
  973. {
  974. return SetStatus(DllExports::GdipFillPath(nativeGraphics,
  975. brush->nativeBrush,
  976. path->nativePath));
  977. }
  978. Status FillClosedCurve(IN const Brush* brush,
  979. IN const PointF* points,
  980. IN INT count)
  981. {
  982. return SetStatus(DllExports::GdipFillClosedCurve(nativeGraphics,
  983. brush->nativeBrush,
  984. points, count));
  985. }
  986. Status FillClosedCurve(IN const Brush* brush,
  987. IN const PointF* points,
  988. IN INT count,
  989. IN FillMode fillMode,
  990. IN REAL tension = 0.5f)
  991. {
  992. return SetStatus(DllExports::GdipFillClosedCurve2(nativeGraphics,
  993. brush->nativeBrush,
  994. points, count,
  995. tension, fillMode));
  996. }
  997. Status FillClosedCurve(IN const Brush* brush,
  998. IN const Point* points,
  999. IN INT count)
  1000. {
  1001. return SetStatus(DllExports::GdipFillClosedCurveI(nativeGraphics,
  1002. brush->nativeBrush,
  1003. points,
  1004. count));
  1005. }
  1006. Status FillClosedCurve(IN const Brush* brush,
  1007. IN const Point* points,
  1008. IN INT count,
  1009. IN FillMode fillMode,
  1010. IN REAL tension = 0.5f)
  1011. {
  1012. return SetStatus(DllExports::GdipFillClosedCurve2I(nativeGraphics,
  1013. brush->nativeBrush,
  1014. points, count,
  1015. tension, fillMode));
  1016. }
  1017. Status FillRegion(IN const Brush* brush,
  1018. IN const Region* region)
  1019. {
  1020. return SetStatus(DllExports::GdipFillRegion(nativeGraphics,
  1021. brush->nativeBrush,
  1022. region->nativeRegion));
  1023. }
  1024. Status
  1025. DrawString(
  1026. IN const WCHAR *string,
  1027. IN INT length,
  1028. IN const Font *font,
  1029. IN const RectF &layoutRect,
  1030. IN const StringFormat *stringFormat,
  1031. IN const Brush *brush
  1032. )
  1033. {
  1034. return SetStatus(DllExports::GdipDrawString(
  1035. nativeGraphics,
  1036. string,
  1037. length,
  1038. font ? font->nativeFont : NULL,
  1039. &layoutRect,
  1040. stringFormat ? stringFormat->nativeFormat : NULL,
  1041. brush ? brush->nativeBrush : NULL
  1042. ));
  1043. }
  1044. Status
  1045. DrawString(
  1046. const WCHAR *string,
  1047. INT length,
  1048. const Font *font,
  1049. const PointF &origin,
  1050. const Brush *brush
  1051. )
  1052. {
  1053. RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
  1054. return SetStatus(DllExports::GdipDrawString(
  1055. nativeGraphics,
  1056. string,
  1057. length,
  1058. font ? font->nativeFont : NULL,
  1059. &rect,
  1060. NULL,
  1061. brush ? brush->nativeBrush : NULL
  1062. ));
  1063. }
  1064. Status
  1065. DrawString(
  1066. const WCHAR *string,
  1067. INT length,
  1068. const Font *font,
  1069. const PointF &origin,
  1070. const StringFormat *stringFormat,
  1071. const Brush *brush
  1072. )
  1073. {
  1074. RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
  1075. return SetStatus(DllExports::GdipDrawString(
  1076. nativeGraphics,
  1077. string,
  1078. length,
  1079. font ? font->nativeFont : NULL,
  1080. &rect,
  1081. stringFormat ? stringFormat->nativeFormat : NULL,
  1082. brush ? brush->nativeBrush : NULL
  1083. ));
  1084. }
  1085. Status
  1086. MeasureString(
  1087. IN const WCHAR *string,
  1088. IN INT length,
  1089. IN const Font *font,
  1090. IN const RectF &layoutRect,
  1091. IN const StringFormat *stringFormat,
  1092. OUT RectF *boundingBox,
  1093. OUT INT *codepointsFitted = 0,
  1094. OUT INT *linesFilled = 0
  1095. ) const
  1096. {
  1097. return SetStatus(DllExports::GdipMeasureString(
  1098. nativeGraphics,
  1099. string,
  1100. length,
  1101. font ? font->nativeFont : NULL,
  1102. &layoutRect,
  1103. stringFormat ? stringFormat->nativeFormat : NULL,
  1104. boundingBox,
  1105. codepointsFitted,
  1106. linesFilled
  1107. ));
  1108. }
  1109. Status
  1110. MeasureString(
  1111. IN const WCHAR *string,
  1112. IN INT length,
  1113. IN const Font *font,
  1114. IN const SizeF &layoutRectSize,
  1115. IN const StringFormat *stringFormat,
  1116. OUT SizeF *size,
  1117. OUT INT *codepointsFitted = 0,
  1118. OUT INT *linesFilled = 0
  1119. ) const
  1120. {
  1121. RectF layoutRect(0, 0, layoutRectSize.Width, layoutRectSize.Height);
  1122. RectF boundingBox;
  1123. Status status;
  1124. if (size == NULL)
  1125. {
  1126. return SetStatus(InvalidParameter);
  1127. }
  1128. status = SetStatus(DllExports::GdipMeasureString(
  1129. nativeGraphics,
  1130. string,
  1131. length,
  1132. font ? font->nativeFont : NULL,
  1133. &layoutRect,
  1134. stringFormat ? stringFormat->nativeFormat : NULL,
  1135. size ? &boundingBox : NULL,
  1136. codepointsFitted,
  1137. linesFilled
  1138. ));
  1139. if (size && status == Ok)
  1140. {
  1141. size->Width = boundingBox.Width;
  1142. size->Height = boundingBox.Height;
  1143. }
  1144. return status;
  1145. }
  1146. Status
  1147. MeasureString(
  1148. IN const WCHAR *string,
  1149. IN INT length,
  1150. IN const Font *font,
  1151. IN const PointF &origin,
  1152. IN const StringFormat *stringFormat,
  1153. OUT RectF *boundingBox
  1154. ) const
  1155. {
  1156. RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
  1157. return SetStatus(DllExports::GdipMeasureString(
  1158. nativeGraphics,
  1159. string,
  1160. length,
  1161. font ? font->nativeFont : NULL,
  1162. &rect,
  1163. stringFormat ? stringFormat->nativeFormat : NULL,
  1164. boundingBox,
  1165. NULL,
  1166. NULL
  1167. ));
  1168. }
  1169. Status
  1170. MeasureString(
  1171. IN const WCHAR *string,
  1172. IN INT length,
  1173. IN const Font *font,
  1174. IN const RectF &layoutRect,
  1175. OUT RectF *boundingBox
  1176. ) const
  1177. {
  1178. return SetStatus(DllExports::GdipMeasureString(
  1179. nativeGraphics,
  1180. string,
  1181. length,
  1182. font ? font->nativeFont : NULL,
  1183. &layoutRect,
  1184. NULL,
  1185. boundingBox,
  1186. NULL,
  1187. NULL
  1188. ));
  1189. }
  1190. Status
  1191. MeasureString(
  1192. IN const WCHAR *string,
  1193. IN INT length,
  1194. IN const Font *font,
  1195. IN const PointF &origin,
  1196. OUT RectF *boundingBox
  1197. ) const
  1198. {
  1199. RectF rect(origin.X, origin.Y, 0.0f, 0.0f);
  1200. return SetStatus(DllExports::GdipMeasureString(
  1201. nativeGraphics,
  1202. string,
  1203. length,
  1204. font ? font->nativeFont : NULL,
  1205. &rect,
  1206. NULL,
  1207. boundingBox,
  1208. NULL,
  1209. NULL
  1210. ));
  1211. }
  1212. Status
  1213. MeasureCharacterRanges(
  1214. IN const WCHAR *string,
  1215. IN INT length,
  1216. IN const Font *font,
  1217. IN const RectF &layoutRect,
  1218. IN const StringFormat *stringFormat,
  1219. IN INT regionCount,
  1220. OUT Region *regions
  1221. ) const
  1222. {
  1223. if (!regions || regionCount <= 0)
  1224. {
  1225. return InvalidParameter;
  1226. }
  1227. GpRegion **nativeRegions = new GpRegion* [regionCount];
  1228. if (!nativeRegions)
  1229. {
  1230. return OutOfMemory;
  1231. }
  1232. for (INT i = 0; i < regionCount; i++)
  1233. {
  1234. nativeRegions[i] = regions[i].nativeRegion;
  1235. }
  1236. Status status = SetStatus(DllExports::GdipMeasureCharacterRanges(
  1237. nativeGraphics,
  1238. string,
  1239. length,
  1240. font ? font->nativeFont : NULL,
  1241. layoutRect,
  1242. stringFormat ? stringFormat->nativeFormat : NULL,
  1243. regionCount,
  1244. nativeRegions
  1245. ));
  1246. delete [] nativeRegions;
  1247. return status;
  1248. }
  1249. Status DrawDriverString(
  1250. IN const UINT16 *text,
  1251. IN INT length,
  1252. IN const Font *font,
  1253. IN const Brush *brush,
  1254. IN const PointF *positions,
  1255. IN INT flags,
  1256. IN const Matrix *matrix
  1257. )
  1258. {
  1259. return SetStatus(DllExports::GdipDrawDriverString(
  1260. nativeGraphics,
  1261. text,
  1262. length,
  1263. font ? font->nativeFont : NULL,
  1264. brush ? brush->nativeBrush : NULL,
  1265. positions,
  1266. flags,
  1267. matrix ? matrix->nativeMatrix : NULL
  1268. ));
  1269. }
  1270. Status MeasureDriverString(
  1271. IN const UINT16 *text,
  1272. IN INT length,
  1273. IN const Font *font,
  1274. IN const PointF *positions,
  1275. IN INT flags,
  1276. IN const Matrix *matrix,
  1277. OUT RectF *boundingBox
  1278. ) const
  1279. {
  1280. return SetStatus(DllExports::GdipMeasureDriverString(
  1281. nativeGraphics,
  1282. text,
  1283. length,
  1284. font ? font->nativeFont : NULL,
  1285. positions,
  1286. flags,
  1287. matrix ? matrix->nativeMatrix : NULL,
  1288. boundingBox
  1289. ));
  1290. }
  1291. // Draw a cached bitmap on this graphics destination offset by
  1292. // x, y. Note this will fail with WrongState if the CachedBitmap
  1293. // native format differs from this Graphics.
  1294. Status DrawCachedBitmap(IN CachedBitmap *cb,
  1295. IN INT x,
  1296. IN INT y)
  1297. {
  1298. return SetStatus(DllExports::GdipDrawCachedBitmap(
  1299. nativeGraphics,
  1300. cb->nativeCachedBitmap,
  1301. x, y
  1302. ));
  1303. }
  1304. Status DrawImage(IN Image* image,
  1305. IN const PointF& point)
  1306. {
  1307. return DrawImage(image, point.X, point.Y);
  1308. }
  1309. Status DrawImage(IN Image* image,
  1310. IN REAL x,
  1311. IN REAL y)
  1312. {
  1313. return SetStatus(DllExports::GdipDrawImage(nativeGraphics,
  1314. image ? image->nativeImage
  1315. : NULL,
  1316. x,
  1317. y));
  1318. }
  1319. Status DrawImage(IN Image* image,
  1320. IN const RectF& rect)
  1321. {
  1322. return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height);
  1323. }
  1324. Status DrawImage(IN Image* image,
  1325. IN REAL x,
  1326. IN REAL y,
  1327. IN REAL width,
  1328. IN REAL height)
  1329. {
  1330. return SetStatus(DllExports::GdipDrawImageRect(nativeGraphics,
  1331. image ? image->nativeImage
  1332. : NULL,
  1333. x,
  1334. y,
  1335. width,
  1336. height));
  1337. }
  1338. Status DrawImage(IN Image* image,
  1339. IN const Point& point)
  1340. {
  1341. return DrawImage(image, point.X, point.Y);
  1342. }
  1343. Status DrawImage(IN Image* image,
  1344. IN INT x,
  1345. IN INT y)
  1346. {
  1347. return SetStatus(DllExports::GdipDrawImageI(nativeGraphics,
  1348. image ? image->nativeImage
  1349. : NULL,
  1350. x,
  1351. y));
  1352. }
  1353. Status DrawImage(IN Image* image,
  1354. IN const Rect& rect)
  1355. {
  1356. return DrawImage(image,
  1357. rect.X,
  1358. rect.Y,
  1359. rect.Width,
  1360. rect.Height);
  1361. }
  1362. Status DrawImage(IN Image* image,
  1363. IN INT x,
  1364. IN INT y,
  1365. IN INT width,
  1366. IN INT height) {
  1367. return SetStatus(DllExports::GdipDrawImageRectI(nativeGraphics,
  1368. image ? image->nativeImage
  1369. : NULL,
  1370. x,
  1371. y,
  1372. width,
  1373. height));
  1374. }
  1375. // Affine Draw Image
  1376. // destPoints.length = 3: rect => parallelogram
  1377. // destPoints[0] <=> top-left corner of the source rectangle
  1378. // destPoints[1] <=> top-right corner
  1379. // destPoints[2] <=> bottom-left corner
  1380. // destPoints.length = 4: rect => quad
  1381. // destPoints[3] <=> bottom-right corner
  1382. Status DrawImage(IN Image* image,
  1383. IN const PointF* destPoints,
  1384. IN INT count)
  1385. {
  1386. if (count != 3 && count != 4)
  1387. return SetStatus(InvalidParameter);
  1388. return SetStatus(DllExports::GdipDrawImagePoints(nativeGraphics,
  1389. image ? image->nativeImage
  1390. : NULL,
  1391. destPoints, count));
  1392. }
  1393. Status DrawImage(IN Image* image,
  1394. IN const Point* destPoints,
  1395. IN INT count)
  1396. {
  1397. if (count != 3 && count != 4)
  1398. return SetStatus(InvalidParameter);
  1399. return SetStatus(DllExports::GdipDrawImagePointsI(nativeGraphics,
  1400. image ? image->nativeImage
  1401. : NULL,
  1402. destPoints,
  1403. count));
  1404. }
  1405. Status DrawImage(IN Image* image,
  1406. IN REAL x,
  1407. IN REAL y,
  1408. IN REAL srcx,
  1409. IN REAL srcy,
  1410. IN REAL srcwidth,
  1411. IN REAL srcheight,
  1412. IN Unit srcUnit)
  1413. {
  1414. return SetStatus(DllExports::GdipDrawImagePointRect(nativeGraphics,
  1415. image ? image->nativeImage
  1416. : NULL,
  1417. x, y,
  1418. srcx, srcy,
  1419. srcwidth, srcheight, srcUnit));
  1420. }
  1421. Status DrawImage(IN Image* image,
  1422. IN const RectF& destRect,
  1423. IN REAL srcx,
  1424. IN REAL srcy,
  1425. IN REAL srcwidth,
  1426. IN REAL srcheight,
  1427. IN Unit srcUnit,
  1428. IN const ImageAttributes* imageAttributes = NULL,
  1429. IN DrawImageAbort callback = NULL,
  1430. IN VOID* callbackData = NULL)
  1431. {
  1432. return SetStatus(DllExports::GdipDrawImageRectRect(nativeGraphics,
  1433. image ? image->nativeImage
  1434. : NULL,
  1435. destRect.X,
  1436. destRect.Y,
  1437. destRect.Width,
  1438. destRect.Height,
  1439. srcx, srcy,
  1440. srcwidth, srcheight,
  1441. srcUnit,
  1442. imageAttributes
  1443. ? imageAttributes->nativeImageAttr
  1444. : NULL,
  1445. callback,
  1446. callbackData));
  1447. }
  1448. Status DrawImage(IN Image* image,
  1449. IN const PointF* destPoints,
  1450. IN INT count,
  1451. IN REAL srcx,
  1452. IN REAL srcy,
  1453. IN REAL srcwidth,
  1454. IN REAL srcheight,
  1455. IN Unit srcUnit,
  1456. IN const ImageAttributes* imageAttributes = NULL,
  1457. IN DrawImageAbort callback = NULL,
  1458. IN VOID* callbackData = NULL)
  1459. {
  1460. return SetStatus(DllExports::GdipDrawImagePointsRect(nativeGraphics,
  1461. image ? image->nativeImage
  1462. : NULL,
  1463. destPoints, count,
  1464. srcx, srcy,
  1465. srcwidth,
  1466. srcheight,
  1467. srcUnit,
  1468. imageAttributes
  1469. ? imageAttributes->nativeImageAttr
  1470. : NULL,
  1471. callback,
  1472. callbackData));
  1473. }
  1474. Status DrawImage(IN Image* image,
  1475. IN INT x,
  1476. IN INT y,
  1477. IN INT srcx,
  1478. IN INT srcy,
  1479. IN INT srcwidth,
  1480. IN INT srcheight,
  1481. IN Unit srcUnit)
  1482. {
  1483. return SetStatus(DllExports::GdipDrawImagePointRectI(nativeGraphics,
  1484. image ? image->nativeImage
  1485. : NULL,
  1486. x,
  1487. y,
  1488. srcx,
  1489. srcy,
  1490. srcwidth,
  1491. srcheight,
  1492. srcUnit));
  1493. }
  1494. Status DrawImage(IN Image* image,
  1495. IN const Rect& destRect,
  1496. IN INT srcx,
  1497. IN INT srcy,
  1498. IN INT srcwidth,
  1499. IN INT srcheight,
  1500. IN Unit srcUnit,
  1501. IN const ImageAttributes* imageAttributes = NULL,
  1502. IN DrawImageAbort callback = NULL,
  1503. IN VOID* callbackData = NULL)
  1504. {
  1505. return SetStatus(DllExports::GdipDrawImageRectRectI(nativeGraphics,
  1506. image ? image->nativeImage
  1507. : NULL,
  1508. destRect.X,
  1509. destRect.Y,
  1510. destRect.Width,
  1511. destRect.Height,
  1512. srcx,
  1513. srcy,
  1514. srcwidth,
  1515. srcheight,
  1516. srcUnit,
  1517. imageAttributes
  1518. ? imageAttributes->nativeImageAttr
  1519. : NULL,
  1520. callback,
  1521. callbackData));
  1522. }
  1523. Status DrawImage(IN Image* image,
  1524. IN const Point* destPoints,
  1525. IN INT count,
  1526. IN INT srcx,
  1527. IN INT srcy,
  1528. IN INT srcwidth,
  1529. IN INT srcheight,
  1530. IN Unit srcUnit,
  1531. IN const ImageAttributes* imageAttributes = NULL,
  1532. IN DrawImageAbort callback = NULL,
  1533. IN VOID* callbackData = NULL)
  1534. {
  1535. return SetStatus(DllExports::GdipDrawImagePointsRectI(nativeGraphics,
  1536. image ? image->nativeImage
  1537. : NULL,
  1538. destPoints,
  1539. count,
  1540. srcx,
  1541. srcy,
  1542. srcwidth,
  1543. srcheight,
  1544. srcUnit,
  1545. imageAttributes
  1546. ? imageAttributes->nativeImageAttr
  1547. : NULL,
  1548. callback,
  1549. callbackData));
  1550. }
  1551. // The following methods are for playing an EMF+ to a graphics
  1552. // via the enumeration interface. Each record of the EMF+ is
  1553. // sent to the callback (along with the callbackData). Then
  1554. // the callback can invoke the Metafile::PlayRecord method
  1555. // to play the particular record.
  1556. Status
  1557. EnumerateMetafile(
  1558. IN const Metafile * metafile,
  1559. IN const PointF & destPoint,
  1560. IN EnumerateMetafileProc callback,
  1561. IN VOID * callbackData = NULL,
  1562. IN const ImageAttributes * imageAttributes = NULL
  1563. )
  1564. {
  1565. return SetStatus(DllExports::GdipEnumerateMetafileDestPoint(
  1566. nativeGraphics,
  1567. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1568. destPoint,
  1569. callback,
  1570. callbackData,
  1571. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1572. }
  1573. Status
  1574. EnumerateMetafile(
  1575. IN const Metafile * metafile,
  1576. IN const Point & destPoint,
  1577. IN EnumerateMetafileProc callback,
  1578. IN VOID * callbackData = NULL,
  1579. IN const ImageAttributes * imageAttributes = NULL
  1580. )
  1581. {
  1582. return SetStatus(DllExports::GdipEnumerateMetafileDestPointI(
  1583. nativeGraphics,
  1584. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1585. destPoint,
  1586. callback,
  1587. callbackData,
  1588. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1589. }
  1590. Status
  1591. EnumerateMetafile(
  1592. IN const Metafile * metafile,
  1593. IN const RectF & destRect,
  1594. IN EnumerateMetafileProc callback,
  1595. IN VOID * callbackData = NULL,
  1596. IN const ImageAttributes * imageAttributes = NULL
  1597. )
  1598. {
  1599. return SetStatus(DllExports::GdipEnumerateMetafileDestRect(
  1600. nativeGraphics,
  1601. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1602. destRect,
  1603. callback,
  1604. callbackData,
  1605. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1606. }
  1607. Status
  1608. EnumerateMetafile(
  1609. IN const Metafile * metafile,
  1610. IN const Rect & destRect,
  1611. IN EnumerateMetafileProc callback,
  1612. IN VOID * callbackData = NULL,
  1613. IN const ImageAttributes * imageAttributes = NULL
  1614. )
  1615. {
  1616. return SetStatus(DllExports::GdipEnumerateMetafileDestRectI(
  1617. nativeGraphics,
  1618. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1619. destRect,
  1620. callback,
  1621. callbackData,
  1622. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1623. }
  1624. Status
  1625. EnumerateMetafile(
  1626. IN const Metafile * metafile,
  1627. IN const PointF * destPoints,
  1628. IN INT count,
  1629. IN EnumerateMetafileProc callback,
  1630. IN VOID * callbackData = NULL,
  1631. IN const ImageAttributes * imageAttributes = NULL
  1632. )
  1633. {
  1634. return SetStatus(DllExports::GdipEnumerateMetafileDestPoints(
  1635. nativeGraphics,
  1636. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1637. destPoints,
  1638. count,
  1639. callback,
  1640. callbackData,
  1641. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1642. }
  1643. Status
  1644. EnumerateMetafile(
  1645. IN const Metafile * metafile,
  1646. IN const Point * destPoints,
  1647. IN INT count,
  1648. IN EnumerateMetafileProc callback,
  1649. IN VOID * callbackData = NULL,
  1650. IN const ImageAttributes * imageAttributes = NULL
  1651. )
  1652. {
  1653. return SetStatus(DllExports::GdipEnumerateMetafileDestPointsI(
  1654. nativeGraphics,
  1655. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1656. destPoints,
  1657. count,
  1658. callback,
  1659. callbackData,
  1660. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1661. }
  1662. Status
  1663. EnumerateMetafile(
  1664. IN const Metafile * metafile,
  1665. IN const PointF & destPoint,
  1666. IN const RectF & srcRect,
  1667. IN Unit srcUnit,
  1668. IN EnumerateMetafileProc callback,
  1669. IN VOID * callbackData = NULL,
  1670. IN const ImageAttributes * imageAttributes = NULL
  1671. )
  1672. {
  1673. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoint(
  1674. nativeGraphics,
  1675. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1676. destPoint,
  1677. srcRect,
  1678. srcUnit,
  1679. callback,
  1680. callbackData,
  1681. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1682. }
  1683. Status
  1684. EnumerateMetafile(
  1685. IN const Metafile * metafile,
  1686. IN const Point & destPoint,
  1687. IN const Rect & srcRect,
  1688. IN Unit srcUnit,
  1689. IN EnumerateMetafileProc callback,
  1690. IN VOID * callbackData = NULL,
  1691. IN const ImageAttributes * imageAttributes = NULL
  1692. )
  1693. {
  1694. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointI(
  1695. nativeGraphics,
  1696. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1697. destPoint,
  1698. srcRect,
  1699. srcUnit,
  1700. callback,
  1701. callbackData,
  1702. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1703. }
  1704. Status
  1705. EnumerateMetafile(
  1706. IN const Metafile * metafile,
  1707. IN const RectF & destRect,
  1708. IN const RectF & srcRect,
  1709. IN Unit srcUnit,
  1710. IN EnumerateMetafileProc callback,
  1711. IN VOID * callbackData = NULL,
  1712. IN const ImageAttributes * imageAttributes = NULL
  1713. )
  1714. {
  1715. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRect(
  1716. nativeGraphics,
  1717. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1718. destRect,
  1719. srcRect,
  1720. srcUnit,
  1721. callback,
  1722. callbackData,
  1723. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1724. }
  1725. Status
  1726. EnumerateMetafile(
  1727. IN const Metafile * metafile,
  1728. IN const Rect & destRect,
  1729. IN const Rect & srcRect,
  1730. IN Unit srcUnit,
  1731. IN EnumerateMetafileProc callback,
  1732. IN VOID * callbackData = NULL,
  1733. IN const ImageAttributes * imageAttributes = NULL
  1734. )
  1735. {
  1736. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestRectI(
  1737. nativeGraphics,
  1738. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1739. destRect,
  1740. srcRect,
  1741. srcUnit,
  1742. callback,
  1743. callbackData,
  1744. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1745. }
  1746. Status
  1747. EnumerateMetafile(
  1748. IN const Metafile * metafile,
  1749. IN const PointF * destPoints,
  1750. IN INT count,
  1751. IN const RectF & srcRect,
  1752. IN Unit srcUnit,
  1753. IN EnumerateMetafileProc callback,
  1754. IN VOID * callbackData = NULL,
  1755. IN const ImageAttributes * imageAttributes = NULL
  1756. )
  1757. {
  1758. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPoints(
  1759. nativeGraphics,
  1760. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1761. destPoints,
  1762. count,
  1763. srcRect,
  1764. srcUnit,
  1765. callback,
  1766. callbackData,
  1767. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1768. }
  1769. Status
  1770. EnumerateMetafile(
  1771. IN const Metafile * metafile,
  1772. IN const Point * destPoints,
  1773. IN INT count,
  1774. IN const Rect & srcRect,
  1775. IN Unit srcUnit,
  1776. IN EnumerateMetafileProc callback,
  1777. IN VOID * callbackData = NULL,
  1778. IN const ImageAttributes * imageAttributes = NULL
  1779. )
  1780. {
  1781. return SetStatus(DllExports::GdipEnumerateMetafileSrcRectDestPointsI(
  1782. nativeGraphics,
  1783. (const GpMetafile *)(metafile ? metafile->nativeImage:NULL),
  1784. destPoints,
  1785. count,
  1786. srcRect,
  1787. srcUnit,
  1788. callback,
  1789. callbackData,
  1790. imageAttributes ? imageAttributes->nativeImageAttr : NULL));
  1791. }
  1792. Status SetClip(IN const Graphics* g,
  1793. IN CombineMode combineMode = CombineModeReplace)
  1794. {
  1795. return SetStatus(DllExports::GdipSetClipGraphics(nativeGraphics,
  1796. g->nativeGraphics,
  1797. combineMode));
  1798. }
  1799. Status SetClip(IN const RectF& rect,
  1800. IN CombineMode combineMode = CombineModeReplace)
  1801. {
  1802. return SetStatus(DllExports::GdipSetClipRect(nativeGraphics,
  1803. rect.X, rect.Y,
  1804. rect.Width, rect.Height,
  1805. combineMode));
  1806. }
  1807. Status SetClip(IN const Rect& rect,
  1808. IN CombineMode combineMode = CombineModeReplace)
  1809. {
  1810. return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics,
  1811. rect.X, rect.Y,
  1812. rect.Width, rect.Height,
  1813. combineMode));
  1814. }
  1815. Status SetClip(IN const GraphicsPath* path,
  1816. IN CombineMode combineMode = CombineModeReplace)
  1817. {
  1818. return SetStatus(DllExports::GdipSetClipPath(nativeGraphics,
  1819. path->nativePath,
  1820. combineMode));
  1821. }
  1822. Status SetClip(IN const Region* region,
  1823. IN CombineMode combineMode = CombineModeReplace)
  1824. {
  1825. return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics,
  1826. region->nativeRegion,
  1827. combineMode));
  1828. }
  1829. // This is different than the other SetClip methods because it assumes
  1830. // that the HRGN is already in device units, so it doesn't transform
  1831. // the coordinates in the HRGN.
  1832. Status SetClip(IN HRGN hRgn,
  1833. IN CombineMode combineMode = CombineModeReplace)
  1834. {
  1835. return SetStatus(DllExports::GdipSetClipHrgn(nativeGraphics, hRgn,
  1836. combineMode));
  1837. }
  1838. Status IntersectClip(IN const RectF& rect)
  1839. {
  1840. return SetStatus(DllExports::GdipSetClipRect(nativeGraphics,
  1841. rect.X, rect.Y,
  1842. rect.Width, rect.Height,
  1843. CombineModeIntersect));
  1844. }
  1845. Status IntersectClip(IN const Rect& rect)
  1846. {
  1847. return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics,
  1848. rect.X, rect.Y,
  1849. rect.Width, rect.Height,
  1850. CombineModeIntersect));
  1851. }
  1852. Status IntersectClip(IN const Region* region)
  1853. {
  1854. return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics,
  1855. region->nativeRegion,
  1856. CombineModeIntersect));
  1857. }
  1858. Status ExcludeClip(IN const RectF& rect)
  1859. {
  1860. return SetStatus(DllExports::GdipSetClipRect(nativeGraphics,
  1861. rect.X, rect.Y,
  1862. rect.Width, rect.Height,
  1863. CombineModeExclude));
  1864. }
  1865. Status ExcludeClip(IN const Rect& rect)
  1866. {
  1867. return SetStatus(DllExports::GdipSetClipRectI(nativeGraphics,
  1868. rect.X, rect.Y,
  1869. rect.Width, rect.Height,
  1870. CombineModeExclude));
  1871. }
  1872. Status ExcludeClip(IN const Region* region)
  1873. {
  1874. return SetStatus(DllExports::GdipSetClipRegion(nativeGraphics,
  1875. region->nativeRegion,
  1876. CombineModeExclude));
  1877. }
  1878. Status ResetClip()
  1879. {
  1880. return SetStatus(DllExports::GdipResetClip(nativeGraphics));
  1881. }
  1882. Status TranslateClip(IN REAL dx,
  1883. IN REAL dy)
  1884. {
  1885. return SetStatus(DllExports::GdipTranslateClip(nativeGraphics, dx, dy));
  1886. }
  1887. Status TranslateClip(IN INT dx,
  1888. IN INT dy)
  1889. {
  1890. return SetStatus(DllExports::GdipTranslateClipI(nativeGraphics,
  1891. dx, dy));
  1892. }
  1893. Status GetClip(OUT Region* region) const
  1894. {
  1895. return SetStatus(DllExports::GdipGetClip(nativeGraphics,
  1896. region->nativeRegion));
  1897. }
  1898. Status GetClipBounds(OUT RectF* rect) const
  1899. {
  1900. return SetStatus(DllExports::GdipGetClipBounds(nativeGraphics, rect));
  1901. }
  1902. Status GetClipBounds(OUT Rect* rect) const
  1903. {
  1904. return SetStatus(DllExports::GdipGetClipBoundsI(nativeGraphics, rect));
  1905. }
  1906. BOOL IsClipEmpty() const
  1907. {
  1908. BOOL booln = FALSE;
  1909. SetStatus(DllExports::GdipIsClipEmpty(nativeGraphics, &booln));
  1910. return booln;
  1911. }
  1912. Status GetVisibleClipBounds(OUT RectF *rect) const
  1913. {
  1914. return SetStatus(DllExports::GdipGetVisibleClipBounds(nativeGraphics,
  1915. rect));
  1916. }
  1917. Status GetVisibleClipBounds(OUT Rect *rect) const
  1918. {
  1919. return SetStatus(DllExports::GdipGetVisibleClipBoundsI(nativeGraphics,
  1920. rect));
  1921. }
  1922. BOOL IsVisibleClipEmpty() const
  1923. {
  1924. BOOL booln = FALSE;
  1925. SetStatus(DllExports::GdipIsVisibleClipEmpty(nativeGraphics, &booln));
  1926. return booln;
  1927. }
  1928. BOOL IsVisible(IN INT x,
  1929. IN INT y) const
  1930. {
  1931. return IsVisible(Point(x,y));
  1932. }
  1933. BOOL IsVisible(IN const Point& point) const
  1934. {
  1935. BOOL booln = FALSE;
  1936. SetStatus(DllExports::GdipIsVisiblePointI(nativeGraphics,
  1937. point.X,
  1938. point.Y,
  1939. &booln));
  1940. return booln;
  1941. }
  1942. BOOL IsVisible(IN INT x,
  1943. IN INT y,
  1944. IN INT width,
  1945. IN INT height) const
  1946. {
  1947. return IsVisible(Rect(x, y, width, height));
  1948. }
  1949. BOOL IsVisible(IN const Rect& rect) const
  1950. {
  1951. BOOL booln = TRUE;
  1952. SetStatus(DllExports::GdipIsVisibleRectI(nativeGraphics,
  1953. rect.X,
  1954. rect.Y,
  1955. rect.Width,
  1956. rect.Height,
  1957. &booln));
  1958. return booln;
  1959. }
  1960. BOOL IsVisible(IN REAL x,
  1961. IN REAL y) const
  1962. {
  1963. return IsVisible(PointF(x, y));
  1964. }
  1965. BOOL IsVisible(IN const PointF& point) const
  1966. {
  1967. BOOL booln = FALSE;
  1968. SetStatus(DllExports::GdipIsVisiblePoint(nativeGraphics,
  1969. point.X,
  1970. point.Y,
  1971. &booln));
  1972. return booln;
  1973. }
  1974. BOOL IsVisible(IN REAL x,
  1975. IN REAL y,
  1976. IN REAL width,
  1977. IN REAL height) const
  1978. {
  1979. return IsVisible(RectF(x, y, width, height));
  1980. }
  1981. BOOL IsVisible(IN const RectF& rect) const
  1982. {
  1983. BOOL booln = TRUE;
  1984. SetStatus(DllExports::GdipIsVisibleRect(nativeGraphics,
  1985. rect.X,
  1986. rect.Y,
  1987. rect.Width,
  1988. rect.Height,
  1989. &booln));
  1990. return booln;
  1991. }
  1992. GraphicsState Save() const
  1993. {
  1994. GraphicsState gstate;
  1995. SetStatus(DllExports::GdipSaveGraphics(nativeGraphics, &gstate));
  1996. return gstate;
  1997. }
  1998. Status Restore(IN GraphicsState gstate)
  1999. {
  2000. return SetStatus(DllExports::GdipRestoreGraphics(nativeGraphics,
  2001. gstate));
  2002. }
  2003. GraphicsContainer BeginContainer(IN const RectF &dstrect,
  2004. IN const RectF &srcrect,
  2005. IN Unit unit)
  2006. {
  2007. GraphicsContainer state;
  2008. SetStatus(DllExports::GdipBeginContainer(nativeGraphics, &dstrect,
  2009. &srcrect, unit, &state));
  2010. return state;
  2011. }
  2012. GraphicsContainer BeginContainer(IN const Rect &dstrect,
  2013. IN const Rect &srcrect,
  2014. IN Unit unit)
  2015. {
  2016. GraphicsContainer state;
  2017. SetStatus(DllExports::GdipBeginContainerI(nativeGraphics, &dstrect,
  2018. &srcrect, unit, &state));
  2019. return state;
  2020. }
  2021. GraphicsContainer BeginContainer()
  2022. {
  2023. GraphicsContainer state;
  2024. SetStatus(DllExports::GdipBeginContainer2(nativeGraphics, &state));
  2025. return state;
  2026. }
  2027. Status EndContainer(IN GraphicsContainer state)
  2028. {
  2029. return SetStatus(DllExports::GdipEndContainer(nativeGraphics, state));
  2030. }
  2031. // Only valid when recording metafiles.
  2032. Status AddMetafileComment(IN const BYTE * data,
  2033. IN UINT sizeData)
  2034. {
  2035. return SetStatus(DllExports::GdipComment(nativeGraphics, sizeData, data));
  2036. }
  2037. static HPALETTE GetHalftonePalette()
  2038. {
  2039. return DllExports::GdipCreateHalftonePalette();
  2040. }
  2041. Status GetLastStatus() const
  2042. {
  2043. Status lastStatus = lastResult;
  2044. lastResult = Ok;
  2045. return lastStatus;
  2046. }
  2047. private:
  2048. Graphics(const Graphics &);
  2049. Graphics& operator=(const Graphics &);
  2050. protected:
  2051. Graphics(GpGraphics* graphics)
  2052. {
  2053. lastResult = Ok;
  2054. SetNativeGraphics(graphics);
  2055. }
  2056. VOID SetNativeGraphics(GpGraphics *graphics)
  2057. {
  2058. this->nativeGraphics = graphics;
  2059. }
  2060. Status SetStatus(Status status) const
  2061. {
  2062. if (status != Ok)
  2063. return (lastResult = status);
  2064. else
  2065. return status;
  2066. }
  2067. GpGraphics* GetNativeGraphics() const
  2068. {
  2069. return this->nativeGraphics;
  2070. }
  2071. GpPen* GetNativePen(const Pen* pen)
  2072. {
  2073. return pen->nativePen;
  2074. }
  2075. protected:
  2076. GpGraphics* nativeGraphics;
  2077. mutable Status lastResult;
  2078. };
  2079. //----------------------------------------------------------------------------
  2080. // Implementation of GraphicsPath methods that use Graphics
  2081. //----------------------------------------------------------------------------
  2082. // The GetBounds rectangle may not be the tightest bounds.
  2083. inline Status
  2084. GraphicsPath::GetBounds(
  2085. OUT RectF* bounds,
  2086. IN const Matrix* matrix,
  2087. IN const Pen* pen) const
  2088. {
  2089. GpMatrix* nativeMatrix = NULL;
  2090. GpPen* nativePen = NULL;
  2091. if (matrix)
  2092. nativeMatrix = matrix->nativeMatrix;
  2093. if (pen)
  2094. nativePen = pen->nativePen;
  2095. return SetStatus(DllExports::GdipGetPathWorldBounds(nativePath, bounds,
  2096. nativeMatrix, nativePen));
  2097. }
  2098. inline Status
  2099. GraphicsPath::GetBounds(
  2100. OUT Rect* bounds,
  2101. IN const Matrix* matrix,
  2102. IN const Pen* pen
  2103. ) const
  2104. {
  2105. GpMatrix* nativeMatrix = NULL;
  2106. GpPen* nativePen = NULL;
  2107. if (matrix)
  2108. nativeMatrix = matrix->nativeMatrix;
  2109. if (pen)
  2110. nativePen = pen->nativePen;
  2111. return SetStatus(DllExports::GdipGetPathWorldBoundsI(nativePath, bounds,
  2112. nativeMatrix, nativePen));
  2113. }
  2114. inline BOOL
  2115. GraphicsPath::IsVisible(
  2116. IN REAL x,
  2117. IN REAL y,
  2118. IN const Graphics* g) const
  2119. {
  2120. BOOL booln = FALSE;
  2121. GpGraphics* nativeGraphics = NULL;
  2122. if (g)
  2123. nativeGraphics = g->nativeGraphics;
  2124. SetStatus(DllExports::GdipIsVisiblePathPoint(nativePath,
  2125. x, y, nativeGraphics,
  2126. &booln));
  2127. return booln;
  2128. }
  2129. inline BOOL
  2130. GraphicsPath::IsVisible(
  2131. IN INT x,
  2132. IN INT y,
  2133. IN const Graphics* g) const
  2134. {
  2135. BOOL booln = FALSE;
  2136. GpGraphics* nativeGraphics = NULL;
  2137. if (g)
  2138. nativeGraphics = g->nativeGraphics;
  2139. SetStatus(DllExports::GdipIsVisiblePathPointI(nativePath,
  2140. x, y, nativeGraphics,
  2141. &booln));
  2142. return booln;
  2143. }
  2144. inline BOOL
  2145. GraphicsPath::IsOutlineVisible(
  2146. IN REAL x,
  2147. IN REAL y,
  2148. IN const Pen* pen,
  2149. IN const Graphics* g) const
  2150. {
  2151. BOOL booln = FALSE;
  2152. GpGraphics* nativeGraphics = NULL;
  2153. GpPen* nativePen = NULL;
  2154. if(g)
  2155. nativeGraphics = g->nativeGraphics;
  2156. if(pen)
  2157. nativePen = pen->nativePen;
  2158. SetStatus(DllExports::GdipIsOutlineVisiblePathPoint(nativePath,
  2159. x, y, nativePen, nativeGraphics,
  2160. &booln));
  2161. return booln;
  2162. }
  2163. inline BOOL
  2164. GraphicsPath::IsOutlineVisible(
  2165. IN INT x,
  2166. IN INT y,
  2167. IN const Pen* pen,
  2168. IN const Graphics* g) const
  2169. {
  2170. BOOL booln = FALSE;
  2171. GpGraphics* nativeGraphics = NULL;
  2172. GpPen* nativePen = NULL;
  2173. if(g)
  2174. nativeGraphics = g->nativeGraphics;
  2175. if(pen)
  2176. nativePen = pen->nativePen;
  2177. SetStatus(DllExports::GdipIsOutlineVisiblePathPointI(nativePath,
  2178. x, y, nativePen, nativeGraphics,
  2179. &booln));
  2180. return booln;
  2181. }
  2182. #endif