blob: 8b31b687bc89619d4ac140e6bafc3e1bef3a57f3 [file] [log] [blame]
Khaled Hosnyd4e928b2018-05-01 17:16:46 +02001/*
2 * Copyright © 2016 Google, Inc.
Ebrahim Byagowid4261b42018-10-21 08:48:07 +03303 * Copyright © 2018 Khaled Hosny
4 * Copyright © 2018 Ebrahim Byagowi
Khaled Hosnyd4e928b2018-05-01 17:16:46 +02005 *
6 * This is part of HarfBuzz, a text shaping library.
7 *
8 * Permission is hereby granted, without written agreement and without
9 * license or royalty fees, to use, copy, modify, and distribute this
10 * software and its documentation for any purpose, provided that the
11 * above copyright notice and the following two paragraphs appear in
12 * all copies of this software.
13 *
14 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
15 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
16 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
17 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
18 * DAMAGE.
19 *
20 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
21 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
22 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
23 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
24 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
25 *
Behdad Esfahbod79971442018-10-22 13:02:04 -070026 * Google Author(s): Sascha Brawer, Behdad Esfahbod
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020027 */
28
29#ifndef HB_OT_H_IN
30#error "Include <hb-ot.h> instead."
31#endif
32
33#ifndef HB_OT_COLOR_H
34#define HB_OT_COLOR_H
35
36#include "hb.h"
Ebrahim Byagowi456978d2018-10-21 08:26:40 +033037#include "hb-ot-name.h"
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020038
39HB_BEGIN_DECLS
40
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -070041
42/*
43 * Color palettes.
44 */
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020045
46HB_EXTERN hb_bool_t
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -070047hb_ot_color_has_palettes (hb_face_t *face);
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020048
49HB_EXTERN unsigned int
Behdad Esfahbod79971442018-10-22 13:02:04 -070050hb_ot_color_palette_get_count (hb_face_t *face);
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020051
Ebrahim Byagowi456978d2018-10-21 08:26:40 +033052HB_EXTERN hb_name_id_t
Behdad Esfahbod79971442018-10-22 13:02:04 -070053hb_ot_color_palette_get_name_id (hb_face_t *face,
54 unsigned int palette_index);
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020055
Ebrahim Byagowib8ee3a02018-10-21 09:44:16 +033056HB_EXTERN hb_name_id_t
Behdad Esfahbod79971442018-10-22 13:02:04 -070057hb_ot_color_palette_color_get_name_id (hb_face_t *face,
58 unsigned int color_index);
Khaled Hosnyd4e928b2018-05-01 17:16:46 +020059
Ebrahim Byagowib8ee3a02018-10-21 09:44:16 +033060/**
61 * hb_ot_color_palette_flags_t:
Behdad Esfahbod9085a722018-10-21 19:08:25 -070062 * @HB_OT_COLOR_PALETTE_FLAG_DEFAULT: default indicating that there is nothing special
63 * to note about a color palette.
64 * @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND: flag indicating that the color
65 * palette is appropriate to use when displaying the font on a light background such as white.
66 * @HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND: flag indicating that the color
67 * palette is appropriate to use when displaying the font on a dark background such as black.
Ebrahim Byagowib8ee3a02018-10-21 09:44:16 +033068 *
69 * Since: REPLACEME
70 */
71typedef enum { /*< flags >*/
Behdad Esfahbod9085a722018-10-21 19:08:25 -070072 HB_OT_COLOR_PALETTE_FLAG_DEFAULT = 0x00000000u,
73 HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_LIGHT_BACKGROUND = 0x00000001u,
74 HB_OT_COLOR_PALETTE_FLAG_USABLE_WITH_DARK_BACKGROUND = 0x00000002u,
Ebrahim Byagowib8ee3a02018-10-21 09:44:16 +033075} hb_ot_color_palette_flags_t;
76
77HB_EXTERN hb_ot_color_palette_flags_t
Behdad Esfahbod79971442018-10-22 13:02:04 -070078hb_ot_color_palette_get_flags (hb_face_t *face,
79 unsigned int palette_index);
Ebrahim Byagowib8ee3a02018-10-21 09:44:16 +033080
Behdad Esfahbod79971442018-10-22 13:02:04 -070081HB_EXTERN unsigned int
Behdad Esfahbod228f96c2018-10-22 16:55:12 -070082hb_ot_color_palette_get_colors (hb_face_t *face,
83 unsigned int palette_index,
84 unsigned int start_offset,
85 unsigned int *color_count, /* IN/OUT. May be NULL. */
86 hb_color_t *colors /* OUT. May be NULL. */);
Behdad Esfahbod9085a722018-10-21 19:08:25 -070087
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -070088
89/*
90 * Color layers.
91 */
92
93HB_EXTERN hb_bool_t
94hb_ot_color_has_layers (hb_face_t *face);
95
Behdad Esfahbod1de17bd2018-10-22 10:29:01 -070096/**
97 * hb_ot_color_layer_t:
98 *
99 * Since: REPLACEME
100 **/
101typedef struct hb_ot_color_layer_t
102{
103 hb_codepoint_t glyph;
104 unsigned int color_index;
105} hb_ot_color_layer_t;
106
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -0700107HB_EXTERN unsigned int
Behdad Esfahbod1de17bd2018-10-22 10:29:01 -0700108hb_ot_color_glyph_get_layers (hb_face_t *face,
109 hb_codepoint_t glyph,
110 unsigned int start_offset,
111 unsigned int *count, /* IN/OUT. May be NULL. */
112 hb_ot_color_layer_t *layers /* OUT. May be NULL. */);
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -0700113
Ebrahim Byagowic7a4e3d2018-10-23 18:00:48 +0330114/*
115 * SVG
116 */
117
118HB_EXTERN hb_bool_t
119hb_ot_color_has_svg (hb_face_t *face);
120
121HB_EXTERN hb_blob_t *
122hb_ot_color_glyph_svg_create_blob (hb_face_t *face,
123 hb_codepoint_t glyph,
124 hb_codepoint_t *start_glyph, /* OUT. May be NULL. */
125 hb_codepoint_t *end_glyph /* OUT. May be NULL. */);
126
Behdad Esfahbod3b3668a2018-10-21 19:23:11 -0700127
Khaled Hosnyd4e928b2018-05-01 17:16:46 +0200128HB_END_DECLS
129
130#endif /* HB_OT_COLOR_H */