plug-ins/jpeg/Makefile.am plug-ins/jpeg/jpeg-exif.c
2005-01-07 Sven Neumann <sven@gimp.org> * plug-ins/jpeg/Makefile.am * plug-ins/jpeg/jpeg-exif.c * plug-ins/jpeg/jpeg-load.c * plug-ins/jpeg/jpeg-save.c * plug-ins/jpeg/jpeg.[ch]: some code cleanup.
This commit is contained in:
parent
59399ad10e
commit
adabbad909
7 changed files with 165 additions and 98 deletions
|
|
@ -1,3 +1,11 @@
|
|||
2005-01-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/jpeg/Makefile.am
|
||||
* plug-ins/jpeg/jpeg-exif.c
|
||||
* plug-ins/jpeg/jpeg-load.c
|
||||
* plug-ins/jpeg/jpeg-save.c
|
||||
* plug-ins/jpeg/jpeg.[ch]: some code cleanup.
|
||||
|
||||
2005-01-06 Manish Singh <yosh@gimp.org>
|
||||
|
||||
* libgimpwidgets/gimpdialog.c: flush the display in dispose if we're
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ libexec_PROGRAMS = $(JPEG)
|
|||
EXTRA_PROGRAMS = jpeg
|
||||
|
||||
jpeg_SOURCES = \
|
||||
jpeg.c \
|
||||
jpeg-load.c \
|
||||
jpeg-save.c \
|
||||
jpeg.h \
|
||||
jpeg-save.h \
|
||||
jpeg-load.h \
|
||||
jpeg.c \
|
||||
jpeg-load.c \
|
||||
jpeg-save.c \
|
||||
jpeg.h \
|
||||
jpeg-save.h \
|
||||
jpeg-load.h \
|
||||
jpeg-exif.c
|
||||
|
||||
jpeg_LDADD = \
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* 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.
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, 2MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
@ -22,30 +22,47 @@
|
|||
* other plugins.
|
||||
*/
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
#define EXIF_HEADER_SIZE 8
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#define jpeg_exif_content_get_value(c,t,v,m) \
|
||||
(exif_content_get_entry (c,t) ? \
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include "jpeg.h"
|
||||
|
||||
|
||||
#define jpeg_exif_content_get_value(c,t,v,m) \
|
||||
(exif_content_get_entry (c,t) ? \
|
||||
jpeg_exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL)
|
||||
|
||||
|
||||
static void jpeg_remove_exif_entry (ExifData *exif_data,
|
||||
ExifIfd ifd,
|
||||
ExifTag tag);
|
||||
static void jpeg_remove_exif_entry (ExifData *exif_data,
|
||||
ExifIfd ifd,
|
||||
ExifTag tag);
|
||||
|
||||
static const gchar *jpeg_exif_entry_get_value (ExifEntry *e,
|
||||
gchar *val,
|
||||
guint maxlen);
|
||||
static const gchar * jpeg_exif_entry_get_value (ExifEntry *e,
|
||||
gchar *val,
|
||||
guint maxlen);
|
||||
|
||||
static gboolean jpeg_query (const gchar *msg);
|
||||
|
||||
static gboolean jpeg_query (const gchar *msg);
|
||||
|
||||
void
|
||||
jpeg_apply_exif_data_to_image (const gchar *filename,
|
||||
|
|
@ -397,28 +414,19 @@ jpeg_exif_entry_get_value (ExifEntry *e,
|
|||
static gboolean
|
||||
jpeg_query (const gchar *msg)
|
||||
{
|
||||
GtkWidget *label;
|
||||
gboolean ret;
|
||||
GtkWidget *dialog;
|
||||
gboolean ret;
|
||||
|
||||
GtkWidget *dialog = gimp_dialog_new (_("Loading JPEG . . ."), "jpeg-query",
|
||||
NULL, 0, gimp_standard_help_func,
|
||||
"file-jpeg-load",
|
||||
dialog = gtk_message_dialog_new (NULL, 0,
|
||||
GTK_MESSAGE_QUESTION,
|
||||
GTK_BUTTONS_OK_CANCEL,
|
||||
"%s", msg);
|
||||
|
||||
GTK_STOCK_NO, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_YES, GTK_RESPONSE_OK,
|
||||
|
||||
NULL);
|
||||
|
||||
label = gtk_label_new (msg);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 12);
|
||||
gtk_widget_show (label);
|
||||
|
||||
ret = gimp_dialog_run (GIMP_DIALOG (dialog));
|
||||
ret = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
return ((ret == GTK_RESPONSE_OK));
|
||||
return (ret == GTK_RESPONSE_OK);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,9 +16,29 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
#include <libexif/exif-data.h>
|
||||
#endif /* HAVE_EXIF */
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "jpeg-load.h"
|
||||
|
||||
|
||||
/* Read next byte */
|
||||
static guint
|
||||
jpeg_getc (j_decompress_ptr cinfo)
|
||||
|
|
@ -239,9 +259,8 @@ load_image (const gchar *filename,
|
|||
/*fallthrough*/
|
||||
|
||||
default:
|
||||
g_message ("Don't know how to load JPEGs\n"
|
||||
"with %d color channels\n"
|
||||
"using colorspace %d (%d)",
|
||||
g_message ("Don't know how to load JPEG images "
|
||||
"with %d color channels, using colorspace %d (%d).",
|
||||
cinfo.output_components, cinfo.out_color_space,
|
||||
cinfo.jpeg_color_space);
|
||||
gimp_quit ();
|
||||
|
|
@ -321,7 +340,7 @@ load_image (const gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("Unknown density unit %d\nassuming dots per inch",
|
||||
g_message ("Unknown density unit %d, assuming dots per inch.",
|
||||
cinfo.density_unit);
|
||||
break;
|
||||
}
|
||||
|
|
@ -372,7 +391,8 @@ load_image (const gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_warning ("JPEG - shouldn't have gotten here.\nReport to http://bugzilla.gnome.org/");
|
||||
g_warning ("JPEG - shouldn't have gotten here.\n"
|
||||
"Report to http://bugzilla.gnome.org/");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -660,9 +680,8 @@ load_thumbnail_image (const gchar *filename,
|
|||
/*fallthrough*/
|
||||
|
||||
default:
|
||||
g_message ("Don't know how to load JPEGs\n"
|
||||
"with %d color channels\n"
|
||||
"using colorspace %d (%d)",
|
||||
g_message ("Don't know how to load JPEG images "
|
||||
"with %d color channels, using colorspace %d (%d).",
|
||||
cinfo.output_components, cinfo.out_color_space,
|
||||
cinfo.jpeg_color_space);
|
||||
|
||||
|
|
@ -728,7 +747,7 @@ load_thumbnail_image (const gchar *filename,
|
|||
break;
|
||||
|
||||
default:
|
||||
g_message ("Unknown density unit %d\nassuming dots per inch",
|
||||
g_message ("Unknown density unit %d, assuming dots per inch.",
|
||||
cinfo.density_unit);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,36 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
#include <libexif/exif-data.h>
|
||||
#endif /* HAVE_EXIF */
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "jpeg-save.h"
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct jpeg_compress_struct cinfo;
|
||||
|
|
|
|||
|
|
@ -16,20 +16,39 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "jpeg-save.h"
|
||||
#include "jpeg-load.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
#include <libexif/exif-data.h>
|
||||
#endif /* HAVE_EXIF */
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
#include "jpeg.h"
|
||||
#include "jpeg-load.h"
|
||||
#include "jpeg-save.h"
|
||||
|
||||
|
||||
/* Declare local functions.
|
||||
*/
|
||||
static void query (void);
|
||||
static void run (const gchar *name,
|
||||
gint nparams,
|
||||
const GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
static void query (void);
|
||||
static void run (const gchar *name,
|
||||
gint nparams,
|
||||
const GimpParam *param,
|
||||
gint *nreturn_vals,
|
||||
GimpParam **return_vals);
|
||||
|
||||
|
||||
GimpPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
|
|
@ -40,7 +59,6 @@ GimpPlugInInfo PLUG_IN_INFO =
|
|||
};
|
||||
|
||||
|
||||
|
||||
MAIN ()
|
||||
|
||||
|
||||
|
|
@ -559,6 +577,3 @@ my_output_message (j_common_ptr cinfo)
|
|||
g_message (buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,30 +1,20 @@
|
|||
#include "config.h" /* configure cares about HAVE_PROGRESSIVE_JPEG */
|
||||
|
||||
#include <glib.h> /* We want glib.h first because of some
|
||||
* pretty obscure Win32 compilation issues.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <jpeglib.h>
|
||||
#include <jerror.h>
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
#include <libexif/exif-data.h>
|
||||
#endif /* HAVE_EXIF */
|
||||
|
||||
#include <libgimp/gimp.h>
|
||||
#include <libgimp/gimpui.h>
|
||||
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
typedef struct my_error_mgr
|
||||
{
|
||||
|
|
@ -51,30 +41,30 @@ gint32 display_ID;
|
|||
gchar *image_comment;
|
||||
|
||||
|
||||
gint32 load_image (const gchar *filename,
|
||||
GimpRunMode runmode,
|
||||
gboolean preview);
|
||||
gint32 load_image (const gchar *filename,
|
||||
GimpRunMode runmode,
|
||||
gboolean preview);
|
||||
|
||||
void destroy_preview (void);
|
||||
void destroy_preview (void);
|
||||
|
||||
void my_error_exit (j_common_ptr cinfo);
|
||||
void my_emit_message (j_common_ptr cinfo,
|
||||
int msg_level);
|
||||
void my_output_message (j_common_ptr cinfo);
|
||||
void my_error_exit (j_common_ptr cinfo);
|
||||
void my_emit_message (j_common_ptr cinfo,
|
||||
int msg_level);
|
||||
void my_output_message (j_common_ptr cinfo);
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
|
||||
ExifData *exif_data;
|
||||
|
||||
gint32 load_thumbnail_image (const gchar *filename,
|
||||
gint *width,
|
||||
gint *height);
|
||||
gint32 load_thumbnail_image (const gchar *filename,
|
||||
gint *width,
|
||||
gint *height);
|
||||
|
||||
void jpeg_apply_exif_data_to_image (const gchar *filename,
|
||||
const gint32 image_ID);
|
||||
void jpeg_apply_exif_data_to_image (const gchar *filename,
|
||||
const gint32 image_ID);
|
||||
|
||||
void jpeg_setup_exif_for_save (ExifData *exif_data,
|
||||
const gint32 image_ID);
|
||||
void jpeg_setup_exif_for_save (ExifData *exif_data,
|
||||
const gint32 image_ID);
|
||||
|
||||
#endif /* HAVE_EXIF */
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue