core, pdb, plug-ins: Create GimpExportOptions class

This patch creates a GimpExportOptions class in both
libgimpbase and in libgimp. Currently it is a mostly empty
object, but it will be added to after 3.0 to allow for
additional export options (like resizing on export while
leaving the original image intact)

libgimp/gimpexport.c was removed, and most of its content
was copied into libgimp/gimpexportoptions.c. gimp_export_image ()
was replaced with gimp_export_options_get_image () in all
export plug-ins.

GimpExportProcedure has a new function to set the default
image capabilities for each plug-in on creation. It also sets up
a new callback function, which allows the options to respond to
user setting changes (such as toggling 'Save as Animation' in the
GIF or WEBP Plug-in).
This commit is contained in:
Alx Sa 2024-05-06 18:38:12 +00:00 committed by Jehan
parent 9a26d45793
commit bcdd4974bb
76 changed files with 1497 additions and 702 deletions

View file

@ -70,6 +70,7 @@ file_save (Gimp *gimp,
gboolean mounted = TRUE; gboolean mounted = TRUE;
GError *my_error = NULL; GError *my_error = NULL;
GList *drawables_list; GList *drawables_list;
GimpExportOptions *options = NULL;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), GIMP_PDB_CALLING_ERROR); 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); g_return_val_if_fail (GIMP_IS_IMAGE (image), GIMP_PDB_CALLING_ERROR);
@ -91,6 +92,9 @@ file_save (Gimp *gimp,
gimp_image_saving (image); gimp_image_saving (image);
/* TEMP - Remove later */
options = gimp_export_options_new ();
drawables_list = gimp_image_get_selected_drawables (image); drawables_list = gimp_image_get_selected_drawables (image);
if (! drawables_list) if (! drawables_list)
@ -190,9 +194,10 @@ file_save (Gimp *gimp,
gimp_get_user_context (gimp), gimp_get_user_context (gimp),
progress, error, progress, error,
gimp_object_get_name (file_proc), gimp_object_get_name (file_proc),
GIMP_TYPE_RUN_MODE, run_mode, GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE, image, GIMP_TYPE_IMAGE, image,
G_TYPE_FILE, file, G_TYPE_FILE, file,
GIMP_TYPE_EXPORT_OPTIONS, options,
G_TYPE_NONE); G_TYPE_NONE);
status = g_value_get_enum (gimp_value_array_index (return_vals, 0)); status = g_value_get_enum (gimp_value_array_index (return_vals, 0));

View file

@ -259,8 +259,10 @@ file_save_invoker (GimpProcedure *procedure,
gimp_value_array_index (new_args, 1)); gimp_value_array_index (new_args, 1));
g_value_transform (gimp_value_array_index (args, 2), g_value_transform (gimp_value_array_index (args, 2),
gimp_value_array_index (new_args, 2)); gimp_value_array_index (new_args, 2));
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
for (i = 3; i < proc->num_args; i++) for (i = 4; i < proc->num_args; i++)
if (G_IS_PARAM_SPEC_STRING (proc->args[i])) if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
g_value_set_static_string (gimp_value_array_index (new_args, i), ""); g_value_set_static_string (gimp_value_array_index (new_args, i), "");
@ -516,6 +518,12 @@ register_file_procs (GimpPDB *pdb)
"The file to save the image in", "The file to save the image in",
G_TYPE_FILE, G_TYPE_FILE,
GIMP_PARAM_READWRITE)); GIMP_PARAM_READWRITE));
gimp_procedure_add_argument (procedure,
gimp_param_spec_export_options ("options",
"options",
"Export option settings",
0,
GIMP_PARAM_READWRITE));
gimp_pdb_register_procedure (pdb, procedure); gimp_pdb_register_procedure (pdb, procedure);
g_object_unref (procedure); g_object_unref (procedure);

View file

@ -390,17 +390,17 @@ gimp_plug_in_set_file_proc_save_handler (GimpPlugIn *plug_in,
procedure = GIMP_PROCEDURE (proc); procedure = GIMP_PROCEDURE (proc);
if ((procedure->num_args < 3) || if ((procedure->num_args < 4) ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) || ! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) || ! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) ||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2])) ! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2]))
{ {
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED, g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n" "Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" " "attempted to register procedure \"%s\" "
"as save handler which does not take the standard " "as save handler which does not take the standard "
"save procedure arguments:\n" "save procedure arguments:\n"
"(GimpRunMode, GimpImage, GFile)", "(GimpRunMode, GimpImage, GFile, GimpExportOptions)",
gimp_object_get_name (plug_in), gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file), gimp_file_get_utf8_name (plug_in->file),
proc_name); proc_name);

View file

@ -998,6 +998,15 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
goto error; goto error;
} }
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
if (! gimp_scanner_parse_int (scanner,
&param_def.meta.m_export_options.capabilities))
{
token = G_TOKEN_INT;
goto error;
}
break;
} }
if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN)) if (! gimp_scanner_parse_token (scanner, G_TOKEN_RIGHT_PAREN))
@ -1059,6 +1068,9 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
case GP_PARAM_DEF_TYPE_ID_ARRAY: case GP_PARAM_DEF_TYPE_ID_ARRAY:
g_free (param_def.meta.m_id_array.type_name); g_free (param_def.meta.m_id_array.type_name);
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
break;
} }
return token; return token;
@ -1240,6 +1252,11 @@ plug_in_rc_write_proc_arg (GimpConfigWriter *writer,
gimp_config_writer_string (writer, gimp_config_writer_string (writer,
param_def.meta.m_id_array.type_name); param_def.meta.m_id_array.type_name);
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
gimp_config_writer_printf (writer, "%d",
param_def.meta.m_export_options.capabilities);
break;
} }
gimp_config_writer_close (writer); gimp_config_writer_close (writer);

View file

@ -270,6 +270,7 @@ EXPORTS
gimp_export_comment gimp_export_comment
gimp_export_exif gimp_export_exif
gimp_export_iptc gimp_export_iptc
gimp_export_options_get_image
gimp_export_procedure_get_support_comment gimp_export_procedure_get_support_comment
gimp_export_procedure_get_support_exif gimp_export_procedure_get_support_exif
gimp_export_procedure_get_support_iptc gimp_export_procedure_get_support_iptc
@ -278,6 +279,7 @@ EXPORTS
gimp_export_procedure_get_support_xmp gimp_export_procedure_get_support_xmp
gimp_export_procedure_get_type gimp_export_procedure_get_type
gimp_export_procedure_new gimp_export_procedure_new
gimp_export_procedure_set_capabilities
gimp_export_procedure_set_support_comment gimp_export_procedure_set_support_comment
gimp_export_procedure_set_support_exif gimp_export_procedure_set_support_exif
gimp_export_procedure_set_support_iptc gimp_export_procedure_set_support_iptc

View file

@ -42,6 +42,7 @@
#include <libgimp/gimpchannel.h> #include <libgimp/gimpchannel.h>
#include <libgimp/gimpdisplay.h> #include <libgimp/gimpdisplay.h>
#include <libgimp/gimpdrawable.h> #include <libgimp/gimpdrawable.h>
#include <libgimp/gimpexportoptions.h>
#include <libgimp/gimpexportprocedure.h> #include <libgimp/gimpexportprocedure.h>
#include <libgimp/gimpfont.h> #include <libgimp/gimpfont.h>
#include <libgimp/gimpgimprc.h> #include <libgimp/gimpgimprc.h>

View file

