app, libgimp*, pdb, plug-ins: review and enhance MR !1549.

- Fix annotations for gimp_export_options_get_image() to make it
  actually introspectable with the GimpImage being both input and
  output. Even though the logic doesn't change much (the input image may
  be overriden or not), it doesn't matter for introspection because
  images are handled centrally by libgimp and therefore must not be
  freed. Actually deleting the image from the central list of images
  though remains a manual action depending on code logic, not some
  automatic action to be handled by binding engines.
- Add G_GNUC_WARN_UNUSED_RESULT to gimp_export_options_get_image()
  because ignoring the returned value is rarely a good idea (as you
  usually want to delete the image).
- Remove gimp_export_options_new(): we don't need this constructor
  because at this point, the best is to tell plug-in developers to just
  pass NULL everywhere. This leaves us free to create a more useful
  default constructor if needed, in the future. Main description for
  GimpExportOptions has also been updated to say this.
- Add a data_destroy callback for the user data passed in
  gimp_export_procedure_set_capabilities().
- Fixing annotations of 'export_options' object from pdb/pdb.pl: input
  args would actually be (nullable) and would not transfer ownership
  (calling code must still free the object). Return value's ownership on
  the other hand is fully transfered.
- Add C and Python unit testing for GimpExportOptions and
  gimp_export_options_get_image() in particular.
- Fix or improve various details.

Note that I have also considered for a long time changing the signature
of gimp_export_options_get_image() to return a boolean indicating
whether `image` had been replaced (hence needed deletion) or not. This
also meant getting rid of the GimpExportReturn enum. Right now it would
work because there are no third case, but I was considering the future
possibility that for instance we got some impossible conversion for some
future capability. I'm not sure it would ever happen; and for sure, this
is not desirable because it implies an export failure a bit late in the
workflow. But just in case, let's keep the enum return value. It does
not even make the using code that much more complicated (well just a
value comparison instead of a simple boolean test).
This commit is contained in:
Jehan 2024-08-17 15:06:27 +02:00
parent bcdd4974bb
commit ddcaa99264
56 changed files with 283 additions and 112 deletions

View File

@ -92,8 +92,10 @@ file_save (Gimp *gimp,
gimp_image_saving (image);
/* TEMP - Remove later */
options = gimp_export_options_new ();
/* XXX - In the future, we'll pass special generic export options this
* way (e.g. crops, resize, filter run at export or others).
*/
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS, NULL);
drawables_list = gimp_image_get_selected_drawables (image);

View File

@ -493,7 +493,8 @@ register_file_procs (GimpPDB *pdb)
"gimp-file-save");
gimp_procedure_set_static_help (procedure,
"Saves a file by extension.",
"This procedure invokes the correct file save handler according to the file's extension and/or prefix.",
"This procedure invokes the correct file save handler according to the file's extension and/or prefix.\n"
"The @options argument is currently unused and should be set to %NULL right now.",
NULL);
gimp_procedure_set_static_attribution (procedure,
"Josh MacDonald",

View File

@ -393,7 +393,8 @@ gimp_plug_in_set_file_proc_save_handler (GimpPlugIn *plug_in,
if ((procedure->num_args < 4) ||
! GIMP_IS_PARAM_SPEC_RUN_MODE (procedure->args[0]) ||
! GIMP_IS_PARAM_SPEC_IMAGE (procedure->args[1]) ||
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2]))
! GIMP_IS_PARAM_SPEC_FILE (procedure->args[2]) ||
! GIMP_IS_PARAM_SPEC_EXPORT_OPTIONS (procedure->args[3]))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"

View File

@ -528,23 +528,34 @@ export_action_perform (const ExportAction *action,
/**
* gimp_export_options_get_image:
* @options: The #GimpExportOptions object.
* @image: Pointer to the image.
* @options: (transfer none): The #GimpExportOptions object.
* @image: (inout) (transfer none): the image.
*
* Takes an image to be saved together with a description
* of the capabilities of the image_format. A copy is created.
* This copy is then converted, @image is changed to point to the
* new image and the procedure returns GIMP_EXPORT_EXPORT.
* The save_plugin has to take care of deleting the created image using
* gimp_image_delete() once the image has been saved.
* Takes an image to be exported, possibly creating a temporary copy
* modified according to export settings in @options (such as the
* capabilities of the export format).
*
* Returns: An enum of #GimpExportReturn describing the user_action.
* If necessary, a copy is created, converted and modified, @image
* changed to point to the new image and the procedure returns
* [enum@ExportReturn.EXPORT].
* In this case, you must take care of deleting the created image using
* [method@Image.delete] once the image has been exported, unless you
* were planning to display it with [ctor@Display.new], or you will leak
* memory.
*
* If [enum@ExportReturn.IGNORE] is returned, then @image is still the
* original image. You should neither modify it, nor should you delete
* it in the end. If you wish to temporarily modify the image before
* export anyway, call [method@Image.duplicate] when
* [enum@ExportReturn.IGNORE] was returned.
*
* Returns: An enum of #GimpExportReturn.
*
* Since: 3.0
**/
GimpExportReturn
gimp_export_options_get_image (GimpExportOptions *options,
GimpImage **image)
gimp_export_options_get_image (GimpExportOptions *options,
GimpImage **image)
{
GSList *actions = NULL;
GimpImageBaseType type;
@ -557,12 +568,19 @@ gimp_export_options_get_image (GimpExportOptions *options,
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 (options != NULL, FALSE);
g_return_val_if_fail (image && gimp_image_is_valid (*image), GIMP_EXPORT_IGNORE);
g_return_val_if_fail (GIMP_IS_EXPORT_OPTIONS (options), GIMP_EXPORT_IGNORE);
/* Get capabilities from ExportOptions */
g_object_get (options, "capabilities", &capabilities, NULL);
g_return_val_if_fail (capabilities & (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_BITMAP),
GIMP_EXPORT_IGNORE);
/* do some sanity checks */
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
capabilities |= GIMP_EXPORT_CAN_HANDLE_ALPHA;

View File

@ -34,9 +34,9 @@ G_BEGIN_DECLS
/**
* GimpExportReturn:
* @GIMP_EXPORT_IGNORE: The image is unmodified but export shall continue anyway
* @GIMP_EXPORT_EXPORT: The chosen transforms were applied to the image
* @GIMP_EXPORT_EXPORT: The chosen transforms were applied to a new image
*
* Possible return values of gimp_export_image().
* Possible return values of [method@ExportOptions.get_image].
**/
typedef enum
{
@ -46,7 +46,7 @@ typedef enum
GimpExportReturn gimp_export_options_get_image (GimpExportOptions *options,
GimpImage **image);
GimpImage **image) G_GNUC_WARN_UNUSED_RESULT;
G_END_DECLS

View File

@ -65,8 +65,9 @@ struct _GimpExportProcedure
GDestroyNotify run_data_destroy;
GimpExportCapabilities capabilities;
GimpExportOptionsEditFunc create_func;
gpointer create_data;
GimpExportOptionsEditFunc edit_func;
gpointer edit_data;
GDestroyNotify edit_data_destroy;
gboolean supports_exif;
gboolean supports_iptc;
@ -440,14 +441,14 @@ gimp_export_procedure_run (GimpProcedure *procedure,
* so we'll make sure it's initialized */
if (options == NULL)
{
options = gimp_export_options_new ();
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS, NULL);
free_options = TRUE;
}
if (export_proc->create_func != NULL)
if (export_proc->edit_func != NULL)
{
export_proc->create_func (procedure, config, options,
export_proc->create_data);
export_proc->edit_func (procedure, config, options,
export_proc->edit_data);
g_signal_connect_object (config, "notify",
G_CALLBACK (gimp_export_procedure_update_options),
@ -485,6 +486,9 @@ gimp_export_procedure_run (GimpProcedure *procedure,
g_object_unref (config);
gimp_value_array_unref (remaining);
if (export_proc->edit_data_destroy && export_proc->edit_data)
export_proc->edit_data_destroy (export_proc->edit_data);
return return_values;
}
@ -582,8 +586,8 @@ gimp_export_procedure_update_options (GimpProcedureConfig *config,
procedure = gimp_procedure_config_get_procedure (config);
export_proc = GIMP_EXPORT_PROCEDURE (procedure);
export_proc->create_func (procedure, config, options,
export_proc->create_data);
export_proc->edit_func (procedure, config, options,
export_proc->edit_data);
}
@ -662,8 +666,9 @@ gimp_export_procedure_new (GimpPlugIn *plug_in,
* 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
* @edit_func: (nullable): callback function to update export options
* @edit_data: (nullable): data for @edit_func
* @edit_data_destroy: (nullable): free function for @edit_data, or %NULL
*
* Sets default #GimpExportCapabilities for image export.
*
@ -672,8 +677,9 @@ gimp_export_procedure_new (GimpPlugIn *plug_in,
void
gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
GimpExportCapabilities capabilities,
GimpExportOptionsEditFunc create_func,
gpointer create_data)
GimpExportOptionsEditFunc edit_func,
gpointer edit_data,
GDestroyNotify edit_data_destroy)
{
g_return_if_fail (GIMP_IS_EXPORT_PROCEDURE (procedure));
@ -684,10 +690,11 @@ gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
/* TODO: Do more with this when we have user-specified callbacks for
* image capabilities */
if (create_func != NULL)
if (edit_func != NULL)
{
procedure->create_func = create_func;
procedure->create_data = create_data;
procedure->edit_func = edit_func;
procedure->edit_data = edit_data;
procedure->edit_data_destroy = edit_data_destroy;
}
}

View File

@ -95,8 +95,9 @@ GimpProcedure * gimp_export_procedure_new (GimpPlugIn
void gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
GimpExportCapabilities capabilities,
GimpExportOptionsEditFunc create_func,
gpointer create_data);
GimpExportOptionsEditFunc edit_func,
gpointer edit_data,
GDestroyNotify edit_data_destroy);
void gimp_export_procedure_set_support_exif (GimpExportProcedure *procedure,

View File

@ -179,12 +179,14 @@ gimp_file_load_layers (GimpRunMode run_mode,
* @run_mode: The run mode.
* @image: Input image.
* @file: The file to save the image in.
* @options: Export option settings.
* @options: (nullable): Export option settings.
*
* Saves a file by extension.
*
* This procedure invokes the correct file save handler according to
* the file's extension and/or prefix.
* The @options argument is currently unused and should be set to %NULL
* right now.
*
* Returns: TRUE on success.
**/

View File

@ -942,11 +942,11 @@ gimp_gp_param_to_value (gpointer gimp,
}
else if (g_type_is_a (G_VALUE_TYPE (value), GIMP_TYPE_EXPORT_OPTIONS))
{
GimpExportOptions *options = gimp_export_options_new ();
GimpExportOptions *options;
g_object_set (options,
"capabilities", param->data.d_export_options.capabilities,
NULL);
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS,
"capabilities", param->data.d_export_options.capabilities,
NULL);
g_value_set_object (value, options);

View File

@ -8,6 +8,7 @@ endif
tests = [
'color-parser',
'export-options',
'image',
'palette',
'selection-float',

View File

@ -0,0 +1,98 @@
/* Sometimes odd dimensions may create weird situations. It's usually a
* good idea to test both even and odd dimensions.
*/
#define NEW_IMAGE_WIDTH 1920
#define NEW_IMAGE_HEIGHT 2001
static GimpValueArray *
gimp_c_test_run (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
gint n_drawables,
GimpDrawable **drawables,
GimpProcedureConfig *config,
gpointer run_data)
{
GimpImage **images;
GimpLayer **layers;
GeglBufferIterator *iter;
GeglBuffer *buffer1;
GeglBuffer *buffer2;
const Babl *format;
GimpImage *new_image;
GimpImage *original_image;
GimpTextLayer *text_layer;
GimpLayer *layer;
GimpLayer *export_layer;
GimpExportOptions *options;
GimpExportReturn delete;
gint n_images;
gint n_layers;
gboolean identical_buffers;
new_image = gimp_image_new (NEW_IMAGE_WIDTH, NEW_IMAGE_HEIGHT, GIMP_RGB);
text_layer = gimp_text_layer_new (new_image, "hello world", gimp_context_get_font (),
20, gimp_unit_point ());
gimp_image_insert_layer (new_image, GIMP_LAYER (text_layer), NULL, 0);
text_layer = gimp_text_layer_new (new_image, "annyeong uju", gimp_context_get_font (),
20, gimp_unit_point ());
gimp_image_insert_layer (new_image, GIMP_LAYER (text_layer), NULL, 0);
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS,
"capabilities", GIMP_EXPORT_CAN_HANDLE_RGB | GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL);
GIMP_TEST_START("Verify start state (1)");
images = gimp_get_images (&n_images);
GIMP_TEST_END(n_images == 1 && images[0] == new_image);
g_free (images);
GIMP_TEST_START("Verify start state (2)");
layers = gimp_image_get_layers (new_image, &n_layers);
GIMP_TEST_END(n_layers == 2);
g_free (layers);
original_image = new_image;
GIMP_TEST_START("gimp_export_options_get_image() created a new image");
delete = gimp_export_options_get_image (options, &new_image);
images = gimp_get_images (&n_images);
GIMP_TEST_END(delete == GIMP_EXPORT_EXPORT && n_images == 2 && new_image != original_image);
g_free (images);
GIMP_TEST_START("The new image has a single layer");
layers = gimp_image_get_layers (new_image, &n_layers);
GIMP_TEST_END(n_layers == 1);
export_layer = layers[0];
g_free (layers);
layer = gimp_image_merge_visible_layers (original_image, GIMP_CLIP_TO_IMAGE);
GIMP_TEST_START("Compare export buffer with original image's merged buffer");
buffer1 = gimp_drawable_get_buffer (GIMP_DRAWABLE (layer));
buffer2 = gimp_drawable_get_buffer (GIMP_DRAWABLE (export_layer));
format = gegl_buffer_get_format (buffer1);
iter = gegl_buffer_iterator_new (buffer1, NULL, 0, format,
GEGL_ACCESS_READ, GEGL_ABYSS_NONE, 2);
gegl_buffer_iterator_add (iter, buffer2, NULL, 0, format,
GEGL_ACCESS_READ, GEGL_ABYSS_NONE);
identical_buffers = TRUE;
while (gegl_buffer_iterator_next (iter))
{
const gfloat *src1 = (const gfloat *) iter->items[0].data;
const gfloat *src2 = (const gfloat *) iter->items[1].data;
gint count = iter->length;
if (memcmp (src1, src2, count * babl_format_get_bytes_per_pixel (format)) != 0)
{
identical_buffers = FALSE;
break;
}
}
GIMP_TEST_END(identical_buffers == TRUE);
GIMP_TEST_RETURN
}

View File

@ -0,0 +1,34 @@
#!/usr/bin/env python3
NEW_IMAGE_WIDTH=1920
NEW_IMAGE_HEIGHT=2001
image = Gimp.Image.new(NEW_IMAGE_WIDTH, NEW_IMAGE_HEIGHT, Gimp.ImageBaseType.RGB)
text_layer = Gimp.TextLayer.new(image, "hello world", Gimp.context_get_font(), 20, Gimp.Unit.point())
image.insert_layer(text_layer, None, 0)
text_layer = Gimp.TextLayer.new(image, "annyeong uju", Gimp.context_get_font(), 20, Gimp.Unit.point())
image.insert_layer(text_layer, None, 0)
images = Gimp.get_images()
layers = image.get_layers()
gimp_assert('Verify start state', len(images) == 1 and images[0] == image and len(layers) == 2)
options = Gimp.ExportOptions()
options.set_property ("capabilities",
Gimp.ExportCapabilities.CAN_HANDLE_RGB |
Gimp.ExportCapabilities.CAN_HANDLE_ALPHA)
delete, export_image = options.get_image(image)
gimp_assert('Gimp.ExportOptions.get_image() created a new image', delete == Gimp.ExportReturn.EXPORT and export_image != image)
export_layers = export_image.get_layers()
gimp_assert('The new image has a single layer', len(export_layers) == 1)
merged_layer = image.merge_visible_layers(Gimp.MergeType.CLIP_TO_IMAGE)
merged_layer.resize_to_image_size()
buffer1 = merged_layer.get_buffer()
buffer2 = export_layers[0].get_buffer()
l1 = buffer1.get(buffer1.get_extent(), 1.0, None, Gegl.AbyssPolicy.NONE)
l2 = buffer2.get(buffer2.get_extent(), 1.0, None, Gegl.AbyssPolicy.NONE)
gimp_assert("Compare export buffer with original image's merged buffer", l1 == l2)

View File

@ -56,7 +56,6 @@ EXPORTS
gimp_env_init
gimp_escape_uline
gimp_export_options_get_type
gimp_export_options_new
gimp_file_get_utf8_name
gimp_file_has_extension
gimp_file_show_in_file_manager

View File

@ -26,6 +26,22 @@
#include "gimpexportoptions.h"
/**
* SECTION: gimpexportoptions
* @title: gimpexportoptions
* @short_description: Generic Export Options
*
* A class holding generic export options.
* Note: right now, GIMP does not provide any generic export option to
* manipulate, and there is practically no reason for you to create this
* object yourself. In Export PDB procedure, or again in functions such
* as [func@Gimp.file_save], you may just pass %NULL.
*
* In the future, this object will enable to pass various generic
* options, such as ability to crop or resize images at export time.
**/
enum
{
PROP_0,
@ -68,9 +84,9 @@ gimp_export_options_class_init (GimpExportOptionsClass *klass)
object_class->set_property = gimp_export_options_set_property;
/**
* GimpExportProcedure:capabilities:
* GimpExportOptions:capabilities:
*
* What #GimpExportCapabilities are supported
* What [flags@ExportCapabilities] are supported.
*
* Since: 3.0.0
*/
@ -135,15 +151,3 @@ gimp_export_options_get_property (GObject *object,
break;
}
}
/* public functions */
GimpExportOptions *
gimp_export_options_new (void)
{
GimpExportOptions *options;
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS, NULL);
return options;
}

View File

@ -68,9 +68,6 @@ typedef enum
} GimpExportCapabilities;
GimpExportOptions * gimp_export_options_new (void);
G_END_DECLS
#endif /* __GIMP_EXPORT_OPTIONS_H__ */

View File

@ -222,6 +222,9 @@ sub file_save {
$help = <<'HELP';
This procedure invokes the correct file save handler according to the
file's extension and/or prefix.
The @options argument is currently unused and should be set to %NULL
right now.
HELP
&josh_pdb_misc('1997');

View File

@ -487,7 +487,8 @@ package Gimp::CodeGen::pdb;
type => 'GimpExportOptions *',
const_type => 'GimpExportOptions *',
init_value => 'NULL',
out_annotate => '(transfer none)',
in_annotate => '(nullable)',
out_annotate => '(transfer full)',
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)',

View File

@ -154,7 +154,7 @@ ascii_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
for (i = 0; aa_formats[i]; i++);

View File

@ -188,7 +188,7 @@ cel_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_file_argument (procedure, "palette-file",
_("_Palette file"),

View File

@ -143,7 +143,7 @@ csource_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_string_aux_argument (procedure, "prefixed-name",
_("_Prefixed name"),

View File

@ -232,7 +232,7 @@ dicom_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -181,7 +181,7 @@ farbfeld_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -152,7 +152,7 @@ gbr_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "spacing",
_("Sp_acing"),

View File

@ -238,7 +238,7 @@ goat_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
}
}

View File

@ -189,7 +189,7 @@ gif_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
export_edit_options, NULL);
export_edit_options, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlace",
_("_Interlace"),

View File

@ -186,7 +186,7 @@ gih_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "spacing",
_("Spacing (_percent)"),

View File

@ -136,7 +136,7 @@ header_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -256,7 +256,7 @@ heif_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "quality",
_("_Quality"),
@ -369,7 +369,7 @@ heif_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_file_procedure_set_priority (GIMP_FILE_PROCEDURE (procedure), 100);

View File

@ -187,7 +187,7 @@ jpegxl_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "lossless",
_("L_ossless"),

View File

@ -279,7 +279,7 @@ mng_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlaced",
_("_Interlace"),

View File

@ -137,7 +137,7 @@ pat_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_string_argument (procedure, "description",
_("_Description"),

View File

@ -298,7 +298,7 @@ pcx_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -346,7 +346,7 @@ pdf_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
export_edit_options, NULL);
export_edit_options, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "vectorize",
_("Convert _bitmaps to vector graphics where possible"),
@ -541,7 +541,14 @@ pdf_export_multi (GimpProcedure *procedure,
"images", &image_ids,
NULL);
options = gimp_export_options_new ();
options = g_object_new (GIMP_TYPE_EXPORT_OPTIONS,
"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,
NULL);
if (uri != NULL)
{
@ -723,7 +730,7 @@ pdf_export_image (GimpProcedure *procedure,
cairo_save (cr);
if (! (gimp_export_options_get_image (options,
&image) == GIMP_EXPORT_EXPORT))
&image) == GIMP_EXPORT_EXPORT))
{
/* gimp_drawable_histogram() only works within the bounds of
* the selection, which is a problem (see issue #2431).

View File

@ -221,7 +221,7 @@ pix_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -240,7 +240,7 @@ png_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "interlaced",
_("_Interlacing (Adam7)"),

View File

@ -372,7 +372,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
@ -415,7 +415,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_BITMAP,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
@ -458,7 +458,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
@ -502,7 +502,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
@ -547,7 +547,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
else if (! strcmp (name, PFM_EXPORT_PROC))
{
@ -581,7 +581,7 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
NULL, NULL, NULL);
}

View File

@ -519,7 +519,7 @@ ps_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_double_argument (procedure, "width",
_("_Width"),

View File

@ -720,7 +720,7 @@ psp_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "compression",
_("_Data Compression"),

View File

@ -519,7 +519,7 @@ raw_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "planar-configuration",
_("Planar configuration"),

View File

@ -324,7 +324,7 @@ sunras_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "rle",
_("_Data Formatting"),

View File

@ -308,7 +308,7 @@ tga_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "rle",
_("_Use RLE compression"),

View File

@ -213,7 +213,7 @@ xbm_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_BITMAP |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "save-comment",
_("_Write comment"),

View File

@ -370,7 +370,7 @@ xmc_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_NEEDS_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "hot-spot-x",
_("Hot spot _X"),

View File

@ -262,7 +262,7 @@ xpm_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "threshold",
_("_Threshold"),

View File

@ -377,7 +377,7 @@ xwd_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

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

View File

@ -200,7 +200,7 @@ bmp_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "use-rle",
_("Ru_n-Length Encoded"),

View File

@ -190,7 +190,7 @@ dds_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "compression-format",
_("Compressio_n"),

View File

@ -245,7 +245,7 @@ fits_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED,
NULL, NULL);
NULL, NULL, NULL);
}
return procedure;

View File

@ -240,7 +240,7 @@ fli_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "from-frame",
_("_From frame"),

View File

@ -465,7 +465,6 @@ icns_export_image (GFile *file,
GimpImage *temp_image;
GimpLayer *temp_layer;
GFile *temp_file = NULL;
GimpExportOptions *options = gimp_export_options_new ();
FILE *temp_fp;
gint temp_size;
gint macos_size;
@ -484,7 +483,6 @@ icns_export_image (GFile *file,
"run-mode", GIMP_RUN_NONINTERACTIVE,
"image", temp_image,
"file", temp_file,
"options", options,
"interlaced", FALSE,
"compression", 9,
"bkgd", FALSE,

View File

@ -201,7 +201,7 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
NULL, NULL, NULL);
/* See bugs #63610 and #61088 for a discussion about the quality
* settings

View File

@ -241,7 +241,7 @@ psd_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_ALPHA |
GIMP_EXPORT_CAN_HANDLE_LAYERS |
GIMP_EXPORT_CAN_HANDLE_LAYER_MASKS,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "clippingpath",
_("Assign a Clipping _Path"),

View File

@ -194,7 +194,7 @@ sgi_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
NULL, NULL);
NULL, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "compression",
_("Compression _type"),

View File

@ -232,7 +232,7 @@ tiff_create_procedure (GimpPlugIn *plug_in,
/* 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);
0, export_edit_options, NULL, NULL);
gimp_procedure_add_boolean_argument (procedure, "bigtiff",
_("Export in _BigTIFF variant file format"),

View File

@ -175,7 +175,7 @@ webp_create_procedure (GimpPlugIn *plug_in,
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA,
export_edit_options, NULL);
export_edit_options, NULL, NULL);
gimp_procedure_add_int_argument (procedure, "preset",
_("Source _type"),