[gimp/goat-invasion: 328/412] libgimpcolor: add gimp_rgb[a]_set, get_pixel()



commit 5fa21c04c5cde0b94606f8cd8684934cead77dc0
Author: Michael Natterer <mitch gimp org>
Date:   Fri Mar 30 15:08:54 2012 +0200

    libgimpcolor: add gimp_rgb[a]_set,get_pixel()
    
    which converts from/to any pixel format using Babl. Added tons of
    includes and CFLAGS now that libgimpcolor publically uses Babl.

 app/base/Makefile.am                   |    1 +
 app/base/temp-buf.c                    |    1 +
 app/composite/Makefile.am              |    1 +
 app/composite/gimp-composite-generic.c |    1 +
 app/config/Makefile.am                 |    1 +
 app/config/gimpconfig-dump.c           |    1 +
 app/config/gimpcoreconfig.c            |    1 +
 app/config/gimpdisplayconfig.c         |    1 +
 app/config/gimpdisplayoptions.c        |    1 +
 app/config/gimprc-deserialize.c        |    1 +
 app/core/gimpgradient-load.c           |    2 +-
 app/core/gimpgrid.c                    |    2 +-
 app/core/gimppalette-load.c            |    2 +-
 app/core/gimppalette-save.c            |    2 +-
 app/display/gimpcanvas.c               |    1 +
 app/gui/color-history.c                |    1 +
 app/gui/splash.c                       |    1 +
 app/paint-funcs/Makefile.am            |    1 +
 app/paint-funcs/paint-funcs.c          |    1 +
 app/pdb/gimp-pdb-compat.c              |    2 +-
 app/plug-in/plug-in-params.c           |    2 +-
 app/text/gimptext-parasite.c           |    2 +-
 app/widgets/gimpcairo.c                |    1 +
 app/widgets/gimpcolorbar.c             |    1 +
 app/widgets/gimpcurveview.c            |    1 +
 app/widgets/gimpdynamicsoutputeditor.c |    1 +
 app/widgets/gimppaletteview.c          |    1 +
 app/widgets/gimprender.c               |    1 +
 app/widgets/gimptexttag.c              |    1 +
 app/widgets/gimpviewrenderergradient.c |    1 +
 app/widgets/gimpviewrendererpalette.c  |    1 +
 app/widgets/gimpwidgets-utils.c        |    1 +
 libgimpcolor/Makefile.am               |    2 +
 libgimpcolor/gimpadaptivesupersample.c |    1 +
 libgimpcolor/gimpcolor.def             |    4 +
 libgimpcolor/gimpcolorspace.c          |    1 +
 libgimpcolor/gimprgb-parse.c           |    1 +
 libgimpcolor/gimprgb.c                 |  105 ++++++++++++++++++++++++++++++++
 libgimpcolor/gimprgb.h                 |   14 ++++
 libgimpconfig/Makefile.am              |    2 +
 libgimpconfig/gimpcolorconfig.c        |    1 +
 libgimpconfig/gimpconfig-deserialize.c |    1 +
 libgimpconfig/gimpconfig-serialize.c   |    1 +
 libgimpconfig/gimpscanner.c            |    1 +
 libgimpwidgets/Makefile.am             |    2 +
 libgimpwidgets/gimpcairo-utils.c       |    1 +
 libgimpwidgets/gimpcellrenderercolor.c |    1 +
 libgimpwidgets/gimpcolorarea.c         |    1 +
 libgimpwidgets/gimpcolorbutton.c       |    1 +
 libgimpwidgets/gimpcolordisplay.c      |    1 +
 libgimpwidgets/gimpcolordisplaystack.c |    1 +
 libgimpwidgets/gimpcolorhexentry.c     |    1 +
 libgimpwidgets/gimpcolornotebook.c     |    1 +
 libgimpwidgets/gimpcolorscale.c        |    1 +
 libgimpwidgets/gimpcolorscales.c       |    1 +
 libgimpwidgets/gimpcolorselect.c       |    1 +
 libgimpwidgets/gimpcolorselection.c    |    1 +
 libgimpwidgets/gimpcolorselector.c     |    1 +
 libgimpwidgets/gimpcontroller.c        |    1 +
 libgimpwidgets/gimppickbutton.c        |    3 +-
 libgimpwidgets/gimppropwidgets.c       |    1 +
 libgimpwidgets/gimpscaleentry.c        |    1 +
 libgimpwidgets/gimpwidgets.c           |    1 +
 modules/Makefile.am                    |    1 +
 modules/color-selector-cmyk-lcms.c     |    1 +
 modules/color-selector-water.c         |    1 +
 modules/color-selector-wheel.c         |    1 +
 modules/display-filter-color-blind.c   |    1 +
 modules/display-filter-gamma.c         |    1 +
 modules/display-filter-high-contrast.c |    1 +
 modules/display-filter-lcms.c          |    1 +
 modules/display-filter-proof.c         |    1 +
 plug-ins/pygimp/pygimpcolor.h          |    1 +
 73 files changed, 197 insertions(+), 8 deletions(-)
