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.

125 lines
3.4 KiB

  1. /**************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * End Cap Creator.
  8. *
  9. * Abstract:
  10. *
  11. * This module defines a class called GpEndCapCreator. This class is
  12. * responsible for constructing a path containing all the custom endcaps
  13. * and anchor endcaps for a given path. These are correctly transformed
  14. * and positioned.
  15. *
  16. * This class is used to create and position all the endcaps for a
  17. * given path and pen. This class is also responsible for trimming
  18. * the original path down so that it fits the end caps properly.
  19. * This class will handle all types of end caps except the base endcaps
  20. * (round, flat and triangle) which may be used as dash caps.
  21. * Caps that are handled are CustomCaps and the 3 Anchor caps (round,
  22. * diamond and arrow). Note that the round anchor cap is distinct from
  23. * the round base cap.
  24. *
  25. * Created:
  26. *
  27. * 10/09/2000 asecchia
  28. * Created it.
  29. *
  30. **************************************************************************/
  31. #ifndef _ENDCAP_HPP
  32. #define _ENDCAP_HPP
  33. class GpEndCapCreator
  34. {
  35. public:
  36. GpEndCapCreator(
  37. GpPath *path,
  38. DpPen *pen,
  39. const GpMatrix *m,
  40. REAL dpi_x,
  41. REAL dpi_y,
  42. bool antialias
  43. );
  44. ~GpEndCapCreator();
  45. GpStatus CreateCapPath(GpPath **caps);
  46. static bool PenNeedsEndCapCreator(const DpPen *pen);
  47. protected:
  48. GpStatus GetCapsForSubpath(
  49. GpPath **startCapPath,
  50. GpPath **endCapPath,
  51. GpPointF *centerPoints,
  52. BYTE *centerTypes,
  53. INT centerCount
  54. );
  55. GpStatus SetCustomStrokeCaps(
  56. GpCustomLineCap* customStartCap,
  57. GpCustomLineCap* customEndCap,
  58. const GpPointF& startPoint,
  59. const GpPointF& endPoint,
  60. const GpPointF *centerPoints,
  61. const BYTE *centerTypes,
  62. INT centerPointCount,
  63. DynPointFArray *startCapPoints,
  64. DynPointFArray *endCapPoints,
  65. DynByteArray *startCapTypes,
  66. DynByteArray *endCapTypes
  67. );
  68. GpStatus SetCustomFillCaps(
  69. GpCustomLineCap* customStartCap,
  70. GpCustomLineCap* customEndCap,
  71. const GpPointF& startPoint,
  72. const GpPointF& endPoint,
  73. const GpPointF *centerPoints,
  74. const BYTE *centerTypes,
  75. INT centerPointCount,
  76. DynPointFArray *startCapPoints,
  77. DynPointFArray *endCapPoints,
  78. DynByteArray *startCapTypes,
  79. DynByteArray *endCapTypes
  80. );
  81. void ComputeCapGradient(
  82. GpIterator<GpPointF> &pointIterator,
  83. BYTE *types,
  84. IN REAL lengthSquared,
  85. IN REAL baseInset,
  86. OUT GpVector2D *grad
  87. );
  88. VOID PrepareDpPenForCustomCap(
  89. DpPen* pen,
  90. const GpCustomLineCap* customCap
  91. ) const;
  92. static GpCustomLineCap *ReferenceArrowAnchor();
  93. static GpCustomLineCap *ReferenceDiamondAnchor();
  94. static GpCustomLineCap *ReferenceRoundAnchor();
  95. static GpCustomLineCap *ReferenceSquareAnchor();
  96. // Data member variables.
  97. GpPath *Path;
  98. DpPen *Pen;
  99. GpMatrix XForm;
  100. bool Antialias;
  101. GpCustomLineCap *StartCap;
  102. GpCustomLineCap *EndCap;
  103. // Note that the widener doesn't use these, so we should actually remove
  104. // this and the parameters to the widener.
  105. REAL DpiX, DpiY;
  106. };
  107. #endif