From 05c1cb7f662a41a194c6e79e6256a3df2f214713 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 28 Sep 2006 18:29:23 +0000 Subject: [PATCH] configure.in plug-ins/common/Makefile.am plug-ins/common/mkgen.pl 2006-09-28 Sven Neumann * configure.in * plug-ins/common/Makefile.am * plug-ins/common/mkgen.pl * plug-ins/common/plugin-defs.pl * plug-ins/common/lcms.c: build framework for ICC color conversion plug-in using littleCMS. --- ChangeLog | 9 +++ configure.in | 4 +- plug-ins/common/.cvsignore | 1 + plug-ins/common/Makefile.am | 26 ++++-- plug-ins/common/lcms.c | 140 +++++++++++++++++++++++++++++++++ plug-ins/common/mkgen.pl | 11 +-- plug-ins/common/plugin-defs.pl | 1 + 7 files changed, 181 insertions(+), 11 deletions(-) create mode 100644 plug-ins/common/lcms.c diff --git a/ChangeLog b/ChangeLog index 7324302da0..36c274b7be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-09-28 Sven Neumann + + * configure.in + * plug-ins/common/Makefile.am + * plug-ins/common/mkgen.pl + * plug-ins/common/plugin-defs.pl + * plug-ins/common/lcms.c: build framework for ICC color conversion + plug-in using littleCMS. + 2006-09-28 Sven Neumann * app/display/gimpdisplayshell.[ch]: added diff --git a/configure.in b/configure.in index fd79089b50..e8c268c77a 100644 --- a/configure.in +++ b/configure.in @@ -1321,6 +1321,7 @@ if test "x$with_lcms" != xno; then ]) if test $have_lcms = yes; then LCMS_LIBS="-llcms" + LCMS="lcms" else have_lcms="no (lcms not found or unusable)" fi @@ -1328,6 +1329,7 @@ else have_lcms="no (lcms support disabled)" fi +AC_SUBST(LCMS) AC_SUBST(LCMS_LIBS) AM_CONDITIONAL(HAVE_LCMS, test $have_lcms = yes) @@ -1869,6 +1871,7 @@ Extra Binaries: Optional Plug-Ins: Ascii Art: $have_libaa Help Browser: $have_gtkhtml2 + LCMS: $have_lcms JPEG: $jpeg_ok MNG: $have_libmng PDF: $have_poppler @@ -1897,4 +1900,3 @@ Optional Modules: Color Correction: $have_lcms Soft Proof: $have_lcms ]); - diff --git a/plug-ins/common/.cvsignore b/plug-ins/common/.cvsignore index 8cfd6be6c8..c2cfa15620 100644 --- a/plug-ins/common/.cvsignore +++ b/plug-ins/common/.cvsignore @@ -69,6 +69,7 @@ illusion iwarp jigsaw laplace +lcms lens lic mail diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am index df58826dc1..d5ba872045 100644 --- a/plug-ins/common/Makefile.am +++ b/plug-ins/common/Makefile.am @@ -8,13 +8,14 @@ ## plug-ins you should only need to modify plugin-defs.pl. +libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la +libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la +libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la +libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la +libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la libgimpui = $(top_builddir)/libgimp/libgimpui-$(GIMP_API_VERSION).la libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la -libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la -libgimp = $(top_builddir)/libgimp/libgimp-$(GIMP_API_VERSION).la -libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la -libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la -libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la + if OS_WIN32 mwindows = -mwindows @@ -101,6 +102,7 @@ libexec_PROGRAMS = \ iwarp \ jigsaw \ laplace \ + $(LCMS) \ lens \ lic \ $(MAIL) \ @@ -181,6 +183,7 @@ libexec_PROGRAMS = \ EXTRA_PROGRAMS = \ aa \ + lcms \ mail \ mng \ png \ @@ -1179,6 +1182,19 @@ laplace_LDADD = \ $(RT_LIBS) \ $(INTLLIBS) +lcms_SOURCES = \ + lcms.c + +lcms_LDADD = \ + $(libgimp) \ + $(libgimpcolor) \ + $(libgimpmath) \ + $(libgimpbase) \ + $(LIBLCMS) \ + $(GLIB_LIBS) \ + $(RT_LIBS) \ + $(INTLLIBS) + lens_SOURCES = \ lens.c diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c new file mode 100644 index 0000000000..9404b44ed8 --- /dev/null +++ b/plug-ins/common/lcms.c @@ -0,0 +1,140 @@ +/* The GIMP -- an 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 2 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include /* lcms.h uses the "inline" keyword */ + +#ifdef HAVE_LCMS_LCMS_H +#include +#else +#include +#endif + +#include + +#include "libgimp/stdplugins-intl.h" + + +#define PLUG_IN_PROC_SET "plug-in-icc-set" +#define PLUG_IN_PROC_APPLY "plug-in-icc-apply" + + +static void query (void); +static void run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals); + + +const GimpPlugInInfo PLUG_IN_INFO = +{ + NULL, /* init_proc */ + NULL, /* quit_proc */ + query, /* query_proc */ + run, /* run_proc */ +}; + +MAIN () + +static void +query (void) +{ + static const GimpParamDef args[] = + { + { GIMP_PDB_INT32, "run-mode", "Interactive, non-interactive" }, + { GIMP_PDB_IMAGE, "image", "Input image" }, + { GIMP_PDB_STRING, "profile", "Filename of an ICC color profile" } + }; + + gimp_install_procedure (PLUG_IN_PROC_SET, + "Set a color profile on the image w/o applying it", + "This procedure sets an ICC color profile on an " + "image using the 'icc-profile' parasite. It does " + "not do any color conversion.", + "Sven Neumann", + "Sven Neumann", + "2006", + "Set ICC Color Profile", + "RGB*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); + + gimp_install_procedure (PLUG_IN_PROC_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. The profile " + "is then set on the image using the 'icc-profile' " + "parasite.", + "Sven Neumann", + "Sven Neumann", + "2006", + "Apply ICC Color Profile", + "RGB*", + GIMP_PLUGIN, + G_N_ELEMENTS (args), 0, + args, NULL); +} + +static void +run (const gchar *name, + gint nparams, + const GimpParam *param, + gint *nreturn_vals, + GimpParam **return_vals) +{ + GimpRunMode run_mode; + GimpPDBStatusType status = GIMP_PDB_SUCCESS; + static GimpParam values[1]; + + run_mode = param[0].data.d_int32; + + INIT_I18N (); + + values[0].type = GIMP_PDB_STATUS; + values[0].data.d_status = status; + + *nreturn_vals = 1; + *return_vals = values; + + if (nparams != 3) + { + values[0].data.d_status = GIMP_PDB_CALLING_ERROR; + return; + } + + if (strcmp (name, PLUG_IN_PROC_SET) == 0) + { + status = GIMP_PDB_EXECUTION_ERROR; + } + else if (strcmp (name, PLUG_IN_PROC_APPLY) == 0) + { + status = GIMP_PDB_EXECUTION_ERROR; + } + else + { + status = GIMP_PDB_CALLING_ERROR; + } + + values[0].data.d_status = status; +} diff --git a/plug-ins/common/mkgen.pl b/plug-ins/common/mkgen.pl index 4b854c2d12..13e07d6021 100755 --- a/plug-ins/common/mkgen.pl +++ b/plug-ins/common/mkgen.pl @@ -48,13 +48,14 @@ print MK < { libdep => 'gtk', ui => 1 }, 'jigsaw' => { libdep => 'gtk', ui => 1 }, 'laplace' => { libdep => 'glib', ui => 1 }, + 'lcms' => { libdep => 'glib', optional => 1, extralibs => 1 }, 'lens' => { libdep => 'gtk', ui => 1 }, 'lic' => { libdep => 'gtk', ui => 1 }, 'mail' => { libdep => 'gtk', ui => 1, optional => 1 },