---
diff --git a/app/base/Makefile.am b/app/base/Makefile.am
index 2ca38a2..2268ec6 100644
--- a/app/base/Makefile.am
+++ b/app/base/Makefile.am
@@ -8,6 +8,7 @@ INCLUDES = \
 	-I$(top_srcdir)		\
 	-I$(top_builddir)/app	\
 	-I$(top_srcdir)/app	\
+	$(BABL_CFLAGS)		\
 	$(CAIRO_CFLAGS)		\
 	$(GLIB_CFLAGS)		\
 	-I$(includedir)
diff --git a/app/base/temp-buf.c b/app/base/temp-buf.c
index 125ab7f..8837539 100644
--- a/app/base/temp-buf.c
+++ b/app/base/temp-buf.c
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 #include <glib/gstdio.h>
diff --git a/app/composite/Makefile.am b/app/composite/Makefile.am
index f843a19..3e2c076 100644
--- a/app/composite/Makefile.am
+++ b/app/composite/Makefile.am
@@ -11,6 +11,7 @@ INCLUDES = \
 	-I$(top_srcdir)		\
 	-I$(top_builddir)/app	\
 	-I$(top_srcdir)/app	\
+	$(BABL_CFLAGS)		\
 	$(CAIRO_CFLAGS)		\
 	$(GLIB_CFLAGS)		\
 	-I$(includedir)
diff --git a/app/composite/gimp-composite-generic.c b/app/composite/gimp-composite-generic.c
index 0071084..590246f 100644
--- a/app/composite/gimp-composite-generic.c
+++ b/app/composite/gimp-composite-generic.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <stdio.h>
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/config/Makefile.am b/app/config/Makefile.am
index 8012c01..3b40d07 100644
--- a/app/config/Makefile.am
+++ b/app/config/Makefile.am
@@ -16,6 +16,7 @@ INCLUDES = \
 	-I$(top_srcdir)		\
 	-I$(top_builddir)/app	\
 	-I$(top_srcdir)/app	\
+	$(BABL_CFLAGS)		\
 	$(CAIRO_CFLAGS)		\
 	$(GDK_PIXBUF_CFLAGS)	\
 	-I$(includedir)
diff --git a/app/config/gimpconfig-dump.c b/app/config/gimpconfig-dump.c
index 5cf410a..9cb75ca 100644
--- a/app/config/gimpconfig-dump.c
+++ b/app/config/gimpconfig-dump.c
@@ -27,6 +27,7 @@
 #include <unistd.h>
 #endif
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index d15aa05..05a78e2 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/config/gimpdisplayconfig.c b/app/config/gimpdisplayconfig.c
index 91c8c3d..dfb11d5 100644
--- a/app/config/gimpdisplayconfig.c
+++ b/app/config/gimpdisplayconfig.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/config/gimpdisplayoptions.c b/app/config/gimpdisplayoptions.c
index 2e038dc..baa8617 100644
--- a/app/config/gimpdisplayoptions.c
+++ b/app/config/gimpdisplayoptions.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/config/gimprc-deserialize.c b/app/config/gimprc-deserialize.c
index f8217b5..bec0b5a 100644
--- a/app/config/gimprc-deserialize.c
+++ b/app/config/gimprc-deserialize.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/core/gimpgradient-load.c b/app/core/gimpgradient-load.c
index 6f18bad..85ad9b7 100644
--- a/app/core/gimpgradient-load.c
+++ b/app/core/gimpgradient-load.c
@@ -22,7 +22,7 @@
 #include <errno.h>
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 #include <glib/gstdio.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/core/gimpgrid.c b/app/core/gimpgrid.c
index 0ae08f1..674941e 100644
--- a/app/core/gimpgrid.c
+++ b/app/core/gimpgrid.c
@@ -23,7 +23,7 @@
 #include <string.h>
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 
 #include "libgimpbase/gimpbase.h"
 #include "libgimpconfig/gimpconfig.h"
diff --git a/app/core/gimppalette-load.c b/app/core/gimppalette-load.c
index 475ce42..453d857 100644
--- a/app/core/gimppalette-load.c
+++ b/app/core/gimppalette-load.c
@@ -32,7 +32,7 @@
 #endif
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 #include <glib/gstdio.h>
 
 #ifdef G_OS_WIN32
diff --git a/app/core/gimppalette-save.c b/app/core/gimppalette-save.c
index e0e0d44..f54ca27 100644
--- a/app/core/gimppalette-save.c
+++ b/app/core/gimppalette-save.c
@@ -26,7 +26,7 @@
 #endif
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 #include <glib/gstdio.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/display/gimpcanvas.c b/app/display/gimpcanvas.c
index 0c89bb8..44965ec 100644
--- a/app/display/gimpcanvas.c
+++ b/app/display/gimpcanvas.c
@@ -17,6 +17,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/gui/color-history.c b/app/gui/color-history.c
index 9540ad1..90d6a6d 100644
--- a/app/gui/color-history.c
+++ b/app/gui/color-history.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/gui/splash.c b/app/gui/splash.c
index 9e3dd63..84ff914 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -19,6 +19,7 @@
 
 #include <stdlib.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/paint-funcs/Makefile.am b/app/paint-funcs/Makefile.am
index 1449b68..08c4f85 100644
--- a/app/paint-funcs/Makefile.am
+++ b/app/paint-funcs/Makefile.am
@@ -13,6 +13,7 @@ INCLUDES = \
 	-I$(top_srcdir)		\
 	-I$(top_builddir)/app	\
 	-I$(top_srcdir)/app	\
+	$(BABL_CFLAGS)		\
 	$(CAIRO_CFLAGS)		\
 	$(GLIB_CFLAGS)		\
 	-I$(includedir)
diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c
index 74b3f82..3887c79 100644
--- a/app/paint-funcs/paint-funcs.c
+++ b/app/paint-funcs/paint-funcs.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/app/pdb/gimp-pdb-compat.c b/app/pdb/gimp-pdb-compat.c
index 52a1308..a793c3f 100644
--- a/app/pdb/gimp-pdb-compat.c
+++ b/app/pdb/gimp-pdb-compat.c
@@ -18,7 +18,7 @@
 #include "config.h"
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 
 #include "libgimpbase/gimpbase.h"
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/plug-in/plug-in-params.c b/app/plug-in/plug-in-params.c
index 0b17276..c4705d6 100644
--- a/app/plug-in/plug-in-params.c
+++ b/app/plug-in/plug-in-params.c
@@ -18,7 +18,7 @@
 #include "config.h"
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 
 #include "libgimpbase/gimpbase.h"
 #include "libgimpbase/gimpprotocol.h"
diff --git a/app/text/gimptext-parasite.c b/app/text/gimptext-parasite.c
index aa8026e..bb3c419 100644
--- a/app/text/gimptext-parasite.c
+++ b/app/text/gimptext-parasite.c
@@ -24,7 +24,7 @@
 #include <stdlib.h>
 
 #include <cairo.h>
