ReactOS 0.4.16-dev-340-g0540c21
gdipluspen.h
Go to the documentation of this file.
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
22class Pen : public GdiplusBase
23{
24 public:
25 friend class Graphics;
26 friend class GraphicsPath;
27
28 Pen(const Brush *brush, REAL width = 1.0f) : nativePen(NULL)
29 {
30 lastStatus = DllExports::GdipCreatePen2(getNat(brush), width, UnitWorld, &nativePen);
31 }
32
33 Pen(const Color &color, REAL width = 1.0f) : nativePen(NULL)
34 {
35 lastStatus = DllExports::GdipCreatePen1(color.GetValue(), width, UnitWorld, &nativePen);
36 }
37
39 {
40 DllExports::GdipDeletePen(nativePen);
41 }
42
43 Pen *
45 {
46 GpPen *clonePen = NULL;
47 SetStatus(DllExports::GdipClonePen(nativePen, &clonePen));
48 if (lastStatus != Ok)
49 return NULL;
50 Pen *newPen = new Pen(clonePen, lastStatus);
51 if (!newPen)
52 DllExports::GdipDeletePen(clonePen);
53 return newPen;
54 }
55
58 {
59 PenAlignment penAlignment;
60 SetStatus(DllExports::GdipGetPenMode(nativePen, &penAlignment));
61 return penAlignment;
62 }
63
64 Brush *
66 {
67 // FIXME
68 return NULL;
69 }
70
71 Status
73 {
74 if (!color)
76
77 ARGB argb;
78 SetStatus(DllExports::GdipGetPenColor(nativePen, &argb));
79 color->SetValue(argb);
80 return lastStatus;
81 }
82
83 Status
84 GetCompoundArray(REAL *compoundArray, INT count)
85 {
86 if (!compoundArray || count <= 0)
88#if 1
90#else
91 return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen, compoundArray, count));
92#endif
93 }
94
95 INT
97 {
98 INT count = 0;
99 SetStatus(DllExports::GdipGetPenCompoundCount(nativePen, &count));
100 return count;
101 }
102
103 Status
105 {
106 if (!customCap)
108
109 return SetStatus(DllExports::GdipGetPenCustomEndCap(nativePen, &getNat(customCap)));
110 }
111
112 Status
114 {
115 if (!customCap)
117
118 return SetStatus(DllExports::GdipGetPenCustomStartCap(nativePen, &getNat(customCap)));
119 }
120
121 DashCap
123 {
124 DashCap dashCap;
125 SetStatus(DllExports::GdipGetPenDashCap197819(nativePen, &dashCap));
126 return dashCap;
127 }
128
129 REAL
131 {
132 REAL offset;
133 SetStatus(DllExports::GdipGetPenDashOffset(nativePen, &offset));
134 return offset;
135 }
136
137 Status
139 {
140 if (dashArray == NULL || count <= 0)
142
143 return SetStatus(DllExports::GdipGetPenDashArray(nativePen, dashArray, count));
144 }
145
146 INT
148 {
149 INT count = 0;
150 SetStatus(DllExports::GdipGetPenDashCount(nativePen, &count));
151 return count;
152 }
153
156 {
157 DashStyle dashStyle;
158 SetStatus(DllExports::GdipGetPenDashStyle(nativePen, &dashStyle));
159 return dashStyle;
160 }
161
162 LineCap
164 {
165 LineCap endCap;
166 SetStatus(DllExports::GdipGetPenEndCap(nativePen, &endCap));
167 return endCap;
168 }
169
170 Status
172 {
173 return lastStatus;
174 }
175
178 {
179 LineJoin lineJoin;
180 SetStatus(DllExports::GdipGetPenLineJoin(nativePen, &lineJoin));
181 return lineJoin;
182 }
183
184 REAL
186 {
187 REAL miterLimit;
188 SetStatus(DllExports::GdipGetPenMiterLimit(nativePen, &miterLimit));
189 return miterLimit;
190 }
191
192 PenType
194 {
196 SetStatus(DllExports::GdipGetPenFillType(nativePen, &type));
197 return type;
198 }
199
200 LineCap
202 {
203 LineCap startCap;
204 SetStatus(DllExports::GdipGetPenStartCap(nativePen, &startCap));
205 return startCap;
206 }
207
208 Status
210 {
211 return SetStatus(DllExports::GdipGetPenTransform(nativePen, getNat(matrix)));
212 }
213
214 REAL
216 {
217 REAL width;
218 SetStatus(DllExports::GdipGetPenWidth(nativePen, &width));
219 return width;
220 }
221
222 Status
224 {
225 return SetStatus(DllExports::GdipMultiplyPenTransform(nativePen, getNat(matrix), order));
226 }
227
228 Status
230 {
231 return SetStatus(DllExports::GdipResetPenTransform(nativePen));
232 }
233
234 Status
236 {
237 return SetStatus(DllExports::GdipRotatePenTransform(nativePen, angle, order));
238 }
239
240 Status
242 {
243 return SetStatus(DllExports::GdipScalePenTransform(nativePen, sx, sy, order));
244 }
245
246 Status
248 {
249 return SetStatus(DllExports::GdipSetPenMode(nativePen, penAlignment));
250 }
251
252 Status
253 SetBrush(const Brush *brush)
254 {
255 GpBrush *theBrush = brush ? getNat(brush) : NULL;
256 return SetStatus(DllExports::GdipSetPenBrushFill(nativePen, theBrush));
257 }
258
259 Status
261 {
262 return SetStatus(DllExports::GdipSetPenColor(nativePen, color.GetValue()));
263 }
264
265 Status
266 SetCompoundArray(const REAL *compoundArray, INT count)
267 {
268 return SetStatus(DllExports::GdipSetPenCompoundArray(nativePen, compoundArray, count));
269 }
270
271 Status
273 {
274 GpCustomLineCap *cap = customCap ? getNat(customCap) : NULL;
275 return SetStatus(DllExports::GdipSetPenCustomEndCap(nativePen, cap));
276 }
277
278 Status
280 {
281 GpCustomLineCap *cap = customCap ? getNat(customCap) : NULL;
282 return SetStatus(DllExports::GdipSetPenCustomStartCap(nativePen, cap));
283 }
284
285 Status
287 {
288 return SetStatus(DllExports::GdipSetPenDashCap197819(nativePen, dashCap));
289 }
290
291 Status
292 SetDashOffset(REAL dashOffset)
293 {
294 return SetStatus(DllExports::GdipSetPenDashOffset(nativePen, dashOffset));
295 }
296
297 Status
299 {
300 return SetStatus(DllExports::GdipSetPenDashArray(nativePen, dashArray, count));
301 }
302
303 Status
305 {
306 return SetStatus(DllExports::GdipSetPenDashStyle(nativePen, dashStyle));
307 }
308
309 Status
311 {
312 return SetStatus(DllExports::GdipSetPenEndCap(nativePen, endCap));
313 }
314
315 Status
316 SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
317 {
318 return SetStatus(DllExports::GdipSetPenLineCap197819(nativePen, startCap, endCap, dashCap));
319 }
320
321 Status
323 {
324 return SetStatus(DllExports::GdipSetPenLineJoin(nativePen, lineJoin));
325 }
326
327 Status
328 SetMiterLimit(REAL miterLimit)
329 {
330 return SetStatus(DllExports::GdipSetPenMiterLimit(nativePen, miterLimit));
331 }
332
333 Status
335 {
336 return SetStatus(DllExports::GdipSetPenStartCap(nativePen, startCap));
337 }
338
339 Status
341 {
343 return SetStatus(DllExports::GdipSetPenTransform(nativePen, mat));
344 }
345
346 Status
348 {
349 return SetStatus(DllExports::GdipSetPenWidth(nativePen, width));
350 }
351
352 Status
354 {
355 return SetStatus(DllExports::GdipTranslatePenTransform(nativePen, dx, dy, order));
356 }
357
358 protected:
361
362 Status
364 {
365 if (status != Ok)
367 return status;
368 }
369
371 {
372 }
373
374 VOID
376 {
377 nativePen = pen;
378 }
379
380 private:
381 // Pen is not copyable
382 Pen(const Pen &);
383 Pen &
384 operator=(const Pen &);
385
386 // get native
387 friend inline GpPen *&
388 getNat(const Pen *pen)
389 {
390 return const_cast<Pen *>(pen)->nativePen;
391 }
392};
393
394#endif /* _GDIPLUSPEN_H */
Definition: gdipluspen.h:23
Status GetCustomStartCap(CustomLineCap *customCap)
Definition: gdipluspen.h:113
Status GetTransform(Matrix *matrix)
Definition: gdipluspen.h:209
Status GetDashPattern(REAL *dashArray, INT count)
Definition: gdipluspen.h:138
Status GetColor(Color *color)
Definition: gdipluspen.h:72
LineCap GetStartCap()
Definition: gdipluspen.h:201
Status MultiplyTransform(Matrix *matrix, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:223
PenAlignment GetAlignment()
Definition: gdipluspen.h:57
Status SetWidth(REAL width)
Definition: gdipluspen.h:347
Status TranslateTransform(REAL dx, REAL dy, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:353
Status GetCustomEndCap(CustomLineCap *customCap)
Definition: gdipluspen.h:104
LineJoin GetLineJoin()
Definition: gdipluspen.h:177
Status SetCustomStartCap(const CustomLineCap *customCap)
Definition: gdipluspen.h:279
LineCap GetEndCap()
Definition: gdipluspen.h:163
INT GetCompoundArrayCount()
Definition: gdipluspen.h:96
Status ResetTransform()
Definition: gdipluspen.h:229
Status ScaleTransform(REAL sx, REAL sy, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:241
Status SetColor(const Color &color)
Definition: gdipluspen.h:260
Pen(const Pen &)
Status SetStartCap(LineCap startCap)
Definition: gdipluspen.h:334
Status SetDashPattern(const REAL *dashArray, INT count)
Definition: gdipluspen.h:298
Status lastStatus
Definition: gdipluspen.h:360
Status SetCustomEndCap(const CustomLineCap *customCap)
Definition: gdipluspen.h:272
DashCap GetDashCap()
Definition: gdipluspen.h:122
Status SetAlignment(PenAlignment penAlignment)
Definition: gdipluspen.h:247
Status GetLastStatus() const
Definition: gdipluspen.h:171
GpPen * nativePen
Definition: gdipluspen.h:359
REAL GetWidth()
Definition: gdipluspen.h:215
Status SetStatus(Status status) const
Definition: gdipluspen.h:363
~Pen()
Definition: gdipluspen.h:38
Pen(GpPen *pen, Status status)
Definition: gdipluspen.h:370
Pen(const Brush *brush, REAL width=1.0f)
Definition: gdipluspen.h:28
Status SetTransform(const Matrix *matrix)
Definition: gdipluspen.h:340
Status GetCompoundArray(REAL *compoundArray, INT count)
Definition: gdipluspen.h:84
Status SetCompoundArray(const REAL *compoundArray, INT count)
Definition: gdipluspen.h:266
Status SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Definition: gdipluspen.h:316
Status SetDashStyle(DashStyle dashStyle)
Definition: gdipluspen.h:304
Brush * GetBrush()
Definition: gdipluspen.h:65
Status SetMiterLimit(REAL miterLimit)
Definition: gdipluspen.h:328
REAL GetMiterLimit()
Definition: gdipluspen.h:185
Status SetDashCap(DashCap dashCap)
Definition: gdipluspen.h:286
REAL GetDashOffset()
Definition: gdipluspen.h:130
Status SetBrush(const Brush *brush)
Definition: gdipluspen.h:253
Status RotateTransform(REAL angle, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:235
Pen(const Color &color, REAL width=1.0f)
Definition: gdipluspen.h:33
Pen & operator=(const Pen &)
PenType GetPenType()
Definition: gdipluspen.h:193
DashStyle GetDashStyle()
Definition: gdipluspen.h:155
Pen * Clone()
Definition: gdipluspen.h:44
friend GpPen *& getNat(const Pen *pen)
Definition: gdipluspen.h:388
Status SetDashOffset(REAL dashOffset)
Definition: gdipluspen.h:292
Status SetEndCap(LineCap endCap)
Definition: gdipluspen.h:310
VOID SetNativePen(GpPen *pen)
Definition: gdipluspen.h:375
INT GetDashPatternCount()
Definition: gdipluspen.h:147
Status SetLineJoin(LineJoin lineJoin)
Definition: gdipluspen.h:322
#define NULL
Definition: types.h:112
float REAL
Definition: types.h:41
PenType
Definition: gdiplusenums.h:95
DashCap
Definition: gdiplusenums.h:170
LineJoin
Definition: gdiplusenums.h:105
LineCap
Definition: gdiplusenums.h:60
DashStyle
Definition: gdiplusenums.h:177
MatrixOrder
Definition: gdiplusenums.h:187
@ MatrixOrderPrepend
Definition: gdiplusenums.h:188
PenAlignment
Definition: gdiplusenums.h:154
@ UnitWorld
Definition: gdiplusenums.h:27
DWORD ARGB
Status
Definition: gdiplustypes.h:25
@ Ok
Definition: gdiplustypes.h:26
@ InvalidParameter
Definition: gdiplustypes.h:28
@ NotImplemented
Definition: gdiplustypes.h:32
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
GLuint GLenum matrix
Definition: glext.h:9407
GLfloat angle
Definition: glext.h:10853
GLsizei const GLfloat * dashArray
Definition: glext.h:11725
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GLenum cap
Definition: glext.h:9639
GLintptr offset
Definition: glext.h:5920
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
static const MAT2 mat
Definition: font.c:66
Definition: ps.c:97
int32_t INT
Definition: typedefs.h:58