[babl] babl: implement babl_space_get_rgb_luminance
- From: Øyvind "pippin" Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [babl] babl: implement babl_space_get_rgb_luminance
- Date: Wed, 29 May 2019 00:00:25 +0000 (UTC)
commit b60b394cb86e91397c2e4d8563a0a4e2e9c550ba
Author: Øyvind Kolås <pippin gimp org>
Date: Wed May 29 01:58:30 2019 +0200
babl: implement babl_space_get_rgb_luminance
This provides the factors often found as defines hard-coded for sRGB
with values that are adapted to the primaries of the RGB family of
pixel encodings for a given babl space.
babl/babl-space.c | 16 ++++++++++++++++
babl/babl.h | 14 ++++++++++++++
export-symbols | 3 ++-
3 files changed, 32 insertions(+), 1 deletion(-)
---
diff --git a/babl/babl-space.c b/babl/babl-space.c
index f64ca3b..da6ac67 100644
--- a/babl/babl-space.c
+++ b/babl/babl-space.c
@@ -1230,3 +1230,19 @@ babl_space_get_XYZtoRGB (const Babl *space)
return &space->space.XYZtoRGB[0];
}
+
+void
+babl_space_get_rgb_luminance (const Babl *space,
+ double *red_luminance,
+ double *green_luminance,
+ double *blue_luminance)
+{
+ if (!space)
+ space = babl_space ("sRGB");
+ if (red_luminance)
+ *red_luminance = space->space.RGBtoXYZ[3];
+ if (green_luminance)
+ *green_luminance = space->space.RGBtoXYZ[4];
+ if (blue_luminance)
+ *blue_luminance = space->space.RGBtoXYZ[5];
+}
diff --git a/babl/babl.h b/babl/babl.h
index 8e71fac..bba5873 100644
--- a/babl/babl.h
+++ b/babl/babl.h
@@ -585,6 +585,20 @@ babl_space_get_RGBtoXYZ (const Babl *space);
const double *
babl_space_get_XYZtoRGB (const Babl *space);
+/**
+ * babl_space_get_rgb_luminance:
+ * @space: a BablSpace
+ * @red_luminance: pointer to a double where red luminance factor is stored
+ * @green_luminance: pointer to a double where green luminance factor is stored
+ * @blue_luminance: pointer to a double where blue luminance factor is stored
+ *
+ * Retrieve the relevant RGB luminance constants for a babl space.
+ */
+void
+babl_space_get_rgb_luminance (const Babl *space,
+ double *red_luminance,
+ double *green_luminance,
+ double *blue_luminance);
/**
* babl_model_is:
diff --git a/export-symbols b/export-symbols
index c0dff8f..d692f46 100644
--- a/export-symbols
+++ b/export-symbols
@@ -47,8 +47,9 @@ babl_space_from_rgbxyz_matrix
babl_space_from_chromaticities
babl_space_from_icc
babl_space_get
-babl_space_get_rgbtoxyz
babl_space_get_icc
+babl_space_get_rgbtoxyz
+babl_space_get_rgb_luminance
babl_space_to_xyz
babl_space_from_xyz
babl_space_to_icc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]