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.

94 lines
3.2 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * Copyright (c) 1999 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * Region to Path Conversion Class
  8. *
  9. * Abstract:
  10. *
  11. * Converts an arbitrary GpRegion to GpPath equivalent. It first
  12. * analyzes the GpRegion for simple conversion cases which it handles.
  13. * If the region is complex, then it invokes Kirk Olynyk's region to
  14. * path conversion routine.
  15. *
  16. * Notes:
  17. *
  18. *
  19. * Created:
  20. *
  21. * 10/29/1999 ericvan
  22. *
  23. \**************************************************************************/
  24. /*********************************Class************************************\
  25. * class RTP_EPATHOBJ : publci EPATHOBJ *
  26. * *
  27. * Adds diagonalization. *
  28. * *
  29. * Public Interface: *
  30. * *
  31. * History: *
  32. * Wed 15-Sep-1993 10:06:05 by Kirk Olynyk [kirko] *
  33. * Wrote it. *
  34. \**************************************************************************/
  35. /**************************************************************************\
  36. * class RTP_PATHMEMOBJ : public PATHMEMOBJ *
  37. * *
  38. * This class is for converting regions to paths *
  39. * *
  40. \**************************************************************************/
  41. const FLONG LastPointFlag = 1;
  42. const UINT MAX_ENUMERATERECTS = 20;
  43. class RegionToPath
  44. {
  45. private:
  46. BOOL bMoreToEnum;
  47. const DpRegion *region;
  48. DynByteArray *types;
  49. DynByteArray inTypes; // accumulated types
  50. DynPointArray *points;
  51. DynPointArray inPoints; // accumulated points
  52. GpPoint* curPoint;
  53. BYTE* curType;
  54. GpPoint* firstPoint; // first point in current subpath
  55. GpPoint* lastPoint;
  56. BOOL endSubpath;
  57. INT outPts; // number of points in output buffer
  58. GpPoint writePts[2]; // output buffer
  59. GpPoint AB; // aptfx[1] - aptfx[0]
  60. INT curIndex; // start of circular buffer (current corner)
  61. INT lastCount; //
  62. INT numPts;
  63. FLONG flags[3];
  64. GpPoint pts[3];
  65. FLONG afl[3]; // array of flags for the vertices
  66. UINT aptfx[3]; // array of vertex positions
  67. public:
  68. RegionToPath() {}
  69. ~RegionToPath() {}
  70. BOOL ConvertRegionToPath(const DpRegion* region,
  71. DynPointArray& newPoints,
  72. DynByteArray& newTypes);
  73. private:
  74. BOOL DiagonalizePath();
  75. BOOL FetchNextPoint();
  76. BOOL WritePoint();
  77. };