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
25 #include "gdiplus_private.h"
27 GpStatus WINGDIPAPI
GdipCreateCustomLineCap(GpPath
* fillPath
, GpPath
* strokePath
,
28 GpLineCap baseCap
, REAL baseInset
, GpCustomLineCap
**customCap
)
32 if(!customCap
|| !(fillPath
|| strokePath
))
33 return InvalidParameter
;
35 *customCap
= GdipAlloc(sizeof(GpCustomLineCap
));
36 if(!*customCap
) return OutOfMemory
;
39 (*customCap
)->fill
= FALSE
;
40 pathdata
= &strokePath
->pathdata
;
43 (*customCap
)->fill
= TRUE
;
44 pathdata
= &fillPath
->pathdata
;
47 (*customCap
)->pathdata
.Points
= GdipAlloc(pathdata
->Count
* sizeof(PointF
));
48 (*customCap
)->pathdata
.Types
= GdipAlloc(pathdata
->Count
);
50 if((!(*customCap
)->pathdata
.Types
|| !(*customCap
)->pathdata
.Points
) &&
52 GdipFree((*customCap
)->pathdata
.Points
);
53 GdipFree((*customCap
)->pathdata
.Types
);
58 memcpy((*customCap
)->pathdata
.Points
, pathdata
->Points
, pathdata
->Count
60 memcpy((*customCap
)->pathdata
.Types
, pathdata
->Types
, pathdata
->Count
);
61 (*customCap
)->pathdata
.Count
= pathdata
->Count
;
63 (*customCap
)->inset
= baseInset
;
64 (*customCap
)->cap
= baseCap
;
69 GpStatus WINGDIPAPI
GdipDeleteCustomLineCap(GpCustomLineCap
*customCap
)
72 return InvalidParameter
;
74 GdipFree(customCap
->pathdata
.Points
);
75 GdipFree(customCap
->pathdata
.Types
);