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

@ -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)