[gimp] plug-ins, pdb: remove the lcms plug-in and add PDB compat procedures
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins, pdb: remove the lcms plug-in and add PDB compat procedures
- Date: Thu, 27 Aug 2015 20:07:05 +0000 (UTC)
commit e83d5e709025221a43596c6645bd08e4913302e9
Author: Michael Natterer <mitch gimp org>
Date: Thu Aug 27 22:06:25 2015 +0200
plug-ins, pdb: remove the lcms plug-in and add PDB compat procedures
app/pdb/internal-procs.c | 2 +-
app/pdb/plug-in-compat-cmds.c | 205 +++++++++++++++
plug-ins/common/.gitignore | 2 -
plug-ins/common/Makefile.am | 19 --
plug-ins/common/gimprc.common | 1 -
plug-ins/common/lcms.c | 473 -----------------------------------
plug-ins/common/plugin-defs.pl | 1 -
po-plug-ins/POTFILES.in | 1 -
tools/pdbgen/pdb/plug_in_compat.pdb | 129 ++++++++++
9 files changed, 335 insertions(+), 498 deletions(-)
---
diff --git a/app/pdb/internal-procs.c b/app/pdb/internal-procs.c
index 926cacb..11ed674 100644
--- a/app/pdb/internal-procs.c
+++ b/app/pdb/internal-procs.c
@@ -28,7 +28,7 @@
#include "internal-procs.h"
-/* 770 procedures registered total */
+/* 772 procedures registered total */
void
internal_procs_init (GimpPDB *pdb)
diff --git a/app/pdb/plug-in-compat-cmds.c b/app/pdb/plug-in-compat-cmds.c
index 67d2a3d..662e1a4 100644
--- a/app/pdb/plug-in-compat-cmds.c
+++ b/app/pdb/plug-in-compat-cmds.c
@@ -1966,6 +1966,118 @@ plug_in_icc_profile_file_info_invoker (GimpProcedure *procedure,
}
static GimpValueArray *
+plug_in_icc_profile_apply_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ const gchar *profile;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ profile = g_value_get_string (gimp_value_array_index (args, 2));
+ intent = g_value_get_enum (gimp_value_array_index (args, 3));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 4));
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GFile *file = NULL;
+ GimpColorProfile *p = NULL;
+
+ if (profile)
+ file = g_file_new_for_path (profile);
+ else if (image->gimp->config->color_management->rgb_profile)
+ file = g_file_new_for_path (image->gimp->config->color_management->rgb_profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
+plug_in_icc_profile_apply_rgb_invoker (GimpProcedure *procedure,
+ Gimp *gimp,
+ GimpContext *context,
+ GimpProgress *progress,
+ const GimpValueArray *args,
+ GError **error)
+{
+ gboolean success = TRUE;
+ GimpImage *image;
+ gint32 intent;
+ gboolean bpc;
+
+ image = gimp_value_get_image (gimp_value_array_index (args, 1), gimp);
+ intent = g_value_get_enum (gimp_value_array_index (args, 2));
+ bpc = g_value_get_boolean (gimp_value_array_index (args, 3));
+
+ if (success)
+ {
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GFile *file = NULL;
+ GimpColorProfile *p = NULL;
+
+ if (image->gimp->config->color_management->rgb_profile)
+ file = g_file_new_for_path (image->gimp->config->color_management->rgb_profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+ }
+
+ return gimp_procedure_get_return_values (procedure, success,
+ error ? *error : NULL);
+}
+
+static GimpValueArray *
plug_in_icc_profile_set_invoker (GimpProcedure *procedure,
Gimp *gimp,
GimpContext *context,
@@ -5989,6 +6101,99 @@ register_plug_in_compat_procs (GimpPDB *pdb)
g_object_unref (procedure);
/*
+ * gimp-plug-in-icc-profile-apply
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_apply_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-apply");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-apply",
+ "Apply a color profile on the image",
+ "This procedure transform from the image's color profile (or the
default RGB profile if none is set) to the given ICC color profile. Only RGB color profiles are accepted. The
profile is then set on the image using the 'icc-profile' \"parasite.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_string ("profile",
+ "profile",
+ "Filename of an ICC color profile",
+ TRUE, FALSE, FALSE,
+ NULL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
+ * gimp-plug-in-icc-profile-apply-rgb
+ */
+ procedure = gimp_procedure_new (plug_in_icc_profile_apply_rgb_invoker);
+ gimp_object_set_static_name (GIMP_OBJECT (procedure),
+ "plug-in-icc-profile-apply-rgb");
+ gimp_procedure_set_static_strings (procedure,
+ "plug-in-icc-profile-apply-rgb",
+ "Apply default RGB color profile on the image",
+ "This procedure transform from the image's color profile (or the
default RGB profile if none is set) to the configured default RGB color profile. The profile is then set on
the image using the 'icc-profile' parasite. If no RGB color profile is configured, sRGB is assumed and the
parasite is unset.",
+ "Sven Neumann <sven gimp org>",
+ "Sven Neumann",
+ "2015",
+ NULL);
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("run-mode",
+ "run mode",
+ "The run mode",
+ GIMP_TYPE_RUN_MODE,
+ GIMP_RUN_INTERACTIVE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ gimp_param_spec_image_id ("image",
+ "image",
+ "Input image",
+ pdb->gimp, FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_enum ("intent",
+ "intent",
+ "Rendering intent",
+ GIMP_TYPE_COLOR_RENDERING_INTENT,
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL,
+ GIMP_PARAM_READWRITE));
+ gimp_procedure_add_argument (procedure,
+ g_param_spec_boolean ("bpc",
+ "bpc",
+ "Black point compensation",
+ FALSE,
+ GIMP_PARAM_READWRITE));
+ gimp_pdb_register_procedure (pdb, procedure);
+ g_object_unref (procedure);
+
+ /*
* gimp-plug-in-icc-profile-set
*/
procedure = gimp_procedure_new (plug_in_icc_profile_set_invoker);
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index b74bac2..043dffc 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -144,8 +144,6 @@
/hot.exe
/jigsaw
/jigsaw.exe
-/lcms
-/lcms.exe
/mail
/mail.exe
/max-rgb
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index ef78dd8..1b98f1a 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -115,7 +115,6 @@ libexec_PROGRAMS = \
guillotine \
hot \
jigsaw \
- lcms \
$(MAIL) \
max-rgb \
metadata \
@@ -1431,24 +1430,6 @@ jigsaw_LDADD = \
$(INTLLIBS) \
$(jigsaw_RC)
-lcms_SOURCES = \
- lcms.c
-
-lcms_LDADD = \
- $(libgimpui) \
- $(libgimpwidgets) \
- $(libgimpmodule) \
- $(libgimp) \
- $(libgimpmath) \
- $(libgimpconfig) \
- $(libgimpcolor) \
- $(libgimpbase) \
- $(GTK_LIBS) \
- $(GEGL_LIBS) \
- $(RT_LIBS) \
- $(INTLLIBS) \
- $(lcms_RC)
-
mail_SOURCES = \
mail.c
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 9b60f6b..c8fdbbf 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -69,7 +69,6 @@ grid_RC = grid.rc.o
guillotine_RC = guillotine.rc.o
hot_RC = hot.rc.o
jigsaw_RC = jigsaw.rc.o
-lcms_RC = lcms.rc.o
mail_RC = mail.rc.o
max_rgb_RC = max-rgb.rc.o
metadata_RC = metadata.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 02ac04e..233b1ae 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -70,7 +70,6 @@
'guillotine' => {},
'hot' => { ui => 1 },
'jigsaw' => { ui => 1 },
- 'lcms' => { ui => 1, gegl => 1 },
'mail' => { ui => 1, optional => 1 },
'max-rgb' => { ui => 1 },
'metadata' => { ui => 1, libs => 'GEXIV2_LIBS', cflags => 'GEXIV2_CFLAGS' },
diff --git a/po-plug-ins/POTFILES.in b/po-plug-ins/POTFILES.in
index 2d5f47b..847d0bd 100644
--- a/po-plug-ins/POTFILES.in
+++ b/po-plug-ins/POTFILES.in
@@ -74,7 +74,6 @@ plug-ins/common/grid.c
plug-ins/common/guillotine.c
plug-ins/common/hot.c
plug-ins/common/jigsaw.c
-plug-ins/common/lcms.c
plug-ins/common/mail.c
plug-ins/common/max-rgb.c
plug-ins/common/metadata.c
diff --git a/tools/pdbgen/pdb/plug_in_compat.pdb b/tools/pdbgen/pdb/plug_in_compat.pdb
index e64c5d3..e2afcad 100644
--- a/tools/pdbgen/pdb/plug_in_compat.pdb
+++ b/tools/pdbgen/pdb/plug_in_compat.pdb
@@ -1849,6 +1849,133 @@ CODE
);
}
+sub plug_in_icc_profile_apply {
+ $blurb = "Apply a color profile on the image";
+
+ $help = <<'HELP';
+This procedure transform from the image's color profile (or the
+default RGB profile if none is set) to the given ICC color
+profile. Only RGB color profiles are accepted. The profile is then set
+on the image using the 'icc-profile' "parasite.
+HELP
+
+ &neo_pdb_misc;
+ $date = '2015';
+
+ @inargs = (
+ { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+ desc => 'The run mode' },
+ { name => 'image', type => 'image',
+ desc => 'Input image' },
+ { name => 'profile', type => 'string',
+ desc => 'Filename of an ICC color profile', allow_non_utf8 => 1 },
+ { name => 'intent', type => 'enum GimpColorRenderingIntent',
+ desc => 'Rendering intent' },
+ { name => 'bpc', type => 'boolean',
+ desc => 'Black point compensation' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GFile *file = NULL;
+ GimpColorProfile *p = NULL;
+
+ if (profile)
+ file = g_file_new_for_path (profile);
+ else if (image->gimp->config->color_management->rgb_profile)
+ file = g_file_new_for_path (image->gimp->config->color_management->rgb_profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
+sub plug_in_icc_profile_apply_rgb {
+ $blurb = "Apply default RGB color profile on the image";
+
+ $help = <<'HELP';
+This procedure transform from the image's color profile (or the
+default RGB profile if none is set) to the configured default RGB
+color profile. The profile is then set on the image using the
+'icc-profile' parasite. If no RGB color profile is configured, sRGB
+is assumed and the parasite is unset.
+HELP
+
+ &neo_pdb_misc;
+ $date = '2015';
+
+ @inargs = (
+ { name => 'run_mode', type => 'enum GimpRunMode', dead => 1,
+ desc => 'The run mode' },
+ { name => 'image', type => 'image',
+ desc => 'Input image' },
+ { name => 'intent', type => 'enum GimpColorRenderingIntent',
+ desc => 'Rendering intent' },
+ { name => 'bpc', type => 'boolean',
+ desc => 'Black point compensation' }
+ );
+
+ %invoke = (
+ code => <<'CODE'
+{
+ if (gimp_pdb_image_is_not_base_type (image, GIMP_GRAY, error))
+ {
+ GFile *file = NULL;
+ GimpColorProfile *p = NULL;
+
+ if (image->gimp->config->color_management->rgb_profile)
+ file = g_file_new_for_path (image->gimp->config->color_management->rgb_profile);
+
+ if (file)
+ {
+ p = gimp_color_profile_new_from_file (file, error);
+
+ if (! p)
+ success = FALSE;
+
+ g_object_unref (file);
+ }
+
+ if (success)
+ {
+ if (! p)
+ p = gimp_image_get_builtin_color_profile (image);
+
+ success = gimp_image_convert_color_profile (image, p, intent, bpc,
+ progress, error);
+ }
+ }
+ else
+ success = FALSE;
+}
+CODE
+ );
+}
+
sub plug_in_icc_profile_set {
$blurb = "Set a color profile on the image";
@@ -4644,6 +4771,8 @@ CODE
plug_in_hsv_noise
plug_in_icc_profile_info
plug_in_icc_profile_file_info
+ plug_in_icc_profile_apply
+ plug_in_icc_profile_apply_rgb
plug_in_icc_profile_set
plug_in_icc_profile_set_rgb
plug_in_illusion
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]