plug-ins: Remove n_drawables parameter

Port all plug-ins to retrieve the layers
directly from the image rather than
having them passed in. This resolves some
issues with introspection and sets the
foundation for future API work.
This commit is contained in:
Alx Sa 2024-04-30 13:50:24 +00:00
parent bb3c28689a
commit 443947c6aa
56 changed files with 346 additions and 885 deletions

View File

@ -70,8 +70,6 @@ file_save (Gimp *gimp,
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);
@ -95,19 +93,7 @@ file_save (Gimp *gimp,
drawables_list = gimp_image_get_selected_drawables (image);
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
if (! drawables_list)
{
g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
_("There is no active layer to save"));
@ -206,14 +192,11 @@ file_save (Gimp *gimp,
gimp_object_get_name (file_proc),
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)
{

View File

@ -390,19 +390,17 @@ gimp_plug_in_set_file_proc_save_handler (GimpPlugIn *plug_in,
procedure = GIMP_PROCEDURE (proc);
if ((procedure->num_args < 5) ||
if ((procedure->num_args < 3) ||
! 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]))
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2]))
{
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:\n"
"(GimpRunMode, GimpImage, int [array size], GimpDrawable Array, GFile)",
"(GimpRunMode, GimpImage, GFile)",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);

View File

@ -43,8 +43,6 @@ drawables = image.list_selected_drawables()
# Needed otherwise it doesn't save the proper size because of bug #8855.
drawables[0].resize_to_image_size()
config.set_property("image", image)
config.set_property("num-drawables", len(drawables))
config.set_property("drawables", Gimp.ObjectArray.new(Gimp.Drawable, drawables, False))
config.set_property("file", Gio.file_new_for_path(output_path))
Gimp.Procedure.run(procedure, config)

View File

@ -14,8 +14,6 @@ procedure = Gimp.get_pdb().lookup_procedure("gimp-xcf-save")
config = procedure.create_config()
drawables = image.list_selected_drawables()
config.set_property("image", image)
config.set_property("num-drawables", len(drawables))
config.set_property("drawables", Gimp.ObjectArray.new(Gimp.Drawable, drawables, False))
config.set_property("file", Gio.file_new_for_path(output_path))
Gimp.Procedure.run(procedure, config)

View File

@ -23,7 +23,5 @@ drawables = image.list_selected_drawables()
# Needed otherwise it doesn't save the proper size because of bug #8855.
drawables[0].resize_to_image_size()
config.set_property("image", image)
config.set_property("num-drawables", len(drawables))
config.set_property("drawables", Gimp.ObjectArray.new(Gimp.Drawable, drawables, False))
config.set_property("file", Gio.file_new_for_path(output_path))
Gimp.Procedure.run(procedure, config)

View File

@ -555,8 +555,6 @@ export_action_perform (const ExportAction *action,
* gimp_export_image:
* @image: Pointer to the image.
* @n_drawables: Size of @drawables.
* @drawables: (array length=n_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?
*
* Takes an image and a drawable to be saved together with a
@ -566,11 +564,10 @@ export_action_perform (const ExportAction *action,
* 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 @drawables are changed to
* point to the new image and the procedure returns GIMP_EXPORT_EXPORT.
* This copy is then converted, @image is 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() and the drawables list with g_free() once the
* image has been saved.
* gimp_image_delete() once the image has been saved.
*
* If the user chooses to Ignore the export problem, @image and
* @drawables are not altered, GIMP_EXPORT_IGNORE is returned and the
@ -584,35 +581,20 @@ export_action_perform (const ExportAction *action,
**/
GimpExportReturn
gimp_export_image (GimpImage **image,
gint *n_drawables,
GimpDrawable ***drawables,
const gchar *format_name,
GimpExportCapabilities capabilities)
{
GSList *actions = NULL;
GimpImageBaseType type;
GList *layers;
gint n_layers;
GList *iter;
GType drawables_type = G_TYPE_NONE;
gboolean added_flatten = FALSE;
gboolean has_layer_masks = FALSE;
gboolean background_has_alpha = TRUE;
GimpExportReturn retval = GIMP_EXPORT_IGNORE;
gint i;
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);
}
g_return_val_if_fail (gimp_image_is_valid (*image), FALSE);
/* do some sanity checks */
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
@ -630,6 +612,13 @@ gimp_export_image (GimpImage **image,
/* check alpha and layer masks */
layers = gimp_image_list_layers (*image);
n_layers = g_list_length (layers);
if (n_layers < 1)
{
g_list_free (layers);
return FALSE;
}
for (iter = layers; iter; iter = iter->next)
{
@ -724,10 +713,9 @@ gimp_export_image (GimpImage **image,
/* check if layer size != canvas size, opacity != 100%, or offsets != 0 */
if (g_list_length (layers) == 1 &&
! children &&
g_type_is_a (drawables_type, GIMP_TYPE_LAYER) &&
! (capabilities & GIMP_EXPORT_CAN_HANDLE_LAYERS))
{
GimpDrawable *drawable = (*drawables)[0];
GimpDrawable *drawable = layers->data;
gint offset_x;
gint offset_y;
@ -884,7 +872,6 @@ gimp_export_image (GimpImage **image,
GSList *list;
GList *drawables_in;
GList *drawables_out;
gint i;
*image = gimp_image_duplicate (*image);
drawables_in = gimp_image_list_selected_layers (*image);
@ -903,11 +890,6 @@ gimp_export_image (GimpImage **image,
}
}
*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);
}

View File

@ -83,8 +83,6 @@ GtkWidget * gimp_export_dialog_new (const gchar *
GtkWidget * gimp_export_dialog_get_content_area (GtkWidget *dialog);
GimpExportReturn gimp_export_image (GimpImage **image,
gint *n_drawables,
GimpDrawable ***drawables,
const gchar *format_name,
GimpExportCapabilities capabilities);

View File

@ -220,18 +220,6 @@ gimp_export_procedure_constructed (GObject *object)
FALSE,
G_PARAM_READWRITE);
GIMP_PROC_ARG_INT (procedure, "num-drawables",
"Number of drawables",
"Number of drawables to be exported",
0, G_MAXINT, 1,
G_PARAM_READWRITE);
GIMP_PROC_ARG_OBJECT_ARRAY (procedure, "drawables",
"Drawables",
"The drawables to export",
GIMP_TYPE_DRAWABLE,
G_PARAM_READWRITE | GIMP_PARAM_NO_VALIDATE);
GIMP_PROC_ARG_FILE (procedure, "file",
"File",
"The file to export to",
@ -347,7 +335,7 @@ gimp_export_procedure_install (GimpProcedure *procedure)
priority);
}
#define ARG_OFFSET 5
#define ARG_OFFSET 3
static GimpValueArray *
gimp_export_procedure_run (GimpProcedure *procedure,
@ -360,18 +348,14 @@ gimp_export_procedure_run (GimpProcedure *procedure,
GimpProcedureConfig *config;
GimpRunMode run_mode;
GimpImage *image;
GimpDrawable **drawables;
GFile *file;
gint n_drawables;
GimpMetadata *metadata;
gchar *mimetype = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
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);
file = GIMP_VALUES_GET_FILE (args, 2);
remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
@ -415,8 +399,7 @@ gimp_export_procedure_run (GimpProcedure *procedure,
metadata = _gimp_procedure_config_begin_export (config, image, run_mode, remaining, mimetype);
g_free (mimetype);
return_values = export_proc->priv->run_func (procedure, run_mode,
image, n_drawables, drawables,
return_values = export_proc->priv->run_func (procedure, run_mode, image,
file, metadata, config,
export_proc->priv->run_data);

View File

@ -34,8 +34,6 @@ G_BEGIN_DECLS
* @procedure: the #GimpProcedure that runs.
* @run_mode: the #GimpRunMode.
* @image: the image to export.
* @n_drawables: the number of drawables to export.
* @drawables: (array length=n_drawables): the drawables to export.
* @file: the #GFile to export to.
* @metadata: metadata object prepared for the mimetype passed in
* gimp_file_procedure_set_mime_types() if export_metadata
@ -58,8 +56,6 @@ G_BEGIN_DECLS
typedef GimpValueArray * (* GimpRunExportFunc) (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,

View File

@ -67,8 +67,6 @@ static GimpProcedure * ascii_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -166,8 +164,6 @@ static GimpValueArray *
ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -175,6 +171,7 @@ ascii_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -185,7 +182,7 @@ ascii_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "AA",
export = gimp_export_image (&image, "AA",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -195,16 +192,7 @@ ascii_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -214,18 +202,16 @@ ascii_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_aa (file, drawables[0], G_OBJECT (config), &error))
if (! export_aa (file, drawables->data, G_OBJECT (config), &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -70,8 +70,6 @@ static GimpValueArray * cel_load (GimpProcedure *procedure,
static GimpValueArray * cel_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -277,8 +275,6 @@ static GimpValueArray *
cel_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -286,6 +282,7 @@ cel_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -296,7 +293,7 @@ cel_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "CEL",
export = gimp_export_image (&image, "CEL",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -305,26 +302,15 @@ cel_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
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 (! export_image (file, image, drawables[0], &error))
if (! export_image (file, image, drawables->data, &error))
status = GIMP_PDB_EXECUTION_ERROR;
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -156,8 +156,6 @@ static GimpProcedure * compressor_create_procedure (GimpPlugIn *plug
static GimpValueArray * compressor_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -179,7 +177,7 @@ static GimpPDBStatusType export_image (const CompressorEntry *comp
GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
gint32 run_mode,
GError **error);
@ -402,8 +400,6 @@ static GimpValueArray *
compressor_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -411,6 +407,8 @@ compressor_export (GimpProcedure *procedure,
{
const CompressorEntry *compressor = run_data;
GimpPDBStatusType status;
GList *drawables = gimp_image_list_layers (image);
gint n_drawables = g_list_length (drawables);
GError *error = NULL;
/* We handle PDB errors by forwarding them to the caller in
@ -422,6 +420,7 @@ compressor_export (GimpProcedure *procedure,
status = export_image (compressor, file, image, n_drawables, drawables,
run_mode, &error);
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -430,7 +429,7 @@ export_image (const CompressorEntry *compressor,
GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
gint32 run_mode,
GError **error)
{

View File

@ -62,8 +62,6 @@ static GimpProcedure * csource_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * csource_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -206,8 +204,6 @@ static GimpValueArray *
csource_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -215,6 +211,7 @@ csource_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gchar *prefixed_name;
gchar *comment;
GError *error = NULL;
@ -228,22 +225,13 @@ csource_export (GimpProcedure *procedure,
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "C Source",
export = gimp_export_image (&image, "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);
}
drawables = gimp_image_list_layers (image);
g_object_set (config,
"save-alpha", gimp_drawable_has_alpha (drawables[0]),
"save-alpha", gimp_drawable_has_alpha (drawables->data),
NULL);
if (! save_dialog (image, procedure, G_OBJECT (config)))
@ -269,7 +257,7 @@ csource_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -277,11 +265,9 @@ csource_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -95,8 +95,6 @@ static GimpValueArray * dicom_load (GimpProcedure *procedure
static GimpValueArray * dicom_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -269,8 +267,6 @@ static GimpValueArray *
dicom_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -278,6 +274,7 @@ dicom_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -287,7 +284,7 @@ dicom_export (GimpProcedure *procedure,
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "DICOM",
export = gimp_export_image (&image, "DICOM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
break;
@ -295,20 +292,11 @@ dicom_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0],
if (! export_image (file, image, drawables->data,
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -316,11 +304,9 @@ dicom_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -73,8 +73,6 @@ static GimpValueArray * farbfeld_load (GimpProcedure *proced
static GimpValueArray * farbfeld_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -216,8 +214,6 @@ static GimpValueArray *
farbfeld_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -225,6 +221,7 @@ farbfeld_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -235,7 +232,7 @@ farbfeld_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "farbfeld",
export = gimp_export_image (&image, "farbfeld",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -245,26 +242,15 @@ farbfeld_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
if (n_drawables != 1)
{
g_set_error (&error, G_FILE_ERROR, 0,
_("Farbfeld format does not support multiple layers."));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
if (! export_image (file, image, drawables[0], &error))
if (! export_image (file, image, drawables->data, &error))
status = GIMP_PDB_EXECUTION_ERROR;
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -70,8 +70,6 @@ static GimpProcedure * gbr_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * gbr_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -168,8 +166,6 @@ static GimpValueArray *
gbr_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -177,6 +173,8 @@ gbr_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
gchar *description;
GError *error = NULL;
@ -207,7 +205,7 @@ gbr_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "GBR",
export = gimp_export_image (&image, "GBR",
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -217,6 +215,8 @@ gbr_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -266,11 +266,9 @@ gbr_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -88,8 +88,6 @@ static GimpValueArray * goat_load (GimpProcedure *procedure,
static GimpValueArray * goat_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -275,8 +273,6 @@ static GimpValueArray *
goat_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -285,6 +281,7 @@ goat_export (GimpProcedure *procedure,
const FileFormat *format = run_data;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -295,7 +292,7 @@ goat_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "GEGL",
export = gimp_export_image (&image, "GEGL",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -305,29 +302,18 @@ goat_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
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 (! export_image (file, format->export_op, image, drawables[0],
if (! export_image (file, format->export_op, image, drawables->data,
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -78,8 +78,6 @@ static GimpProcedure * gif_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * gif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -258,8 +256,6 @@ static GimpValueArray *
gif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -333,6 +329,8 @@ gif_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
GList *drawables;
/* Create an exportable image based on the export options */
switch (run_mode)
{
@ -353,39 +351,28 @@ gif_export (GimpProcedure *procedure,
if (as_animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
export = gimp_export_image (&image, &n_drawables, &drawables, "GIF",
capabilities);
export = gimp_export_image (&image, "GIF", capabilities);
break;
}
default:
break;
}
drawables = gimp_image_list_layers (image);
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 (! export_image (file, image, drawables[0], orig_image, G_OBJECT (config),
&error))
if (! export_image (file, image, drawables->data, orig_image,
G_OBJECT (config), &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
gimp_image_delete (sanitized_image);
g_list_free (drawables);
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -86,8 +86,6 @@ static GimpProcedure * gih_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * gih_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -249,8 +247,6 @@ static GimpValueArray *
gih_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -258,6 +254,8 @@ gih_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables = NULL;
gint n_drawables;
GimpParasite *parasite;
GimpImage *orig_image;
GError *error = NULL;
@ -281,7 +279,7 @@ gih_export (GimpProcedure *procedure,
gimp_pixpipe_params_init (&gihparams);
export = gimp_export_image (&image, &n_drawables, &drawables, "GIH",
export = gimp_export_image (&image, "GIH",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
@ -386,6 +384,8 @@ gih_export (GimpProcedure *procedure,
goto out;
}
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
g_object_get (config,
"spacing", &spacing,
@ -465,11 +465,9 @@ gih_export (GimpProcedure *procedure,
out:
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -56,8 +56,6 @@ static GimpProcedure * header_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * header_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -142,8 +140,6 @@ static GimpValueArray *
header_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -151,6 +147,7 @@ header_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -161,7 +158,7 @@ header_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "Header",
export = gimp_export_image (&image, "Header",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
break;
@ -169,29 +166,18 @@ header_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
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 (! export_image (file, image, drawables[0],
if (! export_image (file, image, drawables->data,
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -84,8 +84,6 @@ static GimpValueArray * heif_load (GimpProcedure *pro
static GimpValueArray * heif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -94,8 +92,6 @@ static GimpValueArray * heif_export (GimpProcedure *pro
static GimpValueArray * heif_av1_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -489,8 +485,6 @@ static GimpValueArray *
heif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata_unused,
GimpProcedureConfig *config,
@ -498,6 +492,7 @@ heif_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GimpMetadata *metadata;
GError *error = NULL;
@ -509,7 +504,7 @@ heif_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "HEIF",
export = gimp_export_image (&image, "HEIF",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
break;
@ -517,16 +512,7 @@ heif_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -542,7 +528,7 @@ heif_export (GimpProcedure *procedure,
heif_init (NULL);
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error, heif_compression_HEVC, metadata))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -562,6 +548,7 @@ heif_export (GimpProcedure *procedure,
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -569,8 +556,6 @@ static GimpValueArray *
heif_av1_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata_unused,
GimpProcedureConfig *config,
@ -578,6 +563,8 @@ heif_av1_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GimpMetadata *metadata;
GError *error = NULL;
@ -589,7 +576,7 @@ heif_av1_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "AVIF",
export = gimp_export_image (&image, "AVIF",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
break;
@ -597,16 +584,7 @@ heif_av1_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -622,7 +600,7 @@ heif_av1_export (GimpProcedure *procedure,
heif_init (NULL);
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error, heif_compression_AV1, metadata))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -637,11 +615,9 @@ heif_av1_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -87,8 +87,6 @@ static GimpProcedure * html_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * html_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -258,14 +256,13 @@ static GimpValueArray *
html_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GList *drawables = gimp_image_list_layers (image);
GeglBuffer *buffer;
GError *error = NULL;
@ -281,17 +278,7 @@ html_export (GimpProcedure *procedure,
GIMP_PDB_CANCEL,
NULL);
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]);
buffer = gimp_drawable_get_buffer (drawables->data);
if (! export_image (file, buffer, G_OBJECT (config),
&error))
@ -301,6 +288,7 @@ html_export (GimpProcedure *procedure,
g_object_unref (buffer);
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -69,8 +69,6 @@ static GimpValueArray *jpegxl_load (GimpProcedure *procedur
static GimpValueArray *jpegxl_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -2107,8 +2105,6 @@ static GimpValueArray *
jpegxl_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -2116,6 +2112,7 @@ jpegxl_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -2126,7 +2123,7 @@ jpegxl_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "JPEG XL",
export = gimp_export_image (&image, "JPEG XL",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
@ -2135,16 +2132,7 @@ jpegxl_export (GimpProcedure *procedure,
default:
break;
}
if (n_drawables < 1)
{
g_set_error (&error, G_FILE_ERROR, 0,
"No drawables to export");
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -2160,7 +2148,7 @@ jpegxl_export (GimpProcedure *procedure,
GimpMetadata *metadata = gimp_image_metadata_save_prepare (image, "image/jxl", &metadata_flags);
if (! export_image (file, config, image, drawables[0], metadata, &error))
if (! export_image (file, config, image, drawables->data, metadata, &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
@ -2172,10 +2160,8 @@ jpegxl_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
g_free (drawables);
gimp_image_delete (image);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -160,8 +160,6 @@ static GimpProcedure * mng_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * mng_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -200,7 +198,7 @@ static gboolean respin_cmap (png_structp png_ptr,
static gboolean mng_export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error);
static gboolean mng_save_dialog (GimpImage *image,
@ -359,8 +357,6 @@ static GimpValueArray *
mng_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -368,6 +364,8 @@ mng_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -377,13 +375,15 @@ mng_export (GimpProcedure *procedure,
{
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "MNG",
export = gimp_export_image (&image, "MNG",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS);
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -401,11 +401,9 @@ mng_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -770,7 +768,7 @@ static gboolean
mng_export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error)
{

View File

@ -57,8 +57,6 @@ static GimpProcedure * pat_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * pat_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -147,8 +145,6 @@ static GimpValueArray *
pat_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -156,6 +152,8 @@ pat_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
gchar *description;
GError *error = NULL;
@ -186,7 +184,7 @@ pat_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PAT",
export = gimp_export_image (&image, "PAT",
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -196,6 +194,8 @@ pat_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -240,11 +240,9 @@ pat_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -79,8 +79,6 @@ static GimpValueArray * dcx_load (GimpProcedure *procedure,
static GimpValueArray * pcx_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -359,8 +357,6 @@ static GimpValueArray *
pcx_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -368,6 +364,7 @@ pcx_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -378,7 +375,7 @@ pcx_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PCX",
export = gimp_export_image (&image, "PCX",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -387,30 +384,19 @@ pcx_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (! export_image (file,
image, drawables[0],
image, drawables->data,
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -186,8 +186,6 @@ static GimpProcedure * pdf_create_procedure (GimpPlugIn *plug_in,
static GimpValueArray * pdf_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -471,8 +469,6 @@ static GimpValueArray *
pdf_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -704,11 +700,8 @@ pdf_export_image (GimpProcedure *procedure,
gint32 n_layers;
gdouble x_res, y_res;
gdouble x_scale, y_scale;
GimpDrawable **temp;
GimpDrawable **temp_out;
GimpItem **drawables;
gint n_drawables;
gint temp_size = 1;
gint j;
drawables = gimp_image_get_selected_drawables (image, &n_drawables);
@ -718,17 +711,12 @@ pdf_export_image (GimpProcedure *procedure,
continue;
}
temp = g_new (GimpDrawable *, 1);
temp[0] = GIMP_DRAWABLE (drawables[0]);
g_free (drawables);
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_size, &temp, NULL,
if (! (gimp_export_image (&image, NULL,
capabilities) == GIMP_EXPORT_EXPORT))
{
/* gimp_drawable_histogram() only works within the bounds of
@ -740,10 +728,6 @@ pdf_export_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);

View File

@ -100,8 +100,6 @@ static GimpValueArray * pix_load (GimpProcedure *procedure,
static GimpValueArray * pix_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -257,8 +255,6 @@ static GimpValueArray *
pix_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -266,6 +262,7 @@ pix_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -276,7 +273,7 @@ pix_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PIX",
export = gimp_export_image (&image, "PIX",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -285,28 +282,17 @@ pix_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
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 (! export_image (file, image, drawables[0], &error))
if (! export_image (file, image, drawables->data, &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -96,8 +96,6 @@ static GimpValueArray * png_load (GimpProcedure *procedure,
static GimpValueArray * png_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -368,8 +366,6 @@ static GimpValueArray *
png_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -377,6 +373,7 @@ png_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GimpImage *orig_image;
gboolean alpha;
GError *error = NULL;
@ -391,7 +388,7 @@ png_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PNG",
export = gimp_export_image (&image, "PNG",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -401,21 +398,8 @@ png_export (GimpProcedure *procedure,
default:
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,
_("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]);
drawables = gimp_image_list_layers (image);
alpha = gimp_drawable_has_alpha (drawables->data);
/* If the image has no transparency, then there is usually no need
* to save a bKGD chunk. For more information, see:
@ -436,7 +420,7 @@ png_export (GimpProcedure *procedure,
{
gint bits_per_sample;
if (export_image (file, image, drawables[0], orig_image, G_OBJECT (config),
if (export_image (file, image, drawables->data, orig_image, G_OBJECT (config),
&bits_per_sample, run_mode != GIMP_RUN_NONINTERACTIVE,
&error))
{
@ -450,11 +434,9 @@ png_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -154,8 +154,6 @@ static GimpValueArray * pnm_load (GimpProcedure *procedure,
static GimpValueArray * pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -580,8 +578,6 @@ static GimpValueArray *
pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -590,6 +586,7 @@ pnm_export (GimpProcedure *procedure,
FileType file_type = GPOINTER_TO_INT (run_data);
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
const gchar *format_name = NULL;
GError *error = NULL;
@ -605,7 +602,7 @@ pnm_export (GimpProcedure *procedure,
{
case FILE_TYPE_PNM:
format_name = "PNM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PNM",
export = gimp_export_image (&image, "PNM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -613,26 +610,26 @@ pnm_export (GimpProcedure *procedure,
case FILE_TYPE_PBM:
format_name = "PBM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PBM",
export = gimp_export_image (&image, "PBM",
GIMP_EXPORT_CAN_HANDLE_BITMAP);
break;
case FILE_TYPE_PGM:
format_name = "PGM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PGM",
export = gimp_export_image (&image, "PGM",
GIMP_EXPORT_CAN_HANDLE_GRAY);
break;
case FILE_TYPE_PPM:
format_name = "PPM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PPM",
export = gimp_export_image (&image, "PPM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
break;
case FILE_TYPE_PAM:
format_name = "PAM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PAM",
export = gimp_export_image (&image, "PAM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
@ -641,7 +638,7 @@ pnm_export (GimpProcedure *procedure,
case FILE_TYPE_PFM:
format_name = "PFM";
export = gimp_export_image (&image, &n_drawables, &drawables, "PFM",
export = gimp_export_image (&image, "PFM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
break;
@ -651,17 +648,7 @@ pnm_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (file_type != FILE_TYPE_PFM &&
file_type != FILE_TYPE_PAM &&
@ -673,19 +660,17 @@ pnm_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], file_type, G_OBJECT (config),
&error))
if (! export_image (file, image, drawables->data, file_type,
G_OBJECT (config), &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -148,8 +148,6 @@ static GimpValueArray * ps_load_thumb (GimpProcedure *procedure,
static GimpValueArray * ps_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -670,8 +668,6 @@ static GimpValueArray *
ps_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -679,6 +675,7 @@ ps_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GimpImage *orig_image;
gboolean eps_flag = FALSE;
GError *error = NULL;
@ -698,7 +695,7 @@ ps_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables,
export = gimp_export_image (&image,
eps_flag ? "EPS" : "PostScript",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
@ -708,16 +705,7 @@ ps_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
switch (run_mode)
{
@ -752,16 +740,15 @@ ps_export (GimpProcedure *procedure,
check_save_vals (config);
if (! export_image (file, G_OBJECT (config), image, drawables[0], &error))
if (! export_image (file, G_OBJECT (config), image, drawables->data,
&error))
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -594,8 +594,6 @@ static GimpValueArray * psp_load (GimpProcedure *procedure,
static GimpValueArray * psp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -606,7 +604,7 @@ static GimpImage * load_image (GFile *file,
static gboolean export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error);
static gboolean save_dialog (GimpProcedure *procedure,
@ -761,8 +759,6 @@ static GimpValueArray *
psp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -770,6 +766,8 @@ psp_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -780,7 +778,7 @@ psp_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PSP",
export = gimp_export_image (&image, "PSP",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -791,6 +789,8 @@ psp_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -808,11 +808,9 @@ psp_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -2834,7 +2832,7 @@ static gint
export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error)
{

View File

@ -75,8 +75,6 @@ static GimpValueArray * qoi_load (GimpProcedure *procedure,
static GimpValueArray * qoi_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -220,8 +218,6 @@ static GimpValueArray *
qoi_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -229,6 +225,7 @@ qoi_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -239,7 +236,7 @@ qoi_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "qoi",
export = gimp_export_image (&image, "qoi",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -249,18 +246,9 @@ qoi_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
if (n_drawables != 1)
{
g_set_error (&error, G_FILE_ERROR, 0,
_("QOI format does not support multiple layers."));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
if (! export_image (file, image, drawables[0], &error))
if (! export_image (file, image, drawables->data, &error))
status = GIMP_PDB_EXECUTION_ERROR;
if (export == GIMP_EXPORT_EXPORT)
@ -269,6 +257,7 @@ qoi_export (GimpProcedure *procedure,
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -174,8 +174,6 @@ static GimpValueArray * raw_load (GimpProcedure *procedur
static GimpValueArray * raw_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -657,8 +655,6 @@ static GimpValueArray *
raw_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -666,6 +662,7 @@ raw_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
RawPlanarConfiguration planar_conf;
GError *error = NULL;
@ -680,50 +677,33 @@ raw_export (GimpProcedure *procedure,
NULL);
}
export = gimp_export_image (&image, &n_drawables, &drawables, "RAW",
export = gimp_export_image (&image, "RAW",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (n_drawables != 1)
{
g_set_error (&error, G_FILE_ERROR, 0,
_("RAW export does not support multiple layers."));
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
if (! save_dialog (image, procedure,
gimp_drawable_has_alpha (drawables[0]),
gimp_drawable_has_alpha (drawables->data),
G_OBJECT (config)))
status = GIMP_PDB_CANCEL;
}
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], config, &error))
if (! export_image (file, image, drawables->data, config, &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -120,8 +120,6 @@ static GimpValueArray * sunras_load (GimpProcedure *procedur
static GimpValueArray * sunras_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -366,8 +364,6 @@ static GimpValueArray *
sunras_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -375,6 +371,7 @@ sunras_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -385,7 +382,7 @@ sunras_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "SUNRAS",
export = gimp_export_image (&image, "SUNRAS",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -394,19 +391,7 @@ sunras_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -416,19 +401,18 @@ sunras_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
if (export == GIMP_EXPORT_EXPORT)
gimp_image_delete (image);
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -184,8 +184,6 @@ static GimpValueArray * tga_load (GimpProcedure *procedure,
static GimpValueArray * tga_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -355,8 +353,6 @@ static GimpValueArray *
tga_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -364,6 +360,7 @@ tga_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -374,7 +371,7 @@ tga_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "TGA",
export = gimp_export_image (&image, "TGA",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -384,16 +381,7 @@ tga_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -403,7 +391,7 @@ tga_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -411,11 +399,9 @@ tga_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -88,8 +88,6 @@ static GimpValueArray * xbm_load (GimpProcedure *procedure,
static GimpValueArray * xbm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -338,8 +336,6 @@ static GimpValueArray *
xbm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -347,6 +343,7 @@ xbm_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gchar *mask_basename = NULL;
GError *error = NULL;
@ -358,7 +355,7 @@ xbm_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "XBM",
export = gimp_export_image (&image, "XBM",
GIMP_EXPORT_CAN_HANDLE_BITMAP |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
break;
@ -366,16 +363,7 @@ xbm_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE ||
run_mode == GIMP_RUN_WITH_LAST_VALS)
@ -412,7 +400,7 @@ xbm_export (GimpProcedure *procedure,
g_free (parasite_data);
}
if (! save_dialog (image, drawables[0], procedure, G_OBJECT (config)))
if (! save_dialog (image, drawables->data, procedure, G_OBJECT (config)))
status = GIMP_PDB_CANCEL;
}
@ -458,7 +446,7 @@ xbm_export (GimpProcedure *procedure,
if (! export_image (file,
prefix,
FALSE,
image, drawables[0],
image, drawables->data,
G_OBJECT (config),
&error)
@ -468,7 +456,7 @@ xbm_export (GimpProcedure *procedure,
! export_image (mask_file,
mask_prefix,
TRUE,
image, drawables[0],
image, drawables->data,
G_OBJECT (config),
&error)))
{
@ -484,11 +472,9 @@ xbm_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -172,8 +172,6 @@ static GimpValueArray * xmc_load_thumb (GimpProcedure *pro
static GimpValueArray * xmc_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -195,7 +193,7 @@ static guint32 read32 (FILE *f,
static gboolean export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GimpImage *orig_image,
GObject *config,
GError **error);
@ -526,8 +524,6 @@ static GimpValueArray *
xmc_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -535,6 +531,8 @@ xmc_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables = gimp_image_list_layers (image);
gint n_drawables = g_list_length (drawables);
GimpImage *orig_image;
GeglRectangle *hotspot_range;
gint hot_spot_x;
@ -565,7 +563,7 @@ xmc_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "XMC",
export = gimp_export_image (&image, "XMC",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
@ -575,6 +573,8 @@ xmc_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
switch (run_mode)
{
@ -617,12 +617,10 @@ xmc_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_free (hotspot_range);
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -1212,7 +1210,7 @@ static gboolean
export_image (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GimpImage *orig_image,
GObject *config,
GError **error)

View File

@ -114,8 +114,6 @@ static GimpValueArray * xpm_load (GimpProcedure *procedure,
static GimpValueArray * xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -303,8 +301,6 @@ static GimpValueArray *
xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -312,6 +308,7 @@ xpm_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -322,7 +319,7 @@ xpm_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "XPM",
export = gimp_export_image (&image, "XPM",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -332,27 +329,18 @@ xpm_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
if (gimp_drawable_has_alpha (drawables[0]))
if (gimp_drawable_has_alpha (drawables->data))
if (! save_dialog (image, procedure, G_OBJECT (config)))
status = GIMP_PDB_CANCEL;
}
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0], G_OBJECT (config),
if (! export_image (file, image, drawables->data, G_OBJECT (config),
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -360,11 +348,9 @@ xpm_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -169,8 +169,6 @@ static GimpValueArray * xwd_load (GimpProcedure *procedure,
static GimpValueArray * xwd_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -413,8 +411,6 @@ static GimpValueArray *
xwd_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -422,6 +418,7 @@ xwd_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -432,7 +429,7 @@ xwd_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "XWD",
export = gimp_export_image (&image, "XWD",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -441,28 +438,17 @@ xwd_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
if (n_drawables != 1)
{
g_set_error (&error, G_FILE_ERROR, 0,
_("XWD format does not support multiple layers."));
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CALLING_ERROR,
error);
}
if (! export_image (file, image, drawables[0], &error))
if (! export_image (file, image, drawables->data, &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -99,8 +99,6 @@ static GimpValueArray * bmp_load (GimpProcedure *procedure,
static GimpValueArray * bmp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -257,8 +255,6 @@ static GimpValueArray *
bmp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -266,6 +262,7 @@ bmp_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -276,7 +273,7 @@ bmp_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "BMP",
export = gimp_export_image (&image, "BMP",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
@ -286,26 +283,15 @@ bmp_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
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 = export_image (file, image, drawables[0], run_mode,
status = export_image (file, image, drawables->data, run_mode,
procedure, G_OBJECT (config),
&error);
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -76,8 +76,6 @@ static GimpValueArray * dds_load (GimpProcedure *procedure,
static GimpValueArray * dds_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -371,8 +369,6 @@ static GimpValueArray *
dds_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -380,6 +376,7 @@ dds_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gdouble gamma;
@ -391,7 +388,7 @@ dds_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init ("dds");
export = gimp_export_image (&image, &n_drawables, &drawables, "DDS",
export = gimp_export_image (&image, "DDS",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -402,6 +399,7 @@ dds_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
g_object_get (config,
"gamma", &gamma,
@ -419,16 +417,14 @@ dds_export (GimpProcedure *procedure,
/* TODO: support multiple-layers selection, especially as DDS has
* DDS_SAVE_SELECTED_LAYER option support.
*/
status = write_dds (file, image, drawables[0],
status = write_dds (file, image, drawables->data,
run_mode == GIMP_RUN_INTERACTIVE,
procedure, config,
export == GIMP_EXPORT_EXPORT);
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -97,8 +97,6 @@ static GimpValueArray * fits_load (GimpProcedure *procedure,
static GimpValueArray * fits_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -283,8 +281,6 @@ static GimpValueArray *
fits_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -294,6 +290,8 @@ fits_export (GimpProcedure *procedure,
GimpItem **flipped_drawables;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -304,7 +302,7 @@ fits_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "FITS",
export = gimp_export_image (&image, "FITS",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
@ -313,16 +311,8 @@ fits_export (GimpProcedure *procedure,
default:
break;
}
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);
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
/* Flip image vertical since FITS writes from bottom to top */
duplicate_image = gimp_image_duplicate (image);
@ -338,11 +328,9 @@ fits_export (GimpProcedure *procedure,
g_free (flipped_drawables);
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -104,8 +104,6 @@ static GimpValueArray * fli_load (GimpProcedure *procedure,
static GimpValueArray * fli_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -335,8 +333,6 @@ static GimpValueArray *
fli_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -344,6 +340,7 @@ fli_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -354,7 +351,7 @@ fli_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "FLI",
export = gimp_export_image (&image, "FLI",
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
@ -364,6 +361,7 @@ fli_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -381,11 +379,9 @@ fli_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -453,26 +453,26 @@ icns_export_image (GFile *file,
{
GimpProcedure *procedure;
GimpValueArray *return_vals;
GimpDrawable **drawables = NULL;
GimpImage *temp_image;
GimpLayer *temp_layer;
GFile *temp_file = NULL;
GimpObjectArray *args;
FILE *temp_fp;
gint temp_size;
gint macos_size;
temp_file = gimp_temp_file ("png");
drawables = g_new (GimpDrawable *, 1);
drawables[0] = iter->data;
args = gimp_object_array_new (GIMP_TYPE_DRAWABLE, (GObject **) drawables, 1, FALSE);
/* TODO: Use GimpExportOptions for this when available */
temp_image = gimp_image_new (width, height,
gimp_image_get_base_type (image));
temp_layer = gimp_layer_new_from_drawable (GIMP_DRAWABLE (iter->data),
temp_image);
gimp_image_insert_layer (temp_image, temp_layer, NULL, 0);
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (), "file-png-export");
return_vals = gimp_procedure_run (procedure,
"run-mode", GIMP_RUN_NONINTERACTIVE,
"image", image,
"num-drawables", 1,
"drawables", args,
"image", temp_image,
"file", temp_file,
"interlaced", FALSE,
"compression", 9,
@ -483,9 +483,7 @@ icns_export_image (GFile *file,
"save-transparent", FALSE,
"optimize-palette", FALSE,
NULL);
gimp_object_array_free (args);
g_clear_pointer (&drawables, g_free);
gimp_image_delete (temp_image);
if (GIMP_VALUES_GET_ENUM (return_vals, 0) != GIMP_PDB_SUCCESS)
{

View File

@ -79,8 +79,6 @@ static GimpValueArray * icns_load_thumb (GimpProcedure *procedure,
static GimpValueArray * icns_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -270,8 +268,6 @@ static GimpValueArray *
icns_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,

View File

@ -96,8 +96,6 @@ static GimpValueArray * ani_load_thumb (GimpProcedure *procedure,
static GimpValueArray * ico_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -105,8 +103,6 @@ static GimpValueArray * ico_export (GimpProcedure *procedure,
static GimpValueArray * cur_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -114,8 +110,6 @@ static GimpValueArray * cur_export (GimpProcedure *procedure,
static GimpValueArray * ani_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -574,8 +568,6 @@ static GimpValueArray *
ico_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -595,8 +587,6 @@ static GimpValueArray *
cur_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -646,8 +636,6 @@ static GimpValueArray *
ani_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,

View File

@ -73,8 +73,6 @@ static GimpValueArray * jpeg_load_thumb (GimpProcedure *procedure,
static GimpValueArray * jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -416,8 +414,6 @@ static GimpValueArray *
jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -426,6 +422,7 @@ jpeg_export (GimpProcedure *procedure,
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpImage *orig_image;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gint orig_num_quant_tables = -1;
@ -445,7 +442,7 @@ jpeg_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "JPEG",
export = gimp_export_image (&image, "JPEG",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
@ -464,16 +461,7 @@ jpeg_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
/* Override preferences from JPG export defaults (if saved). */
@ -574,10 +562,10 @@ jpeg_export (GimpProcedure *procedure,
/* prepare for the preview */
preview_image = image;
orig_image_global = orig_image;
drawable_global = drawables[0];
drawable_global = drawables->data;
/* First acquire information with a dialog */
if (! save_dialog (procedure, config, drawables[0], orig_image))
if (! save_dialog (procedure, config, drawables->data, orig_image))
{
status = GIMP_PDB_CANCEL;
}
@ -595,7 +583,7 @@ jpeg_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, config,
image, drawables[0], orig_image, FALSE,
image, drawables->data, orig_image, FALSE,
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -622,10 +610,9 @@ jpeg_export (GimpProcedure *procedure,
{
gimp_image_delete (image);
}
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -71,8 +71,6 @@ static GimpValueArray * psd_load_thumb (GimpProcedure *procedure,
static GimpValueArray * psd_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -424,8 +422,6 @@ static GimpValueArray *
psd_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -433,6 +429,7 @@ psd_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -443,7 +440,7 @@ psd_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "PSD",
export = gimp_export_image (&image, "PSD",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -455,6 +452,7 @@ psd_export (GimpProcedure *procedure,
default:
break;
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -474,11 +472,9 @@ psd_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -79,8 +79,6 @@ static GimpValueArray * sgi_load (GimpProcedure *procedure,
static GimpValueArray * sgi_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -235,8 +233,6 @@ static GimpValueArray *
sgi_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -244,6 +240,7 @@ sgi_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
GError *error = NULL;
gegl_init (NULL, NULL);
@ -254,7 +251,7 @@ sgi_export (GimpProcedure *procedure,
case GIMP_RUN_WITH_LAST_VALS:
gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, &n_drawables, &drawables, "SGI",
export = gimp_export_image (&image, "SGI",
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
@ -264,16 +261,7 @@ sgi_export (GimpProcedure *procedure,
default:
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);
}
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
@ -283,7 +271,7 @@ sgi_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
if (! export_image (file, image, drawables[0],
if (! export_image (file, image, drawables->data,
G_OBJECT (config), &error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -291,11 +279,9 @@ sgi_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -94,8 +94,6 @@ static GimpValueArray * tiff_load (GimpProcedure *procedure
static GimpValueArray * tiff_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -103,8 +101,6 @@ static GimpValueArray * tiff_export (GimpProcedure *procedure
static GimpPDBStatusType tiff_export_rec (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *orig_image,
gint n_orig_drawables,
GimpDrawable **orig_drawables,
GFile *file,
GimpProcedureConfig *config,
GimpMetadata *metadata,
@ -341,8 +337,6 @@ static GimpValueArray *
tiff_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -364,7 +358,6 @@ tiff_export (GimpProcedure *procedure,
}
status = tiff_export_rec (procedure, run_mode, image,
n_drawables, drawables,
file, config, metadata, FALSE, &error);
return gimp_procedure_new_return_values (procedure, status, error);
@ -374,8 +367,6 @@ static GimpPDBStatusType
tiff_export_rec (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *orig_image,
gint n_orig_drawables,
GimpDrawable **orig_drawables,
GFile *file,
GimpProcedureConfig *config,
GimpMetadata *metadata,
@ -383,8 +374,8 @@ tiff_export_rec (GimpProcedure *procedure,
GError **error)
{
GimpImage *image = orig_image;
GimpDrawable **drawables = orig_drawables;
gint n_drawables = n_orig_drawables;
GList *drawables = gimp_image_list_layers (image);
gint n_drawables = g_list_length (drawables);
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
gboolean bigtiff = FALSE;
@ -392,7 +383,7 @@ tiff_export_rec (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE)
{
if (! save_dialog (orig_image, procedure, G_OBJECT (config),
n_drawables == 1 ? gimp_drawable_has_alpha (drawables[0]) : TRUE,
n_drawables == 1 ? gimp_drawable_has_alpha (drawables->data) : TRUE,
image_is_monochrome (orig_image),
gimp_image_get_base_type (orig_image) == GIMP_INDEXED,
image_is_multi_layer (orig_image),
@ -443,14 +434,14 @@ tiff_export_rec (GimpProcedure *procedure,
capabilities |= GIMP_EXPORT_NEEDS_CROP;
}
export = gimp_export_image (&image, &n_drawables, &drawables, "TIFF",
capabilities);
export = gimp_export_image (&image, "TIFF", capabilities);
}
break;
default:
break;
}
drawables = gimp_image_list_layers (image);
#if 0
/* FIXME */
@ -471,10 +462,7 @@ tiff_export_rec (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
if (status == GIMP_PDB_EXECUTION_ERROR &&
run_mode == GIMP_RUN_INTERACTIVE &&
@ -485,8 +473,7 @@ tiff_export_rec (GimpProcedure *procedure,
tiff_reset_file_size_error ();
g_clear_error (error);
return tiff_export_rec (procedure, run_mode,
orig_image, n_orig_drawables, orig_drawables,
return tiff_export_rec (procedure, run_mode, orig_image,
file, config, metadata, TRUE, error);
}

View File

@ -505,7 +505,7 @@ gboolean
save_animation (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error)
{
@ -582,7 +582,7 @@ save_animation (GFile *file,
}
if (! space)
space = gimp_drawable_get_format (drawables[0]);
space = gimp_drawable_get_format (drawables->data);
gimp_image_undo_freeze (image);

View File

@ -32,7 +32,7 @@ gboolean save_layer (GFile *file,
gboolean save_animation (GFile *file,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GList *drawables,
GObject *config,
GError **error);

View File

@ -69,8 +69,6 @@ static GimpValueArray * webp_load (GimpProcedure *procedure,
static GimpValueArray * webp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -283,8 +281,6 @@ static GimpValueArray *
webp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GFile *file,
GimpMetadata *metadata,
GimpProcedureConfig *config,
@ -292,6 +288,8 @@ webp_export (GimpProcedure *procedure,
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportReturn export = GIMP_EXPORT_IGNORE;
GList *drawables;
gint n_drawables;
gboolean animation;
GError *error = NULL;
@ -324,9 +322,10 @@ webp_export (GimpProcedure *procedure,
if (animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION;
export = gimp_export_image (&image, &n_drawables, &drawables, "WebP",
capabilities);
export = gimp_export_image (&image, "WebP", capabilities);
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
if (animation)
{
@ -338,17 +337,7 @@ webp_export (GimpProcedure *procedure,
}
else
{
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),
if (! save_layer (file, image, drawables->data, G_OBJECT (config),
&error))
{
status = GIMP_PDB_EXECUTION_ERROR;
@ -371,10 +360,8 @@ webp_export (GimpProcedure *procedure,
}
if (export == GIMP_EXPORT_EXPORT)
{
gimp_image_delete (image);
g_free (drawables);
}
g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error);
}

View File

@ -62,7 +62,7 @@ preamble = """<!DOCTYPE html>
postamble = """\n</pre>\n</body>\n</html>\n"""
def export_colorxhtml(procedure, run_mode, image, n_layers, layers, file, metadata, config, data):
def export_colorxhtml(procedure, run_mode, image, file, metadata, config, data):
source_file = config.get_property("source-file")
characters = config.get_property("characters")
size = config.get_property("font-size");
@ -169,7 +169,7 @@ def export_colorxhtml(procedure, run_mode, image, n_layers, layers, file, metada
GLib.Error())
#For now, work with a single layer
layer = layers[0]
layer = image.list_layers()[0]
width = layer.get_width()
height = layer.get_height()

View File

@ -188,10 +188,7 @@ def thumbnail_ora(procedure, file, thumb_size, args, data):
else:
return procedure.new_return_values(result.index(0), GLib.Error(result.index(1)))
# We would expect the n_drawables parameter to not be there with introspection but
# currently that isn't working, see issue #5312. Until that is resolved we keep
# this parameter here or else saving would fail.
def export_ora(procedure, run_mode, image, n_drawables, drawables, file, metadata, config, data):
def export_ora(procedure, run_mode, image, file, metadata, config, data):
def write_file_str(zfile, fname, data):
# work around a permission bug in the zipfile library:
# http://bugs.python.org/issue3394
@ -219,12 +216,16 @@ def export_ora(procedure, run_mode, image, n_drawables, drawables, file, metadat
tmp = os.path.join(tempdir, 'tmp.png')
interlace, compression = 0, 2
#TODO: Use GimpExportOptions for this once available
width, height = drawable.get_width(), drawable.get_height()
tmp_img = Gimp.Image.new(width, height, image.get_base_type())
tmp_layer = Gimp.Layer.new_from_drawable (drawable, tmp_img)
tmp_img.insert_layer (tmp_layer, None, 0)
pdb_proc = Gimp.get_pdb().lookup_procedure('file-png-export')
pdb_config = pdb_proc.create_config()
pdb_config.set_property('run-mode', Gimp.RunMode.NONINTERACTIVE)
pdb_config.set_property('image', image)
pdb_config.set_property('num-drawables', 1)
pdb_config.set_property('drawables', Gimp.ObjectArray.new(Gimp.Drawable, [drawable], False))
pdb_config.set_property('image', tmp_img)
pdb_config.set_property('file', Gio.File.new_for_path(tmp))
pdb_config.set_property('interlaced', interlace)
pdb_config.set_property('compression', compression)
@ -241,6 +242,8 @@ def export_ora(procedure, run_mode, image, n_drawables, drawables, file, metadat
else:
print("Error removing ", tmp)
tmp_img.delete()
def add_layer(parent, x, y, opac, gimp_layer, path, visible=True):
store_layer(image, gimp_layer, path)
# create layer attributes