-#include <glib-object.h>
+#include <gegl.h>
 
 #include "libgimpbase/gimpbase.h"
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/widgets/gimpcairo.c b/app/widgets/gimpcairo.c
index 7e4e67c..2ca84be 100644
--- a/app/widgets/gimpcairo.c
+++ b/app/widgets/gimpcairo.c
@@ -23,6 +23,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/widgets/gimpcolorbar.c b/app/widgets/gimpcolorbar.c
index 0e9b2ac..ccf5697 100644
--- a/app/widgets/gimpcolorbar.c
+++ b/app/widgets/gimpcolorbar.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpwidgets/gimpwidgets.h"
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 487e1f7..3daab3d 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
diff --git a/app/widgets/gimpdynamicsoutputeditor.c b/app/widgets/gimpdynamicsoutputeditor.c
index 234abc6..0d4c743 100644
--- a/app/widgets/gimpdynamicsoutputeditor.c
+++ b/app/widgets/gimpdynamicsoutputeditor.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/widgets/gimppaletteview.c b/app/widgets/gimppaletteview.c
index a34dd50..4b6128c 100644
--- a/app/widgets/gimppaletteview.c
+++ b/app/widgets/gimppaletteview.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
diff --git a/app/widgets/gimprender.c b/app/widgets/gimprender.c
index 4c76e43..587c6a1 100644
--- a/app/widgets/gimprender.c
+++ b/app/widgets/gimprender.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/widgets/gimptexttag.c b/app/widgets/gimptexttag.c
index 5b706af..dee775b 100644
--- a/app/widgets/gimptexttag.c
+++ b/app/widgets/gimptexttag.c
@@ -20,6 +20,7 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/widgets/gimpviewrenderergradient.c b/app/widgets/gimpviewrenderergradient.c
index dc7c577..1a3adc8 100644
--- a/app/widgets/gimpviewrenderergradient.c
+++ b/app/widgets/gimpviewrenderergradient.c
@@ -22,6 +22,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/app/widgets/gimpviewrendererpalette.c b/app/widgets/gimpviewrendererpalette.c
index a9e743b..bb5f250 100644
--- a/app/widgets/gimpviewrendererpalette.c
+++ b/app/widgets/gimpviewrendererpalette.c
@@ -22,6 +22,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index af3c1f4..f24a1c9 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -22,6 +22,7 @@
 
 #include <string.h>
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
 #ifdef GDK_WINDOWING_WIN32
diff --git a/libgimpcolor/Makefile.am b/libgimpcolor/Makefile.am
index 5f89ab6..7afd916 100644
--- a/libgimpcolor/Makefile.am
+++ b/libgimpcolor/Makefile.am
@@ -52,6 +52,7 @@ AM_CPPFLAGS = \
 
 INCLUDES = \
 	-I$(top_srcdir)	\
+	$(BABL_CFLAGS)	\
 	$(CAIRO_CFLAGS)	\
 	$(GLIB_CFLAGS)	\
 	-I$(includedir)
@@ -107,6 +108,7 @@ libgimpcolor_2_0_la_DEPENDENCIES = \
 	$(libgimpbase)
 
 libgimpcolor_2_0_la_LIBADD = \
+	$(BABL_LIBS)	\
 	$(CAIRO_LIBS)	\
 	$(GLIB_LIBS)	\
 	$(libm)
diff --git a/libgimpcolor/gimpadaptivesupersample.c b/libgimpcolor/gimpadaptivesupersample.c
index 9317b2f..3ed96e1 100644
--- a/libgimpcolor/gimpadaptivesupersample.c
+++ b/libgimpcolor/gimpadaptivesupersample.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <glib-object.h>
 
 #include "libgimpmath/gimpmath.h"
diff --git a/libgimpcolor/gimpcolor.def b/libgimpcolor/gimpcolor.def
index 57f0d52..32eb45d 100644
--- a/libgimpcolor/gimpcolor.def
+++ b/libgimpcolor/gimpcolor.def
@@ -42,6 +42,7 @@ EXPORTS
 	gimp_rgb_composite
 	gimp_rgb_distance
 	gimp_rgb_gamma
+	gimp_rgb_get_pixel
 	gimp_rgb_get_type
 	gimp_rgb_get_uchar
 	gimp_rgb_intensity
@@ -57,6 +58,7 @@ EXPORTS
 	gimp_rgb_parse_name
 	gimp_rgb_set
 	gimp_rgb_set_alpha
+	gimp_rgb_set_pixel
 	gimp_rgb_set_uchar
 	gimp_rgb_subtract
 	gimp_rgb_to_cmyk
@@ -70,10 +72,12 @@ EXPORTS
 	gimp_rgb_to_l_int
 	gimp_rgba_add
 	gimp_rgba_distance
+	gimp_rgba_get_pixel
 	gimp_rgba_get_uchar
 	gimp_rgba_multiply
 	gimp_rgba_parse_css
 	gimp_rgba_set
+	gimp_rgba_set_pixel
 	gimp_rgba_set_uchar
 	gimp_rgba_subtract
 	gimp_value_get_rgb
