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;
GError *my_error = NULL;
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_IMAGE (image), GIMP_PDB_CALLING_ERROR);
@ -91,6 +92,9 @@ file_save (Gimp *gimp,
gimp_image_saving (image);
/* TEMP - Remove later */
options = gimp_export_options_new ();
drawables_list = gimp_image_get_selected_drawables (image);
if (! drawables_list)
@ -190,9 +194,10 @@ file_save (Gimp *gimp,
gimp_get_user_context (gimp),
progress, error,
gimp_object_get_name (file_proc),
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE, image,
G_TYPE_FILE, file,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE, image,
G_TYPE_FILE, file,
GIMP_TYPE_EXPORT_OPTIONS, options,
G_TYPE_NONE);
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));
g_value_transform (gimp_value_array_index (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]))
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",
G_TYPE_FILE,
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);
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);
if ((procedure->num_args < 3) ||
! 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]))
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]))
{
g_set_error (error, GIMP_PDB_ERROR, GIMP_PDB_ERROR_FAILED,
"Plug-in \"%s\"\n(%s)\n"
"attempted to register procedure \"%s\" "
"as save handler which does not take the standard "
"save procedure arguments:\n"
"(GimpRunMode, GimpImage, GFile)",
"(GimpRunMode, GimpImage, GFile, GimpExportOptions)",
gimp_object_get_name (plug_in),
gimp_file_get_utf8_name (plug_in->file),
proc_name);

View File

@ -998,6 +998,15 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
goto error;
}
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))
@ -1059,6 +1068,9 @@ plug_in_proc_arg_deserialize (GScanner *scanner,
case GP_PARAM_DEF_TYPE_ID_ARRAY:
g_free (param_def.meta.m_id_array.type_name);
break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
break;
}
return token;
@ -1240,6 +1252,11 @@ plug_in_rc_write_proc_arg (GimpConfigWriter *writer,
gimp_config_writer_string (writer,
param_def.meta.m_id_array.type_name);
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);

View File

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

View File

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

View File

@ -1,8 +1,8 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpexport.c
* Copyright (C) 1999-2004 Sven Neumann <sven@gimp.org>
* gimpexportoptions.c
* 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
@ -12,7 +12,7 @@
* 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
* 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
* License along with this library. If not, see
@ -21,40 +21,18 @@
#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include "gimp.h"
#include "gimpui.h"
#include "gimpexportoptions.h"
#include "libgimp-intl.h"
/**
* 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.
**/
/* export helper functions */
typedef void (* ExportFunc) (GimpImage *image,
GList **drawables);
/* the export action structure */
typedef struct
{
@ -548,47 +526,42 @@ export_action_perform (const ExportAction *action,
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.
* @capabilities: What can the image_format do?
*
* Takes an image to be saved together with a description
* of the capabilities of the image_format. If the type of
* 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.
* 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.
*
* 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.
*
* Since: 3.0
**/
GimpExportReturn
gimp_export_image (GimpImage **image,
GimpExportCapabilities capabilities)
gimp_export_options_get_image (GimpExportOptions *options,
GimpImage **image)
{
GSList *actions = NULL;
GimpImageBaseType type;
GList *layers;
gint n_layers;
GList *iter;
gboolean added_flatten = FALSE;
gboolean has_layer_masks = FALSE;
gboolean background_has_alpha = TRUE;
GimpExportReturn retval = GIMP_EXPORT_IGNORE;
GSList *actions = NULL;
GimpImageBaseType type;
GList *layers;
gint n_layers;
GList *iter;
GimpExportCapabilities capabilities = 0;
gboolean added_flatten = FALSE;
gboolean has_layer_masks = FALSE;
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);
/* Get capabilities from ExportOptions */
g_object_get (options, "capabilities", &capabilities, NULL);
/* do some sanity checks */
if (capabilities & GIMP_EXPORT_NEEDS_ALPHA)
@ -891,71 +864,3 @@ gimp_export_image (GimpImage **image,
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
{
PROP_0,
PROP_CAPABILITIES,
PROP_SUPPORTS_EXIF,
PROP_SUPPORTS_IPTC,
PROP_SUPPORTS_XMP,
@ -57,44 +58,52 @@ enum
struct _GimpExportProcedure
{
GimpFileProcedure parent_instance;
GimpFileProcedure parent_instance;
GimpRunExportFunc run_func;
gpointer run_data;
GDestroyNotify run_data_destroy;
GimpRunExportFunc run_func;
gpointer run_data;
GDestroyNotify run_data_destroy;
gboolean supports_exif;
gboolean supports_iptc;
gboolean supports_xmp;
gboolean supports_profile;
gboolean supports_thumbnail;
gboolean supports_comment;
GimpExportCapabilities capabilities;
GimpExportOptionsEditFunc create_func;
gpointer create_data;
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_finalize (GObject *object);
static void gimp_export_procedure_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_export_procedure_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_export_procedure_constructed (GObject *object);
static void gimp_export_procedure_finalize (GObject *object);
static void gimp_export_procedure_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_export_procedure_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
static void gimp_export_procedure_install (GimpProcedure *procedure);
static void gimp_export_procedure_install (GimpProcedure *procedure);
static GimpValueArray *
gimp_export_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args);
gimp_export_procedure_run (GimpProcedure *procedure,
const GimpValueArray *args);
static GimpProcedureConfig *
gimp_export_procedure_create_config (GimpProcedure *procedure,
GParamSpec **args,
gint n_args);
gimp_export_procedure_create_config (GimpProcedure *procedure,
GParamSpec **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)
@ -118,6 +127,20 @@ gimp_export_procedure_class_init (GimpExportProcedureClass *klass)
procedure_class->run = gimp_export_procedure_run;
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:
*
@ -204,6 +227,7 @@ static void
gimp_export_procedure_init (GimpExportProcedure *procedure)
{
procedure->export_metadata = FALSE;
procedure->capabilities = 0;
}
static void
@ -223,6 +247,11 @@ gimp_export_procedure_constructed (GObject *object)
"File",
"The file to export to",
GIMP_PARAM_READWRITE);
_gimp_procedure_add_argument (procedure,
gimp_param_spec_export_options ("options", "Options",
"Export options", 0,
G_PARAM_READWRITE));
}
static void
@ -246,6 +275,9 @@ gimp_export_procedure_set_property (GObject *object,
switch (property_id)
{
case PROP_CAPABILITIES:
procedure->capabilities = g_value_get_int (value);
break;
case PROP_SUPPORTS_EXIF:
procedure->supports_exif = g_value_get_boolean (value);
break;
@ -281,6 +313,9 @@ gimp_export_procedure_get_property (GObject *object,
switch (property_id)
{
case PROP_CAPABILITIES:
g_value_set_int (value, procedure->capabilities);
break;
case PROP_SUPPORTS_EXIF:
g_value_set_boolean (value, procedure->supports_exif);
break;
@ -334,7 +369,7 @@ gimp_export_procedure_install (GimpProcedure *procedure)
priority);
}
#define ARG_OFFSET 3
#define ARG_OFFSET 4
static GimpValueArray *
gimp_export_procedure_run (GimpProcedure *procedure,
@ -349,12 +384,15 @@ gimp_export_procedure_run (GimpProcedure *procedure,
GimpImage *image;
GFile *file;
GimpMetadata *metadata;
gchar *mimetype = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
GimpExportOptions *options = NULL;
gchar *mimetype = NULL;
GimpPDBStatusType status = GIMP_PDB_EXECUTION_ERROR;
gboolean free_options = FALSE;
run_mode = GIMP_VALUES_GET_ENUM (args, 0);
image = GIMP_VALUES_GET_IMAGE (args, 1);
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);
@ -398,9 +436,33 @@ gimp_export_procedure_run (GimpProcedure *procedure,
metadata = _gimp_procedure_config_begin_export (config, image, run_mode, remaining, 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,
file, metadata, config,
export_proc->run_data);
file, options, metadata,
config, export_proc->run_data);
if (return_values != NULL &&
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 "
"by plug-in, it MUST NOT do that!\n", G_STRFUNC);
if (free_options)
g_object_unref (options);
g_object_unref (config);
gimp_value_array_unref (remaining);
@ -506,6 +570,22 @@ gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure)
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 */
@ -529,7 +609,7 @@ gimp_export_procedure_add_metadata (GimpExportProcedure *export_procedure)
*
* 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.
@ -578,6 +658,39 @@ gimp_export_procedure_new (GimpPlugIn *plug_in,
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:
* @procedure: a #GimpProcedure.

View File

@ -35,6 +35,7 @@ G_BEGIN_DECLS
* @run_mode: the #GimpRunMode.
* @image: the image to export.
* @file: the #GFile to export to.
* @options: the #GimpExportOptions settings.
* @metadata: metadata object prepared for the mimetype passed in
* gimp_file_procedure_set_mime_types() if export_metadata
* argument was set in gimp_export_procedure_new().
@ -57,42 +58,66 @@ typedef GimpValueArray * (* GimpRunExportFunc) (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
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 ())
G_DECLARE_FINAL_TYPE (GimpExportProcedure, gimp_export_procedure, GIMP, EXPORT_PROCEDURE, GimpFileProcedure)
GimpProcedure * gimp_export_procedure_new (GimpPlugIn *plug_in,
const gchar *name,
GimpPDBProcType proc_type,
gboolean export_metadata,
GimpRunExportFunc run_func,
gpointer run_data,
GDestroyNotify run_data_destroy);
GimpProcedure * gimp_export_procedure_new (GimpPlugIn *plug_in,
const gchar *name,
GimpPDBProcType proc_type,
gboolean export_metadata,
GimpRunExportFunc run_func,
gpointer run_data,
GDestroyNotify run_data_destroy);
void gimp_export_procedure_set_support_exif (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_iptc (GimpExportProcedure *procedure,
gboolean supports);
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);
void gimp_export_procedure_set_capabilities (GimpExportProcedure *procedure,
GimpExportCapabilities capabilities,
GimpExportOptionsEditFunc create_func,
gpointer create_data);
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);
void gimp_export_procedure_set_support_exif (GimpExportProcedure *procedure,
gboolean supports);
void gimp_export_procedure_set_support_iptc (GimpExportProcedure *procedure,
gboolean supports);
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

View File

@ -179,6 +179,7 @@ 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.
*
* Saves a file by extension.
*
@ -188,9 +189,10 @@ gimp_file_load_layers (GimpRunMode run_mode,
* Returns: TRUE on success.
**/
gboolean
gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GFile *file)
gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options)
{
GimpValueArray *args;
GimpValueArray *return_vals;
@ -200,6 +202,7 @@ gimp_file_save (GimpRunMode run_mode,
GIMP_TYPE_RUN_MODE, run_mode,
GIMP_TYPE_IMAGE, image,
G_TYPE_FILE, file,
GIMP_TYPE_EXPORT_OPTIONS, options,
G_TYPE_NONE);
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 */
GimpImage* gimp_file_load (GimpRunMode run_mode,
GFile *file);
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
GFile *file);
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image,
GFile *file,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GFile *file);
gboolean gimp_file_save_thumbnail (GimpImage *image,
GFile *file);
GimpImage* gimp_file_load (GimpRunMode run_mode,
GFile *file);
GimpLayer* gimp_file_load_layer (GimpRunMode run_mode,
GimpImage *image,
GFile *file);
GimpLayer** gimp_file_load_layers (GimpRunMode run_mode,
GimpImage *image,
GFile *file,
gint *num_layers);
gboolean gimp_file_save (GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options);
gboolean gimp_file_save_thumbnail (GimpImage *image,
GFile *file);
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,
g_type_from_name (param_def->meta.m_id_array.type_name),
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;
}
@ -498,6 +506,14 @@ _gimp_param_spec_to_gp_param_def (GParamSpec *pspec,
param_def->meta.m_id_array.type_name =
(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 &&
value_type != G_TYPE_FILE &&
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));
}
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))
{
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;
}
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))
{
param->param_type = GP_PARAM_TYPE_PARAM_DEF;
@ -1460,6 +1502,9 @@ _gimp_gp_params_free (GPParam *params,
}
break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
break;
case GP_PARAM_TYPE_PARAM_DEF:
break;
}

