mirror of https://github.com/GNOME/gimp.git
app: support saving/exporting with multi-selection.
This commit just changes our saving API (i.e. the GimpSaveProcedure class) to take an array of drawables as argument instead of a single drawable. It actually doesn't matter much for exporting as the whole API seems more or less bogus there and all formats plug-ins mostly care only whether they will merge/flatten all visible layers (the selected ones don't really matter) or if the format supports layers of some sort. It may be worth later strengthening a bit this whole logics, and maybe allow partial exports for instance. As for saving, it was not even looking at the passed GimpDrawable either and was simply re-querying the active layer anyway. Note that I don't implement the multi-selection saving in XCF yet in this commit. I only updated the API. The reason is that the current commit won't be backportable to gimp-2-10 because it is an API break. On the other hand, the code to save multi-selection can still be backported even though the save() API will only pass a single drawable (as I said anyway, this argument was mostly bogus until now, hence it doesn't matter much for 2.10 logics).
This commit is contained in:
parent
795e18b9c9
commit
d3139e0f7c
|
@ -260,7 +260,7 @@ file_actions_update (GimpActionGroup *group,
|
|||
{
|
||||
Gimp *gimp = action_data_get_gimp (data);
|
||||
GimpImage *image = action_data_get_image (data);
|
||||
GimpDrawable *drawable = NULL;
|
||||
GList *drawables = NULL;
|
||||
GFile *file = NULL;
|
||||
GFile *source = NULL;
|
||||
GFile *export = NULL;
|
||||
|
@ -268,7 +268,7 @@ file_actions_update (GimpActionGroup *group,
|
|||
|
||||
if (image)
|
||||
{
|
||||
drawable = gimp_image_get_active_drawable (image);
|
||||
drawables = gimp_image_get_selected_drawables (image);
|
||||
|
||||
file = gimp_image_get_file (image);
|
||||
source = gimp_image_get_imported_file (image);
|
||||
|
@ -286,16 +286,16 @@ file_actions_update (GimpActionGroup *group,
|
|||
#define SET_SENSITIVE(action,condition) \
|
||||
gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
|
||||
|
||||
SET_SENSITIVE ("file-save", drawable);
|
||||
SET_SENSITIVE ("file-save-as", drawable);
|
||||
SET_SENSITIVE ("file-save-a-copy", drawable);
|
||||
SET_SENSITIVE ("file-save-and-close", drawable);
|
||||
SET_SENSITIVE ("file-save", drawables);
|
||||
SET_SENSITIVE ("file-save-as", drawables);
|
||||
SET_SENSITIVE ("file-save-a-copy", drawables);
|
||||
SET_SENSITIVE ("file-save-and-close", drawables);
|
||||
SET_SENSITIVE ("file-revert", file || source);
|
||||
SET_SENSITIVE ("file-export", drawable);
|
||||
SET_SENSITIVE ("file-export", drawables);
|
||||
SET_VISIBLE ("file-export", ! show_overwrite);
|
||||
SET_SENSITIVE ("file-overwrite", show_overwrite);
|
||||
SET_VISIBLE ("file-overwrite", show_overwrite);
|
||||
SET_SENSITIVE ("file-export-as", drawable);
|
||||
SET_SENSITIVE ("file-export-as", drawables);
|
||||
SET_SENSITIVE ("file-create-template", image);
|
||||
SET_SENSITIVE ("file-copy-location", file || source || export);
|
||||
SET_SENSITIVE ("file-show-in-file-manager", file || source || export);
|
||||
|
@ -336,6 +336,8 @@ file_actions_update (GimpActionGroup *group,
|
|||
SET_SENSITIVE ("file-close-all", image);
|
||||
|
||||
#undef SET_SENSITIVE
|
||||
|
||||
g_list_free (drawables);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -225,6 +225,7 @@ file_save_cmd_callback (GimpAction *action,
|
|||
Gimp *gimp;
|
||||
GimpDisplay *display;
|
||||
GimpImage *image;
|
||||
GList *drawables;
|
||||
GtkWidget *widget;
|
||||
GimpSaveMode save_mode;
|
||||
GFile *file = NULL;
|
||||
|
@ -237,8 +238,13 @@ file_save_cmd_callback (GimpAction *action,
|
|||
|
||||
save_mode = (GimpSaveMode) g_variant_get_int32 (value);
|
||||
|
||||
if (! gimp_image_get_active_drawable (image))
|
||||
return;
|
||||
drawables = gimp_image_get_selected_drawables (image);
|
||||
if (! drawables)
|
||||
{
|
||||
g_list_free (drawables);
|
||||
return;
|
||||
}
|
||||
g_list_free (drawables);
|
||||
|
||||
file = gimp_image_get_file (image);
|
||||
|
||||
|
|
|
@ -4491,10 +4491,11 @@ gimp_image_get_selected_drawables (GimpImage *image)
|
|||
*/
|
||||
if (selected_channels)
|
||||
{
|
||||
return selected_channels;
|
||||
return g_list_copy (selected_channels);
|
||||
}
|
||||
else if (selected_layers)
|
||||
{
|
||||
selected_layers = g_list_copy (selected_layers);
|
||||
if (g_list_length (selected_layers) == 1)
|
||||
{
|
||||
/* As a special case, if only one layer is selected and mask
|
||||
|
|
|
@ -131,10 +131,13 @@ file_gih_save_invoker (GimpProcedure *procedure,
|
|||
gimp_set_busy (gimp);
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 1));
|
||||
file = g_value_get_object (gimp_value_array_index (args, 3));
|
||||
spacing = g_value_get_int (gimp_value_array_index (args, 4));
|
||||
name = g_value_get_string (gimp_value_array_index (args, 5));
|
||||
params = g_value_get_string (gimp_value_array_index (args, 6));
|
||||
/* XXX: drawable list is currently unused. GIH saving just uses the
|
||||
* whole layer list.
|
||||
*/
|
||||
file = g_value_get_object (gimp_value_array_index (args, 4));
|
||||
spacing = g_value_get_int (gimp_value_array_index (args, 5));
|
||||
name = g_value_get_string (gimp_value_array_index (args, 6));
|
||||
params = g_value_get_string (gimp_value_array_index (args, 7));
|
||||
|
||||
pipe = file_gih_image_to_pipe (image, name, spacing, params);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "core/core-types.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
|
||||
#include "plug-in/gimppluginmanager.h"
|
||||
|
@ -285,12 +286,17 @@ file_data_init (Gimp *gimp)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_drawable ("drawable",
|
||||
"Drawable",
|
||||
"Active drawable "
|
||||
"of input image",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
g_param_spec_int ("num-drawables",
|
||||
"num drawables",
|
||||
"The number of drawables to save",
|
||||
1, G_MAXINT32, 1,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_object_array ("drawables",
|
||||
"drawables",
|
||||
"Drawables to save",
|
||||
GIMP_TYPE_DRAWABLE,
|
||||
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_object ("file",
|
||||
"File",
|
||||
|
|
|
@ -63,13 +63,15 @@ file_save (Gimp *gimp,
|
|||
gboolean export_forward,
|
||||
GError **error)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpValueArray *return_vals;
|
||||
GFile *orig_file;
|
||||
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
|
||||
GFile *local_file = NULL;
|
||||
gboolean mounted = TRUE;
|
||||
GError *my_error = NULL;
|
||||
GList *drawables_list;
|
||||
GimpDrawable **drawables = NULL;
|
||||
gint n_drawables;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_PDB_CALLING_ERROR);
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_PDB_CALLING_ERROR);
|
||||
|
@ -91,9 +93,21 @@ file_save (Gimp *gimp,
|
|||
|
||||
gimp_image_saving (image);
|
||||
|
||||
drawable = gimp_image_get_active_drawable (image);
|
||||
drawables_list = gimp_image_get_selected_drawables (image);
|
||||
|
||||
if (! drawable)
|
||||
if (drawables_list)
|
||||
{
|
||||
GList *iter;
|
||||
gint i;
|
||||
|
||||
n_drawables = g_list_length (drawables_list);
|
||||
drawables = g_new (GimpDrawable *, n_drawables);
|
||||
for (iter = drawables_list, i = 0; iter; iter = iter->next, i++)
|
||||
drawables[i] = iter->data;
|
||||
|
||||
g_list_free (drawables_list);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("There is no active layer to save"));
|
||||
|
@ -190,15 +204,16 @@ file_save (Gimp *gimp,
|
|||
gimp_get_user_context (gimp),
|
||||
progress, error,
|
||||
gimp_object_get_name (file_proc),
|
||||
GIMP_TYPE_RUN_MODE, run_mode,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_DRAWABLE, drawable,
|
||||
G_TYPE_FILE, file,
|
||||
GIMP_TYPE_RUN_MODE, run_mode,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
G_TYPE_INT, n_drawables,
|
||||
GIMP_TYPE_OBJECT_ARRAY, drawables,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_NONE);
|
||||
|
||||
status = g_value_get_enum (gimp_value_array_index (return_vals, 0));
|
||||
|
||||
gimp_value_array_unref (return_vals);
|
||||
g_clear_pointer (&drawables, g_free);
|
||||
|
||||
if (local_file)
|
||||
{
|
||||
|
|
|
@ -259,6 +259,8 @@ file_save_invoker (GimpProcedure *procedure,
|
|||
gimp_value_array_index (new_args, 2));
|
||||
g_value_transform (gimp_value_array_index (args, 3),
|
||||
gimp_value_array_index (new_args, 3));
|
||||
g_value_transform (gimp_value_array_index (args, 4),
|
||||
gimp_value_array_index (new_args, 4));
|
||||
|
||||
for (i = 4; i < proc->num_args; i++)
|
||||
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
|
@ -514,11 +516,17 @@ register_file_procs (GimpPDB *pdb)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_drawable ("drawable",
|
||||
"drawable",
|
||||
"Drawable to save",
|
||||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
g_param_spec_int ("num-drawables",
|
||||
"num drawables",
|
||||
"The number of drawables to save",
|
||||
1, G_MAXINT32, 1,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_object_array ("drawables",
|
||||
"drawables",
|
||||
"Drawables to save",
|
||||
GIMP_TYPE_ITEM,
|
||||
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_object ("file",
|
||||
"file",
|
||||
|
|
|
@ -357,18 +357,19 @@ gimp_plug_in_set_file_proc_save_handler (GimpPlugIn *plug_in,
|
|||
|
||||
procedure = GIMP_PROCEDURE (proc);
|
||||
|
||||
if ((procedure->num_args < 4) ||
|
||||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
|
||||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) ||
|
||||
! GIMP_IS_PARAM_SPEC_DRAWABLE (procedure->args[2]) ||
|
||||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[3]))
|
||||
if ((procedure->num_args < 5) ||
|
||||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
|
||||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) ||
|
||||
! G_IS_PARAM_SPEC_INT (procedure->args[2]) ||
|
||||
! GIMP_IS_PARAM_SPEC_OBJECT_ARRAY (procedure->args[3]) ||
|
||||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[4]))
|
||||
{
|
||||
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
|
||||
"Plug-in \"%s\"\n(%s)\n"
|
||||
"attempted to register procedure \"%s\" "
|
||||
"as save handler which does not take the standard "
|
||||
"save procedure arguments: "
|
||||
"(GimpRunMode, GimpImage, GimpDrawable, GFile)",
|
||||
"save procedure arguments:\n"
|
||||
"(GimpRunMode, GimpImage, int [array size], GimpDrawable Array, GFile)",
|
||||
gimp_object_get_name (plug_in),
|
||||
gimp_file_get_utf8_name (plug_in->file),
|
||||
proc_name);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpparamspecs.h"
|
||||
#include "core/gimpprogress.h"
|
||||
|
||||
|
@ -149,11 +150,17 @@ xcf_init (Gimp *gimp)
|
|||
FALSE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_drawable ("drawable",
|
||||
"Drawable",
|
||||
"Active drawable of input image",
|
||||
TRUE,
|
||||
GIMP_PARAM_READWRITE));
|
||||
g_param_spec_int ("n-drawables",
|
||||
"Num drawables",
|
||||
"Number of drawables",
|
||||
1, G_MAXINT, 1,
|
||||
GIMP_PARAM_READWRITE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
gimp_param_spec_object_array ("drawables",
|
||||
"Drawables",
|
||||
"Selected drawables",
|
||||
GIMP_TYPE_DRAWABLE,
|
||||
GIMP_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE));
|
||||
gimp_procedure_add_argument (procedure,
|
||||
g_param_spec_object ("file",
|
||||
"File",
|
||||
|
@ -461,7 +468,7 @@ xcf_save_invoker (GimpProcedure *procedure,
|
|||
gimp_set_busy (gimp);
|
||||
|
||||
image = g_value_get_object (gimp_value_array_index (args, 1));
|
||||
file = g_value_get_object (gimp_value_array_index (args, 3));
|
||||
file = g_value_get_object (gimp_value_array_index (args, 4));
|
||||
|
||||
output = G_OUTPUT_STREAM (g_file_replace (file,
|
||||
NULL, FALSE, G_FILE_CREATE_NONE,
|
||||
|
|
|
@ -51,8 +51,8 @@
|
|||
**/
|
||||
|
||||
|
||||
typedef void (* ExportFunc) (GimpImage *image,
|
||||
GimpDrawable **drawable);
|
||||
typedef void (* ExportFunc) (GimpImage *image,
|
||||
GList **drawables);
|
||||
|
||||
|
||||
/* the export action structure */
|
||||
|
@ -69,8 +69,8 @@ typedef struct
|
|||
/* the functions that do the actual export */
|
||||
|
||||
static void
|
||||
export_merge (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_merge (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
|
@ -96,7 +96,7 @@ export_merge (GimpImage *image,
|
|||
transp = gimp_layer_new (image, "-",
|
||||
gimp_image_width (image),
|
||||
gimp_image_height (image),
|
||||
gimp_drawable_type (*drawable) | 1,
|
||||
gimp_drawable_type ((*drawables)->data) | 1,
|
||||
100.0, GIMP_LAYER_MODE_NORMAL);
|
||||
gimp_image_insert_layer (image, transp, NULL, 1);
|
||||
gimp_selection_none (image);
|
||||
|
@ -110,14 +110,9 @@ export_merge (GimpImage *image,
|
|||
|
||||
merged = gimp_image_merge_visible_layers (image, GIMP_CLIP_TO_IMAGE);
|
||||
|
||||
if (merged != NULL)
|
||||
{
|
||||
*drawable = GIMP_DRAWABLE (merged);
|
||||
}
|
||||
else
|
||||
{
|
||||
return; /* shouldn't happen */
|
||||
}
|
||||
g_return_if_fail (merged != NULL);
|
||||
|
||||
*drawables = g_list_prepend (NULL, merged);
|
||||
|
||||
g_list_free (layers);
|
||||
|
||||
|
@ -142,7 +137,7 @@ export_merge (GimpImage *image,
|
|||
/* remove any remaining (invisible) layers */
|
||||
for (iter = layers; iter; iter = iter->next)
|
||||
{
|
||||
if (iter->data != *drawable)
|
||||
if (iter->data != (*drawables)->data)
|
||||
gimp_image_remove_layer (image, iter->data);
|
||||
}
|
||||
|
||||
|
@ -150,20 +145,20 @@ export_merge (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_flatten (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_flatten (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GimpLayer *flattened;
|
||||
|
||||
flattened = gimp_image_flatten (image);
|
||||
|
||||
if (flattened != NULL)
|
||||
*drawable = GIMP_DRAWABLE (flattened);
|
||||
*drawables = g_list_prepend (NULL, flattened);
|
||||
}
|
||||
|
||||
static void
|
||||
export_remove_alpha (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_remove_alpha (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
|
@ -180,8 +175,8 @@ export_remove_alpha (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_apply_masks (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_apply_masks (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
|
@ -210,29 +205,40 @@ export_apply_masks (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_convert_rgb (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_convert_rgb (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
gimp_image_convert_rgb (image);
|
||||
}
|
||||
|
||||
static void
|
||||
export_convert_grayscale (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_convert_grayscale (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
gimp_image_convert_grayscale (image);
|
||||
}
|
||||
|
||||
static void
|
||||
export_convert_indexed (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_convert_indexed (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GList *layers;
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
gboolean has_alpha = FALSE;
|
||||
|
||||
/* check alpha */
|
||||
layers = gimp_image_list_layers (image);
|
||||
|
||||
if (layers || gimp_drawable_has_alpha (*drawable))
|
||||
for (iter = *drawables; iter; iter = iter->next)
|
||||
{
|
||||
if (gimp_drawable_has_alpha (iter->data))
|
||||
{
|
||||
has_alpha = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (layers || has_alpha)
|
||||
gimp_image_convert_indexed (image,
|
||||
GIMP_CONVERT_DITHER_NONE,
|
||||
GIMP_CONVERT_PALETTE_GENERATE,
|
||||
|
@ -246,8 +252,8 @@ export_convert_indexed (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_convert_bitmap (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_convert_bitmap (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
if (gimp_image_base_type (image) == GIMP_INDEXED)
|
||||
gimp_image_convert_rgb (image);
|
||||
|
@ -259,8 +265,8 @@ export_convert_bitmap (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_add_alpha (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_add_alpha (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
|
@ -277,8 +283,8 @@ export_add_alpha (GimpImage *image,
|
|||
}
|
||||
|
||||
static void
|
||||
export_void (GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
export_void (GimpImage *image,
|
||||
GList **drawables)
|
||||
{
|
||||
/* do nothing */
|
||||
}
|
||||
|
@ -455,9 +461,9 @@ export_action_get_func (const ExportAction *action)
|
|||
static void
|
||||
export_action_perform (const ExportAction *action,
|
||||
GimpImage *image,
|
||||
GimpDrawable **drawable)
|
||||
GList **drawables)
|
||||
{
|
||||
export_action_get_func (action) (image, drawable);
|
||||
export_action_get_func (action) (image, drawables);
|
||||
}
|
||||
|
||||
|
||||
|
@ -718,7 +724,8 @@ export_dialog (GSList *actions,
|
|||
/**
|
||||
* gimp_export_image:
|
||||
* @image: Pointer to the image.
|
||||
* @drawable: Pointer to the drawable.
|
||||
* @n_drawables: Size of @drawables.
|
||||
* @drawables: Array of pointers to drawables.
|
||||
* @format_name: The (short) name of the image_format (e.g. JPEG or GIF).
|
||||
* @capabilities: What can the image_format do?
|
||||
*
|
||||
|
@ -729,13 +736,14 @@ export_dialog (GSList *actions,
|
|||
* to be exported and offers to do the necessary conversions.
|
||||
*
|
||||
* If the user chooses to export the image, a copy is created.
|
||||
* This copy is then converted, @image and @drawable_ID are changed to
|
||||
* This copy is then converted, @image and @drawables are changed to
|
||||
* point to the new image and the procedure returns GIMP_EXPORT_EXPORT.
|
||||
* The save_plugin has to take care of deleting the created image using
|
||||
* gimp_image_delete() when it has saved it.
|
||||
* gimp_image_delete() and the drawables list with g_free() once the
|
||||
* image has been saved.
|
||||
*
|
||||
* If the user chooses to Ignore the export problem, @image and
|
||||
* @drawable_ID are not altered, GIMP_EXPORT_IGNORE is returned and the
|
||||
* @drawables are not altered, GIMP_EXPORT_IGNORE is returned and the
|
||||
* save_plugin should try to save the original image. If the user
|
||||
* chooses Cancel, GIMP_EXPORT_CANCEL is returned and the save_plugin
|
||||
* should quit itself with status %GIMP_PDB_CANCEL.
|
||||
|
@ -747,23 +755,37 @@ export_dialog (GSList *actions,
|
|||
* Returns: An enum of #GimpExportReturn describing the user_action.
|
||||
**/
|
||||
GimpExportReturn
|
||||
gimp_export_image (GimpImage **image,
|
||||
GimpDrawable **drawable,
|
||||
const gchar *format_name,
|
||||
GimpExportCapabilities capabilities)
|
||||
gimp_export_image (GimpImage **image,
|
||||
gint *n_drawables,
|
||||
GimpDrawable ***drawables,
|
||||
const gchar *format_name,
|
||||
GimpExportCapabilities capabilities)
|
||||
{
|
||||
GSList *actions = NULL;
|
||||
GimpImageBaseType type;
|
||||
GList *layers;
|
||||
GList *iter;
|
||||
GType drawables_type = G_TYPE_NONE;
|
||||
gboolean interactive = FALSE;
|
||||
gboolean added_flatten = FALSE;
|
||||
gboolean has_layer_masks = FALSE;
|
||||
gboolean background_has_alpha = TRUE;
|
||||
GimpExportReturn retval = GIMP_EXPORT_CANCEL;
|
||||
gint i;
|
||||
|
||||
g_return_val_if_fail (gimp_image_is_valid (*image) &&
|
||||
gimp_item_is_valid (GIMP_ITEM (*drawable)), FALSE);
|
||||
g_return_val_if_fail (gimp_image_is_valid (*image) && drawables &&
|
||||
n_drawables && *n_drawables > 0, FALSE);
|
||||
|
||||
for (i = 0; i < *n_drawables; i++)
|
||||
{
|
||||
g_return_val_if_fail (gimp_item_is_valid (GIMP_ITEM ((*drawables)[i])), FALSE);
|
||||
|
||||
if (drawables_type == G_TYPE_NONE ||
|
||||
g_type_is_a (drawables_type, G_OBJECT_TYPE ((*drawables)[i])))
|
||||
drawables_type = G_OBJECT_TYPE ((*drawables)[i]);
|
||||
else
|
||||
g_return_val_if_fail (g_type_is_a (G_OBJECT_TYPE ((*drawables)[i]), drawables_type), FALSE);
|
||||
}
|
||||
|
||||
/* do some sanity checks */
|
||||
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
|
||||
|
@ -780,16 +802,16 @@ gimp_export_image (GimpImage **image,
|
|||
|
||||
/* ask for confirmation if the user is not saving a layer (see bug #51114) */
|
||||
if (interactive &&
|
||||
! gimp_item_is_layer (GIMP_ITEM (*drawable)) &&
|
||||
! g_type_is_a (drawables_type, GIMP_TYPE_LAYER) &&
|
||||
! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
|
||||
{
|
||||
if (gimp_item_is_layer_mask (GIMP_ITEM (*drawable)))
|
||||
if (g_type_is_a (drawables_type, GIMP_TYPE_LAYER_MASK))
|
||||
{
|
||||
retval = confirm_save_dialog
|
||||
(_("You are about to save a layer mask as %s.\n"
|
||||
"This will not save the visible layers."), format_name);
|
||||
}
|
||||
else if (gimp_item_is_channel (GIMP_ITEM (*drawable)))
|
||||
else if (g_type_is_a (drawables_type, GIMP_TYPE_CHANNEL))
|
||||
{
|
||||
retval = confirm_save_dialog
|
||||
(_("You are about to save a channel (saved selection) as %s.\n"
|
||||
|
@ -866,19 +888,20 @@ gimp_export_image (GimpImage **image,
|
|||
/* check if layer size != canvas size, opacity != 100%, or offsets != 0 */
|
||||
if (g_list_length (layers) == 1 &&
|
||||
! children &&
|
||||
gimp_item_is_layer (GIMP_ITEM (*drawable)) &&
|
||||
g_type_is_a (drawables_type, GIMP_TYPE_LAYER) &&
|
||||
! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
|
||||
{
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
GimpDrawable *drawable = (*drawables)[0];
|
||||
gint offset_x;
|
||||
gint offset_y;
|
||||
|
||||
gimp_drawable_offsets (*drawable, &offset_x, &offset_y);
|
||||
gimp_drawable_offsets (drawable, &offset_x, &offset_y);
|
||||
|
||||
if ((gimp_layer_get_opacity (GIMP_LAYER (*drawable)) < 100.0) ||
|
||||
if ((gimp_layer_get_opacity (GIMP_LAYER (drawable)) < 100.0) ||
|
||||
(gimp_image_width (*image) !=
|
||||
gimp_drawable_width (*drawable)) ||
|
||||
gimp_drawable_width (drawable)) ||
|
||||
(gimp_image_height (*image) !=
|
||||
gimp_drawable_height (*drawable)) ||
|
||||
gimp_drawable_height (drawable)) ||
|
||||
offset_x || offset_y)
|
||||
{
|
||||
if (capabilities & GIMP_EXPORT_CAN_HANDLE_ALPHA)
|
||||
|
@ -1026,16 +1049,33 @@ gimp_export_image (GimpImage **image,
|
|||
if (retval == GIMP_EXPORT_EXPORT)
|
||||
{
|
||||
GSList *list;
|
||||
GList *drawables_in;
|
||||
GList *drawables_out;
|
||||
gint i;
|
||||
|
||||
*image = gimp_image_duplicate (*image);
|
||||
*drawable = GIMP_DRAWABLE (gimp_image_get_active_layer (*image));
|
||||
drawables_in = gimp_image_list_selected_layers (*image);
|
||||
drawables_out = drawables_in;
|
||||
|
||||
gimp_image_undo_disable (*image);
|
||||
|
||||
for (list = actions; list; list = list->next)
|
||||
{
|
||||
export_action_perform (list->data, *image, drawable);
|
||||
export_action_perform (list->data, *image, &drawables_out);
|
||||
|
||||
if (drawables_in != drawables_out)
|
||||
{
|
||||
g_list_free (drawables_in);
|
||||
drawables_in = drawables_out;
|
||||
}
|
||||
}
|
||||
|
||||
*n_drawables = g_list_length (drawables_out);
|
||||
*drawables = g_new (GimpDrawable *, *n_drawables);
|
||||
for (iter = drawables_out, i = 0; iter; iter = iter->next, i++)
|
||||
(*drawables)[i] = iter->data;
|
||||
|
||||
g_list_free (drawables_out);
|
||||
}
|
||||
|
||||
g_slist_free (actions);
|
||||
|
|
|
@ -81,7 +81,8 @@ GtkWidget * gimp_export_dialog_new (const gchar *
|
|||
GtkWidget * gimp_export_dialog_get_content_area (GtkWidget *dialog);
|
||||
|
||||
GimpExportReturn gimp_export_image (GimpImage **image,
|
||||
GimpDrawable **drawable,
|
||||
gint *n_drawables,
|
||||
GimpDrawable ***drawables,
|
||||
const gchar *format_name,
|
||||
GimpExportCapabilities capabilities);
|
||||
|
||||
|
|
|
@ -176,7 +176,8 @@ gimp_file_load_layers (GimpRunMode run_mode,
|
|||
* gimp_file_save:
|
||||
* @run_mode: The run mode.
|
||||
* @image: Input image.
|
||||
* @drawable: Drawable to save.
|
||||
* @num_drawables: The number of drawables to save.
|
||||
* @drawables: (array length=num_drawables) (element-type GimpItem): Drawables to save.
|
||||
* @file: The file to save the image in.
|
||||
*
|
||||
* Saves a file by extension.
|
||||
|
@ -187,10 +188,11 @@ gimp_file_load_layers (GimpRunMode run_mode,
|
|||
* Returns: TRUE on success.
|
||||
**/
|
||||
gboolean
|
||||
gimp_file_save (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GFile *file)
|
||||
gimp_file_save (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
gint num_drawables,
|
||||
const GimpItem **drawables,
|
||||
GFile *file)
|
||||
{
|
||||
GimpValueArray *args;
|
||||
GimpValueArray *return_vals;
|
||||
|
@ -199,9 +201,11 @@ gimp_file_save (GimpRunMode run_mode,
|
|||
args = gimp_value_array_new_from_types (NULL,
|
||||
GIMP_TYPE_RUN_MODE, run_mode,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_DRAWABLE, drawable,
|
||||
G_TYPE_INT, num_drawables,
|
||||
GIMP_TYPE_OBJECT_ARRAY, NULL,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_NONE);
|
||||
gimp_value_set_object_array (gimp_value_array_index (args, 3), GIMP_TYPE_ITEM, (GObject **) drawables, num_drawables);
|
||||
|
||||
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
||||
"gimp-file-save",
|
||||
|
|
|
@ -32,21 +32,22 @@ G_BEGIN_DECLS
|
|||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
GimpImage* gimp_file_load (GimpRunMode run_mode,
|
||||
GFile *file);
|
||||
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file);
|
||||
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gint *num_layers);
|
||||
gboolean gimp_file_save (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GFile *file);
|
||||
gboolean gimp_file_save_thumbnail (GimpImage *image,
|
||||
GFile *file);
|
||||
GimpImage* gimp_file_load (GimpRunMode run_mode,
|
||||
GFile *file);
|
||||
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file);
|
||||
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GFile *file,
|
||||
gint *num_layers);
|
||||
gboolean gimp_file_save (GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
gint num_drawables,
|
||||
const GimpItem **drawables,
|
||||
GFile *file);
|
||||
gboolean gimp_file_save_thumbnail (GimpImage *image,
|
||||
GFile *file);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
|
@ -86,11 +86,17 @@ gimp_save_procedure_constructed (GObject *object)
|
|||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
GIMP_PROC_ARG_DRAWABLE (procedure, "drawable",
|
||||
"Drawable",
|
||||
"The drawable to save",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
GIMP_PROC_ARG_INT (procedure, "num-drawables",
|
||||
"Number of drawables",
|
||||
"Number of drawables to be saved",
|
||||
0, G_MAXINT, 1,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
GIMP_PROC_ARG_OBJECT_ARRAY (procedure, "drawables",
|
||||
"Drawables",
|
||||
"The drawables to save",
|
||||
GIMP_TYPE_DRAWABLE,
|
||||
G_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE);
|
||||
|
||||
GIMP_PROC_ARG_FILE (procedure, "file",
|
||||
"File",
|
||||
|
@ -147,14 +153,16 @@ gimp_save_procedure_run (GimpProcedure *procedure,
|
|||
GimpValueArray *return_values;
|
||||
GimpRunMode run_mode;
|
||||
GimpImage *image;
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable **drawables;
|
||||
GFile *file;
|
||||
gint n_drawables;
|
||||
gint i;
|
||||
|
||||
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
|
||||
image = GIMP_VALUES_GET_IMAGE (args, 1);
|
||||
drawable = GIMP_VALUES_GET_DRAWABLE (args, 2);
|
||||
file = GIMP_VALUES_GET_FILE (args, 3);
|
||||
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
|
||||
image = GIMP_VALUES_GET_IMAGE (args, 1);
|
||||
n_drawables = GIMP_VALUES_GET_INT (args, 2);
|
||||
drawables = GIMP_VALUES_GET_OBJECT_ARRAY (args, 3);
|
||||
file = GIMP_VALUES_GET_FILE (args, 4);
|
||||
|
||||
remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
|
||||
|
||||
|
@ -167,11 +175,12 @@ gimp_save_procedure_run (GimpProcedure *procedure,
|
|||
|
||||
return_values = save_proc->priv->run_func (procedure,
|
||||
run_mode,
|
||||
image, drawable,
|
||||
image,
|
||||
n_drawables,
|
||||
drawables,
|
||||
file,
|
||||
remaining,
|
||||
save_proc->priv->run_data);
|
||||
|
||||
gimp_value_array_unref (remaining);
|
||||
|
||||
return return_values;
|
||||
|
|
|
@ -34,7 +34,8 @@ G_BEGIN_DECLS
|
|||
* @procedure: the #GimpProcedure that runs.
|
||||
* @run_mode: the #GimpRunMode.
|
||||
* @image: the image to save.
|
||||
* @drawable: the drawable to save.
|
||||
* @n_drawables: the number of drawables to save.
|
||||
* @drawables: the drawables to save.
|
||||
* @file: the #GFile to save to.
|
||||
* @args: the @procedure's remaining arguments.
|
||||
* @run_data: (closure): the run_data given in gimp_save_procedure_new().
|
||||
|
@ -49,7 +50,8 @@ G_BEGIN_DECLS
|
|||
typedef GimpValueArray * (* GimpRunSaveFunc) (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
|
|
@ -231,8 +231,12 @@ HELP
|
|||
desc => 'The run mode' },
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'Input image' },
|
||||
{ name => 'drawable', type => 'drawable',
|
||||
desc => 'Drawable to save' },
|
||||
{ name => 'drawables', type => 'itemarray',
|
||||
desc => 'Drawables to save',
|
||||
no_validate => 1,
|
||||
array => { name => 'num_drawables',
|
||||
type => '1 <= int32',
|
||||
desc => "The number of drawables to save" } },
|
||||
{ name => 'file', type => 'file',
|
||||
desc => 'The file to save the image in' }
|
||||
);
|
||||
|
@ -276,6 +280,8 @@ HELP
|
|||
gimp_value_array_index (new_args, 2));
|
||||
g_value_transform (gimp_value_array_index (args, 3),
|
||||
gimp_value_array_index (new_args, 3));
|
||||
g_value_transform (gimp_value_array_index (args, 4),
|
||||
gimp_value_array_index (new_args, 4));
|
||||
|
||||
for (i = 4; i < proc->num_args; i++)
|
||||
if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
|
||||
|
|
|
@ -67,7 +67,8 @@ static GimpProcedure * ascii_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * ascii_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -159,7 +160,8 @@ static GimpValueArray *
|
|||
ascii_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -181,7 +183,7 @@ ascii_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "AA",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "AA",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -197,6 +199,16 @@ ascii_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("ASCII art does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -205,7 +217,7 @@ ascii_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_aa (file, drawable, G_OBJECT (config), &error))
|
||||
if (! save_aa (file, drawables[0], G_OBJECT (config), &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -215,7 +227,10 @@ ascii_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,8 @@ static GimpValueArray * cel_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * cel_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -269,7 +270,8 @@ static GimpValueArray *
|
|||
cel_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -287,7 +289,7 @@ cel_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "CEL",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "CEL",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -302,8 +304,17 @@ cel_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (save_image (file, image, drawable,
|
||||
&error))
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("CEL format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (save_image (file, image, drawables[0], &error))
|
||||
{
|
||||
if (data_length)
|
||||
{
|
||||
|
@ -316,7 +327,10 @@ cel_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -155,8 +155,9 @@ static GimpProcedure * compressor_create_procedure (GimpPlugIn *plug_
|
|||
|
||||
static GimpValueArray * compressor_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -174,7 +175,8 @@ static GimpImage * load_image (const CompressorEntry *compressor,
|
|||
static GimpPDBStatusType save_image (const CompressorEntry *compressor,
|
||||
GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
gint32 run_mode,
|
||||
GError **error);
|
||||
|
||||
|
@ -393,7 +395,8 @@ static GimpValueArray *
|
|||
compressor_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -408,8 +411,8 @@ compressor_save (GimpProcedure *procedure,
|
|||
gimp_plug_in_set_pdb_error_handler (gimp_procedure_get_plug_in (procedure),
|
||||
GIMP_PDB_ERROR_HANDLER_PLUGIN);
|
||||
|
||||
status = save_image (compressor, file, image, drawable, run_mode,
|
||||
&error);
|
||||
status = save_image (compressor, file, image, n_drawables, drawables,
|
||||
run_mode, &error);
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
@ -418,7 +421,8 @@ static GimpPDBStatusType
|
|||
save_image (const CompressorEntry *compressor,
|
||||
GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
gint32 run_mode,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -440,7 +444,8 @@ save_image (const CompressorEntry *compressor,
|
|||
|
||||
if (! (gimp_file_save (run_mode,
|
||||
image,
|
||||
drawable,
|
||||
n_drawables,
|
||||
(const GimpItem **) drawables,
|
||||
tmp_file) &&
|
||||
valid_file (tmp_file)))
|
||||
{
|
||||
|
|
|
@ -62,7 +62,8 @@ static GimpProcedure * csource_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * csource_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -196,7 +197,8 @@ static GimpValueArray *
|
|||
csource_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -219,16 +221,26 @@ csource_save (GimpProcedure *procedure,
|
|||
config = gimp_procedure_create_config (procedure);
|
||||
gimp_procedure_config_begin_export (config, image, run_mode, args, NULL);
|
||||
|
||||
g_object_set (config,
|
||||
"save-alpha", gimp_drawable_has_alpha (drawable),
|
||||
NULL);
|
||||
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "C Source",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "C Source",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA);
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("C source does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
g_object_set (config,
|
||||
"save-alpha", gimp_drawable_has_alpha (drawables[0]),
|
||||
NULL);
|
||||
|
||||
if (export == GIMP_EXPORT_CANCEL)
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CANCEL,
|
||||
|
@ -257,7 +269,7 @@ csource_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -268,7 +280,10 @@ csource_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,8 @@ static GimpValueArray * dicom_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * dicom_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -260,7 +261,8 @@ static GimpValueArray *
|
|||
dicom_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -277,7 +279,7 @@ dicom_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_INTERACTIVE:
|
||||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
export = gimp_export_image (&image, &drawable, "DICOM",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "DICOM",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY);
|
||||
|
||||
|
@ -291,9 +293,19 @@ dicom_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("Dicom format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable,
|
||||
if (! save_image (file, image, drawables[0],
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -301,7 +313,10 @@ dicom_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ static GimpProcedure * gbr_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * gbr_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -161,7 +162,8 @@ static GimpValueArray *
|
|||
gbr_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -204,7 +206,7 @@ gbr_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "GBR",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "GBR",
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -220,6 +222,16 @@ gbr_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("GBR format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -241,7 +253,7 @@ gbr_save (GimpProcedure *procedure,
|
|||
"file-gbr-save-internal",
|
||||
GIMP_TYPE_RUN_MODE, GIMP_RUN_NONINTERACTIVE,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_DRAWABLE, drawable,
|
||||
GIMP_TYPE_DRAWABLE, drawables[0],
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_INT, spacing,
|
||||
G_TYPE_STRING, description,
|
||||
|
@ -266,7 +278,10 @@ gbr_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -84,7 +84,8 @@ static GimpValueArray * goat_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * goat_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -258,12 +259,13 @@ goat_load (GimpProcedure *procedure,
|
|||
|
||||
static GimpValueArray *
|
||||
goat_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
{
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||
|
@ -278,7 +280,7 @@ goat_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "GEGL",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "GEGL",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -294,14 +296,27 @@ goat_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable,
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("GEGL export plug-in does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0],
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,8 @@ static GimpProcedure * gif_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * gif_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -239,7 +240,8 @@ static GimpValueArray *
|
|||
gif_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -308,7 +310,7 @@ gif_save (GimpProcedure *procedure,
|
|||
if (as_animation)
|
||||
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "GIF",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "GIF",
|
||||
capabilities);
|
||||
|
||||
if (export == GIMP_EXPORT_CANCEL)
|
||||
|
@ -327,7 +329,17 @@ gif_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable, orig_image, G_OBJECT (config),
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("GIF format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0], orig_image, G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -340,7 +352,10 @@ gif_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,8 @@ static GimpProcedure * gih_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * gih_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -265,7 +266,8 @@ static GimpValueArray *
|
|||
gih_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -287,7 +289,7 @@ gih_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "GIH",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "GIH",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||
|
@ -427,12 +429,13 @@ gih_save (GimpProcedure *procedure,
|
|||
gimp_pdb_run_procedure (gimp_get_pdb (),
|
||||
"file-gih-save-internal",
|
||||
GIMP_TYPE_RUN_MODE, GIMP_RUN_NONINTERACTIVE,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_DRAWABLE, drawable,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_INT, info.spacing,
|
||||
G_TYPE_STRING, info.description,
|
||||
G_TYPE_STRING, paramstring,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
G_TYPE_INT, n_drawables,
|
||||
GIMP_TYPE_OBJECT_ARRAY, drawables,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_INT, info.spacing,
|
||||
G_TYPE_STRING, info.description,
|
||||
G_TYPE_STRING, paramstring,
|
||||
G_TYPE_NONE);
|
||||
|
||||
if (GIMP_VALUES_GET_ENUM (save_retvals, 0) == GIMP_PDB_SUCCESS)
|
||||
|
@ -479,7 +482,10 @@ gih_save (GimpProcedure *procedure,
|
|||
|
||||
out:
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,8 @@ static GimpProcedure * header_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * header_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -138,7 +139,8 @@ static GimpValueArray *
|
|||
header_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -156,7 +158,7 @@ header_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "Header",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "Header",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
||||
|
@ -170,14 +172,27 @@ header_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable,
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("Header plug-in does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0],
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,8 @@ static GimpValueArray * heif_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * heif_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -245,7 +246,8 @@ static GimpValueArray *
|
|||
heif_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -268,7 +270,7 @@ heif_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "HEIF",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "HEIF",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA);
|
||||
|
||||
|
@ -282,6 +284,16 @@ heif_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("HEIF format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -290,7 +302,7 @@ heif_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -301,7 +313,10 @@ heif_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,8 @@ static GimpProcedure * html_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * html_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -252,7 +253,8 @@ static GimpValueArray *
|
|||
html_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -278,7 +280,17 @@ html_save (GimpProcedure *procedure,
|
|||
GIMP_PDB_CANCEL,
|
||||
NULL);
|
||||
|
||||
buffer = gimp_drawable_get_buffer (drawable);
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("HTML table plug-in does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
buffer = gimp_drawable_get_buffer (drawables[0]);
|
||||
|
||||
if (! save_image (file, buffer, G_OBJECT (config),
|
||||
&error))
|
||||
|
|
|
@ -160,7 +160,8 @@ static GimpProcedure * mng_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * mng_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -197,7 +198,8 @@ static gboolean respin_cmap (png_structp png_ptr,
|
|||
|
||||
static gboolean mng_save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error);
|
||||
static gboolean mng_save_dialog (GimpImage *image,
|
||||
|
@ -352,7 +354,8 @@ static GimpValueArray *
|
|||
mng_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -373,7 +376,7 @@ mng_save (GimpProcedure *procedure,
|
|||
{
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "MNG",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "MNG",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -394,8 +397,8 @@ mng_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! mng_save_image (file, image, drawable, G_OBJECT (config),
|
||||
&error))
|
||||
if (! mng_save_image (file, image, n_drawables, drawables,
|
||||
G_OBJECT (config), &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -405,7 +408,10 @@ mng_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
@ -770,7 +776,8 @@ mng_putchunk_trns_wrapper (mng_handle handle,
|
|||
static gboolean
|
||||
mng_save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error)
|
||||
{
|
||||
|
|
|
@ -57,7 +57,8 @@ static GimpProcedure * pat_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * pat_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -140,7 +141,8 @@ static GimpValueArray *
|
|||
pat_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -183,7 +185,7 @@ pat_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PAT",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PAT",
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -198,6 +200,16 @@ pat_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("PAT format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -215,11 +227,12 @@ pat_save (GimpProcedure *procedure,
|
|||
save_retvals =
|
||||
gimp_pdb_run_procedure (gimp_get_pdb (),
|
||||
"file-pat-save-internal",
|
||||
GIMP_TYPE_RUN_MODE, GIMP_RUN_NONINTERACTIVE,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
GIMP_TYPE_DRAWABLE, drawable,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_STRING, description,
|
||||
GIMP_TYPE_RUN_MODE, GIMP_RUN_NONINTERACTIVE,
|
||||
GIMP_TYPE_IMAGE, image,
|
||||
G_TYPE_INT, n_drawables,
|
||||
GIMP_TYPE_OBJECT_ARRAY, drawables,
|
||||
G_TYPE_FILE, file,
|
||||
G_TYPE_STRING, description,
|
||||
G_TYPE_NONE);
|
||||
|
||||
if (GIMP_VALUES_GET_ENUM (save_retvals, 0) != GIMP_PDB_SUCCESS)
|
||||
|
@ -239,7 +252,10 @@ pat_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -69,7 +69,8 @@ static GimpValueArray * pcx_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * pcx_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -255,7 +256,8 @@ static GimpValueArray *
|
|||
pcx_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -273,7 +275,7 @@ pcx_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PCX",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PCX",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -288,15 +290,28 @@ pcx_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("PCX format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file,
|
||||
image, drawable,
|
||||
image, drawables[0],
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -224,7 +224,8 @@ static GimpProcedure * pdf_create_procedure (GimpPlugIn *plug_in,
|
|||
static GimpValueArray * pdf_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -485,7 +486,8 @@ static GimpValueArray *
|
|||
pdf_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -763,24 +765,29 @@ pdf_save_image (GimpProcedure *procedure,
|
|||
|
||||
for (i = 0; i < multi_page.image_count; i++)
|
||||
{
|
||||
GimpImage *image = multi_page.images[i];
|
||||
GimpLayer **layers;
|
||||
gint32 n_layers;
|
||||
gdouble x_res, y_res;
|
||||
gdouble x_scale, y_scale;
|
||||
GimpDrawable *temp;
|
||||
gint j;
|
||||
GimpImage *image = multi_page.images[i];
|
||||
GimpLayer **layers;
|
||||
gint32 n_layers;
|
||||
gdouble x_res, y_res;
|
||||
gdouble x_scale, y_scale;
|
||||
GimpDrawable **temp;
|
||||
GimpDrawable **temp_out;
|
||||
gint temp_size = 1;
|
||||
gint j;
|
||||
|
||||
temp = gimp_image_get_active_drawable (image);
|
||||
if (! temp)
|
||||
if (! gimp_image_get_active_drawable (image))
|
||||
continue;
|
||||
|
||||
temp = g_new (GimpDrawable *, 1);
|
||||
temp[0] = gimp_image_get_active_drawable (image);
|
||||
temp_out = temp;
|
||||
|
||||
/* Save the state of the surface before any changes, so that
|
||||
* settings from one page won't affect all the others
|
||||
*/
|
||||
cairo_save (cr);
|
||||
|
||||
if (! (gimp_export_image (&image, &temp, NULL,
|
||||
if (! (gimp_export_image (&image, &temp_size, &temp, NULL,
|
||||
capabilities) == GIMP_EXPORT_EXPORT))
|
||||
{
|
||||
/* gimp_drawable_histogram() only works within the bounds of
|
||||
|
@ -792,6 +799,10 @@ pdf_save_image (GimpProcedure *procedure,
|
|||
image = gimp_image_duplicate (image);
|
||||
}
|
||||
|
||||
if (temp != temp_out)
|
||||
g_free (temp_out);
|
||||
g_free (temp);
|
||||
|
||||
gimp_selection_none (image);
|
||||
|
||||
gimp_image_get_resolution (image, &x_res, &y_res);
|
||||
|
|
|
@ -98,7 +98,8 @@ static GimpValueArray * pix_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * pix_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -244,7 +245,8 @@ static GimpValueArray *
|
|||
pix_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -262,7 +264,7 @@ pix_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PIX",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PIX",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -277,13 +279,26 @@ pix_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable, &error))
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("PIX format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0], &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -92,7 +92,8 @@ static GimpValueArray * png_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * png_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -397,7 +398,8 @@ static GimpValueArray *
|
|||
png_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -425,7 +427,7 @@ png_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PNG",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PNG",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -440,7 +442,20 @@ png_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
alpha = gimp_drawable_has_alpha (drawable);
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
/* PNG images have no layer concept. Export image should have a
|
||||
* single drawable selected.
|
||||
*/
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("PNG format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
alpha = gimp_drawable_has_alpha (drawables[0]);
|
||||
|
||||
/* If the image has no transparency, then there is usually no need
|
||||
* to save a bKGD chunk. For more information, see:
|
||||
|
@ -461,7 +476,7 @@ png_save (GimpProcedure *procedure,
|
|||
{
|
||||
gint bits_per_sample;
|
||||
|
||||
if (save_image (file, image, drawable, orig_image, G_OBJECT (config),
|
||||
if (save_image (file, image, drawables[0], orig_image, G_OBJECT (config),
|
||||
&bits_per_sample, &error))
|
||||
{
|
||||
if (metadata)
|
||||
|
@ -477,7 +492,10 @@ png_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -149,7 +149,8 @@ static GimpValueArray * pnm_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * pnm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -516,16 +517,18 @@ static GimpValueArray *
|
|||
pnm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
{
|
||||
GimpProcedureConfig *config;
|
||||
FileType file_type = GPOINTER_TO_INT (run_data);
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||
GError *error = NULL;
|
||||
FileType file_type = GPOINTER_TO_INT (run_data);
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpExportReturn export = GIMP_EXPORT_CANCEL;
|
||||
const gchar *format_name = NULL;
|
||||
GError *error = NULL;
|
||||
|
||||
INIT_I18N ();
|
||||
gegl_init (NULL, NULL);
|
||||
|
@ -542,30 +545,35 @@ pnm_save (GimpProcedure *procedure,
|
|||
switch (file_type)
|
||||
{
|
||||
case FILE_TYPE_PNM:
|
||||
export = gimp_export_image (&image, &drawable, "PNM",
|
||||
format_name = "PNM";
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PNM",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
break;
|
||||
|
||||
case FILE_TYPE_PBM:
|
||||
export = gimp_export_image (&image, &drawable, "PBM",
|
||||
format_name = "PBM";
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PBM",
|
||||
GIMP_EXPORT_CAN_HANDLE_BITMAP);
|
||||
break;
|
||||
|
||||
case FILE_TYPE_PGM:
|
||||
export = gimp_export_image (&image, &drawable, "PGM",
|
||||
format_name = "PGM";
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PGM",
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY);
|
||||
break;
|
||||
|
||||
case FILE_TYPE_PPM:
|
||||
export = gimp_export_image (&image, &drawable, "PPM",
|
||||
format_name = "PPM";
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PPM",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
break;
|
||||
|
||||
case FILE_TYPE_PFM:
|
||||
export = gimp_export_image (&image, &drawable, "PFM",
|
||||
format_name = "PFM";
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PFM",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY);
|
||||
break;
|
||||
|
@ -581,6 +589,17 @@ pnm_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("%s format does not support multiple layers."),
|
||||
format_name);
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (file_type != FILE_TYPE_PFM &&
|
||||
run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
|
@ -590,7 +609,7 @@ pnm_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, file_type, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], file_type, G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -601,7 +620,10 @@ pnm_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -169,7 +169,8 @@ static GimpValueArray * ps_load_thumb (GimpProcedure *procedure,
|
|||
static GimpValueArray * ps_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -714,7 +715,8 @@ static GimpValueArray *
|
|||
ps_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -737,7 +739,7 @@ ps_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable,
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables,
|
||||
psvals.eps ? "EPS" : "PostScript",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
|
@ -753,6 +755,16 @@ ps_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("PostScript plug-in does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
switch (run_mode)
|
||||
{
|
||||
case GIMP_RUN_INTERACTIVE:
|
||||
|
@ -793,7 +805,7 @@ ps_save (GimpProcedure *procedure,
|
|||
|
||||
check_save_vals ();
|
||||
|
||||
if (save_image (file, image, drawable, &error))
|
||||
if (save_image (file, image, drawables[0], &error))
|
||||
{
|
||||
gimp_set_data (gimp_procedure_get_name (procedure),
|
||||
&psvals, sizeof (PSSaveVals));
|
||||
|
@ -805,7 +817,10 @@ ps_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -552,7 +552,8 @@ static GimpValueArray * psp_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * psp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -561,7 +562,8 @@ static GimpImage * load_image (GFile *file,
|
|||
GError **error);
|
||||
static gboolean save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error);
|
||||
static gboolean save_dialog (GimpProcedure *procedure,
|
||||
|
@ -711,7 +713,8 @@ static GimpValueArray *
|
|||
psp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -733,7 +736,7 @@ psp_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PSP",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PSP",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -758,8 +761,8 @@ psp_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
&error))
|
||||
if (! save_image (file, image, n_drawables, drawables,
|
||||
G_OBJECT (config), &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -769,7 +772,10 @@ psp_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
@ -2098,11 +2104,12 @@ load_image (GFile *file,
|
|||
}
|
||||
|
||||
static gint
|
||||
save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GObject *config,
|
||||
GError **error)
|
||||
save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error)
|
||||
{
|
||||
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
|
||||
_("Exporting not implemented yet."));
|
||||
|
|
|
@ -145,7 +145,8 @@ static GimpValueArray * raw_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * raw_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -546,7 +547,8 @@ static GimpValueArray *
|
|||
raw_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -574,7 +576,7 @@ raw_save (GimpProcedure *procedure,
|
|||
NULL);
|
||||
}
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "RAW",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "RAW",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -585,6 +587,16 @@ raw_save (GimpProcedure *procedure,
|
|||
GIMP_PDB_CANCEL,
|
||||
NULL);
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("RAW export does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (image, procedure, G_OBJECT (config)))
|
||||
|
@ -593,7 +605,7 @@ raw_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -604,7 +616,10 @@ raw_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -118,7 +118,8 @@ static GimpValueArray * sunras_load (GimpProcedure *procedure
|
|||
static GimpValueArray * sunras_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -356,7 +357,8 @@ static GimpValueArray *
|
|||
sunras_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -378,7 +380,7 @@ sunras_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "SUNRAS",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "SUNRAS",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -393,6 +395,19 @@ sunras_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
/* PNG images have no layer concept. Export image should have a
|
||||
* single drawable selected.
|
||||
*/
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("SUNRAS format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -401,7 +416,7 @@ sunras_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -412,7 +427,10 @@ sunras_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -182,7 +182,8 @@ static GimpValueArray * tga_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * tga_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -345,7 +346,8 @@ static GimpValueArray *
|
|||
tga_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -367,7 +369,7 @@ tga_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "TGA",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "TGA",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -383,6 +385,16 @@ tga_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("TGA format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -391,7 +403,7 @@ tga_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -402,7 +414,10 @@ tga_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,8 @@ static GimpValueArray * xbm_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * xbm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -328,7 +329,8 @@ static GimpValueArray *
|
|||
xbm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -351,7 +353,7 @@ xbm_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "XBM",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "XBM",
|
||||
GIMP_EXPORT_CAN_HANDLE_BITMAP |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA);
|
||||
|
||||
|
@ -365,6 +367,16 @@ xbm_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("XBM format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE ||
|
||||
run_mode == GIMP_RUN_WITH_LAST_VALS)
|
||||
{
|
||||
|
@ -394,7 +406,7 @@ xbm_save (GimpProcedure *procedure,
|
|||
gimp_parasite_free (parasite);
|
||||
}
|
||||
|
||||
if (! save_dialog (drawable, procedure, G_OBJECT (config)))
|
||||
if (! save_dialog (drawables[0], procedure, G_OBJECT (config)))
|
||||
status = GIMP_PDB_CANCEL;
|
||||
}
|
||||
|
||||
|
@ -440,7 +452,7 @@ xbm_save (GimpProcedure *procedure,
|
|||
if (! save_image (file,
|
||||
prefix,
|
||||
FALSE,
|
||||
image, drawable,
|
||||
image, drawables[0],
|
||||
G_OBJECT (config),
|
||||
&error)
|
||||
|
||||
|
@ -450,7 +462,7 @@ xbm_save (GimpProcedure *procedure,
|
|||
! save_image (mask_file,
|
||||
mask_prefix,
|
||||
TRUE,
|
||||
image, drawable,
|
||||
image, drawables[0],
|
||||
G_OBJECT (config),
|
||||
&error)))
|
||||
{
|
||||
|
@ -469,7 +481,10 @@ xbm_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -180,7 +180,8 @@ static GimpValueArray * xmc_load_thumb (GimpProcedure *procedure,
|
|||
static GimpValueArray * xmc_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -200,7 +201,8 @@ static guint32 read32 (FILE *f,
|
|||
|
||||
static gboolean save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GimpImage *orig_image,
|
||||
GError **error);
|
||||
|
||||
|
@ -539,7 +541,8 @@ static GimpValueArray *
|
|||
xmc_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -576,7 +579,7 @@ xmc_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "XMC",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "XMC",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||
GIMP_EXPORT_CAN_HANDLE_LAYERS |
|
||||
|
@ -657,8 +660,8 @@ xmc_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (save_image (file, image, drawable, orig_image,
|
||||
&error))
|
||||
if (save_image (file, image, n_drawables, drawables,
|
||||
orig_image, &error))
|
||||
{
|
||||
gimp_set_data (SAVE_PROC, &xmcvals, sizeof (XmcSaveVals));
|
||||
}
|
||||
|
@ -668,7 +671,10 @@ xmc_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
g_free (hotspotRange);
|
||||
|
||||
|
@ -1501,11 +1507,12 @@ load_default_hotspot (GimpImage *image,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GimpImage *orig_image,
|
||||
GError **error)
|
||||
save_image (GFile *file,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GimpImage *orig_image,
|
||||
GError **error)
|
||||
{
|
||||
gchar *filename;
|
||||
FILE *fp; /* File pointer */
|
||||
|
|
|
@ -110,7 +110,8 @@ static GimpValueArray * xpm_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * xpm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -291,7 +292,8 @@ static GimpValueArray *
|
|||
xpm_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -313,7 +315,7 @@ xpm_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "XPM",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "XPM",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -329,16 +331,26 @@ xpm_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("XPM format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (gimp_drawable_has_alpha (drawable))
|
||||
if (gimp_drawable_has_alpha (drawables[0]))
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
status = GIMP_PDB_CANCEL;
|
||||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_image (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -349,7 +361,10 @@ xpm_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -167,7 +167,8 @@ static GimpValueArray * xwd_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * xwd_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -401,7 +402,8 @@ static GimpValueArray *
|
|||
xwd_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -419,7 +421,7 @@ xwd_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "XWD",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "XWD",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -434,13 +436,26 @@ xwd_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable, &error))
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("TGA format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0], &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -327,6 +327,7 @@ send_image (const gchar *filename,
|
|||
gint32 run_mode)
|
||||
{
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpItem **drawables;
|
||||
gchar *ext;
|
||||
GFile *tmpfile;
|
||||
gchar *tmpname;
|
||||
|
@ -352,14 +353,18 @@ send_image (const gchar *filename,
|
|||
tmpfile = gimp_temp_file (ext + 1);
|
||||
tmpname = g_file_get_path (tmpfile);
|
||||
|
||||
drawables = g_new (GimpItem *, 1);
|
||||
drawables[0] = (GimpItem *) drawable;
|
||||
if (! (gimp_file_save (run_mode,
|
||||
image,
|
||||
drawable,
|
||||
image, 1,
|
||||
(const GimpItem **) drawables,
|
||||
tmpfile) &&
|
||||
valid_file (tmpfile)))
|
||||
{
|
||||
g_free (drawables);
|
||||
goto error;
|
||||
}
|
||||
g_free (drawables);
|
||||
|
||||
#ifndef SENDMAIL /* xdg-email */
|
||||
/* From xdg-email doc:
|
||||
|
|
|
@ -97,7 +97,8 @@ static GimpValueArray * bmp_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * bmp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -245,7 +246,8 @@ static GimpValueArray *
|
|||
bmp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -267,7 +269,7 @@ bmp_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "BMP",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "BMP",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||
|
@ -283,7 +285,17 @@ bmp_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
status = save_image (file, image, drawable, run_mode,
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("BMP format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
status = save_image (file, image, drawables[0], run_mode,
|
||||
procedure, G_OBJECT (config),
|
||||
&error);
|
||||
|
||||
|
@ -291,7 +303,10 @@ bmp_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -78,7 +78,8 @@ static GimpValueArray * dds_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * dds_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -409,7 +410,8 @@ static GimpValueArray *
|
|||
dds_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -432,7 +434,7 @@ dds_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init ("dds");
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "DDS",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "DDS",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -462,12 +464,18 @@ dds_save (GimpProcedure *procedure,
|
|||
"gamma", 2.2,
|
||||
NULL);
|
||||
|
||||
status = write_dds (file, image, drawable,
|
||||
/* TODO: support multiple-layers selection, especially as DDS has
|
||||
* DDS_SAVE_SELECTED_LAYER option support.
|
||||
*/
|
||||
status = write_dds (file, image, drawables[0],
|
||||
run_mode == GIMP_RUN_INTERACTIVE,
|
||||
procedure, G_OBJECT (config));
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
gimp_procedure_config_end_run (config, status);
|
||||
g_object_unref (config);
|
||||
|
|
|
@ -86,7 +86,8 @@ static GimpValueArray * fits_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * fits_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -293,7 +294,8 @@ static GimpValueArray *
|
|||
fits_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -311,7 +313,7 @@ fits_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "FITS",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "FITS",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED);
|
||||
|
@ -326,14 +328,26 @@ fits_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawable,
|
||||
&error))
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("FITS format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_image (file, image, drawables[0], &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -102,7 +102,8 @@ static GimpValueArray * fli_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * fli_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -334,7 +335,8 @@ static GimpValueArray *
|
|||
fli_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -356,7 +358,7 @@ fli_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "FLI",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "FLI",
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_ALPHA |
|
||||
|
@ -391,7 +393,10 @@ fli_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -74,7 +74,8 @@ static GimpValueArray * ico_load_thumb (GimpProcedure *procedure,
|
|||
static GimpValueArray * ico_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -263,7 +264,8 @@ static GimpValueArray *
|
|||
ico_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
|
|
@ -71,7 +71,8 @@ static GimpValueArray * jpeg_load_thumb (GimpProcedure *procedure,
|
|||
static GimpValueArray * jpeg_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -381,7 +382,8 @@ static GimpValueArray *
|
|||
jpeg_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -408,7 +410,7 @@ jpeg_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "JPEG",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "JPEG",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY);
|
||||
|
||||
|
@ -445,6 +447,16 @@ jpeg_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("JPEG format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
/* Initialize with hardcoded defaults */
|
||||
load_defaults ();
|
||||
|
||||
|
@ -568,10 +580,10 @@ jpeg_save (GimpProcedure *procedure,
|
|||
/* prepare for the preview */
|
||||
preview_image = image;
|
||||
orig_image_global = orig_image;
|
||||
drawable_global = drawable;
|
||||
drawable_global = drawables[0];
|
||||
|
||||
/* First acquire information with a dialog */
|
||||
if (! save_dialog (drawable))
|
||||
if (! save_dialog (drawables[0]))
|
||||
{
|
||||
status = GIMP_PDB_CANCEL;
|
||||
}
|
||||
|
@ -588,7 +600,7 @@ jpeg_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, orig_image, FALSE,
|
||||
if (! save_image (file, image, drawables[0], orig_image, FALSE,
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -604,6 +616,8 @@ jpeg_save (GimpProcedure *procedure,
|
|||
gimp_display_delete (display);
|
||||
else
|
||||
gimp_image_delete (image);
|
||||
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
|
|
|
@ -69,7 +69,8 @@ static GimpValueArray * psd_load_thumb (GimpProcedure *procedure,
|
|||
static GimpValueArray * psd_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -335,7 +336,8 @@ static GimpValueArray *
|
|||
psd_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -355,7 +357,7 @@ psd_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "PSD",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "PSD",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -394,7 +396,10 @@ psd_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
if (metadata)
|
||||
g_object_unref (metadata);
|
||||
|
|
|
@ -77,7 +77,8 @@ static GimpValueArray * sgi_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * sgi_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -225,7 +226,8 @@ static GimpValueArray *
|
|||
sgi_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
|
@ -247,7 +249,7 @@ sgi_save (GimpProcedure *procedure,
|
|||
case GIMP_RUN_WITH_LAST_VALS:
|
||||
gimp_ui_init (PLUG_IN_BINARY);
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "SGI",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "SGI",
|
||||
GIMP_EXPORT_CAN_HANDLE_RGB |
|
||||
GIMP_EXPORT_CAN_HANDLE_GRAY |
|
||||
GIMP_EXPORT_CAN_HANDLE_INDEXED |
|
||||
|
@ -263,6 +265,16 @@ sgi_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("SGI format does not support multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (run_mode == GIMP_RUN_INTERACTIVE)
|
||||
{
|
||||
if (! save_dialog (procedure, G_OBJECT (config)))
|
||||
|
@ -271,8 +283,8 @@ sgi_save (GimpProcedure *procedure,
|
|||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
if (! save_image (file, image, drawable, G_OBJECT (config),
|
||||
&error))
|
||||
if (! save_image (file, image, drawables[0],
|
||||
G_OBJECT (config), &error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
}
|
||||
|
@ -282,7 +294,10 @@ sgi_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,8 @@ static GimpValueArray * tiff_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * tiff_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -287,12 +288,13 @@ tiff_load (GimpProcedure *procedure,
|
|||
|
||||
static GimpValueArray *
|
||||
tiff_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
{
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
GimpMetadata *metadata;
|
||||
|
@ -356,7 +358,7 @@ tiff_save (GimpProcedure *procedure,
|
|||
/* First acquire information with a dialog */
|
||||
if (! save_dialog (&tsvals,
|
||||
SAVE_PROC,
|
||||
gimp_drawable_has_alpha (drawable),
|
||||
n_drawables == 1 ? gimp_drawable_has_alpha (drawables[0]) : TRUE,
|
||||
image_is_monochrome (image),
|
||||
gimp_image_base_type (image) == GIMP_INDEXED,
|
||||
image_is_multi_layer (image),
|
||||
|
@ -423,7 +425,7 @@ tiff_save (GimpProcedure *procedure,
|
|||
if (tsvals.save_layers && image_is_multi_layer (image))
|
||||
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "TIFF", capabilities);
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "TIFF", capabilities);
|
||||
|
||||
if (export == GIMP_EXPORT_CANCEL)
|
||||
return gimp_procedure_new_return_values (procedure, GIMP_PDB_CANCEL,
|
||||
|
@ -434,6 +436,16 @@ tiff_save (GimpProcedure *procedure,
|
|||
break;
|
||||
}
|
||||
|
||||
if (n_drawables != 1 && tsvals.save_layers)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("\"Save layers\" option not set while trying to export multiple layers."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (status == GIMP_PDB_SUCCESS)
|
||||
{
|
||||
gint saved_bpp;
|
||||
|
@ -451,7 +463,10 @@ tiff_save (GimpProcedure *procedure,
|
|||
}
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
if (metadata)
|
||||
g_object_unref (metadata);
|
||||
|
|
|
@ -502,7 +502,8 @@ combine_buffers (GeglBuffer *layer_buffer,
|
|||
gboolean
|
||||
save_animation (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error)
|
||||
{
|
||||
|
@ -536,6 +537,8 @@ save_animation (GFile *file,
|
|||
gint default_delay;
|
||||
gboolean force_delay;
|
||||
|
||||
g_return_val_if_fail (n_drawables > 0, FALSE);
|
||||
|
||||
g_object_get (config,
|
||||
"preset", &preset,
|
||||
"lossless", &lossless,
|
||||
|
@ -575,7 +578,7 @@ save_animation (GFile *file,
|
|||
}
|
||||
|
||||
if (! space)
|
||||
space = gimp_drawable_get_format (drawable);
|
||||
space = gimp_drawable_get_format (drawables[0]);
|
||||
|
||||
gimp_image_undo_freeze (image);
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@ gboolean save_layer (GFile *file,
|
|||
|
||||
gboolean save_animation (GFile *file,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GObject *config,
|
||||
GError **error);
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ static GimpValueArray * webp_load (GimpProcedure *procedure,
|
|||
static GimpValueArray * webp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data);
|
||||
|
@ -281,12 +282,13 @@ webp_load (GimpProcedure *procedure,
|
|||
|
||||
static GimpValueArray *
|
||||
webp_save (GimpProcedure *procedure,
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
GimpDrawable *drawable,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
GimpRunMode run_mode,
|
||||
GimpImage *image,
|
||||
gint n_drawables,
|
||||
GimpDrawable **drawables,
|
||||
GFile *file,
|
||||
const GimpValueArray *args,
|
||||
gpointer run_data)
|
||||
{
|
||||
GimpProcedureConfig *config;
|
||||
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
|
||||
|
@ -329,7 +331,7 @@ webp_save (GimpProcedure *procedure,
|
|||
if (animation)
|
||||
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION;
|
||||
|
||||
export = gimp_export_image (&image, &drawable, "WebP",
|
||||
export = gimp_export_image (&image, &n_drawables, &drawables, "WebP",
|
||||
capabilities);
|
||||
|
||||
if (export == GIMP_EXPORT_CANCEL)
|
||||
|
@ -340,7 +342,7 @@ webp_save (GimpProcedure *procedure,
|
|||
|
||||
if (animation)
|
||||
{
|
||||
if (! save_animation (file, image, drawable, G_OBJECT (config),
|
||||
if (! save_animation (file, image, n_drawables, drawables, G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -348,7 +350,17 @@ webp_save (GimpProcedure *procedure,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (! save_layer (file, image, drawable, G_OBJECT (config),
|
||||
if (n_drawables != 1)
|
||||
{
|
||||
g_set_error (&error, G_FILE_ERROR, 0,
|
||||
_("The WebP plug-in cannot export multiple layer, except in animation mode."));
|
||||
|
||||
return gimp_procedure_new_return_values (procedure,
|
||||
GIMP_PDB_CALLING_ERROR,
|
||||
error);
|
||||
}
|
||||
|
||||
if (! save_layer (file, image, drawables[0], G_OBJECT (config),
|
||||
&error))
|
||||
{
|
||||
status = GIMP_PDB_EXECUTION_ERROR;
|
||||
|
@ -374,7 +386,10 @@ webp_save (GimpProcedure *procedure,
|
|||
g_object_unref (config);
|
||||
|
||||
if (export == GIMP_EXPORT_EXPORT)
|
||||
gimp_image_delete (image);
|
||||
{
|
||||
gimp_image_delete (image);
|
||||
g_free (drawables);
|
||||
}
|
||||
|
||||
return gimp_procedure_new_return_values (procedure, status, error);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue