From: Øyvind Kolås Date: Fri, 20 Jul 2018 14:14:18 +0000 (+0200) Subject: babl: add a new symbol babl_format_get_encoding X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~16^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a9234712f4c7b986502a83954021ecb57b73e7f7;p=babl.git babl: add a new symbol babl_format_get_encoding This returns the string passed in to babl_format_new - without the space suffix that babl_get_name does for non-sRGB formats. --- diff --git a/babl/babl-format.c b/babl/babl-format.c index d295165..51e5458 100644 --- a/babl/babl-format.c +++ b/babl/babl-format.c @@ -710,6 +710,23 @@ const Babl * babl_format_get_space (const Babl *format) BABL_CLASS_IMPLEMENT (format) +const char * +babl_format_get_encoding (const Babl *babl) +{ + static char ret[256]; + const char *name = babl_get_name (babl); + strcpy (&ret[0], name); + if (babl_format_get_space (babl) != babl_space ("sRGB")) + { + + if (strstr (ret, "-space")) + *strstr (ret, "-space") = '\0'; + + name = &ret[0]; + } + return name; +} + const Babl * babl_format_with_space (const char *name, const Babl *space) { diff --git a/babl/babl.h b/babl/babl.h index 6d58aac..12b09c1 100644 --- a/babl/babl.h +++ b/babl/babl.h @@ -570,6 +570,12 @@ babl_space_from_rgbxyz_matrix (const char *name, const Babl *trc_green, const Babl *trc_blue); +/** + * babl_format_get_encoding: + * + * Returns the components and data type, without space suffix. + */ +const char * babl_format_get_encoding (const Babl *babl); #ifdef __cplusplus } diff --git a/export-symbols b/export-symbols index d246e3d..476238e 100644 --- a/export-symbols +++ b/export-symbols @@ -14,6 +14,7 @@ babl_format_get_model babl_format_get_n_components babl_format_get_space babl_format_get_type +babl_format_get_encoding babl_format_has_alpha babl_format_is_format_n babl_format_is_palette