gdiplus: Added GdipGetPathTypes.
[wine] / dlls / gdiplus / pen.c
1 /*
2  * Copyright (C) 2007 Google (Evan Stade)
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include <stdarg.h>
20
21 #include "windef.h"
22 #include "winbase.h"
23 #include "wingdi.h"
24 #include "gdiplus.h"
25 #include "gdiplus_private.h"
26 #include "wine/debug.h"
27
28 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
29
30 GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit,
31     GpPen **pen)
32 {
33     LOGBRUSH lb;
34     GpPen *gp_pen;
35
36     if(!pen)
37         return InvalidParameter;
38
39     gp_pen = GdipAlloc(sizeof(GpPen));
40     if(!gp_pen)    return OutOfMemory;
41
42     gp_pen->style = GP_DEFAULT_PENSTYLE;
43     gp_pen->color = ARGB2COLORREF(color);
44     gp_pen->width = width;
45     gp_pen->unit = unit;
46     gp_pen->endcap = LineCapFlat;
47
48     /* FIXME: Currently only solid lines supported. */
49     lb.lbStyle = BS_SOLID;
50     lb.lbColor = gp_pen->color;
51     lb.lbHatch = 0;
52
53     if((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel)) {
54         gp_pen->gdipen = ExtCreatePen(gp_pen->style, (INT) gp_pen->width, &lb,
55             0, NULL);
56     } else {
57         FIXME("UnitWorld, UnitPixel only supported units\n");
58         GdipFree(gp_pen);
59         return NotImplemented;
60     }
61
62     *pen = gp_pen;
63
64     return Ok;
65 }
66
67 GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
68 {
69     if(!pen)    return InvalidParameter;
70     DeleteObject(pen->gdipen);
71     GdipFree(pen);
72
73     return Ok;
74 }
75
76 GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
77 {
78     if(!pen)    return InvalidParameter;
79
80     pen->endcap = cap;
81
82     return Ok;
83 }