ReactOS 0.4.17-dev-243-g1369312
pen.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "objbase.h"
#include "gdiplus.h"
#include "gdiplus_private.h"
#include "wine/debug.h"
Include dependency graph for pen.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (gdiplus)
 
static DWORD gdip_to_gdi_dash (GpDashStyle dash)
 
static DWORD gdip_to_gdi_join (GpLineJoin join)
 
static GpPenType bt_to_pt (GpBrushType bt)
 
GpStatus WINGDIPAPI GdipClonePen (GpPen *pen, GpPen **clonepen)
 
GpStatus WINGDIPAPI GdipCreatePen1 (ARGB color, REAL width, GpUnit unit, GpPen **pen)
 
GpStatus WINGDIPAPI GdipCreatePen2 (GpBrush *brush, REAL width, GpUnit unit, GpPen **pen)
 
GpStatus WINGDIPAPI GdipDeletePen (GpPen *pen)
 
GpStatus WINGDIPAPI GdipGetPenBrushFill (GpPen *pen, GpBrush **brush)
 
GpStatus WINGDIPAPI GdipGetPenColor (GpPen *pen, ARGB *argb)
 
GpStatus WINGDIPAPI GdipGetPenCustomEndCap (GpPen *pen, GpCustomLineCap **customCap)
 
GpStatus WINGDIPAPI GdipGetPenCustomStartCap (GpPen *pen, GpCustomLineCap **customCap)
 
GpStatus WINGDIPAPI GdipGetPenDashArray (GpPen *pen, REAL *dash, INT count)
 
GpStatus WINGDIPAPI GdipGetPenDashCap197819 (GpPen *pen, GpDashCap *dashCap)
 
GpStatus WINGDIPAPI GdipGetPenDashCount (GpPen *pen, INT *count)
 
GpStatus WINGDIPAPI GdipGetPenDashOffset (GpPen *pen, REAL *offset)
 
GpStatus WINGDIPAPI GdipGetPenDashStyle (GpPen *pen, GpDashStyle *dash)
 
GpStatus WINGDIPAPI GdipGetPenEndCap (GpPen *pen, GpLineCap *endCap)
 
GpStatus WINGDIPAPI GdipGetPenFillType (GpPen *pen, GpPenType *type)
 
GpStatus WINGDIPAPI GdipGetPenLineJoin (GpPen *pen, GpLineJoin *lineJoin)
 
GpStatus WINGDIPAPI GdipGetPenMode (GpPen *pen, GpPenAlignment *mode)
 
GpStatus WINGDIPAPI GdipGetPenMiterLimit (GpPen *pen, REAL *miterLimit)
 
GpStatus WINGDIPAPI GdipGetPenStartCap (GpPen *pen, GpLineCap *startCap)
 
GpStatus WINGDIPAPI GdipGetPenUnit (GpPen *pen, GpUnit *unit)
 
GpStatus WINGDIPAPI GdipGetPenWidth (GpPen *pen, REAL *width)
 
GpStatus WINGDIPAPI GdipResetPenTransform (GpPen *pen)
 
