uint32_t color = 0xFF;
if (color_indices[layer] != 0xFFFF)
color = colors[color_indices[layer]];
- int alpha = color & 0xFF;
- int r = (color >> 8) & 0xFF;
- int g = (color >> 16) & 0xFF;
- int b = (color >> 24) & 0xFF;
+ int alpha = hb_ot_color_get_alpha (color);
+ int r = hb_ot_color_get_red (color);
+ int g = hb_ot_color_get_green (color);
+ int b = hb_ot_color_get_blue (color);
cairo_set_source_rgba (cr, r / 255., g / 255., b / 255., alpha);
cairo_glyph_t glyph;
*/
typedef uint32_t hb_ot_color_t;
+#define hb_ot_color_get_alpha(color) (color & 0xFF)
+#define hb_ot_color_get_red(color) ((color >> 8) & 0xFF)
+#define hb_ot_color_get_green(color) ((color >> 16) & 0xFF)
+#define hb_ot_color_get_blue(color) ((color >> 24) & 0xFF)
+
HB_EXTERN hb_bool_t
hb_ot_color_has_cpal_data (hb_face_t *face);
HB_EXTERN unsigned int
hb_ot_color_get_color_layers (hb_face_t *face,
- hb_codepoint_t gid,
- unsigned int offset,
- unsigned int *count, /* IN/OUT */
- hb_codepoint_t *gids, /* OUT */
- unsigned int *color_indices /* OUT */);
+ hb_codepoint_t gid,
+ unsigned int offset,
+ unsigned int *count, /* IN/OUT */
+ hb_codepoint_t *gids, /* OUT */
+ unsigned int *color_indices /* OUT */);
HB_END_DECLS
const hb_ot_color_t *_colors = (colors); \
const size_t _i = (i); \
const uint8_t red = (r), green = (g), blue = (b), alpha = (a); \
- if ((_colors[_i] >> 16 & 0xff) != red) { \
+ if (hb_ot_color_get_red (_colors[_i]) != red) { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"colors[" #i "]", _colors[_i], "==", red, 'x'); \
} \
- if ((_colors[_i] >> 8 & 0xff) != green) { \
+ if (hb_ot_color_get_green (_colors[_i]) != green) { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"colors[" #i "]", _colors[_i], "==", green, 'x'); \
} \
- if ((_colors[_i] & 0xff) != blue) { \
+ if (hb_ot_color_get_blue (_colors[_i]) != blue) { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"colors[" #i "]", colors[_i], "==", blue, 'x'); \
} \
- if ((_colors[_i] >> 24 & 0xff) != alpha) { \
+ if (hb_ot_color_get_alpha (_colors[_i]) != alpha) { \
g_assertion_message_cmpnum (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, \
"colors[" #i "]", _colors[_i], "==", alpha, 'x'); \
} \
// assert_color_rgba (colors, 2, 0x77, 0x77, 0x77, 0x77); /* untouched */
/* Palette #3 (out of bounds), start_index=0 */
- memset(colors, 0x77, colors_size);
+ memset (colors, 0x77, colors_size);
g_assert_cmpint (hb_ot_color_get_palette_colors (cpal_v1, 3, 0, &num_colors, colors), ==, 0);
g_assert_cmpint (num_colors, ==, 0);
assert_color_rgba (colors, 0, 0x77, 0x77, 0x77, 0x77); /* untouched */