1 
2 //          Copyright Ahmet Sait Koçak 2020.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          https://www.boost.org/LICENSE_1_0.txt)
6 
7 module bindbc.hb.bind.ot.color;
8 
9 import bindbc.hb.config;
10 
11 static if (hbSupport >= HBSupport.v2_6_3)
12 {
13 	import bindbc.hb.bind.blob;
14 	import bindbc.hb.bind.common;
15 	import bindbc.hb.bind.face;
16 	import bindbc.hb.bind.font;
17 	import bindbc.hb.bind.ot.name;
18 
19 	extern(C) @nogc nothrow:
20 
21 	/*
22 	 * Color palettes.
23 	 */
24 
25 	version(BindHB_Static)
26 		hb_bool_t hb_ot_color_has_palettes (hb_face_t* face);
27 	else
28 	{
29 		private alias fp_hb_ot_color_has_palettes = hb_bool_t function (hb_face_t* face);
30 		__gshared fp_hb_ot_color_has_palettes hb_ot_color_has_palettes;
31 	}
32 
33 	version(BindHB_Static)
34 		uint hb_ot_color_palette_get_count (hb_face_t* face);
35 	else
36 	{
37 		private alias fp_hb_ot_color_palette_get_count = uint function (hb_face_t* face);
38 		__gshared fp_hb_ot_color_palette_get_count hb_ot_color_palette_get_count;
39 	}
40 
41 	version(BindHB_Static)
42 		hb_ot_name_id_t hb_ot_color_palette_get_name_id (
43 			hb_face_t* face,
44 			uint palette_index);
45 	else
46 	{
47 		private alias fp_hb_ot_color_palette_get_name_id = hb_ot_name_id_t function (
48 			hb_face_t* face,
49 			uint palette_index);
50 		__gshared fp_hb_ot_color_palette_get_name_id hb_ot_color_palette_get_name_id;
51 	}
52 
53 	version(BindHB_Static)
54 		hb_ot_name_id_t hb_ot_color_palette_color_get_name_id (
55 			hb_face_t* face,
56 			uint color_index);
57 	else
58 	{
59 		private alias fp_hb_ot_color_palette_color_get_name_id = hb_ot_name_id_t function (
60 			hb_face_t* face,
61 			uint color_index);
62 		__gshared fp_hb_ot_color_palette_color_get_name_id hb_ot_color_palette_color_get_name_id;
63 	}
64 
65 	/**
66 	 * hb_ot_color_palette_flags_t:
67 	 * @HB_OT_COLOR_PALETTE_FLAG_DEFAULT: Default indicating that there is nothing special
68 	 *   to note about a color palette.
69 	 * @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND: Flag indicating that the color
70 	 *   palette is appropriate to use when displaying the font on a light background such as white.
71 	 * @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND: Flag indicating that the color
72 	 *   palette is appropriate to use when displaying the font on a dark background such as black.
73 	 *
74 	 * Since: 2.1.0
75 	 */
76 	enum : uint
77 	{
78 		/*< flags >*/
79 		HB_OT_COLOR_PALETTE_FLAG_DEFAULT = 0x00000000u,
80 		HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND = 0x00000001u,
81 		HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND = 0x00000002u
82 	}
83 	alias hb_ot_color_palette_flags_t = uint;
84 
85 	version(BindHB_Static)
86 		hb_ot_color_palette_flags_t hb_ot_color_palette_get_flags (
87 			hb_face_t* face,
88 			uint palette_index);
89 	else
90 	{
91 		private alias fp_hb_ot_color_palette_get_flags = hb_ot_color_palette_flags_t function (
92 			hb_face_t* face,
93 			uint palette_index);
94 		__gshared fp_hb_ot_color_palette_get_flags hb_ot_color_palette_get_flags;
95 	}
96 
97 	/* IN/OUT.  May be NULL. */
98 	/* OUT.     May be NULL. */
99 	version(BindHB_Static)
100 		uint hb_ot_color_palette_get_colors (
101 			hb_face_t* face,
102 			uint palette_index,
103 			uint start_offset,
104 			uint* color_count,
105 			hb_color_t* colors);
106 	else
107 	{
108 		private alias fp_hb_ot_color_palette_get_colors = uint function (
109 			hb_face_t* face,
110 			uint palette_index,
111 			uint start_offset,
112 			uint* color_count,
113 			hb_color_t* colors);
114 		__gshared fp_hb_ot_color_palette_get_colors hb_ot_color_palette_get_colors;
115 	}
116 
117 	/*
118 	 * Color layers.
119 	 */
120 
121 	version(BindHB_Static)
122 		hb_bool_t hb_ot_color_has_layers (hb_face_t* face);
123 	else
124 	{
125 		private alias fp_hb_ot_color_has_layers = hb_bool_t function (hb_face_t* face);
126 		__gshared fp_hb_ot_color_has_layers hb_ot_color_has_layers;
127 	}
128 
129 	/**
130 	 * hb_ot_color_layer_t:
131 	 *
132 	 * Pairs of glyph and color index.
133 	 *
134 	 * Since: 2.1.0
135 	 **/
136 	struct hb_ot_color_layer_t
137 	{
138 		hb_codepoint_t glyph;
139 		uint color_index;
140 	}
141 
142 	/* IN/OUT.  May be NULL. */
143 	/* OUT.     May be NULL. */
144 	version(BindHB_Static)
145 		uint hb_ot_color_glyph_get_layers (
146 			hb_face_t* face,
147 			hb_codepoint_t glyph,
148 			uint start_offset,
149 			uint* layer_count,
150 			hb_ot_color_layer_t* layers);
151 	else
152 	{
153 		private alias fp_hb_ot_color_glyph_get_layers = uint function (
154 			hb_face_t* face,
155 			hb_codepoint_t glyph,
156 			uint start_offset,
157 			uint* layer_count,
158 			hb_ot_color_layer_t* layers);
159 		__gshared fp_hb_ot_color_glyph_get_layers hb_ot_color_glyph_get_layers;
160 	}
161 
162 	/*
163 	 * SVG
164 	 */
165 
166 	version(BindHB_Static)
167 		hb_bool_t hb_ot_color_has_svg (hb_face_t* face);
168 	else
169 	{
170 		private alias fp_hb_ot_color_has_svg = hb_bool_t function (hb_face_t* face);
171 		__gshared fp_hb_ot_color_has_svg hb_ot_color_has_svg;
172 	}
173 
174 	version(BindHB_Static)
175 		hb_blob_t* hb_ot_color_glyph_reference_svg (
176 			hb_face_t* face,
177 			hb_codepoint_t glyph);
178 	else
179 	{
180 		private alias fp_hb_ot_color_glyph_reference_svg = hb_blob_t* function (
181 			hb_face_t* face,
182 			hb_codepoint_t glyph);
183 		__gshared fp_hb_ot_color_glyph_reference_svg hb_ot_color_glyph_reference_svg;
184 	}
185 
186 	/*
187 	 * PNG: CBDT or sbix
188 	 */
189 
190 	version(BindHB_Static)
191 		hb_bool_t hb_ot_color_has_png (hb_face_t* face);
192 	else
193 	{
194 		private alias fp_hb_ot_color_has_png = hb_bool_t function (hb_face_t* face);
195 		__gshared fp_hb_ot_color_has_png hb_ot_color_has_png;
196 	}
197 
198 	version(BindHB_Static)
199 		hb_blob_t* hb_ot_color_glyph_reference_png (
200 			hb_font_t* font,
201 			hb_codepoint_t glyph);
202 	else
203 	{
204 		private alias fp_hb_ot_color_glyph_reference_png = hb_blob_t* function (
205 			hb_font_t* font,
206 			hb_codepoint_t glyph);
207 		__gshared fp_hb_ot_color_glyph_reference_png hb_ot_color_glyph_reference_png;
208 	}
209 }