@ -1,8 +1,8 @@
/* LIBGIMP - The GIMP Library /* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
* *
* gimpexport.c * gimpexportoptions.c
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org> * Copyright (C) 2024 Alx Sa.
* *
* This library is free software: you can redistribute it and/or * This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -12,7 +12,7 @@
* This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see * License along with this library. If not, see
@ -21,40 +21,18 @@
#include "config.h" #include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "gimp.h" #include "gimp.h"
#include "gimpui.h"
#include "gimpexportoptions.h"
#include "libgimp-intl.h" #include "libgimp-intl.h"
/** /* export helper functions */
* SECTION: gimpexport
* @title: gimpexport
* @short_description: Export an image before it is saved.
*
* This function should be called by all save_plugins unless they are
* able to save all image formats GIMP knows about. It takes care of
* asking the user if she wishes to export the image to a format the
* save_plugin can handle. It then performs the necessary conversions
* (e.g. Flatten) on a copy of the image so that the image can be
* saved without changing the original image.
*
* The capabilities of the save_plugin are specified by combining
* #GimpExportCapabilities using a bitwise OR.
*
* Make sure you have initialized GTK+ before you call this function
* as it will most probably have to open a dialog.
**/
typedef void (* ExportFunc) (GimpImage *image, typedef void (* ExportFunc) (GimpImage *image,
GList **drawables); GList **drawables);
/* the export action structure */ /* the export action structure */
typedef struct typedef struct
{ {
@ -548,47 +526,42 @@ export_action_perform (const ExportAction *action,
export_action_get_func (action) (image, drawables); export_action_get_func (action) (image, drawables);
} }
/* dialog functions */
/** /**
* gimp_export_image: * gimp_export_options_get_image:
* @options: The #GimpExportOptions object.
* @image: Pointer to the image. * @image: Pointer to the image.
* @capabilities: What can the image_format do?
* *
* Takes an image to be saved together with a description * Takes an image to be saved together with a description
* of the capabilities of the image_format. If the type of * of the capabilities of the image_format. A copy is created.
* image doesn't match the capabilities of the format
* a dialog is opened that informs the user that the image has
* 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 is changed to point to the * This copy is then converted, @image is changed to point to the
* new image and the procedure returns GIMP_EXPORT_EXPORT. * new image and the procedure returns GIMP_EXPORT_EXPORT.
* The save_plugin has to take care of deleting the created image using * The save_plugin has to take care of deleting the created image using
* gimp_image_delete() 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 is not
* altered, GIMP_EXPORT_IGNORE is returned and the save_plugin
* should try to save the original image.
*
* Returns: An enum of #GimpExportReturn describing the user_action. * Returns: An enum of #GimpExportReturn describing the user_action.
*
* Since: 3.0
**/ **/
GimpExportReturn GimpExportReturn
gimp_export_image (GimpImage **image, gimp_export_options_get_image (GimpExportOptions *options,
GimpExportCapabilities capabilities) GimpImage **image)
{ {
GSList *actions = NULL; GSList *actions = NULL;
GimpImageBaseType type; GimpImageBaseType type;
GList *layers; GList *layers;
gint n_layers; gint n_layers;
GList *iter; GList *iter;
gboolean added_flatten = FALSE; GimpExportCapabilities capabilities = 0;
gboolean has_layer_masks = FALSE; gboolean added_flatten = FALSE;
gboolean background_has_alpha = TRUE; gboolean has_layer_masks = FALSE;
GimpExportReturn retval = GIMP_EXPORT_IGNORE; gboolean background_has_alpha = TRUE;
GimpExportReturn retval = GIMP_EXPORT_IGNORE;
g_return_val_if_fail (gimp_image_is_valid (*image), FALSE); g_return_val_if_fail (gimp_image_is_valid (*image), FALSE);
g_return_val_if_fail (options != NULL, FALSE);
/* Get capabilities from ExportOptions */
g_object_get (options, "capabilities", &capabilities, NULL);
/* do some sanity checks */ /* do some sanity checks */
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA) if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
@ -891,71 +864,3 @@ gimp_export_image (GimpImage **image,
return retval; return retval;
} }
/**
* gimp_export_dialog_new:
* @format_name: The short name of the image_format (e.g. JPEG or PNG).
* @role: The dialog's @role which will be set with
* gtk_window_set_role().
* @help_id: The GIMP help id.
*
* Creates a new export dialog. All file plug-ins should use this
* dialog to get a consistent look on the export dialogs. Use
* gimp_export_dialog_get_content_area() to get a vertical #GtkBox to be
* filled with export options. The export dialog is a wrapped
* #GimpDialog.
*
* The dialog response when the user clicks on the Export button is
* %GTK_RESPONSE_OK, and when the Cancel button is clicked it is
* %GTK_RESPONSE_CANCEL.
*
* Returns: (transfer full): The new export dialog.
*
* Since: 2.8
**/
GtkWidget *
gimp_export_dialog_new (const gchar *format_name,
const gchar *role,
const gchar *help_id)
{
GtkWidget *dialog;
/* TRANSLATORS: the %s parameter is an image format name (ex: PNG). */
gchar *title = g_strdup_printf (_("Export Image as %s"), format_name);
dialog = gimp_dialog_new (title, role,
NULL, 0,
gimp_standard_help_func, help_id,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Export"), GTK_RESPONSE_OK,
NULL);
gimp_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gimp_window_set_transient (GTK_WINDOW (dialog));
g_free (title);
return dialog;
}
/**
* gimp_export_dialog_get_content_area:
* @dialog: A dialog created with gimp_export_dialog_new()
*
* Returns the vertical #GtkBox of the passed export dialog to be filled with
* export options.
*
* Returns: (transfer none): The #GtkBox to fill with export options.
*
* Since: 2.8
**/
GtkWidget *
gimp_export_dialog_get_content_area (GtkWidget *dialog)
{
return gtk_dialog_get_content_area (GTK_DIALOG (dialog));
}

View file

@ -0,0 +1,55 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
*
* gimpexportoptions.h
* Copyright (C) 2024 Alx Sa.
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimp.h> can be included directly."
#endif
#ifndef __LIBGIMP_GIMP_EXPORT_OPTIONS_H__
#define __LIBGIMP_GIMP_EXPORT_OPTIONS_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
/**
* GimpExportReturn:
* @GIMP_EXPORT_IGNORE: The image is unmodified but export shall continue anyway
* @GIMP_EXPORT_EXPORT: The chosen transforms were applied to the image
*
* Possible return values of gimp_export_image().
**/
typedef enum
{
GIMP_EXPORT_IGNORE,
GIMP_EXPORT_EXPORT
} GimpExportReturn;
GimpExportReturn gimp_export_options_get_image (GimpExportOptions *options,
GimpImage **image);
G_END_DECLS
#endif /* __LIBGIMP_GIMP_EXPORT_OPTIONS_H__ */

View file

@ -46,6 +46,7 @@
enum enum
{ {
PROP_0, PROP_0,
PROP_CAPABILITIES,
PROP_SUPPORTS_EXIF, PROP_SUPPORTS_EXIF,
PROP_SUPPORTS_IPTC, PROP_SUPPORTS_IPTC,
PROP_SUPPORTS_XMP, PROP_SUPPORTS_XMP,
@ -57,44 +58,52 @@ enum
struct _GimpExportProcedure struct _GimpExportProcedure
{ {
GimpFileProcedure parent_instance; GimpFileProcedure parent_instance;
GimpRunExportFunc run_func; GimpRunExportFunc run_func;
gpointer run_data; gpointer run_data;
GDestroyNotify run_data_destroy; GDestroyNotify run_data_destroy;
gboolean supports_exif; GimpExportCapabilities capabilities;
gboolean supports_iptc; GimpExportOptionsEditFunc create_func;
gboolean supports_xmp; gpointer create_data;
gboolean supports_profile;
gboolean supports_thumbnail;
gboolean supports_comment;
gboolean export_metadata; gboolean supports_exif;
gboolean supports_iptc;
gboolean supports_xmp;
gboolean supports_profile;
gboolean supports_thumbnail;
gboolean supports_comment;
gboolean export_metadata;
}; };
static void gimp_export_procedure_constructed (GObject *object); static void gimp_export_procedure_constructed (GObject *object);
static void gimp_export_procedure_finalize (GObject *object); static void gimp_export_procedure_finalize (GObject *object);
static void gimp_export_procedure_set_property (GObject *object, static void gimp_export_procedure_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_export_procedure_get_property (GObject *object, static void gimp_export_procedure_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_export_procedure_install (GimpProcedure *procedure); static void gimp_export_procedure_install (GimpProcedure *procedure);
static GimpValueArray * static GimpValueArray *
gimp_export_procedure_run (GimpProcedure *procedure, gimp_export_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args); const GimpValueArray *args);
static GimpProcedureConfig * static GimpProcedureConfig *
gimp_export_procedure_create_config (GimpProcedure *procedure, gimp_export_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args, GParamSpec **args,
gint n_args); gint n_args);
static void gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure); static void gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure);
static void gimp_export_procedure_update_options (GimpProcedureConfig *config,
GParamSpec *param,
gpointer data);
G_DEFINE_TYPE (GimpExportProcedure, gimp_export_procedure, GIMP_TYPE_FILE_PROCEDURE) G_DEFINE_TYPE (GimpExportProcedure, gimp_export_procedure, GIMP_TYPE_FILE_PROCEDURE)
@ -118,6 +127,20 @@ gimp_export_procedure_class_init (GimpExportProcedureClass *klass)
procedure_class->run = gimp_export_procedure_run; procedure_class->run = gimp_export_procedure_run;
procedure_class->create_config = gimp_export_procedure_create_config; procedure_class->create_config = gimp_export_procedure_create_config;
/**
* GimpExportProcedure:capabilities:
*
* What #GimpExportCapabilities are supported
*
* Since: 3.0.0
*/
props[PROP_CAPABILITIES] = g_param_spec_int ("capabilities",
"Supported image capabilities",
NULL,
0, G_MAXINT, 0,
G_PARAM_CONSTRUCT |
GIMP_PARAM_READWRITE);
/** /**
* GimpExportProcedure:supports-exif: * GimpExportProcedure:supports-exif:
* *
@ -204,6 +227,7 @@ static void
gimp_export_procedure_init (GimpExportProcedure *procedure) gimp_export_procedure_init (GimpExportProcedure *procedure)
{ {
procedure->export_metadata = FALSE; procedure->export_metadata = FALSE;
procedure->capabilities = 0;
} }
static void static void
@ -223,6 +247,11 @@ gimp_export_procedure_constructed (GObject *object)
"File", "File",
"The file to export to", "The file to export to",
GIMP_PARAM_READWRITE); GIMP_PARAM_READWRITE);
_gimp_procedure_add_argument (procedure,
gimp_param_spec_export_options ("options", "Options",
"Export options", 0,
G_PARAM_READWRITE));
} }
static void static void
@ -246,6 +275,9 @@ gimp_export_procedure_set_property (GObject *object,
switch (property_id) switch (property_id)
{ {
case PROP_CAPABILITIES:
procedure->capabilities = g_value_get_int (value);
break;
case PROP_SUPPORTS_EXIF: case PROP_SUPPORTS_EXIF:
procedure->supports_exif = g_value_get_boolean (value); procedure->supports_exif = g_value_get_boolean (value);
break; break;
@ -281,6 +313,9 @@ gimp_export_procedure_get_property (GObject *object,
switch (property_id) switch (property_id)
{ {
case PROP_CAPABILITIES:
g_value_set_int (value, procedure->capabilities);
break;
case PROP_SUPPORTS_EXIF: case PROP_SUPPORTS_EXIF:
g_value_set_boolean (value, procedure->supports_exif); g_value_set_boolean (value, procedure->supports_exif);
break; break;
@ -334,7 +369,7 @@ gimp_export_procedure_install (GimpProcedure *procedure)
priority); priority);
} }
#define ARG_OFFSET 3 #define ARG_OFFSET 4
static GimpValueArray * static GimpValueArray *
gimp_export_procedure_run (GimpProcedure *procedure, gimp_export_procedure_run (GimpProcedure *procedure,
@ -349,12 +384,15 @@ gimp_export_procedure_run (GimpProcedure *procedure,
GimpImage *image; GimpImage *image;
GFile *file; GFile *file;
GimpMetadata *metadata; GimpMetadata *metadata;
gchar *mimetype = NULL; GimpExportOptions *options = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR; gchar *mimetype = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
gboolean free_options = FALSE;
run_mode = GIMP_VALUES_GET_ENUM (args, 0); run_mode = GIMP_VALUES_GET_ENUM (args, 0);
image = GIMP_VALUES_GET_IMAGE (args, 1); image = GIMP_VALUES_GET_IMAGE (args, 1);
file = GIMP_VALUES_GET_FILE (args, 2); file = GIMP_VALUES_GET_FILE (args, 2);
options = g_value_get_object (gimp_value_array_index (args, 3));
remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET); remaining = gimp_value_array_new (gimp_value_array_length (args) - ARG_OFFSET);
@ -398,9 +436,33 @@ gimp_export_procedure_run (GimpProcedure *procedure,
metadata = _gimp_procedure_config_begin_export (config, image, run_mode, remaining, mimetype); metadata = _gimp_procedure_config_begin_export (config, image, run_mode, remaining, mimetype);
g_free (mimetype); g_free (mimetype);
/* GimpExportOptions may be null if called non-interactively from a script,
* so we'll make sure it's initialized */
if (options == NULL)
{
options = gimp_export_options_new ();
free_options = TRUE;
}
if (export_proc->create_func != NULL)
{
export_proc->create_func (procedure, config, options,
export_proc->create_data);
g_signal_connect_object (config, "notify",
G_CALLBACK (gimp_export_procedure_update_options),
options, 0);
}
else
{
g_object_set (options,
"capabilities", export_proc->capabilities,
NULL);
}
return_values = export_proc->run_func (procedure, run_mode, image, return_values = export_proc->run_func (procedure, run_mode, image,
file, metadata, config, file, options, metadata,
export_proc->run_data); config, export_proc->run_data);
if (return_values != NULL && if (return_values != NULL &&
gimp_value_array_length (return_values) > 0 && gimp_value_array_length (return_values) > 0 &&
@ -418,6 +480,8 @@ gimp_export_procedure_run (GimpProcedure *procedure,
g_printerr ("%s: ERROR: the GimpExportProcedureConfig object was refed " g_printerr ("%s: ERROR: the GimpExportProcedureConfig object was refed "
"by plug-in, it MUST NOT do that!\n", G_STRFUNC); "by plug-in, it MUST NOT do that!\n", G_STRFUNC);
if (free_options)
g_object_unref (options);
g_object_unref (config); g_object_unref (config);
gimp_value_array_unref (remaining); gimp_value_array_unref (remaining);
@ -506,6 +570,22 @@ gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure)
ran_once = TRUE; ran_once = TRUE;
} }
static void
gimp_export_procedure_update_options (GimpProcedureConfig *config,
GParamSpec *param,
gpointer data)
{
GimpProcedure *procedure;
GimpExportProcedure *export_proc;
GimpExportOptions *options = GIMP_EXPORT_OPTIONS (data);
procedure = gimp_procedure_config_get_procedure (config);
export_proc = GIMP_EXPORT_PROCEDURE (procedure);
export_proc->create_func (procedure, config, options,
export_proc->create_data);
}
/* public functions */ /* public functions */
@ -529,7 +609,7 @@ gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure)
* *
* It automatically adds the standard * It automatically adds the standard
* *
* (#GimpRunMode, #GimpImage, #GimpDrawable, #GFile) * (#GimpRunMode, #GimpImage, #GFile, #GimpExportOptions)
* *
* arguments of an export procedure. It is possible to add additional * arguments of an export procedure. It is possible to add additional
* arguments. * arguments.
@ -578,6 +658,39 @@ gimp_export_procedure_new (GimpPlugIn *plug_in,
return GIMP_PROCEDURE (procedure); return GIMP_PROCEDURE (procedure);
} }
/**
* gimp_export_procedure_set_capabilities:
* @procedure: a #GimpProcedure.
* @capabilities: a #GimpExportCapabilities enum
* @create_func: (nullable): callback function to update export options
* @create_data: (nullable): data for @create_func
*
* Sets default #GimpExportCapabilities for image export.
*
* Since: 3.0
**/
void
gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
GimpExportCapabilities capabilities,
GimpExportOptionsEditFunc create_func,
gpointer create_data)
{
g_return_if_fail (GIMP_IS_EXPORT_PROCEDURE (procedure));
/* Assign default image capabilities */
g_object_set (procedure,
"capabilities", capabilities,
NULL);
/* TODO: Do more with this when we have user-specified callbacks for
* image capabilities */
if (create_func != NULL)
{
procedure->create_func = create_func;
procedure->create_data = create_data;
}
}
/** /**
* gimp_export_procedure_set_support_exif: * gimp_export_procedure_set_support_exif:
* @procedure: a #GimpProcedure. * @procedure: a #GimpProcedure.

View file

@ -35,6 +35,7 @@ G_BEGIN_DECLS
* @run_mode: the #GimpRunMode. * @run_mode: the #GimpRunMode.
* @image: the image to export. * @image: the image to export.
* @file: the #GFile to export to. * @file: the #GFile to export to.
* @options: the #GimpExportOptions settings.
* @metadata: metadata object prepared for the mimetype passed in * @metadata: metadata object prepared for the mimetype passed in
* gimp_file_procedure_set_mime_types() if export_metadata * gimp_file_procedure_set_mime_types() if export_metadata
* argument was set in gimp_export_procedure_new(). * argument was set in gimp_export_procedure_new().
@ -57,42 +58,66 @@ typedef GimpValueArray * (* GimpRunExportFunc) (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
/**
* GimpExportOptionsEditFunc:
* @procedure: the #GimpProcedure that runs.
* @config: the #GimpProcedureConfig.
* @options: the @GimpExportOptions object to update.
* @create_data: (closure): the create_data given.
*
* To be described.
*
* Since: 3.0
**/
typedef void (* GimpExportOptionsEditFunc) (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
#define GIMP_TYPE_EXPORT_PROCEDURE (gimp_export_procedure_get_type ()) #define GIMP_TYPE_EXPORT_PROCEDURE (gimp_export_procedure_get_type ())
G_DECLARE_FINAL_TYPE (GimpExportProcedure, gimp_export_procedure, GIMP, EXPORT_PROCEDURE, GimpFileProcedure) G_DECLARE_FINAL_TYPE (GimpExportProcedure, gimp_export_procedure, GIMP, EXPORT_PROCEDURE, GimpFileProcedure)
GimpProcedure * gimp_export_procedure_new (GimpPlugIn *plug_in, GimpProcedure * gimp_export_procedure_new (GimpPlugIn *plug_in,
const gchar *name, const gchar *name,
GimpPDBProcType proc_type, GimpPDBProcType proc_type,
gboolean export_metadata, gboolean export_metadata,
GimpRunExportFunc run_func, GimpRunExportFunc run_func,
gpointer run_data, gpointer run_data,
GDestroyNotify run_data_destroy); GDestroyNotify run_data_destroy);
void gimp_export_procedure_set_support_exif (GimpExportProcedure *procedure, void gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
gboolean supports); GimpExportCapabilities capabilities,
void gimp_export_procedure_set_support_iptc (GimpExportProcedure *procedure, GimpExportOptionsEditFunc create_func,
gboolean supports); gpointer create_data);
void gimp_export_procedure_set_support_xmp (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_profile (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_thumbnail (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_comment (GimpExportProcedure *procedure,
gboolean supports);
gboolean gimp_export_procedure_get_support_exif (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_iptc (GimpExportProcedure *procedure); void gimp_export_procedure_set_support_exif (GimpExportProcedure *procedure,
gboolean gimp_export_procedure_get_support_xmp (GimpExportProcedure *procedure); gboolean supports);
gboolean gimp_export_procedure_get_support_profile (GimpExportProcedure *procedure); void gimp_export_procedure_set_support_iptc (GimpExportProcedure *procedure,
gboolean gimp_export_procedure_get_support_thumbnail (GimpExportProcedure *procedure); gboolean supports);
gboolean gimp_export_procedure_get_support_comment (GimpExportProcedure *procedure); void gimp_export_procedure_set_support_xmp (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_profile (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_thumbnail (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_comment (GimpExportProcedure *procedure,
gboolean supports);
gboolean gimp_export_procedure_get_support_exif (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_iptc (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_xmp (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_profile (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_thumbnail (GimpExportProcedure *procedure);
gboolean gimp_export_procedure_get_support_comment (GimpExportProcedure *procedure);
G_END_DECLS G_END_DECLS

View file

@ -179,6 +179,7 @@ gimp_file_load_layers (GimpRunMode run_mode,
* @run_mode: The run mode. * @run_mode: The run mode.
* @image: Input image. * @image: Input image.
* @file: The file to save the image in. * @file: The file to save the image in.
* @options: Export option settings.
* *
* Saves a file by extension. * Saves a file by extension.
* *
@ -188,9 +189,10 @@ gimp_file_load_layers (GimpRunMode run_mode,
* Returns: TRUE on success. * Returns: TRUE on success.
**/ **/
gboolean gboolean
gimp_file_save (GimpRunMode run_mode, gimp_file_save (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file) GFile *file,
GimpExportOptions *options)
{ {
GimpValueArray *args; GimpValueArray *args;
GimpValueArray *return_vals; GimpValueArray *return_vals;
@ -200,6 +202,7 @@ gimp_file_save (GimpRunMode run_mode,
GIMP_TYPE_RUN_MODE, run_mode, GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE, image, GIMP_TYPE_IMAGE, image,
G_TYPE_FILE, file, G_TYPE_FILE, file,
GIMP_TYPE_EXPORT_OPTIONS, options,
G_TYPE_NONE); G_TYPE_NONE);
return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (), return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),

View file

@ -32,20 +32,21 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
GimpImage* gimp_file_load (GimpRunMode run_mode, GimpImage* gimp_file_load (GimpRunMode run_mode,
GFile *file); GFile *file);
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode, GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file); GFile *file);
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode, GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
gint *num_layers); gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode, gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file); GFile *file,
gboolean gimp_file_save_thumbnail (GimpImage *image, GimpExportOptions *options);
GFile *file); gboolean gimp_file_save_thumbnail (GimpImage *image,
GFile *file);
G_END_DECLS G_END_DECLS

View file

@ -293,6 +293,14 @@ _gimp_gp_param_def_to_param_spec (const GPParamDef *param_def)
return gimp_param_spec_object_array (name, nick, blurb, return gimp_param_spec_object_array (name, nick, blurb,
g_type_from_name (param_def->meta.m_id_array.type_name), g_type_from_name (param_def->meta.m_id_array.type_name),
flags); flags);
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
if (! strcmp (param_def->type_name, "GimpParamExportOptions"))
{
return gimp_param_spec_export_options (name, nick, blurb,
param_def->meta.m_export_options.capabilities,
flags);
}
break; break;
} }
@ -498,6 +506,14 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_id_array.type_name = param_def->meta.m_id_array.type_name =
(gchar *) g_type_name (GIMP_PARAM_SPEC_OBJECT_ARRAY (pspec)->object_type); (gchar *) g_type_name (GIMP_PARAM_SPEC_OBJECT_ARRAY (pspec)->object_type);
} }
else if (pspec_type == GIMP_TYPE_PARAM_EXPORT_OPTIONS)
{
GimpParamSpecExportOptions *eospec = GIMP_PARAM_SPEC_EXPORT_OPTIONS (pspec);
param_def->param_def_type = GP_PARAM_DEF_TYPE_EXPORT_OPTIONS;
param_def->meta.m_export_options.capabilities = eospec->capabilities;
}
else if (pspec_type == G_TYPE_PARAM_OBJECT && else if (pspec_type == G_TYPE_PARAM_OBJECT &&
value_type != G_TYPE_FILE && value_type != G_TYPE_FILE &&
value_type != GEGL_TYPE_COLOR) value_type != GEGL_TYPE_COLOR)
@ -924,6 +940,18 @@ gimp_gp_param_to_value (gpointer gimp,
{ {
g_value_set_object (value, get_unit_by_id (gimp, param->data.d_int)); g_value_set_object (value, get_unit_by_id (gimp, param->data.d_int));
} }
else if (g_type_is_a (G_VALUE_TYPE (value), GIMP_TYPE_EXPORT_OPTIONS))
{
GimpExportOptions *options = gimp_export_options_new ();
g_object_set (options,
"capabilities", param->data.d_export_options.capabilities,
NULL);
g_value_set_object (value, options);
g_object_unref (options);
}
else if (G_VALUE_HOLDS_PARAM (value)) else if (G_VALUE_HOLDS_PARAM (value))
{ {
GParamSpec *pspec = GParamSpec *pspec =
@ -1359,6 +1387,20 @@ gimp_value_to_gp_param (const GValue *value,
param->data.d_int = unit ? gimp_unit_get_id (unit) : -1; param->data.d_int = unit ? gimp_unit_get_id (unit) : -1;
} }
else if (g_type_is_a (G_VALUE_TYPE (value), GIMP_TYPE_EXPORT_OPTIONS))
{
GimpExportOptions *options = g_value_get_object (value);
gint capabilities = 0;
param->param_type = GP_PARAM_TYPE_INT;
if (options)
g_object_get (options,
"capabilities", &capabilities,
NULL);
param->data.d_export_options.capabilities = capabilities;
}
else if (G_VALUE_HOLDS_PARAM (value)) else if (G_VALUE_HOLDS_PARAM (value))
{ {
param->param_type = GP_PARAM_TYPE_PARAM_DEF; param->param_type = GP_PARAM_TYPE_PARAM_DEF;
@ -1460,6 +1502,9 @@ _gimp_gp_params_free (GPParam *params,
} }
break; break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
break;
case GP_PARAM_TYPE_PARAM_DEF: case GP_PARAM_TYPE_PARAM_DEF:
break; break;
} }

View file

@ -15,9 +15,6 @@ EXPORTS
gimp_drawable_preview_get_drawable gimp_drawable_preview_get_drawable
gimp_drawable_preview_get_type gimp_drawable_preview_get_type
gimp_drawable_preview_new_from_drawable gimp_drawable_preview_new_from_drawable
gimp_export_dialog_get_content_area
gimp_export_dialog_new
gimp_export_image
gimp_export_procedure_dialog_add_metadata gimp_export_procedure_dialog_add_metadata
gimp_export_procedure_dialog_get_type gimp_export_procedure_dialog_get_type
gimp_export_procedure_dialog_new gimp_export_procedure_dialog_new

View file

@ -33,7 +33,6 @@
#include <libgimp/gimpbrushchooser.h> #include <libgimp/gimpbrushchooser.h>
#include <libgimp/gimpdrawablechooser.h> #include <libgimp/gimpdrawablechooser.h>
#include <libgimp/gimpdrawablepreview.h> #include <libgimp/gimpdrawablepreview.h>
#include <libgimp/gimpexport.h>
#include <libgimp/gimpfontchooser.h> #include <libgimp/gimpfontchooser.h>
#include <libgimp/gimpgradientchooser.h> #include <libgimp/gimpgradientchooser.h>
#include <libgimp/gimpimagecombobox.h> #include <libgimp/gimpimagecombobox.h>

View file

@ -179,6 +179,7 @@ libgimp_sources_introspectable = [
'gimpchannel.c', 'gimpchannel.c',
'gimpdisplay.c', 'gimpdisplay.c',
'gimpdrawable.c', 'gimpdrawable.c',
'gimpexportoptions.c',
'gimpfileprocedure.c', 'gimpfileprocedure.c',
'gimpfont.c', 'gimpfont.c',
'gimpgimprc.c', 'gimpgimprc.c',
@ -239,6 +240,7 @@ libgimp_headers_introspectable = [
'gimpchannel.h', 'gimpchannel.h',
'gimpdisplay.h', 'gimpdisplay.h',
'gimpdrawable.h', 'gimpdrawable.h',
'gimpexportoptions.h',
'gimpfileprocedure.h', 'gimpfileprocedure.h',
'gimpfont.h', 'gimpfont.h',
'gimpgimprc.h', 'gimpgimprc.h',
@ -281,7 +283,6 @@ libgimpui_sources_introspectable = [
'gimpbrushchooser.c', 'gimpbrushchooser.c',
'gimpdrawablechooser.c', 'gimpdrawablechooser.c',
'gimpdrawablepreview.c', 'gimpdrawablepreview.c',
'gimpexport.c',
'gimpfontchooser.c', 'gimpfontchooser.c',
'gimpgradientchooser.c', 'gimpgradientchooser.c',
'gimpimagecombobox.c', 'gimpimagecombobox.c',
@ -318,7 +319,6 @@ libgimpui_headers_introspectable = [
'gimpbrushchooser.h', 'gimpbrushchooser.h',
'gimpdrawablechooser.h', 'gimpdrawablechooser.h',
'gimpdrawablepreview.h', 'gimpdrawablepreview.h',
'gimpexport.h',
'gimpfontchooser.h', 'gimpfontchooser.h',
'gimpgradientchooser.h', 'gimpgradientchooser.h',
'gimpimagecombobox.h', 'gimpimagecombobox.h',

View file

@ -55,6 +55,8 @@ EXPORTS
gimp_enum_value_get_help gimp_enum_value_get_help
gimp_env_init gimp_env_init
gimp_escape_uline gimp_escape_uline
gimp_export_options_get_type
gimp_export_options_new
gimp_file_get_utf8_name gimp_file_get_utf8_name
gimp_file_has_extension gimp_file_has_extension
gimp_file_show_in_file_manager gimp_file_show_in_file_manager
@ -124,6 +126,7 @@ EXPORTS
gimp_paint_application_mode_get_type gimp_paint_application_mode_get_type
gimp_param_array_get_type gimp_param_array_get_type
gimp_param_choice_get_type gimp_param_choice_get_type
gimp_param_export_options_get_type
gimp_param_float_array_get_type gimp_param_float_array_get_type
gimp_param_int32_array_get_type gimp_param_int32_array_get_type
gimp_param_memsize_get_type gimp_param_memsize_get_type
@ -131,6 +134,7 @@ EXPORTS
gimp_param_parasite_get_type gimp_param_parasite_get_type
gimp_param_spec_array gimp_param_spec_array
gimp_param_spec_choice gimp_param_spec_choice
gimp_param_spec_export_options
gimp_param_spec_float_array gimp_param_spec_float_array
gimp_param_spec_int32_array gimp_param_spec_int32_array
gimp_param_spec_memsize gimp_param_spec_memsize

View file

@ -29,6 +29,7 @@
#include <libgimpbase/gimpchoice.h> #include <libgimpbase/gimpchoice.h>
#include <libgimpbase/gimpcpuaccel.h> #include <libgimpbase/gimpcpuaccel.h>
#include <libgimpbase/gimpenv.h> #include <libgimpbase/gimpenv.h>
#include <libgimpbase/gimpexportoptions.h>
#include <libgimpbase/gimplimits.h> #include <libgimpbase/gimplimits.h>
#include <libgimpbase/gimpmemsize.h> #include <libgimpbase/gimpmemsize.h>
#include <libgimpbase/gimpmetadata.h> #include <libgimpbase/gimpmetadata.h>

View file

@ -44,14 +44,15 @@ G_BEGIN_DECLS
#endif #endif
typedef struct _GimpChoice GimpChoice; typedef struct _GimpChoice GimpChoice;
typedef struct _GimpParasite GimpParasite; typedef struct _GimpParasite GimpParasite;
typedef struct _GimpEnumDesc GimpEnumDesc; typedef struct _GimpEnumDesc GimpEnumDesc;
typedef struct _GimpFlagsDesc GimpFlagsDesc; typedef struct _GimpExportOptions GimpExportOptions;
typedef struct _GimpUnit GimpUnit; typedef struct _GimpFlagsDesc GimpFlagsDesc;
typedef struct _GimpValueArray GimpValueArray; typedef struct _GimpUnit GimpUnit;
typedef struct _GimpValueArray GimpValueArray;
typedef struct _GimpMetadata GimpMetadata; typedef struct _GimpMetadata GimpMetadata;
/** /**

View file

@ -0,0 +1,149 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpexportoptions.h
* Copyright (C) 2024 Alx Sa.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include "gimpbasetypes.h"
#include "gimpexportoptions.h"
enum
{
PROP_0,
PROP_CAPABILITIES,
N_PROPS
};
struct _GimpExportOptions
{
GObject parent_instance;
GimpExportCapabilities capabilities;
};
static void gimp_export_options_finalize (GObject *object);
static void gimp_export_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_export_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpExportOptions, gimp_export_options, G_TYPE_OBJECT)
#define parent_class gimp_export_options_parent_class
static GParamSpec *props[N_PROPS] = { NULL, };
static void
gimp_export_options_class_init (GimpExportOptionsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gimp_export_options_finalize;
object_class->get_property = gimp_export_options_get_property;
object_class->set_property = gimp_export_options_set_property;
/**
* GimpExportProcedure:capabilities:
*
* What #GimpExportCapabilities are supported
*
* Since: 3.0.0
*/
props[PROP_CAPABILITIES] = g_param_spec_int ("capabilities",
"Supported image capabilities",
NULL,
0, G_MAXINT, 0,
G_PARAM_CONSTRUCT |
G_PARAM_READWRITE);
g_object_class_install_properties (object_class, N_PROPS, props);
}
static void
gimp_export_options_init (GimpExportOptions *options)
{
options->capabilities = 0;
}
static void
gimp_export_options_finalize (GObject *object)
{
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_export_options_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpExportOptions *options = GIMP_EXPORT_OPTIONS (object);
switch (property_id)
{
case PROP_CAPABILITIES:
options->capabilities = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_export_options_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpExportOptions *options = GIMP_EXPORT_OPTIONS (object);
switch (property_id)
{
case PROP_CAPABILITIES:
g_value_set_int (value, options->capabilities);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
/* public functions */
GimpExportOptions *
gimp_export_options_new (void)
{
GimpExportOptions *options;
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS, NULL);
return options;
}

View file

@ -1,36 +1,41 @@
/* LIBGIMP - The GIMP Library /* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball * Copyright (C) 1995 Spencer Kimball and Peter Mattis
* *
* gimpexport.h * gimpexportoptions.h
* Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org> * Copyright (C) 2024 Alx Sa.
* *
* This library is free software: you can redistribute it and/or * This program is free software: you can redistribute it and/or modify
* modify it under the terms of the GNU Lesser General Public * it under the terms of the GNU General Public License as published by
* License as published by the Free Software Foundation; either * the Free Software Foundation; either version 3 of the License, or
* version 3 of the License, or (at your option) any later version. * (at your option) any later version.
* *
* This library is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Lesser General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU General Public License
* License along with this library. If not, see * along with this program. If not, see <https://www.gnu.org/licenses/>.
* <https://www.gnu.org/licenses/>.
*/ */
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION) #if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly." #error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif #endif
#ifndef __GIMP_EXPORT_H__
#define __GIMP_EXPORT_H__ #ifndef __GIMP_EXPORT_OPTIONS_H__
#define __GIMP_EXPORT_OPTIONS_H__
G_BEGIN_DECLS G_BEGIN_DECLS
/* For information look into the C source or the html documentation */ /* For information look into the C source or the html documentation */
#define GIMP_TYPE_EXPORT_OPTIONS (gimp_export_options_get_type ())
G_DECLARE_FINAL_TYPE (GimpExportOptions, gimp_export_options, GIMP, EXPORT_OPTIONS, GObject)
/** /**
* GimpExportCapabilities: * GimpExportCapabilities:
* @GIMP_EXPORT_CAN_HANDLE_RGB: Handles RGB images * @GIMP_EXPORT_CAN_HANDLE_RGB: Handles RGB images
@ -63,29 +68,9 @@ typedef enum
} GimpExportCapabilities; } GimpExportCapabilities;
/** GimpExportOptions * gimp_export_options_new (void);
* GimpExportReturn:
* @GIMP_EXPORT_IGNORE: The image is unmodified but export shall continue anyway
* @GIMP_EXPORT_EXPORT: The chosen transforms were applied to the image
*
* Possible return values of gimp_export_image().
**/
typedef enum
{
GIMP_EXPORT_IGNORE,
GIMP_EXPORT_EXPORT
} GimpExportReturn;
GtkWidget * gimp_export_dialog_new (const gchar *format_name,
const gchar *role,
const gchar *help_id);
GtkWidget * gimp_export_dialog_get_content_area (GtkWidget *dialog);
GimpExportReturn gimp_export_image (GimpImage **image,
GimpExportCapabilities capabilities);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_EXPORT_H__ */ #endif /* __GIMP_EXPORT_OPTIONS_H__ */

View file

@ -1210,3 +1210,85 @@ gimp_value_take_object_array (GValue *value,
g_value_take_boxed (value, array); g_value_take_boxed (value, array);
} }
/*
* GIMP_TYPE_PARAM_EXPORT_OPTIONS
*/
static void gimp_param_export_options_class_init (GParamSpecClass *klass);
static void gimp_param_export_options_init (GParamSpec *pspec);
GType
gimp_param_export_options_get_type (void)
{
static GType type = 0;
if (! type)
{
const GTypeInfo info =
{
sizeof (GParamSpecClass),
NULL, NULL,
(GClassInitFunc) gimp_param_export_options_class_init,
NULL, NULL,
sizeof (GimpParamSpecExportOptions),
0,
(GInstanceInitFunc) gimp_param_export_options_init
};
type = g_type_register_static (G_TYPE_PARAM_BOXED,
"GimpParamExportOptions", &info, 0);
}
return type;
}
static void
gimp_param_export_options_class_init (GParamSpecClass *klass)
{
klass->value_type = GIMP_TYPE_EXPORT_OPTIONS;
}
static void
gimp_param_export_options_init (GParamSpec *pspec)
{
GimpParamSpecExportOptions *options = GIMP_PARAM_SPEC_EXPORT_OPTIONS (pspec);
options->capabilities = 0;
}
/**
* gimp_param_spec_export_options:
* @name: Canonical name of the property specified.
* @nick: Nick name of the property specified.
* @blurb: Description of the property specified.
* @capabilities: Int representing the image export capabilities
* @flags: Flags for the property specified.
*
* Creates a new #GimpParamSpecExportOptions specifying a
* #G_TYPE_INT property.
*
* See g_param_spec_internal() for details on property names.
*
* Returns: (transfer full): The newly created #GimpParamSpecExportOptions.
*
* Since: 3.0
**/
GParamSpec *
gimp_param_spec_export_options (const gchar *name,
const gchar *nick,
const gchar *blurb,
gint capabilities,
GParamFlags flags)
{
GimpParamSpecExportOptions *options_spec;
options_spec = g_param_spec_internal (GIMP_TYPE_PARAM_EXPORT_OPTIONS,
name, nick, blurb, flags);
g_return_val_if_fail (options_spec, NULL);
options_spec->capabilities = capabilities;
return G_PARAM_SPEC (options_spec);
}

View file

@ -369,6 +369,31 @@ void gimp_value_take_object_array (GValue *value,
gsize length); gsize length);
/*
* GIMP_TYPE_PARAM_EXPORT_OPTIONS
*/
#define GIMP_TYPE_PARAM_EXPORT_OPTIONS (gimp_param_export_options_get_type ())
#define GIMP_PARAM_SPEC_EXPORT_OPTIONS(pspec) (G_TYPE_CHECK_INSTANCE_CAST ((pspec), GIMP_TYPE_PARAM_EXPORT_OPTIONS, GimpParamSpecExportOptions))
#define GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS(pspec) (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), GIMP_TYPE_PARAM_EXPORT_OPTIONS))
typedef struct _GimpParamSpecExportOptions GimpParamSpecExportOptions;
struct _GimpParamSpecExportOptions
{
GParamSpecBoxed parent_instance;
gint capabilities;
};
GType gimp_param_export_options_get_type (void) G_GNUC_CONST;
GParamSpec * gimp_param_spec_export_options (const gchar *name,
const gchar *nick,
const gchar *blurb,
gint capabilities,
GParamFlags flags);
G_END_DECLS G_END_DECLS
#endif /* __GIMP_PARAM_SPECS_H__ */ #endif /* __GIMP_PARAM_SPECS_H__ */

View file

@ -1278,6 +1278,13 @@ _gp_param_def_read (GIOChannel *channel,
user_data)) user_data))
return FALSE; return FALSE;
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
if (! _gimp_wire_read_int32 (channel,
(guint32 *) &param_def->meta.m_export_options.capabilities, 1,
user_data))
return FALSE;
break;
} }
return TRUE; return TRUE;
@ -1328,6 +1335,9 @@ _gp_param_def_destroy (GPParamDef *param_def)
case GP_PARAM_DEF_TYPE_ID_ARRAY: case GP_PARAM_DEF_TYPE_ID_ARRAY:
g_free (param_def->meta.m_id_array.type_name); g_free (param_def->meta.m_id_array.type_name);
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
break;
} }
} }
@ -1604,6 +1614,13 @@ _gp_param_def_write (GIOChannel *channel,
user_data)) user_data))
return FALSE; return FALSE;
break; break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
if (! _gimp_wire_write_int32 (channel,
(guint32 *) &param_def->meta.m_export_options.capabilities, 1,
user_data))
return FALSE;
break;
} }
return TRUE; return TRUE;
@ -2058,6 +2075,13 @@ _gp_params_read (GIOChannel *channel,
(*params)[i].data.d_parasite.data = NULL; (*params)[i].data.d_parasite.data = NULL;
break; break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
if (! _gimp_wire_read_int32 (channel,
(guint32 *) &(*params)[i].data.d_export_options.capabilities, 1,
user_data))
goto cleanup;
break;
case GP_PARAM_TYPE_PARAM_DEF: case GP_PARAM_TYPE_PARAM_DEF:
if (! _gp_param_def_read (channel, if (! _gp_param_def_read (channel,
&(*params)[i].data.d_param_def, &(*params)[i].data.d_param_def,
@ -2261,6 +2285,13 @@ _gp_params_write (GIOChannel *channel,
} }
break; break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
if (! _gimp_wire_write_int32 (channel,
(const guint32 *) &params[i].data.d_export_options.capabilities, 1,
user_data))
return;
break;
case GP_PARAM_TYPE_PARAM_DEF: case GP_PARAM_TYPE_PARAM_DEF:
if (! _gp_param_def_write (channel, if (! _gp_param_def_write (channel,
&params[i].data.d_param_def, &params[i].data.d_param_def,
@ -2330,6 +2361,9 @@ _gp_params_destroy (GPParam *params,
g_free (params[i].data.d_parasite.data); g_free (params[i].data.d_parasite.data);
break; break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
break;
case GP_PARAM_TYPE_PARAM_DEF: case GP_PARAM_TYPE_PARAM_DEF:
_gp_param_def_destroy (&params[i].data.d_param_def); _gp_param_def_destroy (&params[i].data.d_param_def);
break; break;

View file

@ -58,7 +58,8 @@ typedef enum
GP_PARAM_DEF_TYPE_STRING, GP_PARAM_DEF_TYPE_STRING,
GP_PARAM_DEF_TYPE_GEGL_COLOR, GP_PARAM_DEF_TYPE_GEGL_COLOR,
GP_PARAM_DEF_TYPE_ID, GP_PARAM_DEF_TYPE_ID,
GP_PARAM_DEF_TYPE_ID_ARRAY GP_PARAM_DEF_TYPE_ID_ARRAY,
GP_PARAM_DEF_TYPE_EXPORT_OPTIONS
} GPParamDefType; } GPParamDefType;
typedef enum typedef enum
@ -74,35 +75,38 @@ typedef enum
GP_PARAM_TYPE_PARASITE, GP_PARAM_TYPE_PARASITE,
GP_PARAM_TYPE_ARRAY, GP_PARAM_TYPE_ARRAY,
GP_PARAM_TYPE_ID_ARRAY, GP_PARAM_TYPE_ID_ARRAY,
GP_PARAM_TYPE_EXPORT_OPTIONS,
GP_PARAM_TYPE_PARAM_DEF GP_PARAM_TYPE_PARAM_DEF
} GPParamType; } GPParamType;
typedef struct _GPConfig GPConfig; typedef struct _GPConfig GPConfig;
typedef struct _GPTileReq GPTileReq; typedef struct _GPTileReq GPTileReq;
typedef struct _GPTileAck GPTileAck; typedef struct _GPTileAck GPTileAck;
typedef struct _GPTileData GPTileData; typedef struct _GPTileData GPTileData;
typedef struct _GPParamDef GPParamDef; typedef struct _GPParamDef GPParamDef;
typedef struct _GPParamDefInt GPParamDefInt; typedef struct _GPParamDefInt GPParamDefInt;
typedef struct _GPParamDefUnit GPParamDefUnit; typedef struct _GPParamDefUnit GPParamDefUnit;
typedef struct _GPParamDefEnum GPParamDefEnum; typedef struct _GPParamDefEnum GPParamDefEnum;
typedef struct _GPParamDefBoolean GPParamDefBoolean; typedef struct _GPParamDefBoolean GPParamDefBoolean;
typedef struct _GPParamDefFloat GPParamDefFloat; typedef struct _GPParamDefFloat GPParamDefFloat;
typedef struct _GPParamDefString GPParamDefString; typedef struct _GPParamDefString GPParamDefString;
typedef struct _GPParamDefChoice GPParamDefChoice; typedef struct _GPParamDefChoice GPParamDefChoice;
typedef struct _GPParamStrv GPParamStrv; typedef struct _GPParamStrv GPParamStrv;
typedef struct _GPParamDefGeglColor GPParamDefGeglColor; typedef struct _GPParamDefGeglColor GPParamDefGeglColor;
typedef struct _GPParamDefID GPParamDefID; typedef struct _GPParamDefID GPParamDefID;
typedef struct _GPParamDefIDArray GPParamDefIDArray; typedef struct _GPParamDefIDArray GPParamDefIDArray;
typedef struct _GPParam GPParam; typedef struct _GPParamDefExportOptions GPParamDefExportOptions;
typedef struct _GPParamArray GPParamArray; typedef struct _GPParam GPParam;
typedef struct _GPParamIDArray GPParamIDArray; typedef struct _GPParamArray GPParamArray;
typedef struct _GPParamColor GPParamColor; typedef struct _GPParamIDArray GPParamIDArray;
typedef struct _GPParamColorArray GPParamColorArray; typedef struct _GPParamColor GPParamColor;
typedef struct _GPProcRun GPProcRun; typedef struct _GPParamColorArray GPParamColorArray;
typedef struct _GPProcReturn GPProcReturn; typedef struct _GPParamExportOptions GPParamExportOptions;
typedef struct _GPProcInstall GPProcInstall; typedef struct _GPProcRun GPProcRun;
typedef struct _GPProcUninstall GPProcUninstall; typedef struct _GPProcReturn GPProcReturn;
typedef struct _GPProcInstall GPProcInstall;
typedef struct _GPProcUninstall GPProcUninstall;
struct _GPConfig struct _GPConfig
@ -223,6 +227,11 @@ struct _GPParamDefChoice
gchar *default_val; gchar *default_val;
}; };
struct _GPParamDefExportOptions
{
gint capabilities;
};
struct _GPParamDef struct _GPParamDef
{ {
GPParamDefType param_def_type; GPParamDefType param_def_type;
@ -235,16 +244,17 @@ struct _GPParamDef
union union
{ {
GPParamDefInt m_int; GPParamDefInt m_int;
GPParamDefUnit m_unit; GPParamDefUnit m_unit;
GPParamDefEnum m_enum; GPParamDefEnum m_enum;
GPParamDefBoolean m_boolean; GPParamDefBoolean m_boolean;
GPParamDefFloat m_float; GPParamDefFloat m_float;
GPParamDefString m_string; GPParamDefString m_string;
GPParamDefGeglColor m_gegl_color; GPParamDefGeglColor m_gegl_color;
GPParamDefID m_id; GPParamDefID m_id;
GPParamDefIDArray m_id_array; GPParamDefIDArray m_id_array;
GPParamDefChoice m_choice; GPParamDefChoice m_choice;
GPParamDefExportOptions m_export_options;
} meta; } meta;
}; };
@ -278,6 +288,11 @@ struct _GPParamColorArray
GPParamColor *colors; GPParamColor *colors;
}; };
struct _GPParamExportOptions
{
gint capabilities;
};
struct _GPParam struct _GPParam
{ {
GPParamType param_type; GPParamType param_type;
@ -285,18 +300,19 @@ struct _GPParam
union union
{ {
gint32 d_int; gint32 d_int;
gdouble d_float; gdouble d_float;
gchar *d_string; gchar *d_string;
gchar **d_strv; gchar **d_strv;
GBytes *d_bytes; GBytes *d_bytes;
GPParamColor d_gegl_color; GPParamColor d_gegl_color;
GPParamColorArray d_color_array; GPParamColorArray d_color_array;
GimpRGB d_color; GimpRGB d_color;
GimpParasite d_parasite; GimpParasite d_parasite;
GPParamArray d_array; GPParamArray d_array;
GPParamIDArray d_id_array; GPParamIDArray d_id_array;
GPParamDef d_param_def; GPParamExportOptions d_export_options;
GPParamDef d_param_def;
} data; } data;
}; };

View file

@ -54,6 +54,7 @@ libgimpbase_sources_introspectable = files(
'gimpchoice.c', 'gimpchoice.c',
'gimpcpuaccel.c', 'gimpcpuaccel.c',
'gimpenv.c', 'gimpenv.c',
'gimpexportoptions.c',
'gimpmemsize.c', 'gimpmemsize.c',
'gimpmetadata.c', 'gimpmetadata.c',
'gimpparamspecs.c', 'gimpparamspecs.c',
@ -87,6 +88,7 @@ libgimpbase_headers_introspectable = files(
'gimpchoice.h', 'gimpchoice.h',
'gimpcpuaccel.h', 'gimpcpuaccel.h',
'gimpenv.h', 'gimpenv.h',
'gimpexportoptions.h',
'gimplimits.h', 'gimplimits.h',
'gimpmemsize.h', 'gimpmemsize.h',
'gimpmetadata.h', 'gimpmetadata.h',

View file

@ -323,6 +323,14 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
spec->object_type, spec->object_type,
flags); flags);
} }
else if (GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS (pspec))
{
GimpParamSpecExportOptions *spec = GIMP_PARAM_SPEC_EXPORT_OPTIONS (pspec);
copy = gimp_param_spec_export_options (name, nick, blurb,
spec->capabilities,
flags);
}
else if (G_IS_PARAM_SPEC_OBJECT (pspec)) else if (G_IS_PARAM_SPEC_OBJECT (pspec))
{ {
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec); GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);

View file

@ -433,6 +433,15 @@ g_param_spec_uint ("$name",
"$blurb", "$blurb",
1, G_MAXUINT32, 1, 1, G_MAXUINT32, 1,
$flags) $flags)
CODE
}
elsif ($pdbtype eq 'export_options') {
$pspec = <<CODE;
gimp_param_spec_export_options ("$name",
"$nick",
"$blurb",
0,
$flags)
CODE CODE
} }
elsif ($pdbtype eq 'float') { elsif ($pdbtype eq 'float') {

View file

@ -232,7 +232,9 @@ HELP
{ name => 'image', type => 'image', { name => 'image', type => 'image',
desc => 'Input image' }, desc => 'Input image' },
{ name => 'file', type => 'file', { name => 'file', type => 'file',
desc => 'The file to save the image in' } desc => 'The file to save the image in' },
{ name => 'options', type => 'export_options',
desc => 'Export option settings' }
); );
%invoke = ( %invoke = (
@ -272,8 +274,10 @@ HELP
gimp_value_array_index (new_args, 1)); gimp_value_array_index (new_args, 1));
g_value_transform (gimp_value_array_index (args, 2), g_value_transform (gimp_value_array_index (args, 2),
gimp_value_array_index (new_args, 2)); gimp_value_array_index (new_args, 2));
g_value_transform (gimp_value_array_index (args, 3),
gimp_value_array_index (new_args, 3));
for (i = 3; i < proc->num_args; i++) for (i = 4; i < proc->num_args; i++)
if (G_IS_PARAM_SPEC_STRING (proc->args[i])) if (G_IS_PARAM_SPEC_STRING (proc->args[i]))
g_value_set_static_string (gimp_value_array_index (new_args, i), ""); g_value_set_static_string (gimp_value_array_index (new_args, i), "");

