mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 09:53:25 +00:00
more export stuff
--Sven
This commit is contained in:
parent
29d5575655
commit
cdc3f6e779
25 changed files with 511 additions and 285 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
1999-10-04 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/tool_options.c: backed out a change from last weekend that was
|
||||
never supposed to get into CVS
|
||||
|
||||
* libgimp/gimpexport.[ch]: added a third button.
|
||||
Now "Export" performs the conversion, "Ignore" skips it and continues
|
||||
and "Cancel" cancels the save.
|
||||
|
||||
* plug-ins/bmp/bmp.c
|
||||
* plug-ins/common/gif.c
|
||||
* plug-ins/common/jpeg.c
|
||||
* plug-ins/common/png.c
|
||||
* plug-ins/common/ps.c
|
||||
* plug-ins/common/tiff.c
|
||||
* plug-ins/print/print.c: sync with the new interface.
|
||||
|
||||
* plug-ins/common/Makefile.am
|
||||
* plug-ins/common/plugin-defs.pl
|
||||
* plug-ins/common/tga.c
|
||||
* plug-ins/common/xpm.c: two more save plug-ins that know about export.
|
||||
|
||||
* plug-ins/script-fu/script-fu.c: include script-fu-constants.h
|
||||
|
||||
1999-10-03 Olof S Kylander <olof@frozenriver.com>
|
||||
|
||||
* app/airbrush_blob.c
|
||||
|
|
|
@ -846,7 +846,7 @@ paint_pressure_options_new (ToolType tool_type)
|
|||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
case ERASER:
|
||||
/* case PAINTBRUSH: */
|
||||
case PAINTBRUSH:
|
||||
pressure->pressure_w =
|
||||
gtk_check_button_new_with_label (_("Pressure"));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), pressure->pressure_w);
|
||||
|
|
|
@ -846,7 +846,7 @@ paint_pressure_options_new (ToolType tool_type)
|
|||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
case ERASER:
|
||||
/* case PAINTBRUSH: */
|
||||
case PAINTBRUSH:
|
||||
pressure->pressure_w =
|
||||
gtk_check_button_new_with_label (_("Pressure"));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), pressure->pressure_w);
|
||||
|
|
|
@ -846,7 +846,7 @@ paint_pressure_options_new (ToolType tool_type)
|
|||
case DODGEBURN:
|
||||
case SMUDGE:
|
||||
case ERASER:
|
||||
/* case PAINTBRUSH: */
|
||||
case PAINTBRUSH:
|
||||
pressure->pressure_w =
|
||||
gtk_check_button_new_with_label (_("Pressure"));
|
||||
gtk_container_add (GTK_CONTAINER (hbox), pressure->pressure_w);
|
||||
|
|
|
@ -168,21 +168,29 @@ static ExportAction export_action_convert_indexed_or_grayscale =
|
|||
/* dialog functions */
|
||||
|
||||
static GtkWidget *dialog = NULL;
|
||||
static gboolean dialog_return = FALSE;
|
||||
static GimpExportReturnType dialog_return = EXPORT_CANCEL;
|
||||
|
||||
static void
|
||||
export_export_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_widget_destroy (dialog);
|
||||
dialog_return = TRUE;
|
||||
dialog_return = EXPORT_EXPORT;
|
||||
}
|
||||
|
||||
static void
|
||||
export_skip_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_widget_destroy (dialog);
|
||||
dialog_return = EXPORT_IGNORE;
|
||||
}
|
||||
|
||||
static void
|
||||
export_cancel_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
dialog_return = FALSE;
|
||||
dialog_return = EXPORT_CANCEL;
|
||||
dialog = NULL;
|
||||
gtk_main_quit ();
|
||||
}
|
||||
|
@ -212,8 +220,8 @@ export_dialog (GList *actions,
|
|||
gchar *text;
|
||||
ExportAction *action;
|
||||
|
||||
dialog_return = FALSE;
|
||||
g_return_val_if_fail (actions != NULL && format != NULL, FALSE);
|
||||
dialog_return = EXPORT_CANCEL;
|
||||
g_return_val_if_fail (actions != NULL && format != NULL, dialog_return);
|
||||
|
||||
/*
|
||||
* Plug-ins have called gtk_init () before calling gimp_export ().
|
||||
|
@ -246,6 +254,13 @@ export_dialog (GList *actions,
|
|||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Ignore"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
(GtkSignalFunc) export_skip_callback, NULL);
|
||||
gtk_box_pack_start (GTK_BOX (hbbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Cancel"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
|
||||
|
@ -314,7 +329,7 @@ export_dialog (GList *actions,
|
|||
}
|
||||
|
||||
/* the footline */
|
||||
label = gtk_label_new (_("The export conversion won't modify your image."));
|
||||
label = gtk_label_new (_("The export conversion won't modify your original image."));
|
||||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
|
||||
gtk_widget_show (label);
|
||||
|
||||
|
@ -325,7 +340,7 @@ export_dialog (GList *actions,
|
|||
}
|
||||
|
||||
|
||||
gboolean
|
||||
GimpExportReturnType
|
||||
gimp_export_image (gint32 *image_ID_ptr,
|
||||
gint32 *drawable_ID_ptr,
|
||||
gchar *format,
|
||||
|
@ -403,7 +418,7 @@ gimp_export_image (gint32 *image_ID_ptr,
|
|||
if (actions)
|
||||
dialog_return = export_dialog (actions, format);
|
||||
|
||||
if (dialog_return)
|
||||
if (dialog_return == EXPORT_EXPORT)
|
||||
{
|
||||
*image_ID_ptr = gimp_image_duplicate (*image_ID_ptr);
|
||||
*drawable_ID_ptr = gimp_image_get_active_layer (*image_ID_ptr);
|
||||
|
@ -416,10 +431,9 @@ gimp_export_image (gint32 *image_ID_ptr,
|
|||
else if (action->choice == 1 && action->alt_action)
|
||||
action->alt_action (*image_ID_ptr, drawable_ID_ptr);
|
||||
}
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
return (dialog_return);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,14 +29,18 @@
|
|||
#define CAN_HANDLE_LAYERS 1 << 4
|
||||
#define CAN_HANDLE_LAYERS_AS_ANIMATION 1 << 5
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EXPORT_CANCEL,
|
||||
EXPORT_IGNORE,
|
||||
EXPORT_EXPORT
|
||||
} GimpExportReturnType;
|
||||
|
||||
gboolean gimp_export_image (gint32*, /* image_ID */
|
||||
GimpExportReturnType gimp_export_image (gint32*, /* image_ID */
|
||||
gint32*, /* drawable_ID */
|
||||
gchar*, /* format name */
|
||||
gint); /* plug_in_capabilities */
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ run (char *name,
|
|||
GRunModeType run_mode;
|
||||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -202,6 +202,12 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "BMP",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -236,7 +242,7 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -999,6 +999,7 @@ tga_SOURCES = \
|
|||
tga.c
|
||||
|
||||
tga_LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(GTK_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
@ -1131,6 +1132,7 @@ xpm_SOURCES = \
|
|||
xpm.c
|
||||
|
||||
xpm_LDADD = \
|
||||
$(top_builddir)/libgimp/libgimpui.la \
|
||||
$(top_builddir)/libgimp/libgimp.la \
|
||||
$(LIBXPM) \
|
||||
$(GTK_LIBS) \
|
||||
|
|
|
@ -420,7 +420,7 @@ run (char *name,
|
|||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
gint32 orig_image_ID;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -445,6 +445,12 @@ run (char *name,
|
|||
export = gimp_export_image (&image_ID, &drawable_ID, "GIF",
|
||||
(CAN_HANDLE_INDEXED | CAN_HANDLE_GRAY |
|
||||
CAN_HANDLE_ALPHA | CAN_HANDLE_LAYERS_AS_ANIMATION));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -527,7 +533,7 @@ run (char *name,
|
|||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
'spheredesigner' => { libdep => 'gtk' },
|
||||
'spread' => { libdep => 'gtk' },
|
||||
'sunras' => { libdep => 'gtk' },
|
||||
'tga' => { libdep => 'gtk' },
|
||||
'tga' => { libdep => 'gtk', ui => 1 },
|
||||
'threshold_alpha' => { libdep => 'gtk' },
|
||||
'tiff' => { libdep => 'gtk', ui => 1, optional => 1 },
|
||||
'tile' => { libdep => 'gtk' },
|
||||
|
@ -117,7 +117,7 @@
|
|||
'wind' => { libdep => 'gtk' },
|
||||
'wmf' => { libdep => 'gtk' },
|
||||
'xbm' => { libdep => 'gtk' },
|
||||
'xpm' => { libdep => 'gtk', optional => 1 },
|
||||
'xpm' => { libdep => 'gtk', ui => 1, optional => 1 },
|
||||
'xwd' => { libdep => 'glib' },
|
||||
'zealouscrop' => { libdep => 'glib' }
|
||||
);
|
||||
|
|
|
@ -185,8 +185,7 @@ run (char *name, /* I - Name of filter program. */
|
|||
gint32 orig_image_ID;
|
||||
GRunModeType run_mode;
|
||||
GParam *values; /* Return values */
|
||||
gboolean export = FALSE;
|
||||
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
/*
|
||||
* Initialize parameter data...
|
||||
|
@ -236,6 +235,12 @@ run (char *name, /* I - Name of filter program. */
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "PNG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED | CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -298,7 +303,7 @@ run (char *name, /* I - Name of filter program. */
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -409,7 +409,7 @@ run (char *name,
|
|||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
int k;
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
@ -481,6 +481,12 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "PS",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -553,7 +559,7 @@ run (char *name,
|
|||
}
|
||||
}
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
|
||||
values[0].data.d_status = status;
|
||||
|
|
|
@ -409,7 +409,7 @@ run (char *name,
|
|||
gint32 image_ID = -1;
|
||||
gint32 drawable_ID = -1;
|
||||
gint32 orig_image_ID = -1;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
int k;
|
||||
|
||||
l_run_mode = run_mode = param[0].data.d_int32;
|
||||
|
@ -481,6 +481,12 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "PS",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -553,7 +559,7 @@ run (char *name,
|
|||
}
|
||||
}
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
|
||||
values[0].data.d_status = status;
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
#endif
|
||||
#include <gtk/gtk.h>
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
|
||||
/* Round up a division to the nearest integer. */
|
||||
#define ROUNDUP_DIVIDE(n,d) (((n) + (d - 1)) / (d))
|
||||
|
@ -167,13 +168,14 @@ static void run (char *name,
|
|||
GParam *param,
|
||||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static gint32 load_image (char *filename);
|
||||
static gint save_image (char *filename,
|
||||
gint32 image_ID,
|
||||
gint32 drawable_ID);
|
||||
|
||||
static gint save_dialog ();
|
||||
|
||||
static void init_gtk (void);
|
||||
static gint save_dialog (void);
|
||||
static void save_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
static void save_ok_callback (GtkWidget *widget,
|
||||
|
@ -266,6 +268,8 @@ run (char *name,
|
|||
GStatusType status = STATUS_SUCCESS;
|
||||
GRunModeType run_mode;
|
||||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
#ifdef PROFILE
|
||||
struct tms tbuf1, tbuf2;
|
||||
|
@ -304,6 +308,30 @@ run (char *name,
|
|||
}
|
||||
else if (strcmp (name, "file_tga_save") == 0)
|
||||
{
|
||||
init_gtk ();
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[1].data.d_int32;
|
||||
|
||||
/* eventually export the image */
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
case RUN_WITH_LAST_VALS:
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "TGA",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
||||
CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
|
@ -339,7 +367,7 @@ run (char *name,
|
|||
times (&tbuf1);
|
||||
#endif
|
||||
*nreturn_vals = 1;
|
||||
if (save_image (param[3].data.d_string, param[1].data.d_int32, param[2].data.d_int32))
|
||||
if (save_image (param[3].data.d_string, image_ID, drawable_ID))
|
||||
{
|
||||
/* Store psvals data */
|
||||
gimp_set_data ("file_tga_save", &tsvals, sizeof (tsvals));
|
||||
|
@ -348,6 +376,9 @@ run (char *name,
|
|||
}
|
||||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
|
||||
#ifdef PROFILE
|
||||
|
@ -424,7 +455,10 @@ static int totbytes = 0;
|
|||
#endif
|
||||
|
||||
static int
|
||||
std_fread (guchar *buf, int datasize, int nelems, FILE *fp)
|
||||
std_fread (guchar *buf,
|
||||
int datasize,
|
||||
int nelems,
|
||||
FILE *fp)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
if (verbose > 1)
|
||||
|
@ -439,7 +473,10 @@ std_fread (guchar *buf, int datasize, int nelems, FILE *fp)
|
|||
}
|
||||
|
||||
static int
|
||||
std_fwrite (guchar *buf, int datasize, int nelems, FILE *fp)
|
||||
std_fwrite (guchar *buf,
|
||||
int datasize,
|
||||
int nelems,
|
||||
FILE *fp)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
if (verbose > 1)
|
||||
|
@ -457,7 +494,10 @@ std_fwrite (guchar *buf, int datasize, int nelems, FILE *fp)
|
|||
|
||||
/* Decode a bufferful of file. */
|
||||
static int
|
||||
rle_fread (guchar *buf, int datasize, int nelems, FILE *fp)
|
||||
rle_fread (guchar *buf,
|
||||
int datasize,
|
||||
int nelems,
|
||||
FILE *fp)
|
||||
{
|
||||
static guchar *statebuf = 0;
|
||||
static int statelen = 0;
|
||||
|
@ -597,7 +637,10 @@ rle_fread (guchar *buf, int datasize, int nelems, FILE *fp)
|
|||
loading performance than whole-stream images. */
|
||||
/* RunLength Encode a bufferful of file. */
|
||||
static int
|
||||
rle_fwrite (guchar *buf, int datasize, int nelems, FILE *fp)
|
||||
rle_fwrite (guchar *buf,
|
||||
int datasize,
|
||||
int nelems,
|
||||
FILE *fp)
|
||||
{
|
||||
/* Now runlength-encode the whole buffer. */
|
||||
int count, j, buflen;
|
||||
|
@ -713,7 +756,9 @@ rle_fwrite (guchar *buf, int datasize, int nelems, FILE *fp)
|
|||
|
||||
|
||||
static gint32
|
||||
ReadImage (FILE *fp, struct tga_header *hdr, char *filename)
|
||||
ReadImage (FILE *fp,
|
||||
struct tga_header *hdr,
|
||||
char *filename)
|
||||
{
|
||||
static gint32 image_ID;
|
||||
gint32 layer_ID;
|
||||
|
@ -1367,6 +1412,19 @@ save_image (char *filename,
|
|||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
init_gtk ()
|
||||
{
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("tga");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
}
|
||||
|
||||
static gint
|
||||
save_dialog ()
|
||||
|
@ -1376,15 +1434,6 @@ save_dialog ()
|
|||
GtkWidget *toggle;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("save");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), "Save as Tga");
|
||||
|
|
|
@ -210,7 +210,7 @@ run (char *name,
|
|||
gint32 image;
|
||||
gint32 drawable;
|
||||
gint32 orig_image;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -250,7 +250,14 @@ run (char *name,
|
|||
case RUN_WITH_LAST_VALS:
|
||||
init_gtk ();
|
||||
export = gimp_export_image (&image, &drawable, "TIFF",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED | CAN_HANDLE_ALPHA));
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
||||
CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -332,7 +339,7 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ Previous...Inherited code from Ray Lehtiniemi, who inherited it from S & P.
|
|||
#include <X11/xpm.h>
|
||||
#include "gtk/gtk.h"
|
||||
#include "libgimp/gimp.h"
|
||||
#include "libgimp/gimpui.h"
|
||||
#include "libgimp/stdplugins-intl.h"
|
||||
|
||||
static const char linenoise [] =
|
||||
|
@ -80,42 +81,27 @@ static void run (char *name,
|
|||
int *nreturn_vals,
|
||||
GParam **return_vals);
|
||||
|
||||
static gint32
|
||||
load_image (char *filename);
|
||||
|
||||
static void
|
||||
parse_colors (XpmImage *xpm_image,
|
||||
static gint32 load_image (char *filename);
|
||||
static void parse_colors (XpmImage *xpm_image,
|
||||
guchar **cmap);
|
||||
|
||||
static void
|
||||
parse_image (gint32 image_ID,
|
||||
static void parse_image (gint32 image_ID,
|
||||
XpmImage *xpm_image,
|
||||
guchar *cmap);
|
||||
|
||||
static gint
|
||||
save_image (char *filename,
|
||||
static gint save_image (char *filename,
|
||||
gint32 image_ID,
|
||||
gint32 drawable_ID);
|
||||
|
||||
|
||||
static gint
|
||||
save_dialog ();
|
||||
|
||||
static void
|
||||
save_close_callback (GtkWidget *widget,
|
||||
static void init_gtk (void);
|
||||
static gint save_dialog (void);
|
||||
static void save_close_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void
|
||||
save_ok_callback (GtkWidget *widget,
|
||||
static void save_ok_callback (GtkWidget *widget,
|
||||
gpointer data);
|
||||
|
||||
static void
|
||||
save_scale_update (GtkAdjustment *adjustment,
|
||||
static void save_scale_update (GtkAdjustment *adjustment,
|
||||
double *scale_val);
|
||||
|
||||
|
||||
|
||||
|
||||
GPlugInInfo PLUG_IN_INFO =
|
||||
{
|
||||
NULL, /* init_proc */
|
||||
|
@ -205,6 +191,8 @@ run (char *name,
|
|||
static GParam values[2];
|
||||
GRunModeType run_mode;
|
||||
gint32 image_ID;
|
||||
gint32 drawable_ID;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
GStatusType status = STATUS_SUCCESS;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
@ -235,6 +223,30 @@ run (char *name,
|
|||
}
|
||||
else if (strcmp (name, "file_xpm_save") == 0)
|
||||
{
|
||||
init_gtk ();
|
||||
|
||||
image_ID = param[1].data.d_int32;
|
||||
drawable_ID = param[1].data.d_int32;
|
||||
|
||||
/* eventually export the image */
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
case RUN_WITH_LAST_VALS:
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "XPM",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
||||
CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
case RUN_INTERACTIVE:
|
||||
|
@ -242,7 +254,7 @@ run (char *name,
|
|||
gimp_get_data ("file_xpm_save", &xpmvals);
|
||||
|
||||
/* First acquire information with a dialog */
|
||||
if (gimp_drawable_has_alpha(param[2].data.d_int32))
|
||||
if (gimp_drawable_has_alpha (drawable_ID))
|
||||
if (! save_dialog ())
|
||||
return;
|
||||
break;
|
||||
|
@ -269,14 +281,17 @@ run (char *name,
|
|||
}
|
||||
*nreturn_vals = 1;
|
||||
if (save_image (param[3].data.d_string,
|
||||
param[1].data.d_int32,
|
||||
param[2].data.d_int32))
|
||||
image_ID,
|
||||
drawable_ID))
|
||||
{
|
||||
gimp_set_data ("file_xpm_save", &xpmvals, sizeof (XpmSaveVals));
|
||||
values[0].data.d_status = STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
else
|
||||
g_assert (FALSE);
|
||||
|
@ -330,7 +345,8 @@ load_image (char *filename)
|
|||
|
||||
|
||||
static void
|
||||
parse_colors (XpmImage *xpm_image, guchar **cmap)
|
||||
parse_colors (XpmImage *xpm_image,
|
||||
guchar **cmap)
|
||||
{
|
||||
Display *display;
|
||||
Colormap colormap;
|
||||
|
@ -388,7 +404,9 @@ parse_colors (XpmImage *xpm_image, guchar **cmap)
|
|||
|
||||
|
||||
static void
|
||||
parse_image(gint32 image_ID, XpmImage *xpm_image, guchar *cmap)
|
||||
parse_image (gint32 image_ID,
|
||||
XpmImage *xpm_image,
|
||||
guchar *cmap)
|
||||
{
|
||||
int tile_height;
|
||||
int scanlines;
|
||||
|
@ -464,13 +482,16 @@ guint rgbhash (rgbkey *c)
|
|||
return ((guint)c->r) ^ ((guint)c->g) ^ ((guint)c->b);
|
||||
}
|
||||
|
||||
guint compare (rgbkey *c1, rgbkey *c2)
|
||||
guint compare (rgbkey *c1,
|
||||
rgbkey *c2)
|
||||
{
|
||||
return (c1->r == c2->r)&&(c1->g == c2->g)&&(c1->b == c2->b);
|
||||
}
|
||||
|
||||
|
||||
void set_XpmImage(XpmColor *array, guint index, char *colorstring)
|
||||
void set_XpmImage (XpmColor *array,
|
||||
guint index,
|
||||
char *colorstring)
|
||||
{
|
||||
char *p;
|
||||
int i, charnum, indtemp;
|
||||
|
@ -503,8 +524,9 @@ void set_XpmImage(XpmColor *array, guint index, char *colorstring)
|
|||
}
|
||||
}
|
||||
|
||||
void create_colormap_from_hash (gpointer gkey, gpointer value, gpointer
|
||||
user_data)
|
||||
void create_colormap_from_hash (gpointer gkey,
|
||||
gpointer value,
|
||||
gpointer user_data)
|
||||
{
|
||||
rgbkey *key = gkey;
|
||||
char *string = g_new(char, 8);
|
||||
|
@ -543,7 +565,8 @@ save_image (char *filename,
|
|||
gint rc = FALSE;
|
||||
|
||||
/* get some basic stats about the image */
|
||||
switch (gimp_drawable_type (drawable_ID)) {
|
||||
switch (gimp_drawable_type (drawable_ID))
|
||||
{
|
||||
case RGBA_IMAGE:
|
||||
case INDEXEDA_IMAGE:
|
||||
case GRAYA_IMAGE:
|
||||
|
@ -558,7 +581,8 @@ save_image (char *filename,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
switch (gimp_drawable_type (drawable_ID)) {
|
||||
switch (gimp_drawable_type (drawable_ID))
|
||||
{
|
||||
case GRAYA_IMAGE:
|
||||
case GRAY_IMAGE:
|
||||
color = 0;
|
||||
|
@ -573,7 +597,8 @@ save_image (char *filename,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
switch (gimp_drawable_type (drawable_ID)) {
|
||||
switch (gimp_drawable_type (drawable_ID))
|
||||
{
|
||||
case GRAYA_IMAGE:
|
||||
case GRAY_IMAGE:
|
||||
case RGBA_IMAGE:
|
||||
|
@ -694,7 +719,8 @@ save_image (char *filename,
|
|||
sprintf(string, "#%02X%02X%02X", (int)r, (int)g, (int)b);
|
||||
set_XpmImage(colormap, i+1, string);
|
||||
}
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
colormap = g_new(XpmColor, ncolors);
|
||||
|
||||
|
@ -717,13 +743,10 @@ save_image (char *filename,
|
|||
XpmWriteFileFromXpmImage(filename, image, NULL);
|
||||
rc = TRUE;
|
||||
|
||||
|
||||
cleanup:
|
||||
|
||||
/* clean up resources */
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
|
||||
if (ibuff) g_free(ibuff);
|
||||
/*if (mbuff) g_free(mbuff);*/
|
||||
if (hash) g_hash_table_destroy(hash);
|
||||
|
@ -731,6 +754,19 @@ save_image (char *filename,
|
|||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
init_gtk ()
|
||||
{
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("xpm");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse (gimp_gtkrc ());
|
||||
}
|
||||
|
||||
static gint
|
||||
save_dialog ()
|
||||
|
@ -742,15 +778,6 @@ save_dialog ()
|
|||
GtkWidget *frame;
|
||||
GtkWidget *table;
|
||||
GtkObject *scale_data;
|
||||
gchar **argv;
|
||||
gint argc;
|
||||
|
||||
argc = 1;
|
||||
argv = g_new (gchar *, 1);
|
||||
argv[0] = g_strdup ("save");
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
gtk_rc_parse(gimp_gtkrc());
|
||||
|
||||
dlg = gtk_dialog_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (dlg), _("Save as Xpm"));
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -357,7 +357,7 @@ run (char *name,
|
|||
Parasite *parasite;
|
||||
#endif /* GIMP_HAVE_PARASITES */
|
||||
int err;
|
||||
gboolean export = FALSE;
|
||||
GimpExportReturnType export = EXPORT_CANCEL;
|
||||
|
||||
run_mode = param[0].data.d_int32;
|
||||
|
||||
|
@ -399,10 +399,19 @@ run (char *name,
|
|||
init_gtk ();
|
||||
export = gimp_export_image (&image_ID, &drawable_ID, "JPEG",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY));
|
||||
if (export)
|
||||
switch (export)
|
||||
{
|
||||
case EXPORT_EXPORT:
|
||||
display_ID = gimp_display_new (image_ID);
|
||||
gimp_displays_flush ();
|
||||
break;
|
||||
case EXPORT_IGNORE:
|
||||
break;
|
||||
case EXPORT_CANCEL:
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -475,7 +484,7 @@ run (char *name,
|
|||
/* First acquire information with a dialog */
|
||||
err = save_dialog ();
|
||||
|
||||
if (!export)
|
||||
if (export != EXPORT_EXPORT)
|
||||
{
|
||||
/* thaw undo saving and end the undo_group. */
|
||||
gimp_image_thaw_undo (image_ID);
|
||||
|
@ -565,10 +574,10 @@ run (char *name,
|
|||
else
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
{
|
||||
/* if the image was exported, delete the new display */
|
||||
/* according to the documentation, this should also delete the image */
|
||||
/* If the image was exported, delete the new display. */
|
||||
/* This also deletes the image. */
|
||||
|
||||
if (display_ID > -1)
|
||||
gimp_display_delete (display_ID);
|
||||
|
|
|
@ -394,7 +394,7 @@ run(char *name, /* I - Name of print program. */
|
|||
#endif
|
||||
gint32 image_ID; /* image ID */
|
||||
gint32 drawable_ID; /* drawable ID */
|
||||
gboolean export; /* have we exported the image ? */
|
||||
GimpExportReturnType export = EXPORT_CANCEL; /* return value of gimp_export_image() */
|
||||
|
||||
INIT_I18N_UI();
|
||||
|
||||
|
@ -424,6 +424,12 @@ run(char *name, /* I - Name of print program. */
|
|||
export = gimp_export_image (&image_ID, &drawable_ID, "Print",
|
||||
(CAN_HANDLE_RGB | CAN_HANDLE_GRAY | CAN_HANDLE_INDEXED |
|
||||
CAN_HANDLE_ALPHA));
|
||||
if (export == EXPORT_CANCEL)
|
||||
{
|
||||
*nreturn_vals = 1;
|
||||
values[0].data.d_status = STATUS_EXECUTION_ERROR;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -643,7 +649,7 @@ run(char *name, /* I - Name of print program. */
|
|||
|
||||
gimp_drawable_detach(drawable);
|
||||
|
||||
if (export)
|
||||
if (export == EXPORT_EXPORT)
|
||||
gimp_image_delete (image_ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "siod.h"
|
||||
#include "script-fu-console.h"
|
||||
#include "script-fu-constants.h"
|
||||
#include "script-fu-scripts.h"
|
||||
#include "script-fu-server.h"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue