A need that has arisen in PNG export is knowing if the gamma is a simple
gamma and the gAMA tag can be used instead of a full ICC profile.
#include "config.h"
#include "babl-internal.h"
#include "base/util.h"
+#include "babl-trc.h"
static BablSpace space_db[MAX_SPACES];
if (blue_luminance)
*blue_luminance = space->space.RGBtoXYZ[5];
}
+
+double
+babl_space_get_gamma (const Babl *space)
+{
+ if (space->space.trc[0] != space->space.trc[1] ||
+ space->space.trc[1] != space->space.trc[2] ||
+ space->space.trc[0]->trc.type != BABL_TRC_FORMULA_GAMMA)
+ return 0.0;
+ return space->space.trc[0]->trc.gamma;
+}
int icc_length,
BablIccIntent intent,
const char **error);
-
+/* babl_space_get_gamma:
+ * @space: a babl space
+ *
+ * Returns the gamma of the TRCs of the space, iff they are all equal
+ * and a simple gamma number, otherwise 0.0 is returned.
+ */
+double
+babl_space_get_gamma (const Babl *space);
// XXX : deprecated
const Babl *babl_icc_make_space (const char *icc_data,