1 
2 //          Copyright Michael D. Parker 2018.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.freetype.bind.ftstroke;
8 
9 import bindbc.freetype.bind.ftimage,
10        bindbc.freetype.bind.ftglyph,
11        bindbc.freetype.bind.ftsystem,
12        bindbc.freetype.bind.fttypes;
13 
14 struct FT_StrokerRec;
15 alias FT_Stroker = FT_StrokerRec*;
16 
17 alias FT_Stroker_LineJoin = int;
18 enum {
19     FT_STROKER_LINEJOIN_ROUND = 0,
20     FT_STROKER_LINEJOIN_BEVEL,
21     FT_STROKER_LINEJOIN_MITER
22 }
23 
24 alias FT_Stroker_LineCap = int;
25 enum {
26     FT_STROKER_LINECAP_BUTT = 0,
27     FT_STROKER_LINECAP_ROUND,
28     FT_STROKER_LINECAP_SQUARE
29 }
30 
31 alias FT_StrokerBorder = int;
32 enum {
33     FT_STROKER_BORDER_LEFT = 0,
34     FT_STROKER_BORDER_RIGHT
35 }
36 
37 version(BindFT_Static) {
38 	extern(C) @nogc nothrow {
39         FT_StrokerBorder FT_Outline_GetInsideBorder(FT_Outline*);
40         FT_StrokerBorder FT_Outline_GetOutsideBorder(FT_Outline*);
41         FT_Error FT_Stroker_New(FT_Memory,FT_Stroker*);
42         void FT_Stroker_Set(FT_Stroker,FT_Fixed,FT_Stroker_LineCap,FT_Stroker_LineJoin,FT_Fixed);
43         void FT_Stroker_Rewind(FT_Stroker);
44         FT_Error FT_Stroker_ParseOutline(FT_Stroker,FT_Outline*,FT_Bool);
45         FT_Error FT_Stroker_BeginSubPath(FT_Stroker,FT_Vector*,FT_Bool);
46         FT_Error FT_Stroker_EndSubPath(FT_Stroker);
47         FT_Error FT_Stroker_LineTo(FT_Stroker,FT_Vector*);
48         FT_Error FT_Stroker_ConicTo(FT_Stroker,FT_Vector*,FT_Vector*);
49         FT_Error FT_Stroker_CubicTo(FT_Stroker,FT_Vector*,FT_Vector*,FT_Vector*);
50         FT_Error FT_Stroker_GetBorderCounts(FT_Stroker,FT_StrokerBorder,FT_UInt*,FT_UInt*);
51         void FT_Stroker_ExportBorder(FT_Stroker,FT_StrokerBorder,FT_Outline*);
52         FT_Error FT_Stroker_GetCounts(FT_Stroker,FT_UInt*,FT_UInt*);
53         void FT_Stroker_Export(FT_Stroker,FT_Outline*);
54         void FT_Stroker_Done(FT_Stroker);
55         FT_Error FT_Glyph_Stroke(FT_Glyph*,FT_Stroker,FT_Bool);
56         FT_Error FT_Glyph_StrokeBorder(FT_Glyph*,FT_Stroker,FT_Bool,FT_Bool);
57     }
58 }
59 else {
60     extern(C) @nogc nothrow {
61         alias pFT_Outline_GetInsideBorder = FT_StrokerBorder function(FT_Outline*);
62         alias pFT_Outline_GetOutsideBorder = FT_StrokerBorder function(FT_Outline*);
63         alias pFT_Stroker_New = FT_Error function(FT_Memory,FT_Stroker*);
64         alias pFT_Stroker_Set = void function(FT_Stroker,FT_Fixed,FT_Stroker_LineCap,FT_Stroker_LineJoin,FT_Fixed);
65         alias pFT_Stroker_Rewind = void function(FT_Stroker);
66         alias pFT_Stroker_ParseOutline = FT_Error function(FT_Stroker,FT_Outline*,FT_Bool);
67         alias pFT_Stroker_BeginSubPath = FT_Error function(FT_Stroker,FT_Vector*,FT_Bool);
68         alias pFT_Stroker_EndSubPath = FT_Error function(FT_Stroker);
69         alias pFT_Stroker_LineTo = FT_Error function(FT_Stroker,FT_Vector*);
70         alias pFT_Stroker_ConicTo = FT_Error function(FT_Stroker,FT_Vector*,FT_Vector*);
71         alias pFT_Stroker_CubicTo = FT_Error function(FT_Stroker,FT_Vector*,FT_Vector*,FT_Vector*);
72         alias pFT_Stroker_GetBorderCounts = FT_Error function(FT_Stroker,FT_StrokerBorder,FT_UInt*,FT_UInt*);
73         alias pFT_Stroker_ExportBorder = void function(FT_Stroker,FT_StrokerBorder,FT_Outline*);
74         alias pFT_Stroker_GetCounts = FT_Error function(FT_Stroker,FT_UInt*,FT_UInt*);
75         alias pFT_Stroker_Export = void function(FT_Stroker,FT_Outline*);
76         alias pFT_Stroker_Done = void function(FT_Stroker);
77         alias pFT_Glyph_Stroke = FT_Error function(FT_Glyph*,FT_Stroker,FT_Bool);
78         alias pFT_Glyph_StrokeBorder = FT_Error function(FT_Glyph*,FT_Stroker,FT_Bool,FT_Bool);
79     }
80 
81     __gshared {
82         pFT_Outline_GetInsideBorder FT_Outline_GetInsideBorder;
83         pFT_Outline_GetOutsideBorder FT_Outline_GetOutsideBorder;
84         pFT_Stroker_New FT_Stroker_New;
85         pFT_Stroker_Set FT_Stroker_Set;
86         pFT_Stroker_Rewind FT_Stroker_Rewind;
87         pFT_Stroker_ParseOutline FT_Stroker_ParseOutline;
88         pFT_Stroker_BeginSubPath FT_Stroker_BeginSubPath;
89         pFT_Stroker_EndSubPath FT_Stroker_EndSubPath;
90         pFT_Stroker_LineTo FT_Stroker_LineTo;
91         pFT_Stroker_ConicTo FT_Stroker_ConicTo;
92         pFT_Stroker_CubicTo FT_Stroker_CubicTo;
93         pFT_Stroker_GetBorderCounts FT_Stroker_GetBorderCounts;
94         pFT_Stroker_ExportBorder FT_Stroker_ExportBorder;
95         pFT_Stroker_GetCounts FT_Stroker_GetCounts;
96         pFT_Stroker_Export FT_Stroker_Export;
97         pFT_Stroker_Done FT_Stroker_Done;
98         pFT_Glyph_Stroke FT_Glyph_Stroke;
99         pFT_Glyph_StrokeBorder FT_Glyph_StrokeBorder;
100     }
101 }