GpStatus WINGDIPAPI GdipSetPenTransform (GpPen *pen, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipGetPenTransform (GpPen *pen, GpMatrix *matrix)
 
GpStatus WINGDIPAPI GdipTranslatePenTransform (GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipScalePenTransform (GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipRotatePenTransform (GpPen *pen, REAL angle, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipMultiplyPenTransform (GpPen *pen, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
 
GpStatus WINGDIPAPI GdipSetPenBrushFill (GpPen *pen, GpBrush *brush)
 
GpStatus WINGDIPAPI GdipSetPenColor (GpPen *pen, ARGB argb)
 
GpStatus WINGDIPAPI GdipGetPenCompoundArray (GpPen *pen, REAL *compoundarray, INT count)
 
GpStatus WINGDIPAPI GdipGetPenCompoundCount (GpPen *pen, INT *count)
 
GpStatus WINGDIPAPI GdipSetPenCompoundArray (GpPen *pen, GDIPCONST REAL *compoundarray, INT count)
 
GpStatus WINGDIPAPI GdipSetPenCustomEndCap (GpPen *pen, GpCustomLineCap *customCap)
 
GpStatus WINGDIPAPI GdipSetPenCustomStartCap (GpPen *pen, GpCustomLineCap *customCap)
 
GpStatus WINGDIPAPI GdipSetPenDashArray (GpPen *pen, GDIPCONST REAL *dash, INT count)
 
GpStatus WINGDIPAPI GdipSetPenDashCap197819 (GpPen *pen, GpDashCap dashCap)
 
GpStatus WINGDIPAPI GdipSetPenDashOffset (GpPen *pen, REAL offset)
 
GpStatus WINGDIPAPI GdipSetPenDashStyle (GpPen *pen, GpDashStyle dash)
 
GpStatus WINGDIPAPI GdipSetPenEndCap (GpPen *pen, GpLineCap cap)
 
GpStatus WINGDIPAPI GdipSetPenLineCap197819 (GpPen *pen, GpLineCap start, GpLineCap end, GpDashCap dash)
 
GpStatus WINGDIPAPI GdipSetPenLineJoin (GpPen *pen, GpLineJoin join)
 
GpStatus WINGDIPAPI GdipSetPenMiterLimit (GpPen *pen, REAL limit)
 
GpStatus WINGDIPAPI GdipSetPenStartCap (GpPen *pen, GpLineCap cap)
 
GpStatus WINGDIPAPI GdipSetPenWidth (GpPen *pen, REAL width)
 
GpStatus WINGDIPAPI GdipSetPenMode (GpPen *pen, GpPenAlignment mode)
 

Function Documentation

◆ bt_to_pt()

static GpPenType bt_to_pt ( GpBrushType  bt)
static

Definition at line 70 of file pen.c.

71{
72 switch(bt){
74 return PenTypeSolidColor;
76 return PenTypeHatchFill;
78 return PenTypeTextureFill;
83 default:
84 return PenTypeUnknown;
85 }
86}
@ PenTypeSolidColor
Definition: gdiplusenums.h:95
@ PenTypePathGradient
Definition: gdiplusenums.h:98
@ PenTypeLinearGradient
Definition: gdiplusenums.h:99
@ PenTypeUnknown
Definition: gdiplusenums.h:100
@ PenTypeTextureFill
Definition: gdiplusenums.h:97
@ PenTypeHatchFill
Definition: gdiplusenums.h:96
@ BrushTypeHatchFill
Definition: gdiplusenums.h:39
@ BrushTypeLinearGradient
Definition: gdiplusenums.h:42
@ BrushTypeTextureFill
Definition: gdiplusenums.h:40
@ BrushTypeSolidColor
Definition: gdiplusenums.h:38
@ BrushTypePathGradient
Definition: gdiplusenums.h:41

Referenced by GdipGetPenFillType().

◆ gdip_to_gdi_dash()

static DWORD gdip_to_gdi_dash ( GpDashStyle  dash)
static

Definition at line 33 of file pen.c.

34{
35 switch(dash){
36 case DashStyleSolid:
37 return PS_SOLID;
38 case DashStyleDash:
39 return PS_DASH;
40 case DashStyleDot:
41 return PS_DOT;
43 return PS_DASHDOT;
45 return PS_DASHDOTDOT;
46 case DashStyleCustom:
47 return PS_USERSTYLE;
48 default:
49 ERR("Not a member of GpDashStyle enumeration\n");
50 return 0;
51 }
52}
#define ERR(fmt,...)
Definition: precomp.h:57
@ DashStyleSolid
Definition: gdiplusenums.h:177
@ DashStyleDot
Definition: gdiplusenums.h:179
@ DashStyleDashDot
Definition: gdiplusenums.h:180
@ DashStyleCustom
Definition: gdiplusenums.h:182
@ DashStyleDash
Definition: gdiplusenums.h:178
@ DashStyleDashDotDot
Definition: gdiplusenums.h:181
#define PS_DASH
Definition: wingdi.h:587
#define PS_DOT
Definition: wingdi.h:588
#define PS_USERSTYLE
Definition: wingdi.h:592
#define PS_SOLID
Definition: wingdi.h:586
#define PS_DASHDOT
Definition: wingdi.h:589
#define PS_DASHDOTDOT
Definition: wingdi.h:590

Referenced by GdipSetPenDashStyle().

◆ gdip_to_gdi_join()

static DWORD gdip_to_gdi_join ( GpLineJoin  join)
static

Definition at line 54 of file pen.c.

55{
56 switch(join){
57 case LineJoinRound:
58 return PS_JOIN_ROUND;
59 case LineJoinBevel:
60 return PS_JOIN_BEVEL;
61 case LineJoinMiter:
63 return PS_JOIN_MITER;
64 default:
65 ERR("Not a member of GpLineJoin enumeration\n");
66 return 0;
67 }
68}
@ LineJoinMiter
Definition: gdiplusenums.h:105
@ LineJoinMiterClipped
Definition: gdiplusenums.h:108
@ LineJoinBevel
Definition: gdiplusenums.h:106
@ LineJoinRound
Definition: gdiplusenums.h:107
LOCAL int join(int *aux, int a, int b)
Definition: match.c:560
#define PS_JOIN_BEVEL
Definition: wingdi.h:597
#define PS_JOIN_ROUND
Definition: wingdi.h:599
#define PS_JOIN_MITER
Definition: wingdi.h:598

Referenced by GdipSetPenLineJoin().

◆ GdipClonePen()

GpStatus WINGDIPAPI GdipClonePen ( GpPen pen,
GpPen **  clonepen 
)

Definition at line 88 of file pen.c.

89{
91
92 TRACE("(%p, %p)\n", pen, clonepen);
93
94 if(!pen || !clonepen)
95 return InvalidParameter;
96
97 *clonepen = malloc(sizeof(GpPen));
98 if(!*clonepen) return OutOfMemory;
99
100 **clonepen = *pen;
101
102 (*clonepen)->customstart = NULL;
103 (*clonepen)->customend = NULL;
104 (*clonepen)->brush = NULL;
105 (*clonepen)->dashes = NULL;
106 (*clonepen)->compound_array = NULL;
107
108 stat = GdipCloneBrush(pen->brush, &(*clonepen)->brush);
109
110 if (stat == Ok && pen->customstart)
111 stat = GdipCloneCustomLineCap(pen->customstart, &(*clonepen)->customstart);
112
113 if (stat == Ok && pen->customend)
114 stat = GdipCloneCustomLineCap(pen->customend, &(*clonepen)->customend);
115
116 if (stat == Ok && pen->dashes)
117 {
118 (*clonepen)->dashes = malloc(pen->numdashes * sizeof(REAL));
119 if ((*clonepen)->dashes)
120 memcpy((*clonepen)->dashes, pen->dashes, pen->numdashes * sizeof(REAL));
121 else
123 }
124
125 if (stat == Ok && pen->compound_array)
126 {
127 (*clonepen)->compound_array = malloc(pen->compound_array_size * sizeof(REAL));
128 if ((*clonepen)->compound_array)
129 memcpy((*clonepen)->compound_array, pen->compound_array, pen->compound_array_size * sizeof(REAL));
130 else
132 }
133
134 if (stat != Ok)
135 {
136 GdipDeletePen(*clonepen);
137 *clonepen = NULL;
138 return stat;
139 }
140
141 TRACE("<-- %p\n", *clonepen);
142
143 return Ok;
144}
#define stat
Definition: acwin.h:100
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
float REAL
Definition: types.h:41
GpStatus WINGDIPAPI GdipCloneBrush(GpBrush *brush, GpBrush **clone)
Definition: brush.c:70
GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap *from, GpCustomLineCap **to)
Definition: customlinecap.c:34
GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
Definition: pen.c:204
Status
Definition: gdiplustypes.h:24
@ Ok
Definition: gdiplustypes.h:25
@ InvalidParameter
Definition: gdiplustypes.h:27
@ OutOfMemory
Definition: gdiplustypes.h:28
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TRACE(s)
Definition: solgame.cpp:4
INT numdashes
REAL * dashes
GpCustomLineCap * customend
REAL * compound_array
GpBrush * brush
INT compound_array_size
GpCustomLineCap * customstart
Definition: stat.h:66

◆ GdipCreatePen1()

GpStatus WINGDIPAPI GdipCreatePen1 ( ARGB  color,
REAL  width,
GpUnit  unit,
GpPen **  pen 
)

Definition at line 146 of file pen.c.

148{
149 GpBrush *brush;
151
152 TRACE("(%lx, %.2f, %d, %p)\n", color, width, unit, pen);
153
155 status = GdipCreatePen2(brush, width, unit, pen);
156 GdipDeleteBrush(brush);
157 return status;
158}
GpStatus WINGDIPAPI GdipDeleteBrush(GpBrush *brush)
Definition: brush.c:1020
GpStatus WINGDIPAPI GdipCreateSolidFill(ARGB color, GpSolidFill **sf)
Definition: brush.c:783
GpStatus WINGDIPAPI GdipCreatePen2(GpBrush *brush, REAL width, GpUnit unit, GpPen **pen)
Definition: pen.c:160
GLint GLint GLsizei width
Definition: gl.h:1546
GLuint color
Definition: glext.h:6243
png_const_structrp png_const_inforp int * unit
Definition: png.h:2392
Definition: ps.c:97

Referenced by test_brushfill(), test_compoundarray(), test_constructor_destructor(), test_customcap(), test_dasharray(), test_drawellipse(), test_drawpath(), test_drawrectangle(), test_emfonly(), test_GdipDrawArc(), test_GdipDrawArcI(), test_GdipDrawBezierI(), test_GdipDrawCurve(), test_GdipDrawCurve2(), test_GdipDrawCurve2I(), test_GdipDrawCurve3(), test_GdipDrawCurve3I(), test_GdipDrawCurveI(), test_GdipDrawLineI(), test_GdipDrawLinesI(), test_Get_Release_DC(), test_is_outline_visible_path_point(), test_pen(), test_pen_thickness(), test_penfilltype(), test_startup(), test_transform(), test_widen(), test_widen_cap(), and test_worldbounds().

◆ GdipCreatePen2()

GpStatus WINGDIPAPI GdipCreatePen2 ( GpBrush brush,
REAL  width,
GpUnit  unit,
GpPen **  pen 
)

Definition at line 160 of file pen.c.

162{
163 GpPen *gp_pen;
164 GpBrush *clone_brush;
165
166 TRACE("(%p, %.2f, %d, %p)\n", brush, width, unit, pen);
167
168 if(!pen || !brush)
169 return InvalidParameter;
170
171 gp_pen = calloc(1, sizeof(GpPen));
172 if(!gp_pen) return OutOfMemory;
173
174 gp_pen->style = GP_DEFAULT_PENSTYLE;
175 gp_pen->width = width;
176 gp_pen->unit = unit;
177 gp_pen->endcap = LineCapFlat;
178 gp_pen->join = LineJoinMiter;
179 gp_pen->miterlimit = 10.0;
180 gp_pen->dash = DashStyleSolid;
181 gp_pen->offset = 0.0;
182 gp_pen->customstart = NULL;
183 gp_pen->customend = NULL;
184 gp_pen->compound_array = NULL;
185 gp_pen->compound_array_size = 0;
186 GdipSetMatrixElements(&gp_pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
187
188 if(!((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel))) {
189 FIXME("UnitWorld, UnitPixel only supported units\n");
190 free(gp_pen);
191 return NotImplemented;
192 }
193
194 GdipCloneBrush(brush, &clone_brush);
195 gp_pen->brush = clone_brush;
196
197 *pen = gp_pen;
198
199 TRACE("<-- %p\n", *pen);
200
201 return Ok;
202}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define free
Definition: debug_ros.c:5
GpStatus WINGDIPAPI GdipSetMatrixElements(GpMatrix *matrix, REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy)
Definition: matrix.c:318
#define GP_DEFAULT_PENSTYLE
@ LineCapFlat
Definition: gdiplusenums.h:61
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPixel
Definition: gdiplusenums.h:29
@ NotImplemented
Definition: gdiplustypes.h:31
#define calloc
Definition: rosglue.h:14
GpDashStyle dash
GpMatrix transform
REAL offset
REAL miterlimit
GpLineCap endcap
UINT style
GpLineJoin join
GpUnit unit
REAL width

Referenced by GdipCreatePen1(), METAFILE_PlaybackObject(), test_constructor_destructor2(), and test_penfilltype().

◆ GdipDeletePen()

◆ GdipGetPenBrushFill()

GpStatus WINGDIPAPI GdipGetPenBrushFill ( GpPen pen,
GpBrush **  brush 
)

Definition at line 220 of file pen.c.

221{
222 TRACE("(%p, %p)\n", pen, brush);
223
224 if(!pen || !brush)
225 return InvalidParameter;
226
227 return GdipCloneBrush(pen->brush, brush);
228}

Referenced by test_brushfill().

◆ GdipGetPenColor()

GpStatus WINGDIPAPI GdipGetPenColor ( GpPen pen,
ARGB argb 
)

Definition at line 230 of file pen.c.

231{
232 TRACE("(%p, %p)\n", pen, argb);
233
234 if(!pen || !argb)
235 return InvalidParameter;
236
237 if(pen->brush->bt != BrushTypeSolidColor)
238 return NotImplemented;
239
240 return GdipGetSolidFillColor(((GpSolidFill*)pen->brush), argb);
241}
GpStatus WINGDIPAPI GdipGetSolidFillColor(GpSolidFill *sf, ARGB *argb)
Definition: brush.c:1299
GpBrushType bt

Referenced by test_brushfill().

◆ GdipGetPenCompoundArray()

GpStatus WINGDIPAPI GdipGetPenCompoundArray ( GpPen pen,
REAL compoundarray,
INT  count 
)

Definition at line 543 of file pen.c.

544{
545 TRACE("(%p, %p, %i)\n", pen, compoundarray, count);
546
547 if (!pen || !compoundarray || count > pen->compound_array_size)
548 return InvalidParameter;
549 if (pen->compound_array && count > 0)
550 memcpy(compoundarray, pen->compound_array, count * sizeof(REAL));
551 return Ok;
552}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by test_compoundarray().

◆ GdipGetPenCompoundCount()

GpStatus WINGDIPAPI GdipGetPenCompoundCount ( GpPen pen,
INT count 
)

Definition at line 554 of file pen.c.

555{
556 TRACE("(%p, %p)\n", pen, count);
557
558 if (!pen || !count)
559 return InvalidParameter;
561 return Ok;
562}

Referenced by test_compoundarray().

◆ GdipGetPenCustomEndCap()

GpStatus WINGDIPAPI GdipGetPenCustomEndCap ( GpPen pen,
GpCustomLineCap **  customCap 
)

Definition at line 243 of file pen.c.

244{
245 TRACE("(%p, %p)\n", pen, customCap);
246
247 if(!pen || !customCap)
248 return InvalidParameter;
249
250 if(!pen->customend){
251 *customCap = NULL;
252 return Ok;
253 }
254
255 return GdipCloneCustomLineCap(pen->customend, customCap);
256}

Referenced by test_customcap().

◆ GdipGetPenCustomStartCap()

GpStatus WINGDIPAPI GdipGetPenCustomStartCap ( GpPen pen,
GpCustomLineCap **  customCap 
)

Definition at line 258 of file pen.c.

259{
260 TRACE("(%p, %p)\n", pen, customCap);
261
262 if(!pen || !customCap)
263 return InvalidParameter;
264
265 if(!pen->customstart){
266 *customCap = NULL;
267 return Ok;
268 }
269
270 return GdipCloneCustomLineCap(pen->customstart, customCap);
271}

Referenced by test_customcap().

◆ GdipGetPenDashArray()

GpStatus WINGDIPAPI GdipGetPenDashArray ( GpPen pen,
REAL dash,
INT  count 
)

Definition at line 273 of file pen.c.

274{
275 TRACE("(%p, %p, %d)\n", pen, dash, count);
276
277 if(!pen || !dash || count > pen->numdashes)
278 return InvalidParameter;
279
280 /* note: if you pass a negative value for count, it crashes native gdiplus. */
281 if(count < 0)
282 return GenericError;
283
284 memcpy(dash, pen->dashes, count * sizeof(REAL));
285
286 return Ok;
287}
@ GenericError
Definition: gdiplustypes.h:26

Referenced by test_dasharray().

◆ GdipGetPenDashCap197819()

GpStatus WINGDIPAPI GdipGetPenDashCap197819 ( GpPen pen,
GpDashCap dashCap 
)

Definition at line 289 of file pen.c.

290{
291 TRACE("(%p, %p)\n", pen, dashCap);
292
293 if(!pen || !dashCap)
294 return InvalidParameter;
295
296 *dashCap = pen->dashcap;
297
298 return Ok;
299}
GpDashCap dashcap

◆ GdipGetPenDashCount()

GpStatus WINGDIPAPI GdipGetPenDashCount ( GpPen pen,
INT count 
)

Definition at line 301 of file pen.c.

302{
303 TRACE("(%p, %p)\n", pen, count);
304
305 if(!pen || !count)
306 return InvalidParameter;
307
308 *count = pen->numdashes;
309
310 return Ok;
311}

◆ GdipGetPenDashOffset()

GpStatus WINGDIPAPI GdipGetPenDashOffset ( GpPen pen,
REAL offset 
)

Definition at line 313 of file pen.c.

314{
315 TRACE("(%p, %p)\n", pen, offset);
316
317 if(!pen || !offset)
318 return InvalidParameter;
319
320 *offset = pen->offset;
321
322 return Ok;
323}
GLintptr offset
Definition: glext.h:5920

◆ GdipGetPenDashStyle()

GpStatus WINGDIPAPI GdipGetPenDashStyle ( GpPen pen,
GpDashStyle dash 
)

Definition at line 325 of file pen.c.

326{
327 TRACE("(%p, %p)\n", pen, dash);
328
329 if(!pen || !dash)
330 return InvalidParameter;
331
332 *dash = pen->dash;
333
334 return Ok;
335}

Referenced by test_dasharray().

◆ GdipGetPenEndCap()

GpStatus WINGDIPAPI GdipGetPenEndCap ( GpPen pen,
GpLineCap endCap 
)

Definition at line 337 of file pen.c.

338{
339 TRACE("(%p, %p)\n", pen, endCap);
340
341 if(!pen || !endCap)
342 return InvalidParameter;
343
344 *endCap = pen->endcap;
345
346 return Ok;
347}

◆ GdipGetPenFillType()

GpStatus WINGDIPAPI GdipGetPenFillType ( GpPen pen,
GpPenType type 
)

Definition at line 349 of file pen.c.

350{
351 TRACE("(%p, %p)\n", pen, type);
352
353 if(!pen || !type)
354 return InvalidParameter;
355
356 *type = bt_to_pt(pen->brush->bt);
357
358 return Ok;
359}
static GpPenType bt_to_pt(GpBrushType bt)
Definition: pen.c:70
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by test_penfilltype().

◆ GdipGetPenLineJoin()

GpStatus WINGDIPAPI GdipGetPenLineJoin ( GpPen pen,
GpLineJoin lineJoin 
)

Definition at line 361 of file pen.c.

362{
363 TRACE("(%p, %p)\n", pen, lineJoin);
364
365 if(!pen || !lineJoin)
366 return InvalidParameter;
367
368 *lineJoin = pen->join;
369
370 return Ok;
371}

◆ GdipGetPenMiterLimit()

GpStatus WINGDIPAPI GdipGetPenMiterLimit ( GpPen pen,
REAL miterLimit 
)

Definition at line 385 of file pen.c.

386{
387 TRACE("(%p, %p)\n", pen, miterLimit);
388
389 if(!pen || !miterLimit)
390 return InvalidParameter;
391
392 *miterLimit = pen->miterlimit;
393
394 return Ok;
395}

◆ GdipGetPenMode()

GpStatus WINGDIPAPI GdipGetPenMode ( GpPen pen,
GpPenAlignment mode 
)

Definition at line 373 of file pen.c.

374{
375 TRACE("(%p, %p)\n", pen, mode);
376
377 if(!pen || !mode)
378 return InvalidParameter;
379
380 *mode = pen->align;
381
382 return Ok;
383}
GLenum mode
Definition: glext.h:6217
GpPenAlignment align

◆ GdipGetPenStartCap()

GpStatus WINGDIPAPI GdipGetPenStartCap ( GpPen pen,
GpLineCap startCap 
)

Definition at line 397 of file pen.c.

398{
399 TRACE("(%p, %p)\n", pen, startCap);
400
401 if(!pen || !startCap)
402 return InvalidParameter;
403
404 *startCap = pen->startcap;
405
406 return Ok;
407}
GpLineCap startcap

◆ GdipGetPenTransform()

GpStatus WINGDIPAPI GdipGetPenTransform ( GpPen pen,
GpMatrix matrix 
)

Definition at line 466 of file pen.c.

467{
468 TRACE("(%p,%s)\n", pen, debugstr_matrix(matrix));
469
470 if(!pen || !matrix)
471 return InvalidParameter;
472
473 *matrix = pen->transform;
474
475 return Ok;
476}
const char * debugstr_matrix(const GpMatrix *matrix)
Definition: gdiplus.c:498
GLuint GLenum matrix
Definition: glext.h:9407

Referenced by get_pen_transform(), and test_transform().

◆ GdipGetPenUnit()

GpStatus WINGDIPAPI GdipGetPenUnit ( GpPen pen,
GpUnit unit 
)

Definition at line 409 of file pen.c.

410{
411 TRACE("(%p, %p)\n", pen, unit);
412
413 if(!pen || !unit)
414 return InvalidParameter;
415
416 *unit = pen->unit;
417
418 return Ok;
419}

◆ GdipGetPenWidth()

GpStatus WINGDIPAPI GdipGetPenWidth ( GpPen pen,
REAL width 
)

Definition at line 421 of file pen.c.

422{
423 TRACE("(%p, %p)\n", pen, width);
424
425 if(!pen || !width)
426 return InvalidParameter;
427
428 *width = pen->width;
429
430 return Ok;
431}

◆ GdipMultiplyPenTransform()

GpStatus WINGDIPAPI GdipMultiplyPenTransform ( GpPen pen,
GDIPCONST GpMatrix matrix,
GpMatrixOrder  order 
)

Definition at line 508 of file pen.c.

510{
511 TRACE("(%p,%s,%u)\n", pen, debugstr_matrix(matrix), order);
512
513 if(!pen)
514 return InvalidParameter;
515
517}
GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GDIPCONST GpMatrix *matrix2, GpMatrixOrder order)
Definition: matrix.c:239
GLuint GLdouble GLdouble GLint GLint order
Definition: glext.h:11194

Referenced by test_transform().

◆ GdipResetPenTransform()

GpStatus WINGDIPAPI GdipResetPenTransform ( GpPen pen)

Definition at line 433 of file pen.c.

434{
435 TRACE("(%p)\n", pen);
436
437 if(!pen)
438 return InvalidParameter;
439
440 GdipSetMatrixElements(&pen->transform, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
441
442 return Ok;
443}

Referenced by test_transform().

◆ GdipRotatePenTransform()

GpStatus WINGDIPAPI GdipRotatePenTransform ( GpPen pen,
REAL  angle,
GpMatrixOrder  order 
)

Definition at line 498 of file pen.c.

499{
500 TRACE("(%p,%0.2f,%u)\n", pen, angle, order);
501
502 if(!pen)
503 return InvalidParameter;
504
505 return GdipRotateMatrix(&pen->transform, angle, order);
506}
GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle, GpMatrixOrder order)
Definition: matrix.c:257
GLfloat angle
Definition: glext.h:10853

Referenced by test_transform().

◆ GdipScalePenTransform()

GpStatus WINGDIPAPI GdipScalePenTransform ( GpPen pen,
REAL  sx,
REAL  sy,
GpMatrixOrder  order 
)

Definition at line 488 of file pen.c.

489{
490 TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, sx, sy, order);
491
492 if(!pen)
493 return InvalidParameter;
494
495 return GdipScaleMatrix(&pen->transform, sx, sy, order);
496}
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288

Referenced by test_transform().

◆ GdipSetPenBrushFill()

GpStatus WINGDIPAPI GdipSetPenBrushFill ( GpPen pen,
GpBrush brush 
)

Definition at line 519 of file pen.c.

520{
521 TRACE("(%p, %p)\n", pen, brush);
522
523 if(!pen || !brush)
524 return InvalidParameter;
525
527 return GdipCloneBrush(brush, &pen->brush);
528}

Referenced by test_brushfill().

◆ GdipSetPenColor()

GpStatus WINGDIPAPI GdipSetPenColor ( GpPen pen,
ARGB  argb 
)

Definition at line 530 of file pen.c.

531{
532 TRACE("(%p, %lx)\n", pen, argb);
533
534 if(!pen)
535 return InvalidParameter;
536
537 if(pen->brush->bt != BrushTypeSolidColor)
538 return NotImplemented;
539
540 return GdipSetSolidFillColor(((GpSolidFill*)pen->brush), argb);
541}
GpStatus WINGDIPAPI GdipSetSolidFillColor(GpSolidFill *sf, ARGB argb)
Definition: brush.c:1951

◆ GdipSetPenCompoundArray()

GpStatus WINGDIPAPI GdipSetPenCompoundArray ( GpPen pen,
GDIPCONST REAL compoundarray,
INT  count 
)

Definition at line 564 of file pen.c.

566{
567 INT i;
568 REAL *tmp;
569 TRACE("(%p, %p, %i)\n", pen, compoundarray, count);
570
571 if(!pen || !compoundarray || count < 2 || count%2 == 1 || *compoundarray < 0.0 || *compoundarray > 1.0)
572 return InvalidParameter;
573
574 for(i = 1; i<count; i++)
575 {
576 if((compoundarray[i] < compoundarray[i - 1]) || (compoundarray[i] > 1.0))
577 return InvalidParameter;
578 }
579
580 tmp = malloc(count * sizeof(REAL));
581 if(!tmp)
582 return OutOfMemory;
583 free(pen->compound_array);
584 pen->compound_array = tmp;
585 memcpy(pen->compound_array, compoundarray, count * sizeof(REAL));
587 return Ok;
588}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int32_t INT
Definition: typedefs.h:58

Referenced by test_compoundarray().

◆ GdipSetPenCustomEndCap()

GpStatus WINGDIPAPI GdipSetPenCustomEndCap ( GpPen pen,
GpCustomLineCap customCap 
)

Definition at line 590 of file pen.c.

591{
594
595 TRACE("(%p, %p)\n", pen, customCap);
596
597 /* native crashes on pen == NULL, customCap != NULL */
598 if(!customCap) return InvalidParameter;
599
600 if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
602 pen->endcap = LineCapCustom;
603 pen->customend = cap;
604 }
605
606 return ret;
607}
return ret
Definition: mutex.c:146
@ LineCapCustom
Definition: gdiplusenums.h:72
GLenum cap
Definition: glext.h:9639
#define cap
Definition: glfuncs.h:226

Referenced by METAFILE_PlaybackObject(), test_customcap(), test_pen(), and test_widen_cap().

◆ GdipSetPenCustomStartCap()

GpStatus WINGDIPAPI GdipSetPenCustomStartCap ( GpPen pen,
GpCustomLineCap customCap 
)

Definition at line 609 of file pen.c.

610{
613
614 TRACE("(%p, %p)\n", pen, customCap);
615
616 /* native crashes on pen == NULL, customCap != NULL */
617 if(!customCap) return InvalidParameter;
618
619 if((ret = GdipCloneCustomLineCap(customCap, &cap)) == Ok){
621 pen->startcap = LineCapCustom;
622 pen->customstart = cap;
623 }
624
625 return ret;
626}

Referenced by METAFILE_PlaybackObject(), test_customcap(), test_pen(), and test_widen_cap().

◆ GdipSetPenDashArray()

GpStatus WINGDIPAPI GdipSetPenDashArray ( GpPen pen,
GDIPCONST REAL dash,
INT  count 
)

Definition at line 628 of file pen.c.

630{
631 INT i;
632
633 TRACE("(%p, %p, %d)\n", pen, dash, count);
634
635 if(!pen || !dash)
636 return InvalidParameter;
637
638 if(count <= 0)
639 return OutOfMemory;
640
641 for(i = 0; i < count; i++){
642 if(dash[i] <= 0.0)
643 return InvalidParameter;
644 }
645
646 free(pen->dashes);
647 pen->dashes = NULL;
648
649 if(count > 0)
650 pen->dashes = malloc(count * sizeof(REAL));
651 if(!pen->dashes){
652 pen->numdashes = 0;
653 return OutOfMemory;
654 }
655
657 memcpy(pen->dashes, dash, count * sizeof(REAL));
658 pen->numdashes = count;
659
660 return Ok;
661}
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
Definition: pen.c:688

Referenced by test_dasharray().

◆ GdipSetPenDashCap197819()

GpStatus WINGDIPAPI GdipSetPenDashCap197819 ( GpPen pen,
GpDashCap  dashCap 
)

Definition at line 663 of file pen.c.

664{
665 TRACE("(%p, %d)\n", pen, dashCap);
666
667 if(!pen)
668 return InvalidParameter;
669
670 pen->dashcap = dashCap;
671
672 return Ok;
673}

◆ GdipSetPenDashOffset()

GpStatus WINGDIPAPI GdipSetPenDashOffset ( GpPen pen,
REAL  offset 
)

Definition at line 676 of file pen.c.

677{
678 TRACE("(%p, %.2f)\n", pen, offset);
679
680 if(!pen)
681 return InvalidParameter;
682
683 pen->offset = offset;
684
685 return Ok;
686}

Referenced by METAFILE_PlaybackObject().

◆ GdipSetPenDashStyle()

GpStatus WINGDIPAPI GdipSetPenDashStyle ( GpPen pen,
GpDashStyle  dash 
)

Definition at line 688 of file pen.c.

689{
690 TRACE("(%p, %d)\n", pen, dash);
691
692 if(!pen)
693 return InvalidParameter;
694
695 if(dash != DashStyleCustom){
696 free(pen->dashes);
697 pen->dashes = NULL;
698 pen->numdashes = 0;
699 }
700
701 pen->dash = dash;
704 pen->style |= gdip_to_gdi_dash(dash);
705
706 return Ok;
707}
static DWORD gdip_to_gdi_dash(GpDashStyle dash)
Definition: pen.c:33
#define PS_NULL
Definition: wingdi.h:591
#define PS_ALTERNATE
Definition: wingdi.h:585
#define PS_INSIDEFRAME
Definition: wingdi.h:593

Referenced by GdipSetPenDashArray(), METAFILE_PlaybackObject(), test_dasharray(), test_widen(), and test_widen_cap().

◆ GdipSetPenEndCap()

GpStatus WINGDIPAPI GdipSetPenEndCap ( GpPen pen,
GpLineCap  cap 
)

Definition at line 709 of file pen.c.

710{
711 TRACE("(%p, %d)\n", pen, cap);
712
713 if(!pen) return InvalidParameter;
714
715 /* The old custom cap gets deleted even if the new style is LineCapCustom. */
717 pen->customend = NULL;
718 pen->endcap = cap;
719
720 return Ok;
721}

Referenced by METAFILE_PlaybackObject(), test_widen_cap(), and test_worldbounds().

◆ GdipSetPenLineCap197819()

GpStatus WINGDIPAPI GdipSetPenLineCap197819 ( GpPen pen,
GpLineCap  start,
GpLineCap  end,
GpDashCap  dash 
)

Definition at line 724 of file pen.c.

726{
727 TRACE("%p, %d, %d, %d)\n", pen, start, end, dash);
728
729 if(!pen)
730 return InvalidParameter;
731
734 pen->customend = NULL;
735 pen->customstart = NULL;
736
737 pen->startcap = start;
738 pen->endcap = end;
739 pen->dashcap = dash;
740
741 return Ok;
742}
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545

◆ GdipSetPenLineJoin()

GpStatus WINGDIPAPI GdipSetPenLineJoin ( GpPen pen,
GpLineJoin  join 
)

Definition at line 746 of file pen.c.

747{
748 TRACE("(%p, %d)\n", pen, join);
749
750 if(!pen) return InvalidParameter;
751
752 pen->join = join;
754 pen->style |= gdip_to_gdi_join(join);
755
756 return Ok;
757}
static DWORD gdip_to_gdi_join(GpLineJoin join)
Definition: pen.c:54

Referenced by METAFILE_PlaybackObject().

◆ GdipSetPenMiterLimit()

GpStatus WINGDIPAPI GdipSetPenMiterLimit ( GpPen pen,
REAL  limit 
)

Definition at line 759 of file pen.c.

760{
761 TRACE("(%p, %.2f)\n", pen, limit);
762
763 if(!pen)
764 return InvalidParameter;
765
766 pen->miterlimit = limit;
767
768 return Ok;
769}
GLint limit
Definition: glext.h:10326

Referenced by METAFILE_PlaybackObject().

◆ GdipSetPenMode()

GpStatus WINGDIPAPI GdipSetPenMode ( GpPen pen,
GpPenAlignment  mode 
)

Definition at line 795 of file pen.c.

796{
797 TRACE("(%p, %d)\n", pen, mode);
798
799 if(!pen) return InvalidParameter;
800
801 pen->align = mode;
802
803 return Ok;
804}

◆ GdipSetPenStartCap()

GpStatus WINGDIPAPI GdipSetPenStartCap ( GpPen pen,
GpLineCap  cap 
)

Definition at line 771 of file pen.c.

772{
773 TRACE("(%p, %d)\n", pen, cap);
774
775 if(!pen) return InvalidParameter;
776
778 pen->customstart = NULL;
779 pen->startcap = cap;
780
781 return Ok;
782}

Referenced by METAFILE_PlaybackObject(), and test_widen_cap().

◆ GdipSetPenTransform()

GpStatus WINGDIPAPI GdipSetPenTransform ( GpPen pen,
GpMatrix matrix 
)

Definition at line 445 of file pen.c.

446{
447 static int calls;
448 BOOL result;
449
450 TRACE("(%p, %s)\n", pen, debugstr_matrix(matrix));
451
452 if(!pen || !matrix)
453 return InvalidParameter;
454
455 if(!(calls++))
456 FIXME("(%p,%p) Semi-stub\n", pen, matrix);
457
459 if (!result)
460 return InvalidParameter;
461 pen->transform = *matrix;
462
463 return Ok;
464}
GpStatus WINGDIPAPI GdipIsMatrixInvertible(GDIPCONST GpMatrix *matrix, BOOL *result)
Definition: matrix.c:224
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint64EXT * result
Definition: glext.h:11304

Referenced by test_transform().

◆ GdipSetPenWidth()

GpStatus WINGDIPAPI GdipSetPenWidth ( GpPen pen,
REAL  width 
)

Definition at line 784 of file pen.c.

785{
786 TRACE("(%p, %.2f)\n", pen, width);
787
788 if(!pen) return InvalidParameter;
789
790 pen->width = width;
791
792 return Ok;
793}

Referenced by test_widen_cap().

◆ GdipTranslatePenTransform()

GpStatus WINGDIPAPI GdipTranslatePenTransform ( GpPen pen,
REAL  dx,
REAL  dy,
GpMatrixOrder  order 
)

Definition at line 478 of file pen.c.

479{
480 TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order);
481
482 if(!pen)
483 return InvalidParameter;
484
485 return GdipTranslateMatrix(&pen->transform, dx, dy, order);
486}
GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix *matrix, REAL offsetX, REAL offsetY, GpMatrixOrder order)
Definition: matrix.c:420
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97

Referenced by test_transform().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( gdiplus  )