View file

@ -482,6 +482,18 @@ package Gimp::CodeGen::pdb;
set_value_func => 'g_value_set_uint ($value, $var)', set_value_func => 'g_value_set_uint ($value, $var)',
take_value_func => 'g_value_set_uint ($value, $var)' }, take_value_func => 'g_value_set_uint ($value, $var)' },
export_options => { name => 'EXPORT_OPTIONS',
gtype => 'GIMP_TYPE_EXPORT_OPTIONS',
type => 'GimpExportOptions *',
const_type => 'GimpExportOptions *',
init_value => 'NULL',
out_annotate => '(transfer none)',
get_value_func => '$var = g_value_get_object ($value)',
dup_value_func => '$var = g_value_dup_object (gimp_value_array_index ($value))',
set_value_func => 'g_value_set_object ($value, $var)',
take_value_func => 'g_value_set_object ($value, $var)',
headers => [ qw("libgimpbase/gimpbase.h") ] },
unit => { name => 'UNIT', unit => { name => 'UNIT',
gtype => 'GIMP_TYPE_UNIT', gtype => 'GIMP_TYPE_UNIT',
type => 'GimpUnit *', type => 'GimpUnit *',

View file

@ -68,6 +68,7 @@ static GimpValueArray * ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -148,6 +149,13 @@ ascii_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"txt,ansi,text"); "txt,ansi,text");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
for (i = 0; aa_formats[i]; i++); for (i = 0; aa_formats[i]; i++);
gimp_procedure_add_int_argument (procedure, "file-type", gimp_procedure_add_int_argument (procedure, "file-type",
@ -165,6 +173,7 @@ ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -184,11 +193,7 @@ ascii_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -71,6 +71,7 @@ static GimpValueArray * cel_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -183,6 +184,12 @@ cel_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"cel"); "cel");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_file_argument (procedure, "palette-file", gimp_procedure_add_file_argument (procedure, "palette-file",
_("_Palette file"), _("_Palette file"),
_("File to save palette to"), _("File to save palette to"),
@ -276,6 +283,7 @@ cel_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -287,10 +295,7 @@ cel_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);

View file

@ -157,6 +157,7 @@ static GimpValueArray * compressor_export (GimpProcedure *proc
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -176,6 +177,7 @@ static GimpImage * load_image (const CompressorEntry *comp
static GimpPDBStatusType export_image (const CompressorEntry *compressor, static GimpPDBStatusType export_image (const CompressorEntry *compressor,
GFile *file, GFile *file,
GimpImage *image, GimpImage *image,
GimpExportOptions *options,
gint n_drawables, gint n_drawables,
GList *drawables, GList *drawables,
gint32 run_mode, gint32 run_mode,
@ -401,9 +403,10 @@ compressor_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
{ {
const CompressorEntry *compressor = run_data; const CompressorEntry *compressor = run_data;
GimpPDBStatusType status; GimpPDBStatusType status;
@ -417,8 +420,8 @@ compressor_export (GimpProcedure *procedure,
gimp_plug_in_set_pdb_error_handler (gimp_procedure_get_plug_in (procedure), gimp_plug_in_set_pdb_error_handler (gimp_procedure_get_plug_in (procedure),
GIMP_PDB_ERROR_HANDLER_PLUGIN); GIMP_PDB_ERROR_HANDLER_PLUGIN);
status = export_image (compressor, file, image, n_drawables, drawables, status = export_image (compressor, file, image, options, n_drawables,
run_mode, &error); drawables, run_mode, &error);
g_list_free (drawables); g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error); return gimp_procedure_new_return_values (procedure, status, error);
@ -428,6 +431,7 @@ static GimpPDBStatusType
export_image (const CompressorEntry *compressor, export_image (const CompressorEntry *compressor,
GFile *file, GFile *file,
GimpImage *image, GimpImage *image,
GimpExportOptions *options,
gint n_drawables, gint n_drawables,
GList *drawables, GList *drawables,
gint32 run_mode, gint32 run_mode,
@ -448,7 +452,7 @@ export_image (const CompressorEntry *compressor,
tmp_file = gimp_temp_file (ext + 1); tmp_file = gimp_temp_file (ext + 1);
if (! (gimp_file_save (run_mode, image, tmp_file) && if (! (gimp_file_save (run_mode, image, tmp_file, options) &&
valid_file (tmp_file))) valid_file (tmp_file)))
{ {
g_file_delete (tmp_file, NULL, NULL); g_file_delete (tmp_file, NULL, NULL);

View file

@ -63,6 +63,7 @@ static GimpValueArray * csource_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -139,6 +140,11 @@ csource_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"c"); "c");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_string_aux_argument (procedure, "prefixed-name", gimp_procedure_add_string_aux_argument (procedure, "prefixed-name",
_("_Prefixed name"), _("_Prefixed name"),
_("Prefixed name"), _("Prefixed name"),
@ -205,6 +211,7 @@ csource_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -225,9 +232,7 @@ csource_export (GimpProcedure *procedure,
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
g_object_set (config, g_object_set (config,

View file

@ -96,6 +96,7 @@ static GimpValueArray * dicom_export (GimpProcedure *procedure
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -174,13 +175,13 @@ dicom_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("DICOM image")); gimp_procedure_set_menu_label (procedure, _("DICOM image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Loads files of the dicom file format", _("Loads files of the dicom file format"),
"Load a file in the DICOM standard " _("Load a file in the DICOM standard "
"format. The standard is defined at " "format. The standard is defined at "
"http://medical.nema.org/. The plug-in " "http://medical.nema.org/. The plug-in "
"currently only supports reading " "currently only supports reading "
"images with uncompressed pixel " "images with uncompressed pixel "
"sections.", "sections."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Dov Grobgeld", "Dov Grobgeld",
@ -207,16 +208,16 @@ dicom_create_procedure (GimpPlugIn *plug_in,
"Medicine image")); "Medicine image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Save file in the DICOM file format", _("Save file in the DICOM file format"),
"Save an image in the medical " _("Save an image in the medical "
"standard DICOM image formats. " "standard DICOM image formats. "
"The standard is defined at " "The standard is defined at "
"http://medical.nema.org/. The file " "http://medical.nema.org/. The file "
"format is defined in section 10 of " "format is defined in section 10 of "
"the standard. The files are saved " "the standard. The files are saved "
"uncompressed and the compulsory DICOM " "uncompressed and the compulsory DICOM "
"tags are filled with default dummy " "tags are filled with default dummy "
"values.", "values."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Dov Grobgeld", "Dov Grobgeld",
@ -227,6 +228,11 @@ dicom_create_procedure (GimpPlugIn *plug_in,
"image/x-dcm"); "image/x-dcm");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"dcm,dicom"); "dcm,dicom");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
} }
return procedure; return procedure;
@ -268,6 +274,7 @@ dicom_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -279,9 +286,7 @@ dicom_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);

View file

@ -74,6 +74,7 @@ static GimpValueArray * farbfeld_export (GimpProcedure *proced
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -174,6 +175,13 @@ farbfeld_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"ff"); "ff");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
} }
return procedure; return procedure;
@ -215,6 +223,7 @@ farbfeld_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -226,11 +235,7 @@ farbfeld_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, &error)) if (! export_image (file, image, drawables->data, &error))

View file

@ -71,6 +71,7 @@ static GimpValueArray * gbr_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -146,6 +147,13 @@ gbr_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
TRUE); TRUE);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "spacing", gimp_procedure_add_int_argument (procedure, "spacing",
_("Sp_acing"), _("Sp_acing"),
_("Spacing of the brush"), _("Spacing of the brush"),
@ -167,6 +175,7 @@ gbr_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -207,11 +216,7 @@ gbr_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -89,6 +89,7 @@ static GimpValueArray * goat_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -231,6 +232,13 @@ goat_create_procedure (GimpPlugIn *plug_in,
format->mime_type); format->mime_type);
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
format->extensions); format->extensions);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
} }
} }
@ -274,6 +282,7 @@ goat_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -286,11 +295,7 @@ goat_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, format->export_op, image, drawables->data, if (! export_image (file, format->export_op, image, drawables->data,

View file

@ -79,6 +79,7 @@ static GimpValueArray * gif_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -90,6 +91,11 @@ static gboolean export_image (GFile *file,
GObject *config, GObject *config,
GError **error); GError **error);
static void export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
static GimpPDBStatusType sanity_check (GFile *file, static GimpPDBStatusType sanity_check (GFile *file,
GimpImage **image, GimpImage **image,
GimpRunMode run_mode, GimpRunMode run_mode,
@ -179,6 +185,12 @@ gif_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"gif"); "gif");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
export_edit_options, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlace", gimp_procedure_add_boolean_argument (procedure, "interlace",
_("_Interlace"), _("_Interlace"),
_("Try to export as interlaced"), _("Try to export as interlaced"),
@ -257,6 +269,7 @@ gif_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -330,33 +343,8 @@ gif_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ {
GList *drawables; GList *drawables;
GimpExportCapabilities capabilities;
capabilities = (GIMP_EXPORT_CAN_HANDLE_INDEXED | export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
/* Create an exportable image based on the export options */
switch (run_mode)
{
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
{
gboolean as_animation;
g_object_get (config,
"as-animation", &as_animation,
NULL);
if (as_animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
break;
}
default:
break;
}
export = gimp_export_image (&image, capabilities);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, orig_image, if (! export_image (file, image, drawables->data, orig_image,
@ -1182,6 +1170,31 @@ export_image (GFile *file,
return TRUE; return TRUE;
} }
static void
export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data)
{
GimpExportCapabilities capabilities;
gboolean as_animation;
g_object_get (G_OBJECT (config),
"as-animation", &as_animation,
NULL);
capabilities = (GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (as_animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
g_object_set (G_OBJECT (options),
"capabilities", capabilities,
NULL);
}
static gboolean static gboolean
bad_bounds_dialog (void) bad_bounds_dialog (void)
{ {

View file

@ -86,6 +86,7 @@ static GimpValueArray * gih_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -180,6 +181,13 @@ gih_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
TRUE); TRUE);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "spacing", gimp_procedure_add_int_argument (procedure, "spacing",
_("Spacing (_percent)"), _("Spacing (_percent)"),
_("Spacing of the brush"), _("Spacing of the brush"),
@ -247,6 +255,7 @@ gih_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -378,11 +387,7 @@ gih_export (GimpProcedure *procedure,
} }
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS);
layers = gimp_image_list_layers (image); layers = gimp_image_list_layers (image);
n_drawables = g_list_length (layers); n_drawables = g_list_length (layers);

View file

@ -57,6 +57,7 @@ static GimpValueArray * header_export (GimpProcedure *procedure
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -116,8 +117,8 @@ header_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("C source code header")); gimp_procedure_set_menu_label (procedure, _("C source code header"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"saves files as C unsigned character " _("Saves files as C unsigned character "
"array", "array"),
"FIXME: write help", "FIXME: write help",
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
@ -131,6 +132,11 @@ header_create_procedure (GimpPlugIn *plug_in,
"image/x-chdr"); "image/x-chdr");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"h"); "h");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
return procedure; return procedure;
@ -141,6 +147,7 @@ header_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -152,9 +159,7 @@ header_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, if (! export_image (file, image, drawables->data,

View file

@ -85,6 +85,7 @@ static GimpValueArray * heif_export (GimpProcedure *pro
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -93,6 +94,7 @@ static GimpValueArray * heif_av1_export (GimpProcedure *pro
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -251,6 +253,11 @@ heif_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"heif,heic"); "heif,heic");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "quality", gimp_procedure_add_int_argument (procedure, "quality",
_("_Quality"), _("_Quality"),
_("Quality factor (0 = worst, 100 = best)"), _("Quality factor (0 = worst, 100 = best)"),
@ -359,6 +366,11 @@ heif_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"avif"); "avif");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_file_procedure_set_priority (GIMP_FILE_PROCEDURE (procedure), 100); gimp_file_procedure_set_priority (GIMP_FILE_PROCEDURE (procedure), 100);
gimp_procedure_add_int_argument (procedure, "quality", gimp_procedure_add_int_argument (procedure, "quality",
@ -486,6 +498,7 @@ heif_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata_unused, GimpMetadata *metadata_unused,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -506,9 +519,7 @@ heif_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
@ -548,6 +559,7 @@ heif_av1_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata_unused, GimpMetadata *metadata_unused,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -569,9 +581,7 @@ heif_av1_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -88,6 +88,7 @@ static GimpValueArray * html_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -257,6 +258,7 @@ html_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)

View file

@ -70,6 +70,7 @@ static GimpValueArray *jpegxl_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -182,6 +183,12 @@ jpegxl_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"jxl"); "jxl");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "lossless", gimp_procedure_add_boolean_argument (procedure, "lossless",
_("L_ossless"), _("L_ossless"),
_("Use lossless compression"), _("Use lossless compression"),
@ -2115,6 +2122,7 @@ jpegxl_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -2136,10 +2144,7 @@ jpegxl_export (GimpProcedure *procedure,
} }
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -161,6 +161,7 @@ static GimpValueArray * mng_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -272,6 +273,14 @@ mng_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"mng"); "mng");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
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,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlaced", gimp_procedure_add_boolean_argument (procedure, "interlaced",
_("_Interlace"), _("_Interlace"),
_("Use interlacing"), _("Use interlacing"),
@ -358,6 +367,7 @@ mng_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -373,17 +383,12 @@ mng_export (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
{ {
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
if (! mng_save_dialog (image, procedure, G_OBJECT (config))) if (! mng_save_dialog (image, procedure, G_OBJECT (config)))
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
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); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -58,6 +58,7 @@ static GimpValueArray * pat_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -131,6 +132,13 @@ pat_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
TRUE); TRUE);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_string_argument (procedure, "description", gimp_procedure_add_string_argument (procedure, "description",
_("_Description"), _("_Description"),
_("Short description of the pattern"), _("Short description of the pattern"),
@ -146,6 +154,7 @@ pat_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -186,11 +195,7 @@ pat_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -80,6 +80,7 @@ static GimpValueArray * pcx_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -292,6 +293,12 @@ pcx_create_procedure (GimpPlugIn *plug_in,
"image/x-pcx"); "image/x-pcx");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pcx,pcc"); "pcx,pcc");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
return procedure; return procedure;
@ -364,6 +371,7 @@ pcx_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -375,10 +383,7 @@ pcx_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, if (! export_image (file,

View file

@ -187,6 +187,7 @@ static GimpValueArray * pdf_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -196,10 +197,16 @@ static GimpValueArray * pdf_export_multi (GimpProcedure *procedur
static GimpPDBStatusType pdf_export_image (GimpProcedure *procedure, static GimpPDBStatusType pdf_export_image (GimpProcedure *procedure,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpExportOptions *options,
gboolean single_image, gboolean single_image,
gboolean show_progress, gboolean show_progress,
GError **error); GError **error);
static void export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
static void init_image_list_defaults (GimpImage *image); static void init_image_list_defaults (GimpImage *image);
static void validate_image_list (void); static void validate_image_list (void);
@ -333,6 +340,14 @@ pdf_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pdf"); "pdf");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
export_edit_options, NULL);
gimp_procedure_add_boolean_argument (procedure, "vectorize", gimp_procedure_add_boolean_argument (procedure, "vectorize",
_("Convert _bitmaps to vector graphics where possible"), _("Convert _bitmaps to vector graphics where possible"),
_("Convert bitmaps to vector graphics where possible"), _("Convert bitmaps to vector graphics where possible"),
@ -470,6 +485,7 @@ pdf_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -495,7 +511,7 @@ pdf_export (GimpProcedure *procedure,
} }
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
status = pdf_export_image (procedure, config, TRUE, status = pdf_export_image (procedure, config, options, TRUE,
(run_mode != GIMP_RUN_NONINTERACTIVE), (run_mode != GIMP_RUN_NONINTERACTIVE),
&error); &error);
@ -510,6 +526,7 @@ pdf_export_multi (GimpProcedure *procedure,
GError *error = NULL; GError *error = NULL;
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode; GimpRunMode run_mode;
GimpExportOptions *options = NULL;
gchar *uri; gchar *uri;
const gint32 *image_ids = NULL; const gint32 *image_ids = NULL;
GimpImage *image = NULL; GimpImage *image = NULL;
@ -524,6 +541,8 @@ pdf_export_multi (GimpProcedure *procedure,
"images", &image_ids, "images", &image_ids,
NULL); NULL);
options = gimp_export_options_new ();
if (uri != NULL) if (uri != NULL)
{ {
file = g_file_new_for_uri (uri); file = g_file_new_for_uri (uri);
@ -549,7 +568,7 @@ pdf_export_multi (GimpProcedure *procedure,
} }
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
status = pdf_export_image (procedure, config, FALSE, status = pdf_export_image (procedure, config, options, FALSE,
(run_mode != GIMP_RUN_NONINTERACTIVE), (run_mode != GIMP_RUN_NONINTERACTIVE),
&error); &error);
@ -635,21 +654,19 @@ get_missing_fonts (GList *layers)
static GimpPDBStatusType static GimpPDBStatusType
pdf_export_image (GimpProcedure *procedure, pdf_export_image (GimpProcedure *procedure,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpExportOptions *options,
gboolean single_image, gboolean single_image,
gboolean show_progress, gboolean show_progress,
GError **error) GError **error)
{ {
cairo_surface_t *pdf_file; cairo_surface_t *pdf_file;
cairo_t *cr; cairo_t *cr;
GimpExportCapabilities capabilities; FILE *fp;
FILE *fp; gint i;
gint i; gboolean layers_as_pages = FALSE;
gboolean apply_masks; gboolean fill_background_color;
gboolean layers_as_pages = FALSE;
gboolean fill_background_color;
g_object_get (config, g_object_get (config,
"apply-masks", &apply_masks,
"fill-background-color", &fill_background_color, "fill-background-color", &fill_background_color,
NULL); NULL);
@ -682,17 +699,6 @@ pdf_export_image (GimpProcedure *procedure,
cr = cairo_create (pdf_file); cr = cairo_create (pdf_file);
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
/* This seems counter-intuitive, but not setting the mask capability
* will apply any layer mask upon gimp_export_image().
*/
if (! apply_masks)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS;
for (i = 0; i < multi_page.image_count; i++) for (i = 0; i < multi_page.image_count; i++)
{ {
GimpImage *image = multi_page.images[i]; GimpImage *image = multi_page.images[i];
@ -716,8 +722,8 @@ pdf_export_image (GimpProcedure *procedure,
*/ */
cairo_save (cr); cairo_save (cr);
if (! (gimp_export_image (&image, if (! (gimp_export_options_get_image (options,
capabilities) == GIMP_EXPORT_EXPORT)) &image) == GIMP_EXPORT_EXPORT))
{ {
/* gimp_drawable_histogram() only works within the bounds of /* gimp_drawable_histogram() only works within the bounds of
* the selection, which is a problem (see issue #2431). * the selection, which is a problem (see issue #2431).
@ -823,6 +829,34 @@ pdf_export_image (GimpProcedure *procedure,
return GIMP_PDB_SUCCESS; return GIMP_PDB_SUCCESS;
} }
static void
export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data)
{
GimpExportCapabilities capabilities;
gboolean apply_masks;
g_object_get (G_OBJECT (config),
"apply-masks", &apply_masks,
NULL);
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
if (! apply_masks)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS;
g_object_set (G_OBJECT (options),
"capabilities", capabilities,
NULL);
}
/******************************************************/ /******************************************************/
/* Beginning of parameter handling functions */ /* Beginning of parameter handling functions */
/******************************************************/ /******************************************************/

View file

@ -101,6 +101,7 @@ static GimpValueArray * pix_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -172,10 +173,10 @@ pix_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("Alias Pix image")); gimp_procedure_set_menu_label (procedure, _("Alias Pix image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Loads files of the Alias|Wavefront " _("Loads files of the Alias|Wavefront "
"or Esm Software Pix file format", "or Esm Software Pix file format"),
"Loads files of the Alias|Wavefront " _("Loads files of the Alias|Wavefront "
"or Esm Software Pix file format", "or Esm Software Pix file format"),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Michael Taylor", "Michael Taylor",
@ -203,10 +204,10 @@ pix_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("Alias Pix image")); gimp_procedure_set_menu_label (procedure, _("Alias Pix image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Export file in the Alias|Wavefront " _("Export file in the Alias|Wavefront "
"pix/matte file format", "pix/matte file format"),
"Export file in the Alias|Wavefront " _("Export file in the Alias|Wavefront "
"pix/matte file format", "pix/matte file format"),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Michael Taylor", "Michael Taylor",
@ -215,6 +216,12 @@ pix_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pix,matte,mask,alpha,als"); "pix,matte,mask,alpha,als");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
return procedure; return procedure;
@ -256,6 +263,7 @@ pix_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -267,10 +275,7 @@ pix_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, &error)) if (! export_image (file, image, drawables->data, &error))

View file

@ -97,6 +97,7 @@ static GimpValueArray * png_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -234,6 +235,13 @@ png_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"png"); "png");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlaced", gimp_procedure_add_boolean_argument (procedure, "interlaced",
_("_Interlacing (Adam7)"), _("_Interlacing (Adam7)"),
_("Use Adam7 interlacing"), _("Use Adam7 interlacing"),
@ -367,6 +375,7 @@ png_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -382,11 +391,7 @@ png_export (GimpProcedure *procedure,
orig_image = image; orig_image = image;
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
alpha = gimp_drawable_has_alpha (drawables->data); alpha = gimp_drawable_has_alpha (drawables->data);

View file

@ -155,6 +155,7 @@ static GimpValueArray * pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -367,6 +368,12 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pnm"); "pnm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"), _("_Data formatting"),
_("Whether to export ASCII or raw output"), _("Whether to export ASCII or raw output"),
@ -406,6 +413,10 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pbm"); "pbm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_BITMAP,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"), _("_Data formatting"),
_("Whether to export ASCII or raw output"), _("Whether to export ASCII or raw output"),
@ -445,6 +456,10 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pgm"); "pgm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"), _("_Data formatting"),
_("Whether to export ASCII or raw output"), _("Whether to export ASCII or raw output"),
@ -484,6 +499,11 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"ppm"); "ppm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw", gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"), _("_Data formatting"),
_("Whether to export ASCII or raw output"), _("Whether to export ASCII or raw output"),
@ -521,6 +541,13 @@ pnm_create_procedure (GimpPlugIn *plug_in,
"image/x-portable-arbitrarymap"); "image/x-portable-arbitrarymap");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pam"); "pam");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
else if (! strcmp (name, PFM_EXPORT_PROC)) else if (! strcmp (name, PFM_EXPORT_PROC))
{ {
@ -550,6 +577,12 @@ pnm_create_procedure (GimpPlugIn *plug_in,
"image/x-portable-floatmap"); "image/x-portable-floatmap");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pfm"); "pfm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
} }
return procedure; return procedure;
@ -591,6 +624,7 @@ pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -613,45 +647,7 @@ pnm_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
switch (file_type) export = gimp_export_options_get_image (options, &image);
{
case FILE_TYPE_PNM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
break;
case FILE_TYPE_PBM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_BITMAP);
break;
case FILE_TYPE_PGM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_GRAY);
break;
case FILE_TYPE_PPM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
break;
case FILE_TYPE_PAM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
break;
case FILE_TYPE_PFM:
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
break;
}
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -159,6 +159,7 @@ static GimpValueArray * ps_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -514,6 +515,12 @@ ps_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_handles_remote (GIMP_FILE_PROCEDURE (procedure),
TRUE); TRUE);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_double_argument (procedure, "width", gimp_procedure_add_double_argument (procedure, "width",
_("_Width"), _("_Width"),
_("Width of the image in PostScript file " _("Width of the image in PostScript file "
@ -734,6 +741,7 @@ ps_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -772,10 +780,7 @@ ps_export (GimpProcedure *procedure,
break; break;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -595,6 +595,7 @@ static GimpValueArray * psp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -713,6 +714,14 @@ psp_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"psp,tub"); "psp,tub");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
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,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "compression", gimp_procedure_add_choice_argument (procedure, "compression",
_("_Data Compression"), _("_Data Compression"),
_("Type of compression"), _("Type of compression"),
@ -763,6 +772,7 @@ psp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -783,12 +793,7 @@ psp_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
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); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -76,6 +76,7 @@ static GimpValueArray * qoi_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -178,6 +179,14 @@ qoi_create_procedure (GimpPlugIn *plug_in,
"image/qoi"); "image/qoi");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"qoi"); "qoi");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
} }
return procedure; return procedure;
@ -219,6 +228,7 @@ qoi_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -230,11 +240,7 @@ qoi_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, &error)) if (! export_image (file, image, drawables->data, &error))

View file

@ -175,6 +175,7 @@ static GimpValueArray * raw_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -513,6 +514,13 @@ raw_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"data,raw"); "data,raw");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "planar-configuration", gimp_procedure_add_choice_argument (procedure, "planar-configuration",
_("Planar configuration"), _("Planar configuration"),
_("How color pixel data are stored"), _("How color pixel data are stored"),
@ -656,6 +664,7 @@ raw_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -677,11 +686,7 @@ raw_export (GimpProcedure *procedure,
NULL); NULL);
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)

View file

@ -121,6 +121,7 @@ static GimpValueArray * sunras_export (GimpProcedure *procedur
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -275,8 +276,8 @@ sunras_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("SUN Rasterfile image")); gimp_procedure_set_menu_label (procedure, _("SUN Rasterfile image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Load file of the SunRaster file format", _("Load file of the SunRaster file format"),
"Load file of the SunRaster file format", _("Load file of the SunRaster file format"),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Peter Kirchgessner", "Peter Kirchgessner",
@ -301,11 +302,11 @@ sunras_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("SUN Rasterfile image")); gimp_procedure_set_menu_label (procedure, _("SUN Rasterfile image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Export file in the SunRaster file " _("Export file in the SunRaster file "
"format", "format"),
"SUNRAS exporting handles all image " _("SUNRAS exporting handles all image "
"types except those with alpha " "types except those with alpha "
"channels.", "channels."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Peter Kirchgessner", "Peter Kirchgessner",
@ -319,6 +320,12 @@ sunras_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"im1,im8,im24,im32,rs,ras,sun"); "im1,im8,im24,im32,rs,ras,sun");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "rle", gimp_procedure_add_choice_argument (procedure, "rle",
_("_Data Formatting"), _("_Data Formatting"),
_("Use standard or Run-Length Encoded output"), _("Use standard or Run-Length Encoded output"),
@ -368,6 +375,7 @@ sunras_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -387,10 +395,7 @@ sunras_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -185,6 +185,7 @@ static GimpValueArray * tga_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -302,6 +303,13 @@ tga_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"tga"); "tga");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "rle", gimp_procedure_add_boolean_argument (procedure, "rle",
_("_Use RLE compression"), _("_Use RLE compression"),
_("Use RLE compression"), _("Use RLE compression"),
@ -354,6 +362,7 @@ tga_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -368,16 +377,12 @@ tga_export (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
{ {
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
if (! save_dialog (image, procedure, G_OBJECT (config))) if (! save_dialog (image, procedure, G_OBJECT (config)))
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -89,6 +89,7 @@ static GimpValueArray * xbm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -209,6 +210,11 @@ xbm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"xbm,icon,bitmap"); "xbm,icon,bitmap");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_BITMAP |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "save-comment", gimp_procedure_add_boolean_argument (procedure, "save-comment",
_("_Write comment"), _("_Write comment"),
_("Write a comment at the beginning of the file."), _("Write a comment at the beginning of the file."),
@ -337,6 +343,7 @@ xbm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -356,9 +363,7 @@ xbm_export (GimpProcedure *procedure,
mask_basename = g_strdup (init_prefix (file, G_OBJECT (config))); mask_basename = g_strdup (init_prefix (file, G_OBJECT (config)));
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_BITMAP |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)

View file

@ -173,6 +173,7 @@ static GimpValueArray * xmc_export (GimpProcedure *pro
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -364,6 +365,13 @@ xmc_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
XCURSOR_EXTENSION); XCURSOR_EXTENSION);
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_NEEDS_ALPHA,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "hot-spot-x", gimp_procedure_add_int_argument (procedure, "hot-spot-x",
_("Hot spot _X"), _("Hot spot _X"),
_("X-coordinate of hot spot " _("X-coordinate of hot spot "
@ -525,6 +533,7 @@ xmc_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -592,11 +601,7 @@ xmc_export (GimpProcedure *procedure,
break; break;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_NEEDS_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -115,6 +115,7 @@ static GimpValueArray * xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -197,16 +198,16 @@ xpm_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("X PixMap image")); gimp_procedure_set_menu_label (procedure, _("X PixMap image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Load files in XPM (X11 Pixmap) format.", _("Load files in XPM (X11 Pixmap) format."),
"Load files in XPM (X11 Pixmap) format. " _("Load files in XPM (X11 Pixmap) format. "
"XPM is a portable image format " "XPM is a portable image format "
"designed to be included in C source " "designed to be included in C source "
"code. XLib provides utility functions " "code. XLib provides utility functions "
"to read this format. Newer code should " "to read this format. Newer code should "
"however be using gdk-pixbuf-csource " "however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, " "instead. XPM supports colored images, "
"unlike the XBM format which XPM was " "unlike the XBM format which XPM was "
"designed to replace.", "designed to replace."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Spencer Kimball & Peter Mattis & " "Spencer Kimball & Peter Mattis & "
@ -232,16 +233,16 @@ xpm_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("X PixMap image")); gimp_procedure_set_menu_label (procedure, _("X PixMap image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Export files in XPM (X11 Pixmap) format.", _("Export files in XPM (X11 Pixmap) format."),
"Export files in XPM (X11 Pixmap) format. " _("Export files in XPM (X11 Pixmap) format. "
"XPM is a portable image format " "XPM is a portable image format "
"designed to be included in C source " "designed to be included in C source "
"code. XLib provides utility functions " "code. XLib provides utility functions "
"to read this format. Newer code should " "to read this format. Newer code should "
"however be using gdk-pixbuf-csource " "however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, " "instead. XPM supports colored images, "
"unlike the XBM format which XPM was " "unlike the XBM format which XPM was "
"designed to replace.", "designed to replace."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Spencer Kimball & Peter Mattis & " "Spencer Kimball & Peter Mattis & "
@ -256,6 +257,13 @@ xpm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"xpm"); "xpm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "threshold", gimp_procedure_add_int_argument (procedure, "threshold",
_("_Threshold"), _("_Threshold"),
_("Alpha threshold"), _("Alpha threshold"),
@ -302,6 +310,7 @@ xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -313,17 +322,13 @@ xpm_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
{ {
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
if (gimp_drawable_has_alpha (drawables->data)) if (gimp_drawable_has_alpha (drawables->data))
if (! save_dialog (image, procedure, G_OBJECT (config))) if (! save_dialog (image, procedure, G_OBJECT (config)))
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;

View file

@ -170,6 +170,7 @@ static GimpValueArray * xwd_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -371,6 +372,12 @@ xwd_create_procedure (GimpPlugIn *plug_in,
"image/x-xwindowdump"); "image/x-xwindowdump");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"xwd"); "xwd");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
return procedure; return procedure;
@ -412,6 +419,7 @@ xwd_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -423,10 +431,7 @@ xwd_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, &error)) if (! export_image (file, image, drawables->data, &error))

View file

@ -289,7 +289,8 @@ send_image (GObject *config,
GimpDrawable **drawables, GimpDrawable **drawables,
gint32 run_mode) gint32 run_mode)
{ {
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportOptions *options = NULL;
gchar *ext; gchar *ext;
GFile *tmpfile; GFile *tmpfile;
gchar *tmpname; gchar *tmpname;
@ -329,7 +330,9 @@ send_image (GObject *config,
tmpfile = gimp_temp_file (ext + 1); tmpfile = gimp_temp_file (ext + 1);
tmpname = g_file_get_path (tmpfile); tmpname = g_file_get_path (tmpfile);
if (! (gimp_file_save (run_mode, image, tmpfile) && options = gimp_export_options_new ();
if (! (gimp_file_save (run_mode, image, tmpfile, options) &&
valid_file (tmpfile))) valid_file (tmpfile)))
{ {
goto error; goto error;

View file

@ -100,6 +100,7 @@ static GimpValueArray * bmp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -194,6 +195,13 @@ bmp_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"bmp"); "bmp");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "use-rle", gimp_procedure_add_boolean_argument (procedure, "use-rle",
_("Ru_n-Length Encoded"), _("Ru_n-Length Encoded"),
_("Use run-length-encoding compression " _("Use run-length-encoding compression "
@ -256,6 +264,7 @@ bmp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -270,11 +279,7 @@ bmp_export (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
status = export_image (file, image, drawables->data, run_mode, status = export_image (file, image, drawables->data, run_mode,

View file

@ -77,6 +77,7 @@ static GimpValueArray * dds_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -183,6 +184,14 @@ dds_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"dds"); "dds");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
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,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "compression-format", gimp_procedure_add_choice_argument (procedure, "compression-format",
_("Compressio_n"), _("Compressio_n"),
_("Compression format"), _("Compression format"),
@ -370,6 +379,7 @@ dds_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -385,12 +395,7 @@ dds_export (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init ("dds"); gimp_ui_init ("dds");
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
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); drawables = gimp_image_list_layers (image);
g_object_get (config, g_object_get (config,

View file

@ -98,6 +98,7 @@ static GimpValueArray * fits_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -239,6 +240,12 @@ fits_create_procedure (GimpPlugIn *plug_in,
"image/x-fits"); "image/x-fits");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"fit,fits"); "fit,fits");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
} }
return procedure; return procedure;
@ -288,6 +295,7 @@ fits_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -305,10 +313,7 @@ fits_export (GimpProcedure *procedure,
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init (PLUG_IN_BINARY); gimp_ui_init (PLUG_IN_BINARY);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);

View file

@ -105,6 +105,7 @@ static GimpValueArray * fli_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -234,6 +235,13 @@ fli_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"fli,flc"); "fli,flc");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "from-frame", gimp_procedure_add_int_argument (procedure, "from-frame",
_("_From frame"), _("_From frame"),
_("Export beginning from this frame"), _("Export beginning from this frame"),
@ -334,6 +342,7 @@ fli_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -353,11 +362,7 @@ fli_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -460,14 +460,15 @@ icns_export_image (GFile *file,
/* MacOS X format icons */ /* MacOS X format icons */
if (match != -1 && duplicates[match] == 0) if (match != -1 && duplicates[match] == 0)
{ {
GimpProcedure *procedure; GimpProcedure *procedure;
GimpValueArray *return_vals; GimpValueArray *return_vals;
GimpImage *temp_image; GimpImage *temp_image;
GimpLayer *temp_layer; GimpLayer *temp_layer;
GFile *temp_file = NULL; GFile *temp_file = NULL;
FILE *temp_fp; GimpExportOptions *options = gimp_export_options_new ();
gint temp_size; FILE *temp_fp;
gint macos_size; gint temp_size;
gint macos_size;
temp_file = gimp_temp_file ("png"); temp_file = gimp_temp_file ("png");
@ -483,6 +484,7 @@ icns_export_image (GFile *file,
"run-mode", GIMP_RUN_NONINTERACTIVE, "run-mode", GIMP_RUN_NONINTERACTIVE,
"image", temp_image, "image", temp_image,
"file", temp_file, "file", temp_file,
"options", options,
"interlaced", FALSE, "interlaced", FALSE,
"compression", 9, "compression", 9,
"bkgd", FALSE, "bkgd", FALSE,

View file

@ -80,6 +80,7 @@ static GimpValueArray * icns_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -271,6 +272,7 @@ icns_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)

View file

@ -97,6 +97,7 @@ static GimpValueArray * ico_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -104,6 +105,7 @@ static GimpValueArray * cur_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -111,6 +113,7 @@ static GimpValueArray * ani_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -575,6 +578,7 @@ ico_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -594,6 +598,7 @@ cur_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -643,7 +648,8 @@ ani_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpMetadata *metadata, GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
{ {

View file

@ -74,6 +74,7 @@ static GimpValueArray * jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -197,6 +198,11 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"jpg,jpeg,jpe"); "jpg,jpeg,jpe");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
/* See bugs #63610 and #61088 for a discussion about the quality /* See bugs #63610 and #61088 for a discussion about the quality
* settings * settings
*/ */
@ -415,6 +421,7 @@ jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -518,9 +525,7 @@ jpeg_export (GimpProcedure *procedure,
"original-num-quant-tables", orig_num_quant_tables, "original-num-quant-tables", orig_num_quant_tables,
NULL); NULL);
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)

View file

@ -72,6 +72,7 @@ static GimpValueArray * psd_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -134,10 +135,10 @@ psd_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("Photoshop image")); gimp_procedure_set_menu_label (procedure, _("Photoshop image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Loads images from the Photoshop " _("Loads images from the Photoshop "
"PSD and PSB file formats", "PSD and PSB file formats"),
"This plug-in loads images in Adobe " _("This plug-in loads images in Adobe "
"Photoshop (TM) native PSD and PSB format.", "Photoshop (TM) native PSD and PSB format."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"John Marshall", "John Marshall",
@ -163,11 +164,11 @@ psd_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("Photoshop image (merged)")); gimp_procedure_set_menu_label (procedure, _("Photoshop image (merged)"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Loads images from the Photoshop " _("Loads images from the Photoshop "
"PSD and PSB file formats", "PSD and PSB file formats"),
"This plug-in loads the merged image " _("This plug-in loads the merged image "
"data in Adobe Photoshop (TM) native " "data in Adobe Photoshop (TM) native "
"PSD and PSB format.", "PSD and PSB format."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Ell", "Ell",
@ -192,11 +193,11 @@ psd_create_procedure (GimpPlugIn *plug_in,
psd_load_thumb, NULL, NULL); psd_load_thumb, NULL, NULL);
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Loads thumbnails from the " _("Loads thumbnails from the "
"Photoshop PSD file format", "Photoshop PSD file format"),
"This plug-in loads thumbnail images " _("This plug-in loads thumbnail images "
"from Adobe Photoshop (TM) native " "from Adobe Photoshop (TM) native "
"PSD format files.", "PSD format files."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"John Marshall", "John Marshall",
@ -214,14 +215,14 @@ psd_create_procedure (GimpPlugIn *plug_in,
gimp_procedure_set_menu_label (procedure, _("Photoshop image")); gimp_procedure_set_menu_label (procedure, _("Photoshop image"));
gimp_procedure_set_documentation (procedure, gimp_procedure_set_documentation (procedure,
"Saves files in the Photoshop(tm) " _("Saves files in the Photoshop (TM) "
"PSD file format", "PSD file format"),
"This filter saves files of Adobe " _("This filter saves files of Adobe "
"Photoshop(tm) native PSD format. " "Photoshop (TM) native PSD format. "
"These files may be of any image type " "These files may be of any image type "
"supported by GIMP, with or without " "supported by GIMP, with or without "
"layers, layer masks, aux channels " "layers, layer masks, aux channels "
"and guides.", "and guides."),
name); name);
gimp_procedure_set_attribution (procedure, gimp_procedure_set_attribution (procedure,
"Monigotes", "Monigotes",
@ -233,6 +234,15 @@ psd_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"psd"); "psd");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
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 |
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS,
NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "clippingpath", gimp_procedure_add_boolean_argument (procedure, "clippingpath",
_("Assign a Clipping _Path"), _("Assign a Clipping _Path"),
_("Select a path to be the " _("Select a path to be the "
@ -421,6 +431,7 @@ psd_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -441,13 +452,7 @@ psd_export (GimpProcedure *procedure,
NULL); NULL);
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
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 |
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (export_image (file, image, G_OBJECT (config), &error)) if (export_image (file, image, G_OBJECT (config), &error))

View file

@ -80,6 +80,7 @@ static GimpValueArray * sgi_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -188,6 +189,13 @@ sgi_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"sgi,rgb,rgba,bw,icon"); "sgi,rgb,rgba,bw,icon");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
gimp_procedure_add_int_argument (procedure, "compression", gimp_procedure_add_int_argument (procedure, "compression",
_("Compression _type"), _("Compression _type"),
_("Compression level (0 = none, 1 = RLE, 2 = ARLE)"), _("Compression level (0 = none, 1 = RLE, 2 = ARLE)"),
@ -234,6 +242,7 @@ sgi_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -253,11 +262,7 @@ sgi_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
} }
export = gimp_export_image (&image, export = gimp_export_options_get_image (options, &image);
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)

View file

@ -95,6 +95,7 @@ static GimpValueArray * tiff_export (GimpProcedure *procedure
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
@ -103,9 +104,14 @@ static GimpPDBStatusType tiff_export_rec (GimpProcedure *procedure
GimpImage *orig_image, GimpImage *orig_image,
GFile *file, GFile *file,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
gboolean retried, gboolean retried,
GError **error); GError **error);
static void export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
static gboolean image_is_monochrome (GimpImage *image); static gboolean image_is_monochrome (GimpImage *image);
static gboolean image_is_multi_layer (GimpImage *image); static gboolean image_is_multi_layer (GimpImage *image);
@ -223,6 +229,11 @@ tiff_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"tif,tiff"); "tif,tiff");
/* TIFF capabilities are so dependent on export settings, we can't assign
* defaults until we know how the user wants to export it */
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
0, export_edit_options, NULL);
gimp_procedure_add_boolean_argument (procedure, "bigtiff", gimp_procedure_add_boolean_argument (procedure, "bigtiff",
_("Export in _BigTIFF variant file format"), _("Export in _BigTIFF variant file format"),
_("The BigTIFF variant file format uses 64-bit offsets, " _("The BigTIFF variant file format uses 64-bit offsets, "
@ -339,6 +350,7 @@ tiff_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -358,8 +370,8 @@ tiff_export (GimpProcedure *procedure,
break; break;
} }
status = tiff_export_rec (procedure, run_mode, image, status = tiff_export_rec (procedure, run_mode, image, file,
file, config, metadata, FALSE, &error); config, options, metadata, FALSE, &error);
return gimp_procedure_new_return_values (procedure, status, error); return gimp_procedure_new_return_values (procedure, status, error);
} }
@ -370,6 +382,7 @@ tiff_export_rec (GimpProcedure *procedure,
GimpImage *orig_image, GimpImage *orig_image,
GFile *file, GFile *file,
GimpProcedureConfig *config, GimpProcedureConfig *config,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
gboolean retried, gboolean retried,
GError **error) GError **error)
@ -396,43 +409,9 @@ tiff_export_rec (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ {
GimpExportCapabilities capabilities; g_object_get (config, "bigtiff", &bigtiff, NULL);
GimpCompression compression;
gboolean save_layers;
gboolean crop_layers;
g_object_get (config, export = gimp_export_options_get_image (options, &image);
"bigtiff", &bigtiff,
"save-layers", &save_layers,
"crop-layers", &crop_layers,
NULL);
compression = gimp_procedure_config_get_choice_id (config, "compression");
if (compression == GIMP_COMPRESSION_CCITTFAX3 ||
compression == GIMP_COMPRESSION_CCITTFAX4)
{
/* G3/G4 are fax compressions. They only support
* monochrome images without alpha support.
*/
capabilities = GIMP_EXPORT_CAN_HANDLE_INDEXED;
}
else
{
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
}
if (save_layers && image_is_multi_layer (orig_image))
{
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
if (crop_layers)
capabilities |= GIMP_EXPORT_NEEDS_CROP;
}
export = gimp_export_image (&image, capabilities);
} }
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
@ -466,13 +445,59 @@ tiff_export_rec (GimpProcedure *procedure,
tiff_reset_file_size_error (); tiff_reset_file_size_error ();
g_clear_error (error); g_clear_error (error);
return tiff_export_rec (procedure, run_mode, orig_image, return tiff_export_rec (procedure, run_mode, orig_image, file,
file, config, metadata, TRUE, error); config, options, metadata, TRUE, error);
} }
return status; return status;
} }
static void
export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data)
{
GimpExportCapabilities capabilities;
GimpCompression compression;
gboolean save_layers;
gboolean crop_layers;
g_object_get (config,
"save-layers", &save_layers,
"crop-layers", &crop_layers,
NULL);
compression = gimp_procedure_config_get_choice_id (config, "compression");
if (compression == GIMP_COMPRESSION_CCITTFAX3 ||
compression == GIMP_COMPRESSION_CCITTFAX4)
{
/* G3/G4 are fax compressions. They only support
* monochrome images without alpha support.
*/
capabilities = GIMP_EXPORT_CAN_HANDLE_INDEXED;
}
else
{
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
}
if (save_layers)
{
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS;
if (crop_layers)
capabilities |= GIMP_EXPORT_NEEDS_CROP;
}
g_object_set (G_OBJECT (options),
"capabilities", capabilities,
NULL);
}
static gboolean static gboolean
image_is_monochrome (GimpImage *image) image_is_monochrome (GimpImage *image)
{ {

View file

@ -70,10 +70,15 @@ static GimpValueArray * webp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data); gpointer run_data);
static void export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
G_DEFINE_TYPE (Webp, webp, GIMP_TYPE_PLUG_IN) G_DEFINE_TYPE (Webp, webp, GIMP_TYPE_PLUG_IN)
@ -165,6 +170,13 @@ webp_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure), gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"webp"); "webp");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
export_edit_options, NULL);
gimp_procedure_add_int_argument (procedure, "preset", gimp_procedure_add_int_argument (procedure, "preset",
_("Source _type"), _("Source _type"),
_("WebP encoder preset (Default=0, Picture=1, Photo=2, Drawing=3, " _("WebP encoder preset (Default=0, Picture=1, Photo=2, Drawing=3, "
@ -282,6 +294,7 @@ webp_export (GimpProcedure *procedure,
GimpRunMode run_mode, GimpRunMode run_mode,
GimpImage *image, GimpImage *image,
GFile *file, GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata, GimpMetadata *metadata,
GimpProcedureConfig *config, GimpProcedureConfig *config,
gpointer run_data) gpointer run_data)
@ -295,11 +308,10 @@ webp_export (GimpProcedure *procedure,
gegl_init (NULL, NULL); gegl_init (NULL, NULL);
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init (PLUG_IN_BINARY);
if (run_mode == GIMP_RUN_INTERACTIVE) if (run_mode == GIMP_RUN_INTERACTIVE)
{ {
gimp_ui_init (PLUG_IN_BINARY);
if (! save_dialog (image, procedure, G_OBJECT (config))) if (! save_dialog (image, procedure, G_OBJECT (config)))
return gimp_procedure_new_return_values (procedure, return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL, GIMP_PDB_CANCEL,
@ -311,17 +323,8 @@ webp_export (GimpProcedure *procedure,
NULL); NULL);
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ export = gimp_export_options_get_image (options, &image);
GimpExportCapabilities capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION;
export = gimp_export_image (&image, capabilities);
}
drawables = gimp_image_list_layers (image); drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables); n_drawables = g_list_length (drawables);
@ -363,3 +366,29 @@ webp_export (GimpProcedure *procedure,
g_list_free (drawables); g_list_free (drawables);
return gimp_procedure_new_return_values (procedure, status, error); return gimp_procedure_new_return_values (procedure, status, error);
} }
static void
export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data)
{
GimpExportCapabilities capabilities;
gboolean animation;
g_object_get (G_OBJECT (config),
"animation", &animation,
NULL);
capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
if (animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION;
g_object_set (G_OBJECT (options),
"capabilities", capabilities,
NULL);
}

View file

@ -62,7 +62,7 @@ preamble = """<!DOCTYPE html>
postamble = """\n</pre>\n</body>\n</html>\n""" postamble = """\n</pre>\n</body>\n</html>\n"""
def export_colorxhtml(procedure, run_mode, image, file, metadata, config, data): def export_colorxhtml(procedure, run_mode, image, file, options, metadata, config, data):
if file is None: if file is None:
error = 'No file given' error = 'No file given'
return procedure.new_return_values(Gimp.PDBStatusType.CALLING_ERROR, return procedure.new_return_values(Gimp.PDBStatusType.CALLING_ERROR,

View file

@ -188,7 +188,7 @@ def thumbnail_ora(procedure, file, thumb_size, args, data):
else: else:
return procedure.new_return_values(result.index(0), GLib.Error(result.index(1))) return procedure.new_return_values(result.index(0), GLib.Error(result.index(1)))
def export_ora(procedure, run_mode, image, file, metadata, config, data): def export_ora(procedure, run_mode, image, file, options, metadata, config, data):
def write_file_str(zfile, fname, data): def write_file_str(zfile, fname, data):
# work around a permission bug in the zipfile library: # work around a permission bug in the zipfile library:
# http://bugs.python.org/issue3394 # http://bugs.python.org/issue3394
@ -216,7 +216,6 @@ def export_ora(procedure, run_mode, image, file, metadata, config, data):
tmp = os.path.join(tempdir, 'tmp.png') tmp = os.path.join(tempdir, 'tmp.png')
interlace, compression = 0, 2 interlace, compression = 0, 2
#TODO: Use GimpExportOptions for this once available
width, height = drawable.get_width(), drawable.get_height() width, height = drawable.get_width(), drawable.get_height()
tmp_img = Gimp.Image.new(width, height, image.get_base_type()) tmp_img = Gimp.Image.new(width, height, image.get_base_type())
tmp_layer = Gimp.Layer.new_from_drawable (drawable, tmp_img) tmp_layer = Gimp.Layer.new_from_drawable (drawable, tmp_img)
@ -227,6 +226,7 @@ def export_ora(procedure, run_mode, image, file, metadata, config, data):
pdb_config.set_property('run-mode', Gimp.RunMode.NONINTERACTIVE) pdb_config.set_property('run-mode', Gimp.RunMode.NONINTERACTIVE)
pdb_config.set_property('image', tmp_img) pdb_config.set_property('image', tmp_img)
pdb_config.set_property('file', Gio.File.new_for_path(tmp)) pdb_config.set_property('file', Gio.File.new_for_path(tmp))
pdb_config.set_property('options', None)
pdb_config.set_property('interlaced', interlace) pdb_config.set_property('interlaced', interlace)
pdb_config.set_property('compression', compression) pdb_config.set_property('compression', compression)
# write all PNG chunks except oFFs(ets) # write all PNG chunks except oFFs(ets)