ReactOS  0.4.14-dev-1007-g90d795b
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 
22 class 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  {
31  }
32 
33  Pen(const Color &color, REAL width = 1.0f) : nativePen(NULL)
34  {
36  }
37 
38  ~Pen()
39  {
41  }
42 
43  Pen *
45  {
46  GpPen *clonePen = NULL;
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;
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;
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
89  return SetStatus(NotImplemented);
90 #else
91  return SetStatus(DllExports::GdipGetPenCompoundArray(nativePen, compoundArray, count));
92 #endif
93  }
94 
95  INT
97  {
98  INT count = 0;
100  return count;
101  }
102 
103  Status
105  {
106  if (!customCap)
107  return SetStatus(InvalidParameter);
108 
110  }
111 
112  Status
114  {
115  if (!customCap)
116  return SetStatus(InvalidParameter);
117 
119  }
120 
121  DashCap
123  {
124  DashCap dashCap;
126  return dashCap;
127  }
128 
129  REAL
131  {
132  REAL offset;
134  return offset;
135  }
136 
137  Status
139  {
140  if (dashArray == NULL || count <= 0)
141  return SetStatus(InvalidParameter);
142 
144  }
145 
146  INT
148  {
149  INT count = 0;
151  return count;
152  }
153 
154  DashStyle
156  {
157  DashStyle dashStyle;
159  return dashStyle;
160  }
161 
162  LineCap
164  {
165  LineCap endCap;
167  return endCap;
168  }
169 
170  Status
172  {
173  return lastStatus;
174  }
175 
176  LineJoin
178  {
179  LineJoin lineJoin;
181  return lineJoin;
182  }
183 
184  REAL
186  {
187  REAL miterLimit;
189  return miterLimit;
190  }
191 
192  PenType
194  {
195  PenType type;
197  return type;
198  }
199 
200  LineCap
202  {
203  LineCap startCap;
205  return startCap;
206  }
207 
208  Status
210  {
212  }
213 
214  REAL
216  {
217  REAL width;
219  return width;
220  }
221 
222  Status
224  {
226  }
227 
228  Status
230  {
232  }
233 
234  Status
236  {
238  }
239 
240  Status
242  {
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;
257  }
258 
259  Status
261  {
263  }
264 
265  Status
266  SetCompoundArray(const REAL *compoundArray, INT count)
267  {
269  }
270 
271  Status
272  SetCustomEndCap(const CustomLineCap *customCap)
273  {
274  GpCustomLineCap *cap = customCap ? getNat(customCap) : NULL;
276  }
277 
278  Status
280  {
281  GpCustomLineCap *cap = customCap ? getNat(customCap) : NULL;
283  }
284 
285  Status
287  {
289  }
290 
291  Status
292  SetDashOffset(REAL dashOffset)
293  {
295  }
296 
297  Status
299  {
301  }
302 
303  Status
305  {
307  }
308 
309  Status
311  {
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  {
325  }
326 
327  Status
328  SetMiterLimit(REAL miterLimit)
329  {
331  }
332 
333  Status
335  {
337  }
338 
339  Status
341  {
344  }
345 
346  Status
348  {
350  }
351 
352  Status
354  {
356  }
357 
358  protected:
361 
362  Status
364  {
365  if (status != Ok)
366  lastStatus = status;
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 */
INT GetCompoundArrayCount()
Definition: gdipluspen.h:96
GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen *pen, REAL *miterLimit)
Definition: pen.c:372
REAL GetWidth()
Definition: gdipluspen.h:215
Pen * Clone()
Definition: gdipluspen.h:44
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194
GpStatus WINGDIPAPI GdipGetPenCustomEndCap(GpPen *pen, GpCustomLineCap **customCap)
Definition: pen.c:230
Status SetWidth(REAL width)
Definition: gdipluspen.h:347
REAL GetMiterLimit()
Definition: gdipluspen.h:185
PenAlignment
Definition: gdiplusenums.h:153
Status SetDashPattern(const REAL *dashArray, INT count)
Definition: gdipluspen.h:298
GpStatus WINGDIPAPI GdipGetPenDashStyle(GpPen *pen, GpDashStyle *dash)
Definition: pen.c:312
GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)
Definition: pen.c:449
Status SetLineJoin(LineJoin lineJoin)
Definition: gdipluspen.h:322
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap *customCap)
Definition: pen.c:547
GpPen * nativePen
Definition: gdipluspen.h:359
GLuint GLenum matrix
Definition: glext.h:9407
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint dy
Definition: linetemp.h:97
Status SetDashStyle(DashStyle dashStyle)
Definition: gdipluspen.h:304
GpStatus WINGDIPAPI GdipSetPenColor(GpPen *pen, ARGB argb)
Definition: pen.c:513
GLintptr offset
Definition: glext.h:5920
GpStatus WINGDIPAPI GdipGetPenDashCount(GpPen *pen, INT *count)
Definition: pen.c:288
GpStatus WINGDIPAPI GdipClonePen(GpPen *pen, GpPen **clonepen)
Definition: pen.c:88
DashCap
Definition: gdiplusenums.h:169
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
friend GpPen *& getNat(const Pen *pen)
Definition: gdipluspen.h:388
DashStyle GetDashStyle()
Definition: gdipluspen.h:155
GpStatus WINGDIPAPI GdipGetPenDashArray(GpPen *pen, REAL *dash, INT count)
Definition: pen.c:260
LineJoin
Definition: gdiplusenums.h:104
static const MAT2 mat
Definition: font.c:66
GpStatus WINGDIPAPI GdipGetPenColor(GpPen *pen, ARGB *argb)
Definition: pen.c:217
GpStatus WINGDIPAPI GdipSetPenLineJoin(GpPen *pen, GpLineJoin join)
Definition: pen.c:708
GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
Definition: pen.c:746
GLfloat angle
Definition: glext.h:10853
int32_t INT
Definition: typedefs.h:57
GpStatus WINGDIPAPI GdipSetPenMode(GpPen *pen, GpPenAlignment mode)
Definition: pen.c:757
GpStatus WINGDIPAPI GdipGetPenCompoundCount(GpPen *pen, INT *count)
Definition: pen.c:526
GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
Definition: pen.c:491
~Pen()
Definition: gdipluspen.h:38
LineCap GetEndCap()
Definition: gdipluspen.h:163
VOID SetNativePen(GpPen *pen)
Definition: gdipluspen.h:375
Status GetLastStatus() const
Definition: gdipluspen.h:171
Pen & operator=(const Pen &)
Status GetCompoundArray(REAL *compoundArray, INT count)
Definition: gdipluspen.h:84
GpStatus WINGDIPAPI GdipSetPenLineCap197819(GpPen *pen, GpLineCap start, GpLineCap end, GpDashCap dash)
Definition: pen.c:686
PenAlignment GetAlignment()
Definition: gdipluspen.h:57
GpStatus WINGDIPAPI GdipGetPenDashOffset(GpPen *pen, REAL *offset)
Definition: pen.c:300
GLenum cap
Definition: glext.h:9639
Status GetDashPattern(REAL *dashArray, INT count)
Definition: gdipluspen.h:138
Status GetCustomEndCap(CustomLineCap *customCap)
Definition: gdipluspen.h:104
GLuint color
Definition: glext.h:6243
LineCap GetStartCap()
Definition: gdipluspen.h:201
GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)
Definition: pen.c:461
GpStatus WINGDIPAPI GdipGetPenMode(GpPen *pen, GpPenAlignment *mode)
Definition: pen.c:360
smooth NULL
Definition: ftsmooth.c:416
GpStatus WINGDIPAPI GdipGetPenCustomStartCap(GpPen *pen, GpCustomLineCap **customCap)
Definition: pen.c:245
Status SetDashCap(DashCap dashCap)
Definition: gdipluspen.h:286
Status SetDashOffset(REAL dashOffset)
Definition: gdipluspen.h:292
MatrixOrder
Definition: gdiplusenums.h:186
Status lastStatus
Definition: gdipluspen.h:360
GpStatus WINGDIPAPI GdipGetPenWidth(GpPen *pen, REAL *width)
Definition: pen.c:408
GLfloat f
Definition: glext.h:7540
Status TranslateTransform(REAL dx, REAL dy, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:353
GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
Definition: pen.c:733
Status SetAlignment(PenAlignment penAlignment)
Definition: gdipluspen.h:247
Status SetLineCap(LineCap startCap, LineCap endCap, DashCap dashCap)
Definition: gdipluspen.h:316
GpStatus WINGDIPAPI GdipSetPenTransform(GpPen *pen, GpMatrix *matrix)
Definition: pen.c:432
LineCap
Definition: gdiplusenums.h:59
GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)
Definition: pen.c:481
Pen(const Color &color, REAL width=1.0f)
Definition: gdipluspen.h:33
Status SetStartCap(LineCap startCap)
Definition: gdipluspen.h:334
GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen *pen, GpLineCap *startCap)
Definition: pen.c:384
GpStatus WINGDIPAPI GdipSetPenMiterLimit(GpPen *pen, REAL limit)
Definition: pen.c:721
Status ResetTransform()
Definition: gdipluspen.h:229
Status SetColor(const Color &color)
Definition: gdipluspen.h:260
DashCap GetDashCap()
Definition: gdipluspen.h:122
Status GetCustomStartCap(CustomLineCap *customCap)
Definition: gdipluspen.h:113
INT GetDashPatternCount()
Definition: gdipluspen.h:147
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
Definition: pen.c:671
GpStatus WINGDIPAPI GdipSetPenDashOffset(GpPen *pen, REAL offset)
Definition: pen.c:638
PenType
Definition: gdiplusenums.h:94
GpStatus WINGDIPAPI GdipResetPenTransform(GpPen *pen)
Definition: pen.c:420
Status SetMiterLimit(REAL miterLimit)
Definition: gdipluspen.h:328
PenType GetPenType()
Definition: gdipluspen.h:193
Status
Definition: gdiplustypes.h:24
Status MultiplyTransform(Matrix *matrix, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:223
GpStatus WINGDIPAPI GdipGetPenEndCap(GpPen *pen, GpLineCap *endCap)
Definition: pen.c:324
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen *pen, GpBrush *brush)
Definition: pen.c:502
Status SetCompoundArray(const REAL *compoundArray, INT count)
Definition: gdipluspen.h:266
GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, GpPen **pen)
Definition: pen.c:150
Status RotateTransform(REAL angle, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:235
DashStyle
Definition: gdiplusenums.h:176
GLsizei const GLfloat * dashArray
Definition: glext.h:11725
Brush * GetBrush()
Definition: gdipluspen.h:65
GpStatus WINGDIPAPI GdipGetPenFillType(GpPen *pen, GpPenType *type)
Definition: pen.c:336
Status SetCustomEndCap(const CustomLineCap *customCap)
Definition: gdipluspen.h:272
GpStatus WINGDIPAPI GdipGetPenLineJoin(GpPen *pen, GpLineJoin *lineJoin)
Definition: pen.c:348
Pen(const Brush *brush, REAL width=1.0f)
Definition: gdipluspen.h:28
Status GetColor(Color *color)
Definition: gdipluspen.h:72
GLint dx
Definition: linetemp.h:97
GpStatus WINGDIPAPI GdipSetPenDashArray(GpPen *pen, GDIPCONST REAL *dash, INT count)
Definition: pen.c:585
REAL GetDashOffset()
Definition: gdipluspen.h:130
Status SetBrush(const Brush *brush)
Definition: gdipluspen.h:253
GpStatus WINGDIPAPI GdipSetPenDashCap197819(GpPen *pen, GpDashCap dashCap)
Definition: pen.c:625
GpStatus WINGDIPAPI GdipGetPenDashCap197819(GpPen *pen, GpDashCap *dashCap)
Definition: pen.c:276
Status SetEndCap(LineCap endCap)
Definition: gdipluspen.h:310
GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
Definition: pen.c:192
Pen(GpPen *pen, Status status)
Definition: gdipluspen.h:370
GpStatus WINGDIPAPI GdipSetPenCompoundArray(GpPen *pen, GDIPCONST REAL *dash, INT count)
Definition: pen.c:536
Status SetCustomStartCap(const CustomLineCap *customCap)
Definition: gdipluspen.h:279
float REAL
Definition: types.h:41
Status GetTransform(Matrix *matrix)
Definition: gdipluspen.h:209
LineJoin GetLineJoin()
Definition: gdipluspen.h:177
Definition: gdipluspen.h:22
static SERVICE_STATUS status
Definition: service.c:31
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap *customCap)
Definition: pen.c:566
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen)
Definition: pen.c:136
Status ScaleTransform(REAL sx, REAL sy, MatrixOrder order=MatrixOrderPrepend)
Definition: gdipluspen.h:241
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
Definition: pen.c:650
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)
Definition: pen.c:471
Status SetTransform(const Matrix *matrix)
Definition: gdipluspen.h:340
Definition: ps.c:97
DWORD ARGB
Status SetStatus(Status status) const
Definition: gdipluspen.h:363