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
19 #include "gdiplus_private.h"
21 GpStatus WINGDIPAPI
GdipCloneCustomLineCap(GpCustomLineCap
* from
,
24 TRACE("(%p, %p)\n", from
, to
);
27 return InvalidParameter
;
29 *to
= heap_alloc_zero(sizeof(GpCustomLineCap
));
30 if(!*to
) return OutOfMemory
;
32 memcpy(*to
, from
, sizeof(GpCustomLineCap
));
34 (*to
)->pathdata
.Points
= heap_alloc_zero(from
->pathdata
.Count
* sizeof(PointF
));
35 (*to
)->pathdata
.Types
= heap_alloc_zero(from
->pathdata
.Count
);
37 if((!(*to
)->pathdata
.Types
|| !(*to
)->pathdata
.Points
) && (*to
)->pathdata
.Count
){
38 heap_free((*to
)->pathdata
.Points
);
39 heap_free((*to
)->pathdata
.Types
);
44 memcpy((*to
)->pathdata
.Points
, from
->pathdata
.Points
, from
->pathdata
.Count
46 memcpy((*to
)->pathdata
.Types
, from
->pathdata
.Types
, from
->pathdata
.Count
);
48 TRACE("<-- %p\n", *to
);
53 /* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
54 * version of this function returns NotImplemented. I cannot figure out why. */
55 GpStatus WINGDIPAPI
GdipCreateCustomLineCap(GpPath
* fillPath
, GpPath
* strokePath
,
56 GpLineCap baseCap
, REAL baseInset
, GpCustomLineCap
**customCap
)
60 TRACE("%p %p %d %f %p\n", fillPath
, strokePath
, baseCap
, baseInset
, customCap
);
62 if(!customCap
|| !(fillPath
|| strokePath
))
63 return InvalidParameter
;
65 *customCap
= heap_alloc_zero(sizeof(GpCustomLineCap
));
66 if(!*customCap
) return OutOfMemory
;
68 (*customCap
)->type
= CustomLineCapTypeDefault
;
70 (*customCap
)->fill
= FALSE
;
71 pathdata
= &strokePath
->pathdata
;
74 (*customCap
)->fill
= TRUE
;
75 pathdata
= &fillPath
->pathdata
;
78 (*customCap
)->pathdata
.Points
= heap_alloc_zero(pathdata
->Count
* sizeof(PointF
));
79 (*customCap
)->pathdata
.Types
= heap_alloc_zero(pathdata
->Count
);
81 if((!(*customCap
)->pathdata
.Types
|| !(*customCap
)->pathdata
.Points
) &&
83 heap_free((*customCap
)->pathdata
.Points
);
84 heap_free((*customCap
)->pathdata
.Types
);
85 heap_free(*customCap
);
89 memcpy((*customCap
)->pathdata
.Points
, pathdata
->Points
, pathdata
->Count
91 memcpy((*customCap
)->pathdata
.Types
, pathdata
->Types
, pathdata
->Count
);
92 (*customCap
)->pathdata
.Count
= pathdata
->Count
;
94 (*customCap
)->inset
= baseInset
;
95 (*customCap
)->cap
= baseCap
;
96 (*customCap
)->join
= LineJoinMiter
;
97 (*customCap
)->scale
= 1.0;
99 TRACE("<-- %p\n", *customCap
);
104 GpStatus WINGDIPAPI
GdipDeleteCustomLineCap(GpCustomLineCap
*customCap
)
106 TRACE("(%p)\n", customCap
);
109 return InvalidParameter
;
111 heap_free(customCap
->pathdata
.Points
);
112 heap_free(customCap
->pathdata
.Types
);
113 heap_free(customCap
);
118 GpStatus WINGDIPAPI
GdipGetCustomLineCapStrokeJoin(GpCustomLineCap
* customCap
,
119 GpLineJoin
* lineJoin
)
121 TRACE("(%p, %p)\n", customCap
, lineJoin
);
123 if(!customCap
|| !lineJoin
)
124 return InvalidParameter
;
126 *lineJoin
= customCap
->join
;
131 GpStatus WINGDIPAPI
GdipGetCustomLineCapWidthScale(GpCustomLineCap
* custom
,
134 TRACE("(%p, %p)\n", custom
, widthScale
);
136 if(!custom
|| !widthScale
)
137 return InvalidParameter
;
139 *widthScale
= custom
->scale
;
144 GpStatus WINGDIPAPI
GdipSetCustomLineCapStrokeCaps(GpCustomLineCap
* custom
,
145 GpLineCap start
, GpLineCap end
)
149 TRACE("(%p,%u,%u)\n", custom
, start
, end
);
152 return InvalidParameter
;
155 FIXME("not implemented\n");
157 return NotImplemented
;
160 GpStatus WINGDIPAPI
GdipSetCustomLineCapBaseCap(GpCustomLineCap
* custom
,
165 TRACE("(%p,%u)\n", custom
, base
);
168 FIXME("not implemented\n");
170 return NotImplemented
;
173 GpStatus WINGDIPAPI
GdipGetCustomLineCapBaseInset(GpCustomLineCap
* custom
,
176 TRACE("(%p, %p)\n", custom
, inset
);
178 if(!custom
|| !inset
)
179 return InvalidParameter
;
181 *inset
= custom
->inset
;
186 GpStatus WINGDIPAPI
GdipSetCustomLineCapBaseInset(GpCustomLineCap
* custom
,
191 TRACE("(%p,%0.2f)\n", custom
, inset
);
194 FIXME("not implemented\n");
196 return NotImplemented
;
199 /*FIXME: LineJoin completely ignored now */
200 GpStatus WINGDIPAPI
GdipSetCustomLineCapStrokeJoin(GpCustomLineCap
* custom
,
203 TRACE("(%p, %d)\n", custom
, join
);
206 return InvalidParameter
;
213 GpStatus WINGDIPAPI
GdipSetCustomLineCapWidthScale(GpCustomLineCap
* custom
, REAL width
)
215 TRACE("(%p,%0.2f)\n", custom
, width
);
218 return InvalidParameter
;
220 custom
->scale
= width
;
225 GpStatus WINGDIPAPI
GdipGetCustomLineCapBaseCap(GpCustomLineCap
*customCap
, GpLineCap
*baseCap
)
227 TRACE("(%p, %p)\n", customCap
, baseCap
);
229 if(!customCap
|| !baseCap
)
230 return InvalidParameter
;
232 *baseCap
= customCap
->cap
;
237 GpStatus WINGDIPAPI
GdipGetCustomLineCapType(GpCustomLineCap
*customCap
, CustomLineCapType
*type
)
239 TRACE("(%p, %p)\n", customCap
, type
);
241 if(!customCap
|| !type
)
242 return InvalidParameter
;
244 *type
= customCap
->type
;
248 GpStatus WINGDIPAPI
GdipCreateAdjustableArrowCap(REAL height
, REAL width
, BOOL fill
,
249 GpAdjustableArrowCap
**cap
)
253 TRACE("(%0.2f,%0.2f,%i,%p)\n", height
, width
, fill
, cap
);
256 FIXME("not implemented\n");
258 return NotImplemented
;
261 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap
* cap
, BOOL
* fill
)
265 TRACE("(%p,%p)\n", cap
, fill
);
268 FIXME("not implemented\n");
270 return NotImplemented
;
273 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap
* cap
, REAL
* height
)
277 TRACE("(%p,%p)\n", cap
, height
);
280 FIXME("not implemented\n");
282 return NotImplemented
;
285 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap
* cap
, REAL
* middle
)
289 TRACE("(%p,%p)\n", cap
, middle
);
292 FIXME("not implemented\n");
294 return NotImplemented
;
297 GpStatus WINGDIPAPI
GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap
* cap
, REAL
* width
)
301 TRACE("(%p,%p)\n", cap
, width
);
304 FIXME("not implemented\n");
306 return NotImplemented
;
309 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap
* cap
, BOOL fill
)
313 TRACE("(%p,%i)\n", cap
, fill
);
316 FIXME("not implemented\n");
318 return NotImplemented
;
321 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap
* cap
, REAL height
)
325 TRACE("(%p,%0.2f)\n", cap
, height
);
328 FIXME("not implemented\n");
330 return NotImplemented
;
333 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap
* cap
, REAL middle
)
337 TRACE("(%p,%0.2f)\n", cap
, middle
);
340 FIXME("not implemented\n");
342 return NotImplemented
;
345 GpStatus WINGDIPAPI
GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap
* cap
, REAL width
)
349 TRACE("(%p,%0.2f)\n", cap
, width
);
352 FIXME("not implemented\n");
354 return NotImplemented
;