View File

@ -15,9 +15,6 @@ EXPORTS
gimp_drawable_preview_get_drawable
gimp_drawable_preview_get_type
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_get_type
gimp_export_procedure_dialog_new

View File

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

View File

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

View File

@ -55,6 +55,8 @@ EXPORTS
gimp_enum_value_get_help
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
@ -124,6 +126,7 @@ EXPORTS
gimp_paint_application_mode_get_type
gimp_param_array_get_type
gimp_param_choice_get_type
gimp_param_export_options_get_type
gimp_param_float_array_get_type
gimp_param_int32_array_get_type
gimp_param_memsize_get_type
@ -131,6 +134,7 @@ EXPORTS
gimp_param_parasite_get_type
gimp_param_spec_array
gimp_param_spec_choice
gimp_param_spec_export_options
gimp_param_spec_float_array
gimp_param_spec_int32_array
gimp_param_spec_memsize

View File

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

View File

@ -44,14 +44,15 @@ G_BEGIN_DECLS
#endif
typedef struct _GimpChoice GimpChoice;
typedef struct _GimpParasite GimpParasite;
typedef struct _GimpEnumDesc GimpEnumDesc;
typedef struct _GimpFlagsDesc GimpFlagsDesc;
typedef struct _GimpUnit GimpUnit;
typedef struct _GimpValueArray GimpValueArray;
typedef struct _GimpChoice GimpChoice;
typedef struct _GimpParasite GimpParasite;
typedef struct _GimpEnumDesc GimpEnumDesc;
typedef struct _GimpExportOptions GimpExportOptions;
typedef struct _GimpFlagsDesc GimpFlagsDesc;
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
* Copyright (C) 1995-1999 Peter Mattis and Spencer Kimball
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpexport.h
* Copyright (C) 1999-2000 Sven Neumann <sven@gimp.org>
* 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 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 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
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* 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 Lesser General Public
* License along with this library. If not, see
* <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#if !defined (__GIMP_UI_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only <libgimp/gimpui.h> can be included directly."
#if !defined (__GIMP_BASE_H_INSIDE__) && !defined (GIMP_BASE_COMPILATION)
#error "Only <libgimpbase/gimpbase.h> can be included directly."
#endif
#ifndef __GIMP_EXPORT_H__
#define __GIMP_EXPORT_H__
#ifndef __GIMP_EXPORT_OPTIONS_H__
#define __GIMP_EXPORT_OPTIONS_H__
G_BEGIN_DECLS
/* 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:
* @GIMP_EXPORT_CAN_HANDLE_RGB: Handles RGB images
@ -63,29 +68,9 @@ typedef enum
} GimpExportCapabilities;
/**
* 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);
GimpExportOptions * gimp_export_options_new (void);
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);
}
/*
* 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);
/*
* 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
#endif /* __GIMP_PARAM_SPECS_H__ */