diff --git a/libgimpcolor/gimpcolorspace.c b/libgimpcolor/gimpcolorspace.c
index b3d5ee3..760479c 100644
--- a/libgimpcolor/gimpcolorspace.c
+++ b/libgimpcolor/gimpcolorspace.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <glib-object.h>
 
 #include "libgimpmath/gimpmath.h"
diff --git a/libgimpcolor/gimprgb-parse.c b/libgimpcolor/gimprgb-parse.c
index 60fb180..0fb31348 100644
--- a/libgimpcolor/gimprgb-parse.c
+++ b/libgimpcolor/gimprgb-parse.c
@@ -28,6 +28,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <babl/babl.h>
 #include <glib-object.h>
 
 #include "gimpcolortypes.h"
diff --git a/libgimpcolor/gimprgb.c b/libgimpcolor/gimprgb.c
index 329c107..8cb064b 100644
--- a/libgimpcolor/gimprgb.c
+++ b/libgimpcolor/gimprgb.c
@@ -18,6 +18,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <glib-object.h>
 
 #include "libgimpmath/gimpmath.h"
@@ -131,6 +132,58 @@ gimp_rgb_set_alpha (GimpRGB *rgb,
 }
 
 /**
+ * gimp_rgb_set:
+ * @rgb:    a #GimpRGB struct
+ * @format: a Babl format
+ * @pixel:  pointer to the source pixel
+ *
+ * Sets the red, green and blue components of @rgb from the color
+ * stored in @pixel. The pixel format of @pixel is determined by
+ * @format.
+ *
+ * Since: GIMP 2.10
+ **/
+void
+gimp_rgb_set_pixel (GimpRGB       *rgb,
+                    const Babl    *format,
+                    gconstpointer  pixel)
+{
+  g_return_if_fail (rgb != NULL);
+  g_return_if_fail (format != NULL);
+  g_return_if_fail (pixel != NULL);
+
+  babl_process (babl_fish (format,
+                           babl_format ("R'G'B' double")),
+                pixel, rgb, 1);
+}
+
+/**
+ * gimp_rgb_get:
+ * @rgb:    a #GimpRGB struct
+ * @format: a Babl format
+ * @pixel:  pointer to the destination pixel
+ *
+ * Writes the red, green, blue and alpha components of @rgb to the
+ * color stored in @pixel. The pixel format of @pixel is determined by
+ * @format.
+ *
+ * Since: GIMP 2.10
+ **/
+void
+gimp_rgb_get_pixel (const GimpRGB *rgb,
+                    const Babl    *format,
+                    gpointer       pixel)
+{
+  g_return_if_fail (rgb != NULL);
+  g_return_if_fail (format != NULL);
+  g_return_if_fail (pixel != NULL);
+
+  babl_process (babl_fish (babl_format ("R'G'B' double"),
+                           format),
+                rgb, pixel, 1);
+}
+
+/**
  * gimp_rgb_set_uchar:
  * @rgb:   a #GimpRGB struct
  * @red:   the red component
@@ -385,6 +438,58 @@ gimp_rgb_composite (GimpRGB              *color1,
 
 /**
  * gimp_rgba_set:
+ * @rgba:   a #GimpRGB struct
+ * @format: a Babl format
+ * @pixel:  pointer to the source pixel
+ *
+ * Sets the red, green, blue and alpha components of @rgba from the
+ * color stored in @pixel. The pixel format of @pixel is determined
+ * by @format.
+ *
+ * Since: GIMP 2.10
+ **/
+void
+gimp_rgba_set_pixel (GimpRGB       *rgba,
+                     const Babl    *format,
+                     gconstpointer  pixel)
+{
+  g_return_if_fail (rgba != NULL);
+  g_return_if_fail (format != NULL);
+  g_return_if_fail (pixel != NULL);
+
+  babl_process (babl_fish (format,
+                           babl_format ("R'G'B'A double")),
+                pixel, rgba, 1);
+}
+
+/**
+ * gimp_rgba_get:
+ * @rgba:   a #GimpRGB struct
+ * @format: a Babl format
+ * @pixel:  pointer to the destination pixel
+ *
+ * Writes the red, green, blue and alpha components of @rgba to the
+ * color stored in @pixel. The pixel format of @pixel is determined by
+ * @format.
+ *
+ * Since: GIMP 2.10
+ **/
+void
+gimp_rgba_get_pixel (const GimpRGB *rgba,
+                     const Babl    *format,
+                     gpointer       pixel)
+{
+  g_return_if_fail (rgba != NULL);
+  g_return_if_fail (format != NULL);
+  g_return_if_fail (pixel != NULL);
+
+  babl_process (babl_fish (babl_format ("R'G'B'A double"),
+                           format),
+                rgba, pixel, 1);
+}
+
+/**
+ * gimp_rgba_set:
  * @rgba:  a #GimpRGB struct
  * @red:   the red component
  * @green: the green component
diff --git a/libgimpcolor/gimprgb.h b/libgimpcolor/gimprgb.h
index d618b53..8646978 100644
--- a/libgimpcolor/gimprgb.h
+++ b/libgimpcolor/gimprgb.h
@@ -80,6 +80,13 @@ void      gimp_rgb_set             (GimpRGB       *rgb,
 void      gimp_rgb_set_alpha       (GimpRGB       *rgb,
                                     gdouble        alpha);
 
+void      gimp_rgb_set_pixel       (GimpRGB       *rgb,
+                                    const Babl    *format,
+                                    gconstpointer  pixel);
+void      gimp_rgb_get_pixel       (const GimpRGB *rgb,
+                                    const Babl    *format,
+                                    gpointer       pixel);
+
 void      gimp_rgb_set_uchar       (GimpRGB       *rgb,
                                     guchar         red,
                                     guchar         green,
@@ -138,6 +145,13 @@ void      gimp_rgba_set            (GimpRGB       *rgba,
                                     gdouble        blue,
                                     gdouble        alpha);
 
+void      gimp_rgba_set_pixel      (GimpRGB       *rgba,
+                                    const Babl    *format,
+                                    gconstpointer  pixel);
+void      gimp_rgba_get_pixel      (const GimpRGB *rgba,
+                                    const Babl    *format,
+                                    gpointer       pixel);
+
 void      gimp_rgba_set_uchar      (GimpRGB       *rgba,
                                     guchar         red,
                                     guchar         green,
diff --git a/libgimpconfig/Makefile.am b/libgimpconfig/Makefile.am
index 4f48169..67a7127 100644
--- a/libgimpconfig/Makefile.am
+++ b/libgimpconfig/Makefile.am
@@ -49,6 +49,7 @@ AM_CPPFLAGS = \
 
 INCLUDES = \
 	-I$(top_srcdir)	\
+	$(BABL_CFLAGS)	\
 	$(CAIRO_CFLAGS)	\
 	$(GLIB_CFLAGS)	\
 	-I$(includedir)
@@ -116,6 +117,7 @@ libgimpconfig_2_0_la_LIBADD = \
 	$(libgimpbase)	\
 	$(libgimpcolor)	\
 	$(libgimpmath)	\
+	$(BABL_LIBS)	\
 	$(CAIRO_LIBS)	\
 	$(GLIB_LIBS)
 
diff --git a/libgimpconfig/gimpcolorconfig.c b/libgimpconfig/gimpcolorconfig.c
index 6bfe77a..6b73925 100644
--- a/libgimpconfig/gimpcolorconfig.c
+++ b/libgimpconfig/gimpcolorconfig.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/libgimpconfig/gimpconfig-deserialize.c b/libgimpconfig/gimpconfig-deserialize.c
index 122190f..5bbc491 100644
--- a/libgimpconfig/gimpconfig-deserialize.c
+++ b/libgimpconfig/gimpconfig-deserialize.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/libgimpconfig/gimpconfig-serialize.c b/libgimpconfig/gimpconfig-serialize.c
index 2b44c3b..3e2b003 100644
--- a/libgimpconfig/gimpconfig-serialize.c
+++ b/libgimpconfig/gimpconfig-serialize.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/libgimpconfig/gimpscanner.c b/libgimpconfig/gimpscanner.c
index 228bbd7..31743d1 100644
--- a/libgimpconfig/gimpscanner.c
+++ b/libgimpconfig/gimpscanner.c
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <errno.h>
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 
diff --git a/libgimpwidgets/Makefile.am b/libgimpwidgets/Makefile.am
index 91f752e..b820cac 100644
--- a/libgimpwidgets/Makefile.am
+++ b/libgimpwidgets/Makefile.am
@@ -54,6 +54,7 @@ AM_CPPFLAGS = \
 
 INCLUDES = \
 	-I$(top_srcdir)	\
+	$(BABL_CFLAGS)	\
 	$(GTK_CFLAGS)	\
 	-I$(includedir)
 
@@ -261,6 +262,7 @@ libgimpwidgets_2_0_la_LIBADD = \
 	$(libgimpcolor)		\
 	$(libgimpconfig)	\
 	$(libgimpbase)		\
+	$(BABL_LIBS)		\
 	$(GTK_LIBS)		\
 	$(libm)
 
diff --git a/libgimpwidgets/gimpcairo-utils.c b/libgimpwidgets/gimpcairo-utils.c
index 3b1dd88..7ad9297 100644
--- a/libgimpwidgets/gimpcairo-utils.c
+++ b/libgimpwidgets/gimpcairo-utils.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimpcellrenderercolor.c b/libgimpwidgets/gimpcellrenderercolor.c
index 20c33f6..7da4b2a 100644
--- a/libgimpwidgets/gimpcellrenderercolor.c
+++ b/libgimpwidgets/gimpcellrenderercolor.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimpcolorarea.c b/libgimpwidgets/gimpcolorarea.c
index 3f4edec..913dcfd 100644
--- a/libgimpwidgets/gimpcolorarea.c
+++ b/libgimpwidgets/gimpcolorarea.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolorbutton.c b/libgimpwidgets/gimpcolorbutton.c
index a235512..393e88f 100644
--- a/libgimpwidgets/gimpcolorbutton.c
+++ b/libgimpwidgets/gimpcolorbutton.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolordisplay.c b/libgimpwidgets/gimpcolordisplay.c
index 5216b4a..e6eb823 100644
--- a/libgimpwidgets/gimpcolordisplay.c
+++ b/libgimpwidgets/gimpcolordisplay.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimpcolordisplaystack.c b/libgimpwidgets/gimpcolordisplaystack.c
index 76eac5b..74331a0 100644
--- a/libgimpwidgets/gimpcolordisplaystack.c
+++ b/libgimpwidgets/gimpcolordisplaystack.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolorhexentry.c b/libgimpwidgets/gimpcolorhexentry.c
index e5885d7..6c503b4 100644
--- a/libgimpwidgets/gimpcolorhexentry.c
+++ b/libgimpwidgets/gimpcolorhexentry.c
@@ -23,6 +23,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
diff --git a/libgimpwidgets/gimpcolornotebook.c b/libgimpwidgets/gimpcolornotebook.c
index a265da5..5f6cb0a 100644
--- a/libgimpwidgets/gimpcolornotebook.c
+++ b/libgimpwidgets/gimpcolornotebook.c
@@ -24,6 +24,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolorscale.c b/libgimpwidgets/gimpcolorscale.c
index 4bebdbd..d9b46ed 100644
--- a/libgimpwidgets/gimpcolorscale.c
+++ b/libgimpwidgets/gimpcolorscale.c
@@ -24,6 +24,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolorscales.c b/libgimpwidgets/gimpcolorscales.c
index 751a5e5..0b1f875 100644
--- a/libgimpwidgets/gimpcolorscales.c
+++ b/libgimpwidgets/gimpcolorscales.c
@@ -26,6 +26,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index 7f28f84..7b48c1b 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -24,6 +24,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/libgimpwidgets/gimpcolorselection.c b/libgimpwidgets/gimpcolorselection.c
index acea552..896ec68 100644
--- a/libgimpwidgets/gimpcolorselection.c
+++ b/libgimpwidgets/gimpcolorselection.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcolorselector.c b/libgimpwidgets/gimpcolorselector.c
index 27d408c..e3ac08f 100644
--- a/libgimpwidgets/gimpcolorselector.c
+++ b/libgimpwidgets/gimpcolorselector.c
@@ -25,6 +25,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpcontroller.c b/libgimpwidgets/gimpcontroller.c
index 8ce412d..9309bc4 100644
--- a/libgimpwidgets/gimpcontroller.c
+++ b/libgimpwidgets/gimpcontroller.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimppickbutton.c b/libgimpwidgets/gimppickbutton.c
index 05482a7..0738f01 100644
--- a/libgimpwidgets/gimppickbutton.c
+++ b/libgimpwidgets/gimppickbutton.c
@@ -18,8 +18,9 @@
 
 #include "config.h"
 
-#include <gdk/gdkkeysyms.h>
+#include <babl/babl.h>
 #include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "libgimpcolor/gimpcolor.h"
 
diff --git a/libgimpwidgets/gimppropwidgets.c b/libgimpwidgets/gimppropwidgets.c
index a8d2e23..1dd879c 100644
--- a/libgimpwidgets/gimppropwidgets.c
+++ b/libgimpwidgets/gimppropwidgets.c
@@ -19,6 +19,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 /* FIXME: #undef GTK_DISABLE_DEPRECATED */
 #undef GTK_DISABLE_DEPRECATED
 #include <gtk/gtk.h>
