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.fttrigon;
8 
9 import bindbc.freetype.bind.ftimage,
10        bindbc.freetype.bind.fttypes;
11 
12 alias FT_Angle = FT_Fixed;
13 
14 enum {
15     FT_ANGLE_PI     = 180 << 16,
16     FT_ANGLE_2PI    = FT_ANGLE_PI * 2,
17     FT_ANGLE_PI2    = FT_ANGLE_PI / 2,
18     FT_ANGLE_PI4    = FT_ANGLE_PI / 4
19 }
20 
21 version(BindFT_Static) {
22 	extern(C) @nogc nothrow {
23         FT_Fixed FT_Sin(FT_Angle);
24         FT_Fixed FT_Cos(FT_Angle);
25         FT_Fixed FT_Tan(FT_Angle);
26         FT_Angle FT_Atan2(FT_Fixed,FT_Fixed);
27         FT_Angle FT_Angle_Diff(FT_Angle,FT_Angle);
28         void FT_Vector_Unit(FT_Vector*,FT_Angle);
29         void FT_Vector_Rotate(FT_Vector*,FT_Angle);
30         FT_Fixed FT_Vector_Length(FT_Vector*);
31         void FT_Vector_Polarize(FT_Vector*,FT_Fixed*,FT_Angle*);
32         void FT_Vector_From_Polar(FT_Vector*,FT_Fixed,FT_Angle);
33     }
34 }
35 else {
36     extern(C) @nogc nothrow {
37         alias pFT_Sin = FT_Fixed function(FT_Angle);
38         alias pFT_Cos = FT_Fixed function(FT_Angle);
39         alias pFT_Tan = FT_Fixed function(FT_Angle);
40         alias pFT_Atan2 = FT_Angle function(FT_Fixed,FT_Fixed);
41         alias pFT_Angle_Diff = FT_Angle function(FT_Angle,FT_Angle);
42         alias pFT_Vector_Unit = void function(FT_Vector*,FT_Angle);
43         alias pFT_Vector_Rotate = void function(FT_Vector*,FT_Angle);
44         alias pFT_Vector_Length = FT_Fixed function(FT_Vector*);
45         alias pFT_Vector_Polarize = void function(FT_Vector*,FT_Fixed*,FT_Angle*);
46         alias pFT_Vector_From_Polar = void function(FT_Vector*,FT_Fixed,FT_Angle);
47     }
48 
49     __gshared {
50         pFT_Sin FT_Sin;
51         pFT_Cos FT_Cos;
52         pFT_Tan FT_Tan;
53         pFT_Atan2 FT_Atan2;
54         pFT_Angle_Diff FT_Angle_Diff;
55         pFT_Vector_Unit FT_Vector_Unit;
56         pFT_Vector_Rotate FT_Vector_Rotate;
57         pFT_Vector_Length FT_Vector_Length;
58         pFT_Vector_Polarize FT_Vector_Polarize;
59         pFT_Vector_From_Polar FT_Vector_From_Polar;
60     }
61 }