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