diff --git a/libgimpwidgets/gimpscaleentry.c b/libgimpwidgets/gimpscaleentry.c
index abff2ba..369a767 100644
--- a/libgimpwidgets/gimpscaleentry.c
+++ b/libgimpwidgets/gimpscaleentry.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/libgimpwidgets/gimpwidgets.c b/libgimpwidgets/gimpwidgets.c
index b0bbbb7..6aa409e 100644
--- a/libgimpwidgets/gimpwidgets.c
+++ b/libgimpwidgets/gimpwidgets.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/Makefile.am b/modules/Makefile.am
index 746a618..7b50ac6 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -14,6 +14,7 @@ libdir = $(gimpplugindir)/modules
 
 INCLUDES = \
         -I$(top_srcdir)	\
+	$(BABL_CFLAGS)	\
         $(GTK_CFLAGS)	\
         -I$(includedir)
 
diff --git a/modules/color-selector-cmyk-lcms.c b/modules/color-selector-cmyk-lcms.c
index 0d5d20f..d40677c 100644
--- a/modules/color-selector-cmyk-lcms.c
+++ b/modules/color-selector-cmyk-lcms.c
@@ -21,6 +21,7 @@
 
 #include <lcms.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/color-selector-water.c b/modules/color-selector-water.c
index 1d8f024..fc34e0f 100644
--- a/modules/color-selector-water.c
+++ b/modules/color-selector-water.c
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/color-selector-wheel.c b/modules/color-selector-wheel.c
index 465b095..ed09dea 100644
--- a/modules/color-selector-wheel.c
+++ b/modules/color-selector-wheel.c
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/display-filter-color-blind.c b/modules/display-filter-color-blind.c
index 49daefb..65d7416 100644
--- a/modules/display-filter-color-blind.c
+++ b/modules/display-filter-color-blind.c
@@ -29,6 +29,7 @@
 
 #include <string.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/display-filter-gamma.c b/modules/display-filter-gamma.c
