[color] Add HB_COLOR

Normally I would have added to_string / from_string like other types
have.  But since we don't use hb_color_t much, I'm not going to do that.
Although, if we did, we could use it in hb-view to parse colors...
This commit is contained in:
Behdad Esfahbod 2018-10-22 18:20:57 -07:00
parent 228f96c9d0
commit b18acab7bc

View File

@ -446,16 +446,20 @@ hb_variation_to_string (hb_variation_t *variation,
/**
* hb_color_t:
* ARGB data type for holding color values.
*
* Data type for holding color values.
*
* Since: REPLACEME
*/
typedef uint32_t hb_color_t;
#define hb_color_get_alpha(color) (color & 0xFF)
#define hb_color_get_red(color) ((color >> 8) & 0xFF)
#define hb_color_get_green(color) ((color >> 16) & 0xFF)
#define hb_color_get_blue(color) ((color >> 24) & 0xFF)
#define HB_COLOR(b,g,r,a) ((hb_color_t) HB_TAG ((b),(g),(r),(a)))
#define hb_color_get_alpha(color) ((color) & 0xFF)
#define hb_color_get_red(color) (((color) >> 8) & 0xFF)
#define hb_color_get_green(color) (((color) >> 16) & 0xFF)
#define hb_color_get_blue(color) (((color) >> 24) & 0xFF)
HB_END_DECLS