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 15 #ifndef _GDIPLUSLINECAPS_H 16 #define _GDIPLUSLINECAPS_H 17 18 inline 19 CustomLineCap::CustomLineCap( 20 IN const GraphicsPath* fillPath, 21 IN const GraphicsPath* strokePath, 22 IN LineCap baseCap, 23 IN REAL baseInset 24 ) 25 { 26 nativeCap = NULL; 27 GpPath* nativeFillPath = NULL; 28 GpPath* nativeStrokePath = NULL; 29 30 if(fillPath) 31 nativeFillPath = fillPath->nativePath; 32 if(strokePath) 33 nativeStrokePath = strokePath->nativePath; 34 35 lastResult = DllExports::GdipCreateCustomLineCap( 36 nativeFillPath, nativeStrokePath, 37 baseCap, baseInset, &nativeCap); 38 } 39 40 inline 41 CustomLineCap::CustomLineCap() 42 { 43 // This is used for default constructor for subclasses. 44 // So don't create a nativeCap. 45 46 nativeCap = NULL; 47 lastResult = Ok; 48 } 49 50 inline 51 CustomLineCap::~CustomLineCap() 52 { 53 DllExports::GdipDeleteCustomLineCap(nativeCap); 54 } 55 56 inline Status 57 CustomLineCap::SetStrokeCaps( 58 IN LineCap startCap, 59 IN LineCap endCap) 60 { 61 return SetStatus(DllExports::GdipSetCustomLineCapStrokeCaps(nativeCap, 62 startCap, endCap)); 63 } 64 65 inline Status 66 CustomLineCap::GetStrokeCaps( 67 OUT LineCap* startCap, 68 OUT LineCap* endCap) const 69 { 70 return SetStatus(DllExports::GdipGetCustomLineCapStrokeCaps(nativeCap, 71 startCap, endCap)); 72 } 73 74 inline Status 75 CustomLineCap::SetStrokeJoin( 76 IN LineJoin lineJoin) 77 { 78 return SetStatus(DllExports::GdipSetCustomLineCapStrokeJoin(nativeCap, lineJoin)); 79 } 80 81 inline LineJoin 82 CustomLineCap::GetStrokeJoin() const 83 { 84 LineJoin lineJoin; 85 86 SetStatus(DllExports::GdipGetCustomLineCapStrokeJoin(nativeCap, &lineJoin)); 87 88 return lineJoin; 89 } 90 91 inline Status 92 CustomLineCap::SetBaseCap(IN LineCap baseCap) 93 { 94 return SetStatus(DllExports::GdipSetCustomLineCapBaseCap(nativeCap, baseCap)); 95 } 96 97 inline LineCap 98 CustomLineCap::GetBaseCap() const 99 { 100 LineCap baseCap; 101 SetStatus(DllExports::GdipGetCustomLineCapBaseCap(nativeCap, &baseCap)); 102 103 return baseCap; 104 } 105 106 inline Status 107 CustomLineCap::SetBaseInset(IN REAL inset) 108 { 109 return SetStatus(DllExports::GdipSetCustomLineCapBaseInset(nativeCap, inset)); 110 } 111 112 inline REAL 113 CustomLineCap::GetBaseInset() const 114 { 115 REAL inset; 116 SetStatus(DllExports::GdipGetCustomLineCapBaseInset(nativeCap, &inset)); 117 118 return inset; 119 } 120 121 122 inline Status 123 CustomLineCap::SetWidthScale(IN REAL widthScale) 124 { 125 return SetStatus(DllExports::GdipSetCustomLineCapWidthScale(nativeCap, widthScale)); 126 } 127 128 inline REAL 129 CustomLineCap::GetWidthScale() const 130 { 131 REAL widthScale; 132 SetStatus(DllExports::GdipGetCustomLineCapWidthScale(nativeCap, &widthScale)); 133 134 return widthScale; 135 } 136 137 inline CustomLineCap* 138 CustomLineCap::Clone() const 139 { 140 GpCustomLineCap *newNativeLineCap = NULL; 141 142 SetStatus(DllExports::GdipCloneCustomLineCap(nativeCap, &newNativeLineCap)); 143 144 if (lastResult == Ok) 145 { 146 CustomLineCap *newLineCap = new CustomLineCap(newNativeLineCap, lastResult); 147 if (newLineCap == NULL) 148 { 149 SetStatus(DllExports::GdipDeleteCustomLineCap(newNativeLineCap)); 150 } 151 152 return newLineCap; 153 } 154 155 return NULL; 156 } 157 158 class AdjustableArrowCap : public CustomLineCap 159 { 160 public: 161 162 AdjustableArrowCap( 163 IN REAL height, 164 IN REAL width, 165 IN BOOL isFilled = TRUE 166 ) 167 { 168 GpAdjustableArrowCap* cap = NULL; 169 170 lastResult = DllExports::GdipCreateAdjustableArrowCap( 171 height, width, isFilled, &cap); 172 SetNativeCap(cap); 173 } 174 175 Status SetHeight(IN REAL height) 176 { 177 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 178 return SetStatus(DllExports::GdipSetAdjustableArrowCapHeight( 179 cap, height)); 180 } 181 182 REAL GetHeight() const 183 { 184 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 185 REAL height; 186 SetStatus(DllExports::GdipGetAdjustableArrowCapHeight( 187 cap, &height)); 188 189 return height; 190 } 191 192 Status SetWidth(IN REAL width) 193 { 194 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 195 return SetStatus(DllExports::GdipSetAdjustableArrowCapWidth( 196 cap, width)); 197 } 198 199 REAL GetWidth() const 200 { 201 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 202 REAL width; 203 SetStatus(DllExports::GdipGetAdjustableArrowCapWidth( 204 cap, &width)); 205 206 return width; 207 } 208 209 Status SetMiddleInset(IN REAL middleInset) 210 { 211 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 212 return SetStatus(DllExports::GdipSetAdjustableArrowCapMiddleInset( 213 cap, middleInset)); 214 } 215 216 REAL GetMiddleInset() const 217 { 218 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 219 REAL middleInset; 220 SetStatus(DllExports::GdipGetAdjustableArrowCapMiddleInset( 221 cap, &middleInset)); 222 223 return middleInset; 224 } 225 226 Status SetFillState(IN BOOL isFilled) 227 { 228 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 229 return SetStatus(DllExports::GdipSetAdjustableArrowCapFillState( 230 cap, isFilled)); 231 } 232 233 BOOL IsFilled() const 234 { 235 GpAdjustableArrowCap* cap = (GpAdjustableArrowCap*) nativeCap; 236 BOOL isFilled; 237 SetStatus(DllExports::GdipGetAdjustableArrowCapFillState( 238 cap, &isFilled)); 239 240 return isFilled; 241 } 242 243 #ifdef DCR_USE_NEW_250932 244 245 private: 246 AdjustableArrowCap(const AdjustableArrowCap &); 247 AdjustableArrowCap& operator=(const AdjustableArrowCap &); 248 249 #endif 250 251 }; 252 253 #endif 254