2 * Copyright (C) 2007 Google (Evan Stade)
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
28 #include "gdiplus_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus
);
33 GpStatus WINGDIPAPI
GdipCloneCustomLineCap(GpCustomLineCap
* from
,
36 TRACE("(%p, %p)\n", from
, to
);
39 return InvalidParameter
;
41 *to
= heap_alloc_zero(sizeof(GpCustomLineCap
));
42 if(!*to
) return OutOfMemory
;
44 memcpy(*to
, from
, sizeof(GpCustomLineCap
));
46 (*to
)->pathdata
.Points
= heap_alloc_zero(from
->pathdata
.Count
* sizeof(PointF
));
47 (*to
)->pathdata
.Types
= heap_alloc_zero(from
->pathdata
.Count
);
49 if((!(*to
)->pathdata
.Types
|| !(*to
)->pathdata
.Points
) && (*to
)->pathdata
.Count
){
50 heap_free((*to
)->pathdata
.Points
);
51 heap_free((*to
)->pathdata
.Types
);
56 memcpy((*to
)->pathdata
.Points
, from
->pathdata
.Points
, from
->pathdata
.Count
58 memcpy((*to
)->pathdata
.Types
, from
->pathdata
.Types
, from
->pathdata
.Count
);
60 TRACE("<-- %p\n", *to
);
65 /* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
66 * version of this function returns NotImplemented. I cannot figure out why. */
67 GpStatus WINGDIPAPI
GdipCreateCustomLineCap(GpPath
* fillPath
, GpPath
* strokePath
,
68 GpLineCap baseCap
, REAL baseInset
, GpCustomLineCap
**customCap
)
72 TRACE("%p %p %d %f %p\n", fillPath
, strokePath
, baseCap
, baseInset
, customCap
);
74 if(!customCap
|| !(fillPath
|| strokePath
))
75 return InvalidParameter
;
77 *customCap
= heap_alloc_zero(sizeof(GpCustomLineCap
));
78 if(!*customCap
) return OutOfMemory
;
80 (*customCap
)->type
= CustomLineCapTypeDefault
;
82 (*customCap
)->fill
= FALSE
;
83 pathdata
= &strokePath
->pathdata
;
86 (*customCap
)->fill
= TRUE
;
87 pathdata
= &fillPath
->pathdata
;
90 (*customCap
)->pathdata
.Points
= heap_alloc_zero(pathdata
->Count
* sizeof(PointF
));
91 (*customCap
)->pathdata
.Types
= heap_alloc_zero(pathdata
->Count
);
93 if((!(*customCap
)->pathdata
.Types
|| !(*customCap
)->pathdata
.Points
) &&
95 heap_free((*customCap
)->pathdata
.Points
);
96 heap_free((*customCap
)->pathdata
.Types
);
97 heap_free(*customCap
);
101 memcpy((*customCap
)->pathdata
.Points
, pathdata
->Points
, pathdata
->Count
103 memcpy((*customCap
)->pathdata
.Types
, pathdata
->Types
, pathdata
->Count
);
104 (*customCap
)->pathdata
.Count
= pathdata
->Count
;
106 (*customCap
)->inset
= baseInset
;
107 (*customCap
)->cap
= baseCap
;
108 (*customCap
)->join
= LineJoinMiter
;
109 (*customCap
)->scale
= 1.0;
111 TRACE("<-- %p\n", *customCap
);
116 GpStatus WINGDIPAPI
GdipDeleteCustomLineCap(GpCustomLineCap
*customCap
)
118 TRACE("(%p)\n", customCap
);
121 return InvalidParameter
;
123 heap_free(customCap
->pathdata
.Points
);
124 heap_free(customCap
->pathdata
.Types
);
125 heap_free(customCap
);
130 GpStatus WINGDIPAPI
GdipGetCustomLineCapStrokeJoin(GpCustomLineCap
* customCap
,
131 GpLineJoin
* lineJoin
)
133 TRACE("(%p, %p)\n", customCap
, lineJoin
);
135 if(!customCap
|| !lineJoin
)
136 return InvalidParameter
;
138 *lineJoin
= customCap
->join
;
143 GpStatus WINGDIPAPI
GdipGetCustomLineCapWidthScale(GpCustomLineCap
* custom
,
146 TRACE("(%p, %p)\n", custom
, widthScale
);
148 if(!custom
|| !widthScale
)
149 return InvalidParameter
;
151 *widthScale
= custom
->scale
;
156 GpStatus WINGDIPAPI
GdipSetCustomLineCapStrokeCaps(GpCustomLineCap
* custom
,
157 GpLineCap start
, GpLineCap end
)
161 TRACE("(%p,%u,%u)\n", custom
, start
, end
);
164 return InvalidParameter
;
167 FIXME("not implemented\n");
169 return NotImplemented
;
172 GpStatus WINGDIPAPI
GdipSetCustomLineCapBaseCap(GpCustomLineCap
* custom
,
177 TRACE("(%p,%u)\n", custom
, base
);
180 FIXME("not implemented\n");
182 return NotImplemented
;
185 GpStatus WINGDIPAPI
GdipGetCustomLineCapBaseInset(GpCustomLineCap
* custom
,
188 TRACE("(%p, %p)\n", custom
, inset
);
190 if(!custom
|| !inset
)
191 return InvalidParameter
;
193 *inset
= custom
->inset
;
198 GpStatus WINGDIPAPI
GdipSetCustomLineCapBaseInset(GpCustomLineCap
* custom
,
203 TRACE("(%p,%0.2f)\n", custom
, inset
);
206 FIXME("not implemented\n");
208 return NotImplemented
;
211 /*FIXME: LineJoin completely ignored now */
212 GpStatus WINGDIPAPI
GdipSetCustomLineCapStrokeJoin(GpCustomLineCap
* custom
,
215 TRACE("(%p, %d)\n", custom
, join
);
218 return InvalidParameter
;
225 GpStatus WINGDIPAPI
GdipSetCustomLineCapWidthScale(GpCustomLineCap
* custom
, REAL width
)
227 TRACE("(%p,%0.2f)\n", custom
, width
);
230 return InvalidParameter
;
232 custom
->scale
= width
;
237 GpStatus WINGDIPAPI
GdipGetCustomLineCapBaseCap(GpCustomLineCap
*customCap
, GpLineCap
*baseCap
)
239 TRACE("(%p, %p)\n", customCap
, baseCap
);
241 if(!customCap
|| !baseCap
)
242 return InvalidParameter
;
244 *baseCap
= customCap
->cap
;
249 GpStatus WINGDIPAPI
GdipGetCustomLineCapType(GpCustomLineCap
*customCap
, CustomLineCapType
*type
)
251 TRACE("(%p, %p)\n", customCap
, type
);
253 if(!customCap
|| !type
)
254 return InvalidParameter
;
256 *type
= customCap
->type
;
260 GpStatus WINGDIPAPI
GdipCreateAdjustableArrowCap(REAL height
, REAL width
, BOOL fill
,
261 GpAdjustableArrowCap
**cap
)
265 TRACE("(%0.2f,%0.2f,%i,%p)\n", height
, width
, fill
, cap
);
268 FIXME("not implemented\n");
270 return NotImplemented
;
273 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap
* cap
, BOOL
* fill
)
277 TRACE("(%p,%p)\n", cap
, fill
);
280 FIXME("not implemented\n");
282 return NotImplemented
;
285 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap
* cap
, REAL
* height
)
289 TRACE("(%p,%p)\n", cap
, height
);
292 FIXME("not implemented\n");
294 return NotImplemented
;
297 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap
* cap
, REAL
* middle
)
301 TRACE("(%p,%p)\n", cap
, middle
);
304 FIXME("not implemented\n");
306 return NotImplemented
;
309 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap
* cap
, REAL
* width
)
313 TRACE("(%p,%p)\n", cap
, width
);
316 FIXME("not implemented\n");
318 return NotImplemented
;
321 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap
* cap
, BOOL fill
)
325 TRACE("(%p,%i)\n", cap
, fill
);
328 FIXME("not implemented\n");
330 return NotImplemented
;
333 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap
* cap
, REAL height
)
337 TRACE("(%p,%0.2f)\n", cap
, height
);
340 FIXME("not implemented\n");
342 return NotImplemented
;
345 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap
* cap
, REAL middle
)
349 TRACE("(%p,%0.2f)\n", cap
, middle
);
352 FIXME("not implemented\n");
354 return NotImplemented
;
357 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap
* cap
, REAL width
)
361 TRACE("(%p,%0.2f)\n", cap
, width
);
364 FIXME("not implemented\n");
366 return NotImplemented
;