Commit c64a1041 authored by Michael Natterer's avatar Michael Natterer

plug-ins: merge the file-tiff-load and file-tiff-save plug-ins

so they can share duplicated code.
parent 52f4e993
......@@ -3,7 +3,5 @@
/.deps
/_libs
/.libs
/file-tiff-load
/file-tiff-load.exe
/file-tiff-save
/file-tiff-save.exe
/file-tiff
/file-tiff.exe
......@@ -14,8 +14,7 @@ endif
if HAVE_WINDRES
include $(top_srcdir)/build/windows/gimprc-plug-ins.rule
file_tiff_load_RC = file-tiff-load.rc.o
file_tiff_save_RC = file-tiff-save.rc.o
file_tiff_RC = file-tiff.rc.o
endif
AM_LDFLAGS = $(mwindows)
......@@ -31,15 +30,18 @@ AM_CPPFLAGS = \
$(GEXIV2_CFLAGS) \
-I$(includedir)
libexec_PROGRAMS = file-tiff-load file-tiff-save
libexec_PROGRAMS = file-tiff
file_tiff_load_SOURCES = \
file-tiff-load.c
file_tiff_SOURCES = \
file-tiff.c \
file-tiff-io.c \
file-tiff-io.h \
file-tiff-load.c \
file-tiff-load.h \
file-tiff-save.c \
file-tiff-save.h
file_tiff_save_SOURCES = \
file-tiff-save.c
ldadd = \
file_tiff_LDADD = \
$(libgimpui) \
$(libgimpwidgets) \
$(libgimpconfig) \
......@@ -51,12 +53,5 @@ ldadd = \
$(GTK_LIBS) \
$(GEGL_LIBS) \
$(RT_LIBS) \
$(INTLLIBS)
file_tiff_load_LDADD = \
$(ldadd) \
$(file_tiff_load_RC)
file_tiff_save_LDADD = \
$(ldadd) \
$(file_tiff_load_RC)
$(INTLLIBS) \
$(file_tiff_RC)
/* tiff loading for GIMP
* -Peter Mattis
*
* The TIFF loading code has been completely revamped by Nick Lamb
* njl195@zepler.org.uk -- 18 May 1998
* And it now gains support for tiles (and doubtless a zillion bugs)
* njl195@zepler.org.uk -- 12 June 1999
* LZW patent fuss continues :(
* njl195@zepler.org.uk -- 20 April 2000
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
* khk@khk.net -- 13 May 2000
* Added support for ICCPROFILE tiff tag. If this tag is present in a
* TIFF file, then a parasite is created and vice versa.
* peter@kirchgessner.net -- 29 Oct 2002
* Progress bar only when run interactive
* Added support for layer offsets - pablo.dangelo@web.de -- 7 Jan 2004
* Honor EXTRASAMPLES tag while loading images with alphachannel
* pablo.dangelo@web.de -- 16 Jan 2004
*/
#include "config.h"
#include <errno.h>
#include <string.h>
#include <tiffio.h>
#include <libgimp/gimp.h>
#include <libgimp/gimpui.h>
#include "file-tiff-io.h"
static void tiff_warning (const gchar *module,
const gchar *fmt,
va_list ap) G_GNUC_PRINTF (2, 0);
static void tiff_error (const gchar *module,
const gchar *fmt,
va_list ap) G_GNUC_PRINTF (2, 0);
TIFF *
tiff_open (const gchar *filename,
const gchar *mode,
GError **error)
{
TIFFSetWarningHandler (tiff_warning);
TIFFSetErrorHandler (tiff_error);
#ifdef G_OS_WIN32
gunichar2 *utf16_filename = g_utf8_to_utf16 (filename, -1, NULL, NULL, error);
if (utf16_filename)
{
TIFF *tif = TIFFOpenW (utf16_filename, mode);
g_free (utf16_filename);
return tif;
}
return NULL;
#else
return TIFFOpen (filename, mode);
#endif
}
static void
tiff_warning (const gchar *module,
const gchar *fmt,
va_list ap)
{
gint tag = 0;
if (! strcmp (fmt, "%s: unknown field with tag %d (0x%x) encountered"))
{
va_list ap_test;
G_VA_COPY (ap_test, ap);
va_arg (ap_test, const char *); /* ignore first arg */
tag = va_arg (ap_test, int);
}
/* for older versions of libtiff? */
else if (! strcmp (fmt, "unknown field with tag %d (0x%x) ignored"))
{
va_list ap_test;
G_VA_COPY (ap_test, ap);
tag = va_arg (ap_test, int);
}
/* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=131975
* Ignore the warnings about unregistered private tags (>= 32768).
*/
if (tag >= 32768)
return;
/* Other unknown fields are only reported to stderr. */
if (tag > 0)
{
gchar *msg = g_strdup_vprintf (fmt, ap);
g_printerr ("%s\n", msg);
g_free (msg);
return;
}
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
}
static void
tiff_error (const gchar *module,
const gchar *fmt,
va_list ap)
{
/* Workaround for: http://bugzilla.gnome.org/show_bug.cgi?id=132297
* Ignore the errors related to random access and JPEG compression
*/
if (! strcmp (fmt, "Compression algorithm does not support random access"))
return;
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, fmt, ap);
}
/* tiff loading for GIMP
* -Peter Mattis
*
* The TIFF loading code has been completely revamped by Nick Lamb
* njl195@zepler.org.uk -- 18 May 1998
* And it now gains support for tiles (and doubtless a zillion bugs)
* njl195@zepler.org.uk -- 12 June 1999
* LZW patent fuss continues :(
* njl195@zepler.org.uk -- 20 April 2000
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
* khk@khk.net -- 13 May 2000
* Added support for ICCPROFILE tiff tag. If this tag is present in a
* TIFF file, then a parasite is created and vice versa.
* peter@kirchgessner.net -- 29 Oct 2002
* Progress bar only when run interactive
* Added support for layer offsets - pablo.dangelo@web.de -- 7 Jan 2004
* Honor EXTRASAMPLES tag while loading images with alphachannel
* pablo.dangelo@web.de -- 16 Jan 2004
*/
#ifndef __FILE_TIFF_IO_H__
#define __FILE_TIFF_IO_H__
TIFF * tiff_open (const gchar *filename,
const gchar *mode,
GError **error);
#endif /* __FILE_TIFF_IO_H__ */
This diff is collapsed.
/* tiff loading for GIMP
* -Peter Mattis
*
* The TIFF loading code has been completely revamped by Nick Lamb
* njl195@zepler.org.uk -- 18 May 1998
* And it now gains support for tiles (and doubtless a zillion bugs)
* njl195@zepler.org.uk -- 12 June 1999
* LZW patent fuss continues :(
* njl195@zepler.org.uk -- 20 April 2000
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
* khk@khk.net -- 13 May 2000
* Added support for ICCPROFILE tiff tag. If this tag is present in a
* TIFF file, then a parasite is created and vice versa.
* peter@kirchgessner.net -- 29 Oct 2002
* Progress bar only when run interactive
* Added support for layer offsets - pablo.dangelo@web.de -- 7 Jan 2004
* Honor EXTRASAMPLES tag while loading images with alphachannel
* pablo.dangelo@web.de -- 16 Jan 2004
*/
#ifndef __FILE_TIFF_LOAD_H__
#define __FILE_TIFF_LOAD_H__
typedef struct
{
gint o_pages;
gint n_pages;
gint *pages;
GimpPageSelectorTarget target;
} TiffSelectedPages;
gboolean load_dialog (TIFF *tif,
const gchar *help_id,
TiffSelectedPages *pages);
gint32 load_image (const gchar *filename,
TIFF *tif,
TiffSelectedPages *pages,
gboolean *resolution_loaded,
GError **error);
#endif /* __FILE_TIFF_LOAD_H__ */
This diff is collapsed.
/* tiff saving for GIMP
* -Peter Mattis
*
* The TIFF loading code has been completely revamped by Nick Lamb
* njl195@zepler.org.uk -- 18 May 1998
* And it now gains support for tiles (and doubtless a zillion bugs)
* njl195@zepler.org.uk -- 12 June 1999
* LZW patent fuss continues :(
* njl195@zepler.org.uk -- 20 April 2000
* The code for this filter is based on "tifftopnm" and "pnmtotiff",
* 2 programs that are a part of the netpbm package.
* khk@khk.net -- 13 May 2000
* Added support for ICCPROFILE tiff tag. If this tag is present in a
* TIFF file, then a parasite is created and vice versa.
* peter@kirchgessner.net -- 29 Oct 2002
* Progress bar only when run interactive
* Added support for layer offsets - pablo.dangelo@web.de -- 7 Jan 2004
* Honor EXTRASAMPLES tag while loading images with alphachannel
* pablo.dangelo@web.de -- 16 Jan 2004
*/
#ifndef __FILE_TIFF_SAVE_H__
#define __FILE_TIFF_SAVE_H__
typedef struct
{
gint compression;
gint fillorder;
gboolean save_transp_pixels;
gboolean save_exif;
gboolean save_xmp;
gboolean save_iptc;
gboolean save_thumbnail;
} TiffSaveVals;
gboolean save_image (const gchar *filename,
TiffSaveVals *tsvals,
gint32 image,
gint32 drawable,
gint32 orig_image,
const gchar *image_comment,
gint *saved_bpp,
GError **error);
gboolean save_dialog (TiffSaveVals *tsvals,
const gchar *help_id,
gboolean has_alpha,
gboolean is_monochrome,
gboolean is_indexed,
gchar **image_comment);
#endif /* __FILE_TIFF_SAVE_H__ */
This diff is collapsed.
......@@ -117,6 +117,7 @@ plug-ins/file-psd/psd-thumb-load.c
plug-ins/file-psd/psd-util.c
plug-ins/file-psd/psd.c
plug-ins/file-sgi/sgi.c
plug-ins/file-tiff/file-tiff.c
plug-ins/file-tiff/file-tiff-load.c
plug-ins/file-tiff/file-tiff-save.c
plug-ins/flame/flame.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment