[PSDK][GDIPLUS] Further Pen work
[reactos.git] / reactos / sdk / include / psdk / gdipluspen.h
1 /*
2 * GdiPlusPen.h
3 *
4 * Windows GDI+
5 *
6 * This file is part of the w32api package.
7 *
8 * THIS SOFTWARE IS NOT COPYRIGHTED
9 *
10 * This source code is offered for use in the public domain. You may
11 * use, modify or distribute it freely.
12 *
13 * This code is distributed in the hope that it will be useful but
14 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
15 * DISCLAIMED. This includes but is not limited to warranties of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 */
18
19 #ifndef _GDIPLUSPEN_H
20 #define _GDIPLUSPEN_H
21
22 class CustomLineCap;
23
24 class Pen : public GdiplusBase
25 {
26 friend class Graphics;
27
28 public:
29 Pen(const Brush *brush, REAL width = 1.0f)
30 {
31 }
32
33 Pen(const Color &color, REAL width = 1.0f)
34 {
35 Unit unit = UnitWorld;
36 pen = NULL;
37 status = DllExports::GdipCreatePen1(color.GetValue(),
38 width,
39 unit,
40 &pen);
41 }
42
43 Pen *Clone(VOID)
44 {
45 return NULL;
46 }
47
48 PenAlignment GetAlignment(VOID)
49 {
50 PenAlignment penAlignment;
51 SetStatus(DllExports::GdipGetPenMode(pen, &penAlignment));
52 return penAlignment;
53 }
54
55 Brush *GetBrush(VOID)
56 {
57 return NULL;
58 }
59
60 Status GetColor(Color *color)
61 {
62 ARGB argb;
63 Status status = SetStatus(DllExports::GdipGetPenColor(pen, &argb));
64 if (color)
65 color->SetValue(argb);
66 return status;
67 }
68
69 Status GetCompoundArray(REAL *compoundArray, INT count)
70 {
71 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipGetPenCompoundArray(pen, count));
72 }
73
74 INT GetCompoundArrayCount(VOID)
75 {
76 INT count;
77 SetStatus(DllExports::GdipGetPenCompoundCount(pen, &count));
78 return count;
79 }
80
81 Status GetCustomEndCap(CustomLineCap *customCap)
82 {
83 return NotImplemented;
84 }
85
86 Status GetCustomStartCap(CustomLineCap *customCap)
87 {
88 return NotImplemented;
89 }
90
91 DashCap GetDashCap(VOID)
92 {
93 DashCap dashCap;
94 SetStatus(DllExports::GdipGetPenDashCap197819(pen, &dashCap));
95 return dashCap;
96 }
97
98 REAL GetDashOffset(VOID)
99 {
100 REAL offset;
101 SetStatus(DllExports::GdipGetPenDashOffset(pen, &offset));
102 return offset;
103 }
104
105 Status GetDashPattern(REAL *dashArray, INT count)
106 {
107 return SetStatus(DllExports::GdipGetPenDashArray(pen, dashArray, count));
108 }
109
110 INT GetDashPatternCount(VOID)
111 {
112 INT count;
113 SetStatus(DllExports::GdipGetPenDashCount(pen, &count));
114 return count;
115 }
116
117 DashStyle GetDashStyle(VOID)
118 {
119 DashStyle dashStyle;
120 SetStatus(DllExports::GdipGetPenDashStyle(pen, &dashStyle));
121 return dashStyle;
122 }
123
124 LineCap GetEndCap(VOID)
125 {
126 LineCap endCap;
127 SetStatus(DllExports::GdipGetPenEndCap(pen, &endCap));
128 return endCap;
129 }
130
131 Status GetLastStatus(VOID)
132 {
133 return status;
134 }
135
136 LineJoin GetLineJoin(VOID)
137 {
138 LineJoin lineJoin;
139 SetStatus(DllExports::GdipGetPenLineJoin(pen, &lineJoin));
140 return lineJoin;
141 }
142
143 REAL GetMiterLimit(VOID)
144 {
145 REAL miterLimit;
146 SetStatus(DllExports::GdipGetPenMiterLimit(pen, &miterLimit));
147 return miterLimit;
148 }
149
150 PenType GetPenType(VOID)
151 {
152 PenType type;
153 SetStatus(DllExports::GdipGetPenFillType(pen, &type));
154 return type;
155 }
156
157 LineCap GetStartCap(VOID)
158 {
159 LineCap startCap;
160 SetStatus(DllExports::GdipGetPenStartCap(pen, &startCap));
161 return startCap;
162 }
163
164 Status GetTransform(Matrix *matrix)
165 {
166 return NotImplemented;
167 }
168
169 REAL GetWidth(VOID)
170 {
171 REAL width;
172 SetStatus(DllExports::GdipGetPenWidth(pen, &width));
173 return width;
174 }
175
176 Status MultiplyTransform(Matrix *matrix, MatrixOrder order)
177 {
178 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipMultiplyPenTransform(pen, matrix ? matrix->matrix : NULL, order));
179 }
180
181 Status ResetTransform(VOID)
182 {
183 return SetStatus(DllExports::GdipResetPenTransform(pen));
184 }
185
186 Status RotateTransform(REAL angle, MatrixOrder order)
187 {
188 return NotImplemented; // FIXME: not available: SetStatus(DllExports::GdipRotatePenTransform(pen, angle, order));
189 }
190
191 Status ScaleTransform(REAL sx, REAL sy, MatrixOrder order)
192 {
193 return SetStatus(DllExports::GdipScalePenTransform(pen, sx, sy, order));
194 }
195
196 Status SetAlignment(PenAlignment penAlignment)
197 {
198 return SetStatus(DllExports::GdipSetPenMode(pen, penAlignment));
199 }
200
201 Status SetBrush(const Brush *brush)
202 {
203 return NotImplemented; // FIXME: Brush unimplemented SetStatus(DllExports::GdipSetPenBrushFill(pen, brush ? brush->brush : NULL));
204 }
205
206 Status SetColor(const Color &color)
207 {
208 return SetStatus(DllExports::GdipSetPenColor(pen, color.GetValue()));
209 }
210
211 Status SetCompoundArray(const REAL *compoundArray, INT count)
212 {
213 return SetStatus(DllExports::GdipSetPenCompoundArray(pen, compoundArray, count));
214 }
215
216 Status SetCustomEndCap(const CustomLineCap *customCap)
217 {
218 return NotImplemented;
219 }
220
221 Status SetCustomStartCap(const CustomLineCap *customCap)
222 {
223 return NotImplemented;
224 }
225
226 Status SetDashCap(DashCap dashCap)
227 {
228 return SetStatus(DllExports::GdipSetPenDashCap197819(pen, dashCap));
229 }
230
231 Status SetDashOffset(REAL dashOffset)
232 {
233 return SetStatus(DllExports::GdipSetPenDashOffset(pen, dashOffset));
234 }
235
236 Status SetDashPattern(const REAL *dashArray, INT count)
237 {
238 return SetStatus(DllExports::GdipSetPenDashArray(pen, dashArray, count));
239 }
240
241 Status SetDashStyle(DashStyle dashStyle)
242 {
243 return SetStatus(DllExports::GdipSetPenDashStyle(pen, dashStyle));
244 }
245
246 Status SetEndCap(LineCap endCap)
247 {
248 return SetStatus(DllExports::GdipSetPenEndCap(pen, endCap));
249 }
250
251 Status SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
252 {
253 return SetStatus(DllExports::GdipSetPenLineCap197819(pen, startCap, endCap, dashCap));
254 }
255
256 Status SetLineJoin(LineJoin lineJoin)
257 {
258 return SetStatus(DllExports::GdipSetPenLineJoin(pen, lineJoin));
259 }
260
261 Status SetMiterLimit(REAL miterLimit)
262 {
263 return SetStatus(DllExports::GdipSetPenMiterLimit(pen, miterLimit));
264 }
265
266 Status SetStartCap(LineCap startCap)
267 {
268 return SetStatus(DllExports::GdipSetPenStartCap(pen, startCap));
269 }
270
271 Status SetTransform(const Matrix *matrix)
272 {
273 return SetStatus(DllExports::GdipSetPenTransform(pen, matrix ? matrix->matrix : NULL));
274 }
275
276 Status SetWidth(REAL width)
277 {
278 return SetStatus(DllExports::GdipSetPenWidth(pen, width));
279 }
280
281 private:
282 GpPen *pen;
283
284 private:
285 mutable Status status;
286
287 Status SetStatus(Status status) const
288 {
289 if (status == Ok)
290 return status;
291 this->status = status;
292 return status;
293 }
294 };
295
296 #endif /* _GDIPLUSPEN_H */