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.

262 lines
6.6 KiB

  1. /**************************************************************************\
  2. *
  3. * Copyright (c) 2000-2001, Microsoft Corp. All Rights Reserved.
  4. *
  5. * Module Name:
  6. *
  7. * GdiplusLineCaps.h
  8. *
  9. * Abstract:
  10. *
  11. * GDI+ CustomLineCap APIs
  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. nativeCap = NULL;
  39. lastResult = Ok;
  40. }
  41. inline
  42. CustomLineCap::~CustomLineCap()
  43. {
  44. DllExports::GdipDeleteCustomLineCap(nativeCap);
  45. }
  46. inline Status
  47. CustomLineCap::SetStrokeCaps(
  48. IN LineCap startCap,
  49. IN LineCap endCap)
  50. {
  51. return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap,
  52. startCap, endCap));
  53. }
  54. inline Status
  55. CustomLineCap::GetStrokeCaps(
  56. OUT LineCap* startCap,
  57. OUT LineCap* endCap) const
  58. {
  59. return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap,
  60. startCap, endCap));
  61. }
  62. inline Status
  63. CustomLineCap::SetStrokeJoin(
  64. IN LineJoin lineJoin)
  65. {
  66. return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap,
  67. lineJoin));
  68. }
  69. inline LineJoin
  70. CustomLineCap::GetStrokeJoin() const
  71. {
  72. LineJoin lineJoin;
  73. SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap,
  74. &lineJoin));
  75. return lineJoin;
  76. }
  77. inline Status
  78. CustomLineCap::SetBaseCap(IN LineCap baseCap)
  79. {
  80. return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap,
  81. 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,
  94. inset));
  95. }
  96. inline REAL
  97. CustomLineCap::GetBaseInset() const
  98. {
  99. REAL inset;
  100. SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset));
  101. return inset;
  102. }
  103. inline Status
  104. CustomLineCap::SetWidthScale(IN REAL widthScale)
  105. {
  106. return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap,
  107. widthScale));
  108. }
  109. inline REAL
  110. CustomLineCap::GetWidthScale() const
  111. {
  112. REAL widthScale;
  113. SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap,
  114. &widthScale));
  115. return widthScale;
  116. }
  117. inline CustomLineCap*
  118. CustomLineCap::Clone() const
  119. {
  120. GpCustomLineCap *newNativeLineCap = NULL;
  121. SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap,
  122. &newNativeLineCap));
  123. if (lastResult == Ok)
  124. {
  125. CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap,
  126. lastResult);
  127. if (newLineCap == NULL)
  128. {
  129. SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap));
  130. }
  131. return newLineCap;
  132. }
  133. return NULL;
  134. }
  135. inline Status
  136. CustomLineCap::GetLastStatus() const
  137. {
  138. Status lastStatus = lastResult;
  139. lastResult = Ok;
  140. return (lastStatus);
  141. }
  142. class AdjustableArrowCap : public CustomLineCap
  143. {
  144. public:
  145. AdjustableArrowCap(
  146. IN REAL height,
  147. IN REAL width,
  148. IN BOOL isFilled = TRUE
  149. )
  150. {
  151. GpAdjustableArrowCap* cap = NULL;
  152. lastResult = DllExports::GdipCreateAdjustableArrowCap(
  153. height, width, isFilled, &cap);
  154. SetNativeCap(cap);
  155. }
  156. Status SetHeight(IN REAL height)
  157. {
  158. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  159. return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight(
  160. cap, height));
  161. }
  162. REAL GetHeight() const
  163. {
  164. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  165. REAL height;
  166. SetStatus(DllExports::GdipGetAdjustableArrowCapHeight(
  167. cap, &height));
  168. return height;
  169. }
  170. Status SetWidth(IN REAL width)
  171. {
  172. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  173. return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth(
  174. cap, width));
  175. }
  176. REAL GetWidth() const
  177. {
  178. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  179. REAL width;
  180. SetStatus(DllExports::GdipGetAdjustableArrowCapWidth(
  181. cap, &width));
  182. return width;
  183. }
  184. Status SetMiddleInset(IN REAL middleInset)
  185. {
  186. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  187. return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset(
  188. cap, middleInset));
  189. }
  190. REAL GetMiddleInset() const
  191. {
  192. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  193. REAL middleInset;
  194. SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset(
  195. cap, &middleInset));
  196. return middleInset;
  197. }
  198. Status SetFillState(IN BOOL isFilled)
  199. {
  200. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  201. return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState(
  202. cap, isFilled));
  203. }
  204. BOOL IsFilled() const
  205. {
  206. GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap;
  207. BOOL isFilled;
  208. SetStatus(DllExports::GdipGetAdjustableArrowCapFillState(
  209. cap, &isFilled));
  210. return isFilled;
  211. }
  212. private:
  213. AdjustableArrowCap(const AdjustableArrowCap &);
  214. AdjustableArrowCap& operator=(const AdjustableArrowCap &);
  215. };
  216. #endif