index 2287f59..7030df9 100644
--- a/modules/display-filter-gamma.c
+++ b/modules/display-filter-gamma.c
@@ -17,6 +17,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/display-filter-high-contrast.c b/modules/display-filter-high-contrast.c
index a779fe0..80b547d 100644
--- a/modules/display-filter-high-contrast.c
+++ b/modules/display-filter-high-contrast.c
@@ -17,6 +17,7 @@
 
 #include "config.h"
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpcolor/gimpcolor.h"
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index c99b0f8..0e27093 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -27,6 +27,7 @@
 
 #include <lcms.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #ifdef GDK_WINDOWING_QUARTZ
diff --git a/modules/display-filter-proof.c b/modules/display-filter-proof.c
index 41967f5..57a2327 100644
--- a/modules/display-filter-proof.c
+++ b/modules/display-filter-proof.c
@@ -21,6 +21,7 @@
 
 #include <lcms.h>
 
+#include <babl/babl.h>
 #include <gtk/gtk.h>
 
 #include "libgimpbase/gimpbase.h"
diff --git a/plug-ins/pygimp/pygimpcolor.h b/plug-ins/pygimp/pygimpcolor.h
index 53a6bdb..fb2f000 100644
--- a/plug-ins/pygimp/pygimpcolor.h
+++ b/plug-ins/pygimp/pygimpcolor.h
@@ -21,6 +21,7 @@
 
 #include <Python.h>
 
+#include <babl/babl.h>
 #include <cairo.h>
 #include <glib-object.h>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]