[gimp] pdb, app, libgimp: add new PDB group image_color_profile
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] pdb, app, libgimp: add new PDB group image_color_profile
- Date: Fri, 5 Jun 2015 11:21:22 +0000 (UTC)
commit 80093a85df9c41d822dae8c0746525b248e5f758
Author: Michael Natterer <mitch gimp org>
Date: Fri Jun 5 12:51:46 2015 +0200
pdb, app, libgimp: add new PDB group image_color_profile
Which will have proper API to deal with an image's color profile (no
parasites, no ICC blobs). So far contains gimp_image_get_color_profile()
and gimp_image_set_color_profile().
app/pdb/Makefile.am | 1 +
app/pdb/image-color-profile-cmds.c | 198 ++++++++++++++++++++++++++++++
app/pdb/internal-procs.c | 3 +-
app/pdb/internal-procs.h | 109 ++++++++--------
libgimp/Makefile.am | 5 +
libgimp/gimp.def | 2 +
libgimp/gimp.h | 1 +
libgimp/gimp_pdb_headers.h | 1 +
libgimp/gimpimagecolorprofile.c | 96 ++++++++++++++
libgimp/gimpimagecolorprofile.h | 40 ++++++
libgimp/gimpimagecolorprofile_pdb.c | 117 ++++++++++++++++++
libgimp/gimpimagecolorprofile_pdb.h | 44 +++++++
tools/pdbgen/Makefile.am | 1 +
tools/pdbgen/groups.pl | 1 +
tools/pdbgen/pdb/image_color_profile.pdb | 114 +++++++++++++++++
15 files changed, 678 insertions(+), 55 deletions(-)
---
diff --git a/app/pdb/Makefile.am b/app/pdb/Makefile.am
index d69fe5b..393fccf 100644
--- a/app/pdb/Makefile.am
+++ b/app/pdb/Makefile.am
@@ -58,6 +58,7 @@ libappinternal_procs_a_SOURCES = \
gradients-cmds.c \
help-cmds.c \
image-cmds.c \
+ image-color-profile-cmds.c \
image-convert-cmds.c \
image-grid-cmds.c \
image-guides-cmds.c \
diff --git a/app/pdb/image-color-profile-cmds.c b/app/pdb/image-color-profile-cmds.c
new file mode 100644
index 0000000..3e4c132
--- /dev/null
+++ b/app/pdb/image-color-profile-cmds.c
@@ -0,0 +1,198 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl. */
+
+#include "config.h"
+
+#include <cairo.h>
+
+#include <gegl.h>
+
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+#include "libgimpcolor/gimpcolor.h"
+
+#include "libgimpbase/gimpbase.h"
+
+#include "pdb-types.h"
+
+#include "core/gimpimage-profile.h"
+#include "core/gimpimage.h"
+#include "core/gimpparamspecs.h"
+
+#include "gimppdb.h"
+#include "gimpprocedure.h"
+#include "internal-procs.h"
+
+#include "gimp-intl.h"
+
+
+static GimpValueArray *
+image_get_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpValueArray *return_vals;
+ GimpImage *image;
+ gint32 num_bytes = 0;
+ guint8 *profile_data = NULL;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+
+ if (success)
+ {
+ GimpColorProfile profile;
+
+ profile = gimp_image_get_color_profile (image, NULL);
+
+ if (profile)
+ {
+ gsize length;
+
+ profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
+ num_bytes = length;
+
+ gimp_color_profile_close (profile);
+ }
+ }
+
+ return_vals = gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+
+ if (success)
+ {
+ g_value_set_int (gimp_value_array_index (return_vals, 1), num_bytes);
+ gimp_value_take_int8array (gimp_value_array_index (return_vals, 2), profile_data, num_bytes);
+ }
+
+ return return_vals;
+}
+
+static GimpValueArray *
+image_set_color_profile_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 num_bytes;
+ const guint8 *color_profile;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 0), gimp);
+ num_bytes = g_value_get_int (gimp_value_array_index (args, 1));
+ color_profile = gimp_value_get_int8array (gimp_value_array_index (args, 2));
+
+ if (success)
+ {
+ GimpColorProfile profile;
+
+ profile = gimp_color_profile_open_from_data (color_profile, num_bytes, error);
+
+ if (profile)
+ {
+ success = gimp_image_set_color_profile (image, profile, error);
+ gimp_color_profile_close (profile);
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+void
+register_image_color_profile_procs (GimpPDB *pdb)
+{
+ GimpProcedure *procedure;
+
+ /*
+ * gimp-image-get-color-profile
+ */
+ procedure = gimp_procedure_new (image_get_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-get-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-get-color-profile",
+ "Returns the image's color profile",
+ "This procedure returns the image's color profile.",
+ "Michael Natterer <mitch gimp org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_return_value (procedure,
+ gimp_param_spec_int8_array ("profile-data",
+ "profile data",
+ "The image's serialized color profile. The
returned value must be freed with g_free()",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-image-set-color-profile
+ */
+ procedure = gimp_procedure_new (image_set_color_profile_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "gimp-image-set-color-profile");
+ gimp_procedure_set_static_strings (procedure,
+ "gimp-image-set-color-profile",
+ "Sets the image's color profile",
+ "This procedure sets the image's color profile.",
+ "Michael Natterer <mitch gimp org>",
+ "Michael Natterer",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "The image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int32 ("num-bytes",
+ "num bytes",
+ "Number of bytes in the color_profile array",
+ 0, G_MAXINT32, 0,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_int8_array ("color-profile",
+ "color profile",
+ "The new serialized color profile",
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+}
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index d63b1da..239cfcc 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 755 procedures registered total */
+/* 757 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
@@ -59,6 +59,7 @@ internal_procs_init (GimpPDB *pdb)
register_gradients_procs (pdb);
register_help_procs (pdb);
register_image_procs (pdb);
+ register_image_color_profile_procs (pdb);
register_image_convert_procs (pdb);
register_image_grid_procs (pdb);
register_image_guides_procs (pdb);
diff --git a/app/pdb/internal-procs.h b/app/pdb/internal-procs.h
index fc1f147..3bcf405 100644
--- a/app/pdb/internal-procs.h
+++ b/app/pdb/internal-procs.h
@@ -20,62 +20,63 @@
#ifndef __INTERNAL_PROCS_H__
#define __INTERNAL_PROCS_H__
-void internal_procs_init (GimpPDB *pdb);
+void internal_procs_init (GimpPDB *pdb);
/* Forward declarations for registering PDB procs */
-void register_brush_procs (GimpPDB *pdb);
-void register_brush_select_procs (GimpPDB *pdb);
-void register_brushes_procs (GimpPDB *pdb);
-void register_buffer_procs (GimpPDB *pdb);
-void register_channel_procs (GimpPDB *pdb);
-void register_color_procs (GimpPDB *pdb);
-void register_context_procs (GimpPDB *pdb);
-void register_display_procs (GimpPDB *pdb);
-void register_drawable_procs (GimpPDB *pdb);
-void register_drawable_color_procs (GimpPDB *pdb);
-void register_drawable_transform_procs (GimpPDB *pdb);
-void register_dynamics_procs (GimpPDB *pdb);
-void register_edit_procs (GimpPDB *pdb);
-void register_fileops_procs (GimpPDB *pdb);
-void register_floating_sel_procs (GimpPDB *pdb);
-void register_font_select_procs (GimpPDB *pdb);
-void register_fonts_procs (GimpPDB *pdb);
-void register_gimp_procs (GimpPDB *pdb);
-void register_gimprc_procs (GimpPDB *pdb);
-void register_gradient_procs (GimpPDB *pdb);
-void register_gradient_select_procs (GimpPDB *pdb);
-void register_gradients_procs (GimpPDB *pdb);
-void register_help_procs (GimpPDB *pdb);
-void register_image_procs (GimpPDB *pdb);
-void register_image_convert_procs (GimpPDB *pdb);
-void register_image_grid_procs (GimpPDB *pdb);
-void register_image_guides_procs (GimpPDB *pdb);
-void register_image_select_procs (GimpPDB *pdb);
-void register_image_transform_procs (GimpPDB *pdb);
-void register_image_undo_procs (GimpPDB *pdb);
-void register_item_procs (GimpPDB *pdb);
-void register_item_transform_procs (GimpPDB *pdb);
-void register_layer_procs (GimpPDB *pdb);
-void register_message_procs (GimpPDB *pdb);
-void register_paint_tools_procs (GimpPDB *pdb);
-void register_palette_procs (GimpPDB *pdb);
-void register_palette_select_procs (GimpPDB *pdb);
-void register_palettes_procs (GimpPDB *pdb);
-void register_paths_procs (GimpPDB *pdb);
-void register_pattern_procs (GimpPDB *pdb);
-void register_pattern_select_procs (GimpPDB *pdb);
-void register_patterns_procs (GimpPDB *pdb);
-void register_plug_in_procs (GimpPDB *pdb);
-void register_plug_in_compat_procs (GimpPDB *pdb);
-void register_procedural_db_procs (GimpPDB *pdb);
-void register_progress_procs (GimpPDB *pdb);
-void register_selection_procs (GimpPDB *pdb);
-void register_selection_tools_procs (GimpPDB *pdb);
-void register_text_layer_procs (GimpPDB *pdb);
-void register_text_tool_procs (GimpPDB *pdb);
-void register_transform_tools_procs (GimpPDB *pdb);
-void register_unit_procs (GimpPDB *pdb);
-void register_vectors_procs (GimpPDB *pdb);
+void register_brush_procs (GimpPDB *pdb);
+void register_brush_select_procs (GimpPDB *pdb);
+void register_brushes_procs (GimpPDB *pdb);
+void register_buffer_procs (GimpPDB *pdb);
+void register_channel_procs (GimpPDB *pdb);
+void register_color_procs (GimpPDB *pdb);
+void register_context_procs (GimpPDB *pdb);
+void register_display_procs (GimpPDB *pdb);
+void register_drawable_procs (GimpPDB *pdb);
+void register_drawable_color_procs (GimpPDB *pdb);
+void register_drawable_transform_procs (GimpPDB *pdb);
+void register_dynamics_procs (GimpPDB *pdb);
+void register_edit_procs (GimpPDB *pdb);
+void register_fileops_procs (GimpPDB *pdb);
+void register_floating_sel_procs (GimpPDB *pdb);
+void register_font_select_procs (GimpPDB *pdb);
+void register_fonts_procs (GimpPDB *pdb);
+void register_gimp_procs (GimpPDB *pdb);
+void register_gimprc_procs (GimpPDB *pdb);
+void register_gradient_procs (GimpPDB *pdb);
+void register_gradient_select_procs (GimpPDB *pdb);
+void register_gradients_procs (GimpPDB *pdb);
+void register_help_procs (GimpPDB *pdb);
+void register_image_procs (GimpPDB *pdb);
+void register_image_color_profile_procs (GimpPDB *pdb);
+void register_image_convert_procs (GimpPDB *pdb);
+void register_image_grid_procs (GimpPDB *pdb);
+void register_image_guides_procs (GimpPDB *pdb);
+void register_image_select_procs (GimpPDB *pdb);
+void register_image_transform_procs (GimpPDB *pdb);
+void register_image_undo_procs (GimpPDB *pdb);
+void register_item_procs (GimpPDB *pdb);
+void register_item_transform_procs (GimpPDB *pdb);
+void register_layer_procs (GimpPDB *pdb);
+void register_message_procs (GimpPDB *pdb);
+void register_paint_tools_procs (GimpPDB *pdb);
+void register_palette_procs (GimpPDB *pdb);
+void register_palette_select_procs (GimpPDB *pdb);
+void register_palettes_procs (GimpPDB *pdb);
+void register_paths_procs (GimpPDB *pdb);
+void register_pattern_procs (GimpPDB *pdb);
+void register_pattern_select_procs (GimpPDB *pdb);
+void register_patterns_procs (GimpPDB *pdb);
+void register_plug_in_procs (GimpPDB *pdb);
+void register_plug_in_compat_procs (GimpPDB *pdb);
+void register_procedural_db_procs (GimpPDB *pdb);
+void register_progress_procs (GimpPDB *pdb);
+void register_selection_procs (GimpPDB *pdb);
+void register_selection_tools_procs (GimpPDB *pdb);
+void register_text_layer_procs (GimpPDB *pdb);
+void register_text_tool_procs (GimpPDB *pdb);
+void register_transform_tools_procs (GimpPDB *pdb);
+void register_unit_procs (GimpPDB *pdb);
+void register_vectors_procs (GimpPDB *pdb);
#endif /* __INTERNAL_PROCS_H__ */
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index c69adf3..bf52189 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -99,6 +99,7 @@ PDB_WRAPPERS_C = \
gimpgradientselect_pdb.c \
gimphelp_pdb.c \
gimpimage_pdb.c \
+ gimpimagecolorprofile_pdb.c \
gimpimageconvert_pdb.c \
gimpimagegrid_pdb.c \
gimpimageguides_pdb.c \
@@ -154,6 +155,7 @@ PDB_WRAPPERS_H = \
gimpgradientselect_pdb.h \
gimphelp_pdb.h \
gimpimage_pdb.h \
+ gimpimagecolorprofile_pdb.h \
gimpimageconvert_pdb.h \
gimpimagegrid_pdb.h \
gimpimageguides_pdb.h \
@@ -208,6 +210,8 @@ libgimp_sources = \
gimpgradientselect.h \
gimpimage.c \
gimpimage.h \
+ gimpimagecolorprofile.c \
+ gimpimagecolorprofile.h \
gimplayer.c \
gimplayer.h \
gimppalette.c \
@@ -329,6 +333,7 @@ gimpinclude_HEADERS = \
gimpgradients.h \
gimpgradientselect.h \
gimpimage.h \
+ gimpimagecolorprofile.h \
gimplayer.h \
gimppalette.h \
gimppalettes.h \
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index bc0b5d4..80e0aee 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -402,6 +402,7 @@ EXPORTS
gimp_image_get_channel_position
gimp_image_get_channels
gimp_image_get_cmap
+ gimp_image_get_color_profile
gimp_image_get_colormap
gimp_image_get_component_active
gimp_image_get_component_visible
@@ -494,6 +495,7 @@ EXPORTS
gimp_image_set_active_layer
gimp_image_set_active_vectors
gimp_image_set_cmap
+ gimp_image_set_color_profile
gimp_image_set_colormap
gimp_image_set_component_active
gimp_image_set_component_visible
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 5a05e4e..a681fd0 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -44,6 +44,7 @@
#include <libgimp/gimpgradients.h>
#include <libgimp/gimpgradientselect.h>
#include <libgimp/gimpimage.h>
+#include <libgimp/gimpimagecolorprofile.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimppalette.h>
#include <libgimp/gimppalettes.h>
diff --git a/libgimp/gimp_pdb_headers.h b/libgimp/gimp_pdb_headers.h
index a0de235..75efaa4 100644
--- a/libgimp/gimp_pdb_headers.h
+++ b/libgimp/gimp_pdb_headers.h
@@ -51,6 +51,7 @@
#include <libgimp/gimpgradientselect_pdb.h>
#include <libgimp/gimphelp_pdb.h>
#include <libgimp/gimpimage_pdb.h>
+#include <libgimp/gimpimagecolorprofile_pdb.h>
#include <libgimp/gimpimageconvert_pdb.h>
#include <libgimp/gimpimagegrid_pdb.h>
#include <libgimp/gimpimageguides_pdb.h>
diff --git a/libgimp/gimpimagecolorprofile.c b/libgimp/gimpimagecolorprofile.c
new file mode 100644
index 0000000..65b1485
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile.c
@@ -0,0 +1,96 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include "gimp.h"
+
+
+/**
+ * gimp_image_get_color_profile:
+ * @image_ID: The image.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile.
+ *
+ * Returns: The image's color profile. The returned value
+ * must be freed with gimp_color_profile_close().
+ *
+ * Since: 2.10
+ **/
+GimpColorProfile
+gimp_image_get_color_profile (gint32 image_ID)
+{
+ guint8 *data;
+ gint length;
+
+ data = _gimp_image_get_color_profile (image_ID, &length);
+
+ if (data)
+ {
+ GimpColorProfile profile;
+
+ profile = gimp_color_profile_open_from_data (data, length, NULL);
+ g_free (data);
+
+ return profile;
+ }
+
+ return NULL;
+}
+
+/**
+ * gimp_image_set_color_profile:
+ * @image_ID: The image.
+ * @profile: A #GimpColorProfile, or %NULL.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile.
+ *
+ * Returns: %TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_image_set_color_profile (gint32 image_ID,
+ GimpColorProfile profile)
+{
+ guint8 *data = NULL;
+ gint length = 0;
+ gboolean success;
+
+ if (profile)
+ {
+ gsize l;
+
+ data = gimp_color_profile_save_to_data (profile, &l, NULL);
+ length = l;
+
+ if (! data)
+ return FALSE;
+ }
+
+ success = _gimp_image_set_color_profile (image_ID, length, data);
+ g_free (data);
+
+ return success;
+}
diff --git a/libgimp/gimpimagecolorprofile.h b/libgimp/gimpimagecolorprofile.h
new file mode 100644
index 0000000..e489b52
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile.h
@@ -0,0 +1,40 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_COLOR_PROFILE_H__
+#define __GIMP_IMAGE_COLOR_PROFILE_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+GimpColorProfile gimp_image_get_color_profile (gint32 image_ID);
+gboolean gimp_image_set_color_profile (gint32 image_ID,
+ GimpColorProfile profile);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_COLOR_PROFILE_H__ */
diff --git a/libgimp/gimpimagecolorprofile_pdb.c b/libgimp/gimpimagecolorprofile_pdb.c
new file mode 100644
index 0000000..1979d0e
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile_pdb.c
@@ -0,0 +1,117 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile_pdb.c
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#include "config.h"
+
+#include <string.h>
+
+#include "gimp.h"
+
+
+/**
+ * SECTION: gimpimagecolorprofile
+ * @title: gimpimagecolorprofile
+ * @short_description: Operations on an image's color profile.
+ *
+ * Operations on an image's color profile.
+ **/
+
+
+/**
+ * _gimp_image_get_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ *
+ * Returns the image's color profile
+ *
+ * This procedure returns the image's color profile.
+ *
+ * Returns: The image's serialized color profile. The returned value
+ * must be freed with g_free().
+ *
+ * Since: 2.10
+ **/
+guint8 *
+_gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ guint8 *profile_data = NULL;
+
+ return_vals = gimp_run_procedure ("gimp-image-get-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_END);
+
+ *num_bytes = 0;
+
+ if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
+ {
+ *num_bytes = return_vals[1].data.d_int32;
+ profile_data = g_new (guint8, *num_bytes);
+ memcpy (profile_data,
+ return_vals[2].data.d_int8array,
+ *num_bytes * sizeof (guint8));
+ }
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return profile_data;
+}
+
+/**
+ * _gimp_image_set_color_profile:
+ * @image_ID: The image.
+ * @num_bytes: Number of bytes in the color_profile array.
+ * @color_profile: The new serialized color profile.
+ *
+ * Sets the image's color profile
+ *
+ * This procedure sets the image's color profile.
+ *
+ * Returns: TRUE on success.
+ *
+ * Since: 2.10
+ **/
+gboolean
+_gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile)
+{
+ GimpParam *return_vals;
+ gint nreturn_vals;
+ gboolean success = TRUE;
+
+ return_vals = gimp_run_procedure ("gimp-image-set-color-profile",
+ &nreturn_vals,
+ GIMP_PDB_IMAGE, image_ID,
+ GIMP_PDB_INT32, num_bytes,
+ GIMP_PDB_INT8ARRAY, color_profile,
+ GIMP_PDB_END);
+
+ success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
+
+ gimp_destroy_params (return_vals, nreturn_vals);
+
+ return success;
+}
diff --git a/libgimp/gimpimagecolorprofile_pdb.h b/libgimp/gimpimagecolorprofile_pdb.h
new file mode 100644
index 0000000..c52daba
--- /dev/null
+++ b/libgimp/gimpimagecolorprofile_pdb.h
@@ -0,0 +1,44 @@
+/* LIBGIMP - The GIMP Library
+ * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
+ *
+ * gimpimagecolorprofile_pdb.h
+ *
+ * This library is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* NOTE: This file is auto-generated by pdbgen.pl */
+
+#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
+#error "Only <libgimp/gimp.h> can be included directly."
+#endif
+
+#ifndef __GIMP_IMAGE_COLOR_PROFILE_PDB_H__
+#define __GIMP_IMAGE_COLOR_PROFILE_PDB_H__
+
+G_BEGIN_DECLS
+
+/* For information look into the C source or the html documentation */
+
+
+G_GNUC_INTERNAL guint8* _gimp_image_get_color_profile (gint32 image_ID,
+ gint *num_bytes);
+G_GNUC_INTERNAL gboolean _gimp_image_set_color_profile (gint32 image_ID,
+ gint num_bytes,
+ const guint8 *color_profile);
+
+
+G_END_DECLS
+
+#endif /* __GIMP_IMAGE_COLOR_PROFILE_PDB_H__ */
diff --git a/tools/pdbgen/Makefile.am b/tools/pdbgen/Makefile.am
index 0c6bc5e..ef326b4 100644
--- a/tools/pdbgen/Makefile.am
+++ b/tools/pdbgen/Makefile.am
@@ -26,6 +26,7 @@ pdb_sources = \
pdb/gradients.pdb \
pdb/help.pdb \
pdb/image.pdb \
+ pdb/image_color_profile.pdb \
pdb/image_convert.pdb \
pdb/image_grid.pdb \
pdb/image_guides.pdb \
diff --git a/tools/pdbgen/groups.pl b/tools/pdbgen/groups.pl
index e2aaa53..fe0c178 100644
--- a/tools/pdbgen/groups.pl
+++ b/tools/pdbgen/groups.pl
@@ -24,6 +24,7 @@
gradients
help
image
+ image_color_profile
image_convert
image_grid
image_guides
diff --git a/tools/pdbgen/pdb/image_color_profile.pdb b/tools/pdbgen/pdb/image_color_profile.pdb
new file mode 100644
index 0000000..f9624d8
--- /dev/null
+++ b/tools/pdbgen/pdb/image_color_profile.pdb
@@ -0,0 +1,114 @@
+# GIMP - The GNU Image Manipulation Program
+# Copyright (C) 1995 Spencer Kimball and Peter Mattis
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# "Perlized" from C source by Manish Singh <yosh gimp org>
+
+sub image_get_color_profile {
+ $blurb = "Returns the image's color profile";
+
+ $help = <<'HELP';
+This procedure returns the image's color profile.
+HELP
+
+ &mitch_pdb_misc('2015', '2.10');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' }
+ );
+
+ @outargs = (
+ { name => 'profile_data', type => 'int8array', wrap => 1,
+ desc => "The image's serialized color profile. The returned value must be freed with g_free()",
+ array => { name => 'num_bytes',
+ desc => 'Number of bytes in the color_profile array' } }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-profile.h") ],
+ code => <<'CODE'
+{
+ GimpColorProfile profile;
+
+ profile = gimp_image_get_color_profile (image, NULL);
+
+ if (profile)
+ {
+ gsize length;
+
+ profile_data = gimp_color_profile_save_to_data (profile, &length, NULL);
+ num_bytes = length;
+
+ gimp_color_profile_close (profile);
+ }
+}
+CODE
+ );
+}
+
+sub image_set_color_profile {
+ $blurb = "Sets the image's color profile";
+
+ $help = <<'HELP';
+This procedure sets the image's color profile.
+HELP
+
+ &mitch_pdb_misc('2015', '2.10');
+
+ @inargs = (
+ { name => 'image', type => 'image',
+ desc => 'The image' },
+ { name => 'color_profile', type => 'int8array', wrap => 1,
+ desc => 'The new serialized color profile',
+ array => { name => 'num_bytes',
+ desc => 'Number of bytes in the color_profile array' } }
+ );
+
+ %invoke = (
+ headers => [ qw("core/gimpimage-profile.h") ],
+ code => <<'CODE'
+{
+ GimpColorProfile profile;
+
+ profile = gimp_color_profile_open_from_data (color_profile, num_bytes, error);
+
+ if (profile)
+ {
+ success = gimp_image_set_color_profile (image, profile, error);
+ gimp_color_profile_close (profile);
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+ headers = qw(<cairo.h>
+ "libgimpcolor/gimpcolor.h"
+ "gimp-intl.h");
+
+ procs = qw(image_get_color_profile
+ image_set_color_profile);
+
+%exports = (app => [ procs], lib => [ procs]);
+
+$desc = 'Image Color Profile';
+$doc_title = 'gimpimagecolorprofile';
+$doc_short_desc = 'Operations on an image\'s color profile.';
+$doc_long_desc = 'Operations on an image\'s color profile.';
+
+1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]