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.

161 lines
4.7 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 1998-2000 Microsoft Corporation
  4. *
  5. * Abstract:
  6. *
  7. * Contains the definiton of the DpPen structure which stores all of the
  8. * state needed by drivers to render with a pen.
  9. *
  10. * Notes:
  11. *
  12. *
  13. *
  14. * Created:
  15. *
  16. * 12/01/1998 andrewgo
  17. * Created it.
  18. * 03/24/1999 agodfrey
  19. * Moved into separate file.
  20. * 12/8/99 bhouse
  21. * Major overhaul of DpPen. No longer used as base class of GpPen.
  22. * Moved all driver required state into DpPen. Changed to struct.
  23. *
  24. \**************************************************************************/
  25. #ifndef _DPPEN_HPP
  26. #define _DPPEN_HPP
  27. //--------------------------------------------------------------------------
  28. // Represent pen information
  29. //--------------------------------------------------------------------------
  30. struct DpPen
  31. {
  32. BOOL IsEqual(const DpPen * pen) const
  33. {
  34. //!!! what to do about DeviceBrush and DashArray?
  35. BOOL isEqual =
  36. Type == pen->Type &&
  37. Width == pen->Width &&
  38. Unit == pen->Unit &&
  39. StartCap == pen->StartCap &&
  40. EndCap == pen->EndCap &&
  41. Join == pen->Join &&
  42. MiterLimit == pen->MiterLimit &&
  43. PenAlignment == pen->PenAlignment &&
  44. DashStyle == pen->DashStyle &&
  45. DashCap == pen->DashCap &&
  46. DashCount == pen->DashCount &&
  47. DashOffset == pen->DashOffset;
  48. if(isEqual)
  49. {
  50. if(CustomStartCap || pen->CustomStartCap)
  51. {
  52. if(CustomStartCap && pen->CustomStartCap)
  53. isEqual = CustomStartCap->IsEqual(pen->CustomStartCap);
  54. else
  55. isEqual = FALSE; // One of them doesn't have
  56. // a custom cap.
  57. }
  58. }
  59. if(isEqual)
  60. {
  61. if(CustomEndCap || pen->CustomEndCap)
  62. {
  63. if(CustomEndCap && pen->CustomEndCap)
  64. isEqual = CustomEndCap->IsEqual(pen->CustomEndCap);
  65. else
  66. isEqual = FALSE; // One of them doesn't have
  67. // a custom cap.
  68. }
  69. }
  70. return isEqual;
  71. }
  72. // Can the path be rendered using our nominal width pen code?
  73. BOOL IsOnePixelWideSolid(const GpMatrix *worldToDevice, REAL dpiX) const;
  74. BOOL IsOnePixelWide(const GpMatrix *worldToDevice, REAL dpiX) const;
  75. // See if the pen has a non-identity transform.
  76. BOOL HasTransform() const
  77. {
  78. return !Xform.IsIdentity();
  79. }
  80. BOOL IsSimple() const
  81. {
  82. return (!((DashStyle != DashStyleSolid) ||
  83. (StartCap & LineCapAnchorMask) ||
  84. (EndCap & LineCapAnchorMask) ||
  85. (DashCap & LineCapAnchorMask)
  86. ));
  87. }
  88. BOOL IsCompound() const
  89. {
  90. return ((CompoundCount > 0) && (CompoundArray != NULL));
  91. }
  92. BOOL IsCenterNoAnchor() const
  93. {
  94. return (!((StartCap & LineCapAnchorMask) ||
  95. (EndCap & LineCapAnchorMask) ||
  96. (DashCap & LineCapAnchorMask)
  97. ));
  98. }
  99. VOID InitDefaults()
  100. {
  101. Type = PenTypeSolidColor;
  102. Width = 1;
  103. Unit = UnitWorld;
  104. StartCap = LineCapFlat;
  105. EndCap = LineCapFlat;
  106. Join = LineJoinMiter;
  107. MiterLimit = 10; // PS's default miter limit.
  108. PenAlignment = PenAlignmentCenter;
  109. Brush = NULL;
  110. DashStyle = DashStyleSolid;
  111. DashCap = LineCapFlat;
  112. DashCount = 0;
  113. DashOffset = 0;
  114. DashArray = NULL;
  115. CompoundCount = 0;
  116. CompoundArray = NULL;
  117. CustomStartCap = NULL;
  118. CustomEndCap = NULL;
  119. }
  120. GpPenType Type;
  121. REAL Width;
  122. GpUnit Unit;
  123. GpLineCap StartCap;
  124. GpLineCap EndCap;
  125. GpLineJoin Join;
  126. REAL MiterLimit;
  127. GpPenAlignment PenAlignment;
  128. const DpBrush * Brush;
  129. GpMatrix Xform;
  130. GpDashStyle DashStyle;
  131. GpLineCap DashCap; // In v2, we should use GpDashCap for this
  132. INT DashCount;
  133. REAL DashOffset;
  134. REAL* DashArray;
  135. INT CompoundCount;
  136. REAL* CompoundArray;
  137. DpCustomLineCap* CustomStartCap;
  138. DpCustomLineCap* CustomEndCap;
  139. };
  140. #endif