readme.de: Git is not an acronym.
[wine/hramrach.git] / dlls / gdiplus / customlinecap.c
blob5658e69c00da49a417f86b87b135035b527f72db
1 /*
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 <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wingdi.h"
25 #include "objbase.h"
27 #include "gdiplus.h"
28 #include "gdiplus_private.h"
29 #include "wine/debug.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
33 GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
34 GpCustomLineCap** to)
36 TRACE("(%p, %p)\n", from, to);
38 if(!from || !to)
39 return InvalidParameter;
41 *to = GdipAlloc(sizeof(GpCustomLineCap));
42 if(!*to) return OutOfMemory;
44 memcpy(*to, from, sizeof(GpCustomLineCap));
46 (*to)->pathdata.Points = GdipAlloc(from->pathdata.Count * sizeof(PointF));
47 (*to)->pathdata.Types = GdipAlloc(from->pathdata.Count);
49 if((!(*to)->pathdata.Types || !(*to)->pathdata.Points) && (*to)->pathdata.Count){
50 GdipFree((*to)->pathdata.Points);
51 GdipFree((*to)->pathdata.Types);
52 GdipFree(*to);
53 return OutOfMemory;
56 memcpy((*to)->pathdata.Points, from->pathdata.Points, from->pathdata.Count
57 * sizeof(PointF));
58 memcpy((*to)->pathdata.Types, from->pathdata.Types, from->pathdata.Count);
60 return Ok;
63 /* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
64 * version of this function returns NotImplemented. I cannot figure out why. */
65 GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
66 GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
68 GpPathData *pathdata;
70 TRACE("%p %p %d %f %p\n", fillPath, strokePath, baseCap, baseInset, customCap);
72 if(!customCap || !(fillPath || strokePath))
73 return InvalidParameter;
75 *customCap = GdipAlloc(sizeof(GpCustomLineCap));
76 if(!*customCap) return OutOfMemory;
78 if(strokePath){
79 (*customCap)->fill = FALSE;
80 pathdata = &strokePath->pathdata;
82 else{
83 (*customCap)->fill = TRUE;
84 pathdata = &fillPath->pathdata;
87 (*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF));
88 (*customCap)->pathdata.Types = GdipAlloc(pathdata->Count);
90 if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
91 pathdata->Count){
92 GdipFree((*customCap)->pathdata.Points);
93 GdipFree((*customCap)->pathdata.Types);
94 GdipFree(*customCap);
95 return OutOfMemory;
98 memcpy((*customCap)->pathdata.Points, pathdata->Points, pathdata->Count
99 * sizeof(PointF));
100 memcpy((*customCap)->pathdata.Types, pathdata->Types, pathdata->Count);
101 (*customCap)->pathdata.Count = pathdata->Count;
103 (*customCap)->inset = baseInset;
104 (*customCap)->cap = baseCap;
105 (*customCap)->join = LineJoinMiter;
106 (*customCap)->scale = 1.0;
108 return Ok;
111 GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
113 TRACE("(%p)\n", customCap);
115 if(!customCap)
116 return InvalidParameter;
118 GdipFree(customCap->pathdata.Points);
119 GdipFree(customCap->pathdata.Types);
120 GdipFree(customCap);
122 return Ok;
125 GpStatus WINGDIPAPI GdipGetCustomLineCapStrokeJoin(GpCustomLineCap* customCap,
126 GpLineJoin* lineJoin)
128 TRACE("(%p, %p)\n", customCap, lineJoin);
130 if(!customCap || !lineJoin)
131 return InvalidParameter;
133 *lineJoin = customCap->join;
135 return Ok;
138 GpStatus WINGDIPAPI GdipGetCustomLineCapWidthScale(GpCustomLineCap* custom,
139 REAL* widthScale)
141 TRACE("(%p, %p)\n", custom, widthScale);
143 if(!custom || !widthScale)
144 return InvalidParameter;
146 *widthScale = custom->scale;
148 return Ok;
151 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeCaps(GpCustomLineCap* custom,
152 GpLineCap start, GpLineCap end)
154 static int calls;
156 if(!custom)
157 return InvalidParameter;
159 if(!(calls++))
160 FIXME("not implemented\n");
162 return NotImplemented;
165 GpStatus WINGDIPAPI GdipSetCustomLineCapBaseCap(GpCustomLineCap* custom,
166 GpLineCap base)
168 static int calls;
170 if(!(calls++))
171 FIXME("not implemented\n");
173 return NotImplemented;
176 GpStatus WINGDIPAPI GdipGetCustomLineCapBaseInset(GpCustomLineCap* custom,
177 REAL* inset)
179 TRACE("(%p, %p)\n", custom, inset);
181 if(!custom || !inset)
182 return InvalidParameter;
184 *inset = custom->inset;
186 return Ok;
189 GpStatus WINGDIPAPI GdipSetCustomLineCapBaseInset(GpCustomLineCap* custom,
190 REAL inset)
192 static int calls;
194 if(!(calls++))
195 FIXME("not implemented\n");
197 return NotImplemented;
200 /*FIXME: LineJoin completely ignored now */
201 GpStatus WINGDIPAPI GdipSetCustomLineCapStrokeJoin(GpCustomLineCap* custom,
202 GpLineJoin join)
204 TRACE("(%p, %d)\n", custom, join);
206 if(!custom)
207 return InvalidParameter;
209 custom->join = join;
211 return Ok;
214 GpStatus WINGDIPAPI GdipSetCustomLineCapWidthScale(GpCustomLineCap* custom,
215 REAL width)
217 static int calls;
219 if(!(calls++))
220 FIXME("not implemented\n");
222 return NotImplemented;
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;
234 return Ok;
237 GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL fill,
238 GpAdjustableArrowCap **cap)
240 static int calls;
242 if(!(calls++))
243 FIXME("not implemented\n");
245 return NotImplemented;
248 GpStatus WINGDIPAPI GdipGetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL* fill)
250 static int calls;
252 if(!(calls++))
253 FIXME("not implemented\n");
255 return NotImplemented;
258 GpStatus WINGDIPAPI GdipGetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL* height)
260 static int calls;
262 if(!(calls++))
263 FIXME("not implemented\n");
265 return NotImplemented;
268 GpStatus WINGDIPAPI GdipGetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL* middle)
270 static int calls;
272 if(!(calls++))
273 FIXME("not implemented\n");
275 return NotImplemented;
278 GpStatus WINGDIPAPI GdipGetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL* width)
280 static int calls;
282 if(!(calls++))
283 FIXME("not implemented\n");
285 return NotImplemented;
288 GpStatus WINGDIPAPI GdipSetAdjustableArrowCapFillState(GpAdjustableArrowCap* cap, BOOL fill)
290 static int calls;
292 if(!(calls++))
293 FIXME("not implemented\n");
295 return NotImplemented;
298 GpStatus WINGDIPAPI GdipSetAdjustableArrowCapHeight(GpAdjustableArrowCap* cap, REAL height)
300 static int calls;
302 if(!(calls++))
303 FIXME("not implemented\n");
305 return NotImplemented;
308 GpStatus WINGDIPAPI GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap* cap, REAL middle)
310 static int calls;
312 if(!(calls++))
313 FIXME("not implemented\n");
315 return NotImplemented;
318 GpStatus WINGDIPAPI GdipSetAdjustableArrowCapWidth(GpAdjustableArrowCap* cap, REAL width)
320 static int calls;
322 if(!(calls++))
323 FIXME("not implemented\n");
325 return NotImplemented;