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.
This commit is contained in:
Michael Natterer 2012-03-30 15:08:54 +02:00
parent 7f437d7d53
commit 3e119c5af7
73 changed files with 197 additions and 8 deletions

View file

@ -8,6 +8,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(BABL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(GLIB_CFLAGS) \
-I$(includedir)

View file

@ -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>

View file

@ -11,6 +11,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(BABL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(GLIB_CFLAGS) \
-I$(includedir)

View file

@ -26,6 +26,7 @@
#include <string.h>
#include <stdio.h>
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -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)

View file

@ -27,6 +27,7 @@
#include <unistd.h>
#endif
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -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"

View file

@ -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"

View file

@ -32,7 +32,7 @@
#endif
#include <cairo.h>
#include <glib-object.h>
#include <gegl.h>
#include <glib/gstdio.h>
#ifdef G_OS_WIN32

View file

@ -26,7 +26,7 @@
#endif
#include <cairo.h>
#include <glib-object.h>
#include <gegl.h>
#include <glib/gstdio.h>
#include "libgimpbase/gimpbase.h"

View file

@ -17,6 +17,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -19,6 +19,7 @@
#include <stdlib.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -13,6 +13,7 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/app \
-I$(top_srcdir)/app \
$(BABL_CFLAGS) \
$(CAIRO_CFLAGS) \
$(GLIB_CFLAGS) \
-I$(includedir)

View file

@ -19,6 +19,7 @@
#include <string.h>
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -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"

View file

@ -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"

View file

@ -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"

View file

@ -23,6 +23,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -19,6 +19,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"

View file

@ -19,6 +19,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

View file

@ -19,6 +19,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -20,6 +20,7 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -22,6 +22,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -22,6 +22,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -22,6 +22,7 @@
#include <string.h>
#include <gegl.h>
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_WIN32

View file

@ -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)

View file

@ -18,6 +18,7 @@
#include "config.h"
#include <babl/babl.h>
#include <glib-object.h>
#include "libgimpmath/gimpmath.h"

View file

@ -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

View file

@ -18,6 +18,7 @@
#include "config.h"
#include <babl/babl.h>
#include <glib-object.h>
#include "libgimpmath/gimpmath.h"

View file

@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
#include <babl/babl.h>
#include <glib-object.h>
#include "gimpcolortypes.h"

View file

@ -18,6 +18,7 @@
#include "config.h"
#include <babl/babl.h>
#include <glib-object.h>
#include "libgimpmath/gimpmath.h"
@ -130,6 +131,58 @@ gimp_rgb_set_alpha (GimpRGB *rgb,
rgb->a = a;
}
/**
* 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
@ -383,6 +436,58 @@ gimp_rgb_composite (GimpRGB *color1,
/* RGBA functions */
/**
* 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

View file

@ -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,

View file

@ -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)

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -25,6 +25,7 @@
#include <string.h>
#include <errno.h>
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>

View file

@ -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)

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -23,6 +23,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>

View file

@ -24,6 +24,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -24,6 +24,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -26,6 +26,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -24,6 +24,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -25,6 +25,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -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"

View file

@ -19,6 +19,7 @@
#include <string.h>
#include <babl/babl.h>
/* FIXME: #undef GTK_DISABLE_DEPRECATED */
#undef GTK_DISABLE_DEPRECATED
#include <gtk/gtk.h>

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -21,6 +21,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -14,6 +14,7 @@ libdir = $(gimpplugindir)/modules
INCLUDES = \
-I$(top_srcdir) \
$(BABL_CFLAGS) \
$(GTK_CFLAGS) \
-I$(includedir)

View file

@ -21,6 +21,7 @@
#include <lcms.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -21,6 +21,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -20,6 +20,7 @@
#include <stdlib.h>
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -29,6 +29,7 @@
#include <string.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -17,6 +17,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -17,6 +17,7 @@
#include "config.h"
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpcolor/gimpcolor.h"

View file

@ -27,6 +27,7 @@
#include <lcms.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_QUARTZ

View file

@ -21,6 +21,7 @@
#include <lcms.h>
#include <babl/babl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"

View file

@ -21,6 +21,7 @@
#include <Python.h>
#include <babl/babl.h>
#include <cairo.h>
#include <glib-object.h>