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.ftrender;
8 
9 import bindbc.freetype.bind.freetype,
10        bindbc.freetype.bind.ftglyph,
11        bindbc.freetype.bind.ftimage,
12        bindbc.freetype.bind.ftmodapi,
13        bindbc.freetype.bind.fttypes;
14 
15 extern(C) nothrow {
16     alias FT_Glyph_InitFunc = FT_Error function(FT_Glyph, FT_GlyphSlot);
17     alias FT_Glyph_DoneFunc = void function(FT_Glyph);
18     alias FT_Glyph_TransformFunc = void function(FT_Glyph, const(FT_Matrix)* matrix, const(FT_Vector)*);
19     alias FT_Glyph_GetBBoxFunc = void function(FT_Glyph, FT_BBox*);
20     alias FT_Glyph_CopyFunc = FT_Error function(FT_Glyph, FT_Glyph);
21     alias FT_Glyph_PrepareFunc = FT_Error function(FT_Glyph, FT_GlyphSlot);
22 }
23 
24 struct FT_Glyph_Class {  // typedef'd in ftglyph.h
25     FT_Long glyph_size;
26     FT_Glyph_Format glyph_format;
27     FT_Glyph_InitFunc glyph_init;
28     FT_Glyph_DoneFunc glyph_done;
29     FT_Glyph_CopyFunc glyph_copy;
30     FT_Glyph_TransformFunc glyph_transform;
31     FT_Glyph_GetBBoxFunc glyph_bbox;
32     FT_Glyph_PrepareFunc glyph_prepare;
33 }
34 
35 extern(C) nothrow {
36     alias FT_Renderer_RenderFunc = FT_Error function(FT_Renderer, FT_GlyphSlot, FT_Render_Mode, const(FT_Vector)*);
37     alias FT_Renderer_TransformFunc = FT_Error function(FT_Renderer, FT_GlyphSlot, const(FT_Matrix)*, const(FT_Vector)*);
38     alias FT_Renderer_GetCBoxFunc = void function(FT_Renderer, FT_GlyphSlot, FT_BBox*);
39     alias FT_Renderer_SetModeFunc = FT_Error function(FT_Renderer, FT_ULong, FT_Pointer);
40 }
41 
42 struct FT_Renderer_Class {
43     FT_Module_Class root;
44     FT_Glyph_Format glyph_format;
45     FT_Renderer_RenderFunc render_glyph;
46     FT_Renderer_TransformFunc transform_glyph;
47     FT_Renderer_GetCBoxFunc get_glyph_cbox;
48     FT_Renderer_SetModeFunc set_mode;
49     FT_Raster_Funcs* raster_class;
50 }
51 
52 version(BindFT_Static) {
53 	extern(C) @nogc nothrow {
54         FT_Renderer FT_Get_Renderer(FT_Library,FT_Glyph_Format);
55         FT_Error FT_Set_Renderer(FT_Library,FT_Renderer,FT_UInt,FT_Parameter*);
56     }
57 }
58 else {
59     extern(C) @nogc nothrow {
60         alias da_FT_Get_Renderer = FT_Renderer function(FT_Library,FT_Glyph_Format);
61         alias da_FT_Set_Renderer = FT_Error function(FT_Library,FT_Renderer,FT_UInt,FT_Parameter*);
62     }
63 
64     __gshared {
65         da_FT_Get_Renderer FT_Get_Renderer;
66         da_FT_Set_Renderer FT_Set_Renderer;
67     }
68 }