View File

@ -1278,6 +1278,13 @@ _gp_param_def_read (GIOChannel *channel,
user_data))
return FALSE;
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;
@ -1328,6 +1335,9 @@ _gp_param_def_destroy (GPParamDef *param_def)
case GP_PARAM_DEF_TYPE_ID_ARRAY:
g_free (param_def->meta.m_id_array.type_name);
break;
case GP_PARAM_DEF_TYPE_EXPORT_OPTIONS:
break;
}
}
@ -1604,6 +1614,13 @@ _gp_param_def_write (GIOChannel *channel,
user_data))
return FALSE;
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;
@ -2058,6 +2075,13 @@ _gp_params_read (GIOChannel *channel,
(*params)[i].data.d_parasite.data = NULL;
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:
if (! _gp_param_def_read (channel,
&(*params)[i].data.d_param_def,
@ -2261,6 +2285,13 @@ _gp_params_write (GIOChannel *channel,
}
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:
if (! _gp_param_def_write (channel,
&params[i].data.d_param_def,
@ -2330,6 +2361,9 @@ _gp_params_destroy (GPParam *params,
g_free (params[i].data.d_parasite.data);
break;
case GP_PARAM_TYPE_EXPORT_OPTIONS:
break;
case GP_PARAM_TYPE_PARAM_DEF:
_gp_param_def_destroy (&params[i].data.d_param_def);
break;

View File

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

View File

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

View File

@ -323,6 +323,14 @@ gimp_config_param_spec_duplicate (GParamSpec *pspec)
spec->object_type,
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))
{
GType value_type = G_PARAM_SPEC_VALUE_TYPE (pspec);

View File

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

View File

@ -232,7 +232,9 @@ HELP
{ name => 'image', type => 'image',
desc => 'Input image' },
{ 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 = (
@ -272,8 +274,10 @@ HELP
gimp_value_array_index (new_args, 1));
g_value_transform (gimp_value_array_index (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]))
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)',
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',
gtype => 'GIMP_TYPE_UNIT',
type => 'GimpUnit *',

View File

@ -68,6 +68,7 @@ static GimpValueArray * ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -148,6 +149,13 @@ ascii_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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++);
gimp_procedure_add_int_argument (procedure, "file-type",
@ -165,6 +173,7 @@ ascii_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -184,11 +193,7 @@ ascii_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -89,6 +89,7 @@ static GimpValueArray * goat_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -231,6 +232,13 @@ goat_create_procedure (GimpPlugIn *plug_in,
format->mime_type);
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
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,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -286,11 +295,7 @@ goat_export (GimpProcedure *procedure,
gegl_init (NULL, NULL);
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
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,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -90,6 +91,11 @@ static gboolean export_image (GFile *file,
GObject *config,
GError **error);
static void export_edit_options (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gpointer create_data);
static GimpPDBStatusType sanity_check (GFile *file,
GimpImage **image,
GimpRunMode run_mode,
@ -179,6 +185,12 @@ gif_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Interlace"),
_("Try to export as interlaced"),
@ -257,6 +269,7 @@ gif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -330,33 +343,8 @@ gif_export (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
GList *drawables;
GimpExportCapabilities capabilities;
capabilities = (GIMP_EXPORT_CAN_HANDLE_INDEXED |
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);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (! export_image (file, image, drawables->data, orig_image,
@ -1182,6 +1170,31 @@ export_image (GFile *file,
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
bad_bounds_dialog (void)
{

View File

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

View File

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

View File

@ -85,6 +85,7 @@ static GimpValueArray * heif_export (GimpProcedure *pro
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -93,6 +94,7 @@ static GimpValueArray * heif_av1_export (GimpProcedure *pro
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -251,6 +253,11 @@ heif_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Quality"),
_("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),
"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_procedure_add_int_argument (procedure, "quality",
@ -486,6 +498,7 @@ heif_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata_unused,
GimpProcedureConfig *config,
gpointer run_data)
@ -506,9 +519,7 @@ heif_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)
@ -548,6 +559,7 @@ heif_av1_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata_unused,
GimpProcedureConfig *config,
gpointer run_data)
@ -569,9 +581,7 @@ heif_av1_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)

View File

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

View File

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

View File

@ -161,6 +161,7 @@ static GimpValueArray * mng_export (GimpProcedure *procedur
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -272,6 +273,14 @@ mng_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Interlace"),
_("Use interlacing"),
@ -358,6 +367,7 @@ mng_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -378,12 +388,7 @@ mng_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
export = gimp_export_image (&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);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);

View File

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

View File

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

View File

@ -187,6 +187,7 @@ static GimpValueArray * pdf_export (GimpProcedure *procedur
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -196,10 +197,16 @@ static GimpValueArray * pdf_export_multi (GimpProcedure *procedur
static GimpPDBStatusType pdf_export_image (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gboolean single_image,
gboolean show_progress,
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 validate_image_list (void);
@ -333,6 +340,14 @@ pdf_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("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,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -495,7 +511,7 @@ pdf_export (GimpProcedure *procedure,
}
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),
&error);
@ -510,6 +526,7 @@ pdf_export_multi (GimpProcedure *procedure,
GError *error = NULL;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
GimpExportOptions *options = NULL;
gchar *uri;
const gint32 *image_ids = NULL;
GimpImage *image = NULL;
@ -524,6 +541,8 @@ pdf_export_multi (GimpProcedure *procedure,
"images", &image_ids,
NULL);
options = gimp_export_options_new ();
if (uri != NULL)
{
file = g_file_new_for_uri (uri);
@ -549,7 +568,7 @@ pdf_export_multi (GimpProcedure *procedure,
}
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),
&error);
@ -635,21 +654,19 @@ get_missing_fonts (GList *layers)
static GimpPDBStatusType
pdf_export_image (GimpProcedure *procedure,
GimpProcedureConfig *config,
GimpExportOptions *options,
gboolean single_image,
gboolean show_progress,
GError **error)
{
cairo_surface_t *pdf_file;
cairo_t *cr;
GimpExportCapabilities capabilities;
FILE *fp;
gint i;
gboolean apply_masks;
gboolean layers_as_pages = FALSE;
gboolean fill_background_color;
cairo_surface_t *pdf_file;
cairo_t *cr;
FILE *fp;
gint i;
gboolean layers_as_pages = FALSE;
gboolean fill_background_color;
g_object_get (config,
"apply-masks", &apply_masks,
"fill-background-color", &fill_background_color,
NULL);
@ -682,17 +699,6 @@ pdf_export_image (GimpProcedure *procedure,
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++)
{
GimpImage *image = multi_page.images[i];
@ -716,8 +722,8 @@ pdf_export_image (GimpProcedure *procedure,
*/
cairo_save (cr);
if (! (gimp_export_image (&image,
capabilities) == GIMP_EXPORT_EXPORT))
if (! (gimp_export_options_get_image (options,
&image) == GIMP_EXPORT_EXPORT))
{
/* gimp_drawable_histogram() only works within the bounds of
* the selection, which is a problem (see issue #2431).
@ -823,6 +829,34 @@ pdf_export_image (GimpProcedure *procedure,
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 */
/******************************************************/

View File

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

View File

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

View File

@ -155,6 +155,7 @@ static GimpValueArray * pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -367,6 +368,12 @@ pnm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Data formatting"),
_("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),
"pbm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_BITMAP,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("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),
"pgm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
gimp_procedure_add_choice_argument (procedure, "raw",
_("_Data formatting"),
_("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),
"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",
_("_Data formatting"),
_("Whether to export ASCII or raw output"),
@ -521,6 +541,13 @@ pnm_create_procedure (GimpPlugIn *plug_in,
"image/x-portable-arbitrarymap");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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))
{
@ -550,6 +577,12 @@ pnm_create_procedure (GimpPlugIn *plug_in,
"image/x-portable-floatmap");
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"pfm");
gimp_export_procedure_set_capabilities (GIMP_EXPORT_PROCEDURE (procedure),
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY,
NULL, NULL);
}
return procedure;
@ -591,6 +624,7 @@ pnm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -613,45 +647,7 @@ pnm_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
switch (file_type)
{
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;
}
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -185,6 +185,7 @@ static GimpValueArray * tga_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -302,6 +303,13 @@ tga_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Use RLE compression"),
_("Use RLE compression"),
@ -354,6 +362,7 @@ tga_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -373,11 +382,7 @@ tga_export (GimpProcedure *procedure,
status = GIMP_PDB_CANCEL;
}
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (status == GIMP_PDB_SUCCESS)

View File

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

View File

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

View File

@ -115,6 +115,7 @@ static GimpValueArray * xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
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_documentation (procedure,
"Load files in XPM (X11 Pixmap) format.",
"Load files in XPM (X11 Pixmap) format. "
"XPM is a portable image format "
"designed to be included in C source "
"code. XLib provides utility functions "
"to read this format. Newer code should "
"however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, "
"unlike the XBM format which XPM was "
"designed to replace.",
_("Load files in XPM (X11 Pixmap) format."),
_("Load files in XPM (X11 Pixmap) format. "
"XPM is a portable image format "
"designed to be included in C source "
"code. XLib provides utility functions "
"to read this format. Newer code should "
"however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, "
"unlike the XBM format which XPM was "
"designed to replace."),
name);
gimp_procedure_set_attribution (procedure,
"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_documentation (procedure,
"Export files in XPM (X11 Pixmap) format.",
"Export files in XPM (X11 Pixmap) format. "
"XPM is a portable image format "
"designed to be included in C source "
"code. XLib provides utility functions "
"to read this format. Newer code should "
"however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, "
"unlike the XBM format which XPM was "
"designed to replace.",
_("Export files in XPM (X11 Pixmap) format."),
_("Export files in XPM (X11 Pixmap) format. "
"XPM is a portable image format "
"designed to be included in C source "
"code. XLib provides utility functions "
"to read this format. Newer code should "
"however be using gdk-pixbuf-csource "
"instead. XPM supports colored images, "
"unlike the XBM format which XPM was "
"designed to replace."),
name);
gimp_procedure_set_attribution (procedure,
"Spencer Kimball & Peter Mattis & "
@ -256,6 +257,13 @@ xpm_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("_Threshold"),
_("Alpha threshold"),
@ -302,6 +310,7 @@ xpm_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -313,11 +322,7 @@ xpm_export (GimpProcedure *procedure,
gegl_init (NULL, NULL);
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)

View File

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

View File

@ -289,7 +289,8 @@ send_image (GObject *config,
GimpDrawable **drawables,
gint32 run_mode)
{
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpExportOptions *options = NULL;
gchar *ext;
GFile *tmpfile;
gchar *tmpname;
@ -329,7 +330,9 @@ send_image (GObject *config,
tmpfile = gimp_temp_file (ext + 1);
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)))
{
goto error;

View File

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

View File

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

View File

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

View File

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

View File

@ -460,14 +460,15 @@ icns_export_image (GFile *file,
/* MacOS X format icons */
if (match != -1 && duplicates[match] == 0)
{
GimpProcedure *procedure;
GimpValueArray *return_vals;
GimpImage *temp_image;
GimpLayer *temp_layer;
GFile *temp_file = NULL;
FILE *temp_fp;
gint temp_size;
gint macos_size;
GimpProcedure *procedure;
GimpValueArray *return_vals;
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;
temp_file = gimp_temp_file ("png");
@ -483,6 +484,7 @@ 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

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

View File

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

View File

@ -74,6 +74,7 @@ static GimpValueArray * jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -197,6 +198,11 @@ jpeg_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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
* settings
*/
@ -415,6 +421,7 @@ jpeg_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -518,9 +525,7 @@ jpeg_export (GimpProcedure *procedure,
"original-num-quant-tables", orig_num_quant_tables,
NULL);
export = gimp_export_image (&image,
GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY);
export = gimp_export_options_get_image (options, &image);
drawables = gimp_image_list_layers (image);
if (run_mode == GIMP_RUN_INTERACTIVE)

View File

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

View File

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

View File

@ -95,6 +95,7 @@ static GimpValueArray * tiff_export (GimpProcedure *procedure
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data);
@ -103,9 +104,14 @@ static GimpPDBStatusType tiff_export_rec (GimpProcedure *procedure
GimpImage *orig_image,
GFile *file,
GimpProcedureConfig *config,
GimpExportOptions *options,
GimpMetadata *metadata,
gboolean retried,
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_multi_layer (GimpImage *image);
@ -223,6 +229,11 @@ tiff_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("Export in _BigTIFF variant file format"),
_("The BigTIFF variant file format uses 64-bit offsets, "
@ -339,6 +350,7 @@ tiff_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -358,8 +370,8 @@ tiff_export (GimpProcedure *procedure,
break;
}
status = tiff_export_rec (procedure, run_mode, image,
file, config, metadata, FALSE, &error);
status = tiff_export_rec (procedure, run_mode, image, file,
config, options, metadata, FALSE, &error);
return gimp_procedure_new_return_values (procedure, status, error);
}
@ -370,6 +382,7 @@ tiff_export_rec (GimpProcedure *procedure,
GimpImage *orig_image,
GFile *file,
GimpProcedureConfig *config,
GimpExportOptions *options,
GimpMetadata *metadata,
gboolean retried,
GError **error)
@ -396,43 +409,9 @@ tiff_export_rec (GimpProcedure *procedure,
if (status == GIMP_PDB_SUCCESS)
{
GimpExportCapabilities capabilities;
GimpCompression compression;
gboolean save_layers;
gboolean crop_layers;
g_object_get (config, "bigtiff", &bigtiff, NULL);
g_object_get (config,
"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);
export = gimp_export_options_get_image (options, &image);
}
drawables = gimp_image_list_layers (image);
@ -466,13 +445,59 @@ tiff_export_rec (GimpProcedure *procedure,
tiff_reset_file_size_error ();
g_clear_error (error);
return tiff_export_rec (procedure, run_mode, orig_image,
file, config, metadata, TRUE, error);
return tiff_export_rec (procedure, run_mode, orig_image, file,
config, options, metadata, TRUE, error);
}
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
image_is_monochrome (GimpImage *image)
{

View File

@ -70,10 +70,15 @@ static GimpValueArray * webp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
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)
@ -165,6 +170,13 @@ webp_create_procedure (GimpPlugIn *plug_in,
gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
"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",
_("Source _type"),
_("WebP encoder preset (Default=0, Picture=1, Photo=2, Drawing=3, "
@ -282,6 +294,7 @@ webp_export (GimpProcedure *procedure,
GimpRunMode run_mode,
GimpImage *image,
GFile *file,
GimpExportOptions *options,
GimpMetadata *metadata,
GimpProcedureConfig *config,
gpointer run_data)
@ -295,11 +308,10 @@ webp_export (GimpProcedure *procedure,
gegl_init (NULL, NULL);
if (run_mode == GIMP_RUN_INTERACTIVE)
gimp_ui_init (PLUG_IN_BINARY);
if (run_mode == GIMP_RUN_INTERACTIVE)
{
gimp_ui_init (PLUG_IN_BINARY);
if (! save_dialog (image, procedure, G_OBJECT (config)))
return gimp_procedure_new_return_values (procedure,
GIMP_PDB_CANCEL,
@ -311,17 +323,8 @@ webp_export (GimpProcedure *procedure,
NULL);
if (status == GIMP_PDB_SUCCESS)
{
GimpExportCapabilities capabilities = (GIMP_EXPORT_CAN_HANDLE_RGB |
GIMP_EXPORT_CAN_HANDLE_GRAY |
GIMP_EXPORT_CAN_HANDLE_INDEXED |
GIMP_EXPORT_CAN_HANDLE_ALPHA);
export = gimp_export_options_get_image (options, &image);
if (animation)
capabilities |= GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION;
export = gimp_export_image (&image, capabilities);
}
drawables = gimp_image_list_layers (image);
n_drawables = g_list_length (drawables);
@ -363,3 +366,29 @@ webp_export (GimpProcedure *procedure,
g_list_free (drawables);
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"""
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:
error = 'No file given'
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:
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):
# work around a permission bug in the zipfile library:
# 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')
interlace, compression = 0, 2
#TODO: Use GimpExportOptions for this once available
width, height = drawable.get_width(), drawable.get_height()
tmp_img = Gimp.Image.new(width, height, image.get_base_type())
tmp_layer = Gimp.Layer.new_from_drawable (drawable, tmp_img)
@ -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('image', tmp_img)
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('compression', compression)
# write all PNG chunks except oFFs(ets)