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.
 
 
 
 
 
 

254 rivejä
6.1 KiB

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