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.

245 lines
6.0 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 2000, Microsoft Corp. All Rights Reserved.
  4. *
  5. * Abstract:
  6. *
  7. * APIs for Custom Line Caps
  8. *
  9. * Revision History:
  10. *
  11. * 02/23/2000 ikkof
  12. * Created it.
  13. *
  14. \**************************************************************************/
  15. #ifndef _GDIPLUSLINECAPS_H
  16. #define _GDIPLUSLINECAPS_H
  17. inline
  18. CustomLineCap::CustomLineCap(
  19. IN const GraphicsPath* fillPath,
  20. IN const GraphicsPath* strokePath,
  21. IN LineCap baseCap,
  22. IN REAL baseInset
  23. )
  24. {
  25. nativeCap = NULL;
  26. GpPath* nativeFillPath = NULL;
  27. GpPath* nativeStrokePath = NULL;
  28. if(fillPath)
  29. nativeFillPath = fillPath->nativePath;
  30. if(strokePath)
  31. nativeStrokePath = strokePath->nativePath;
  32. lastResult = DllExports::GdipCreateCustomLineCap(
  33. nativeFillPath, nativeStrokePath,
  34. baseCap, baseInset, &nativeCap);
  35. }
  36. inline
  37. CustomLineCap::CustomLineCap()
  38. {
  39. // This is used for default constructor for subclasses.
  40. // So don't create a nativeCap.
  41. nativeCap = NULL;
  42. lastResult = Ok;
  43. }
  44. inline
  45. CustomLineCap::~CustomLineCap()
  46. {
  47. DllExports::GdipDeleteCustomLineCap(nativeCap);
  48. }
  49. inline Status
  50. CustomLineCap::SetStrokeCaps(
  51. IN LineCap startCap,
  52. IN LineCap endCap)
  53. {
  54. return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap,
  55. startCap, endCap));
  56. }
  57. inline Status
  58. CustomLineCap::GetStrokeCaps(
  59. OUT LineCap* startCap,
  60. OUT LineCap* endCap) const
  61. {
  62. return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap,
  63. startCap, endCap));
  64. }
  65. inline Status
  66. CustomLineCap::SetStrokeJoin(
  67. IN LineJoin lineJoin)
  68. {
  69. return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin));
  70. }
  71. inline LineJoin
  72. CustomLineCap::GetStrokeJoin() const
  73. {
  74. LineJoin lineJoin;
  75. SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin));
  76. return lineJoin;
  77. }
  78. inline Status
  79. CustomLineCap::SetBaseCap(IN LineCap baseCap)
  80. {
  81. return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap));
  82. }
  83. inline LineCap
  84. CustomLineCap::GetBaseCap() const
  85. {
  86. LineCap baseCap;
  87. SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap));
  88. return baseCap;
  89. }
  90. inline Status
  91. CustomLineCap::SetBaseInset(IN REAL inset)
  92. {
  93. return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset));
  94. }
  95. inline REAL
  96. CustomLineCap::GetBaseInset() const
  97. {
  98. REAL inset;
  99. SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
  100. return inset;
  101. }
  102. inline Status
  103. CustomLineCap::SetWidthScale(IN REAL widthScale)
  104. {
  105. return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale));
  106. }
  107. inline REAL
  108. CustomLineCap::GetWidthScale() const
  109. {
  110. REAL widthScale;
  111. SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale));
  112. return widthScale;
  113. }
  114. inline CustomLineCap*
  115. CustomLineCap::Clone() const
  116. {
  117. GpCustomLineCap *newNativeLineCap = NULL;
  118. SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &newNativeLineCap));
  119. if (lastResult == Ok)
  120. {
  121. CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap, lastResult);
  122. if (newLineCap == NULL)
  123. {
  124. SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap));
  125. }
  126. return newLineCap;
  127. }
  128. return NULL;
  129. }
  130. class AdjustableArrowCap : public CustomLineCap
  131. {
  132. public:
  133. AdjustableArrowCap(
  134. IN REAL height,
  135. IN REAL width,
  136. IN BOOL isFilled = TRUE
  137. )
  138. {
  139. GpAdjustableArrowCap* cap = NULL;
  140. lastResult = DllExports::GdipCreateAdjustableArrowCap(
  141. height, width, isFilled, &cap);
  142. SetNativeCap(cap);
  143. }
  144. Status SetHeight(IN REAL height)
  145. {
  146. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  147. return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(
  148. cap, height));
  149. }
  150. REAL GetHeight() const
  151. {
  152. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  153. REAL height;
  154. SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(
  155. cap, &height));
  156. return height;
  157. }
  158. Status SetWidth(IN REAL width)
  159. {
  160. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  161. return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(
  162. cap, width));
  163. }
  164. REAL GetWidth() const
  165. {
  166. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  167. REAL width;
  168. SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(
  169. cap, &width));
  170. return width;
  171. }
  172. Status SetMiddleInset(IN REAL middleInset)
  173. {
  174. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  175. return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
  176. cap, middleInset));
  177. }
  178. REAL GetMiddleInset() const
  179. {
  180. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  181. REAL middleInset;
  182. SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
  183. cap, &middleInset));
  184. return middleInset;
  185. }
  186. Status SetFillState(IN BOOL isFilled)
  187. {
  188. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  189. return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(
  190. cap, isFilled));
  191. }
  192. BOOL IsFilled() const
  193. {
  194. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  195. BOOL isFilled;
  196. SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(
  197. cap, &isFilled));
  198. return isFilled;
  199. }
  200. };
  201. #endif