Commit Graph

8398 Commits

Author SHA1 Message Date
Michael Natterer a50069e176 libgimp: change the return values of GimpPlugIn::init_procedures()
and ::query_procedures() to a GList* of strings.
2019-08-02 19:10:13 +02:00
Jehan bc7b358802 libgimp, plug-ins: remove n_procedures from (init|query)_procedures().
The way currently implemented plug-ins are, they are already
NULL-terminating the returned arrays. Since a procedure name cannot be
NULL itself by definition, defining the array length by a terminal NULL
is enough. There is no need to also add a n_procedures parameters which
is just one more possible bug source, even more as we were already
expecting the NULL termination by using g_strfreev() to free the memory.

Anyway a length parameter does not bring any advantage since a plug-in
can still "lie" about its array size (just as it can forget to
NULL-terminate it) and when this happens, the plug-in will segfault.
That's it, it's just a plug-in programming error.

Last but not least, some binding seem to have issues with returned array
setting an (out) parameter as the length. In pygobject at least, the
length parameter doesn't disappear and we end up with this ugly
signature:

> In [3]: Gimp.PlugIn.do_query_procedures.__doc__
> Out[3]: 'query_procedures(self) -> list, n_procedures:int'

See bug report pygobject#352.
To avoid this, we should either set both the array and the length as
(out) parameters or just set the returned array as NULL-terminated
(which is the solution I chose).
2019-08-02 13:50:38 +02:00
Jehan 3945701bd6 plug-ins: localization calls must happens inside query().
It's a bit weird because this has to happen during the query() step, but
plug-ins don't have access to this step anymore, apart from
query_procedures(), which then turns out to be badly named.
2019-08-02 12:58:37 +02:00
Michael Natterer 5f8d0ef27b libgimp: add gimp_plug_in_extension_enable() and _extension_process()
Start copying all the actual wire communication to GimpPlugIn, and
move the legacy versions to gimplegacy.c.

This implies having the entire protocol code twice, but without any
if(PLUG_IN) { plug_in_stuff(); } else { legacy_stuff(); }

At the moment it is a wild mixture of old and new, but when finished
the wire code in gimplegacy.c will be entirely separate from the wire
code in GimpPlugIn, which will make it easy to g_assert() that only
one API is used by a plug-in.
2019-08-02 12:02:20 +02:00
Jehan 17667b7ddf plug-ins: start porting palette-to-gradient to new GimpPlugIn API.
Several aspects of the new API are kind of broken in the Python binding,
especially the arguments. So this first version has no arguments at all.
This also means it cannot be installed in "<Palettes>" menu for the time
being. This is work-in-progress and the missing parts will be
uncommented later when we figure out how to fix the problems.
2019-08-02 03:03:47 +02:00
Michael Natterer 0bec2bcdec libgimp: add gimp_procedure_set_menu_label() and _set_documentation()
which replace _set_strings(). Add more docs.
2019-08-02 00:56:00 +02:00
Michael Natterer b511cf34cf libgimp: add gimp_procedure_set_attribution()
Also rename "author" to "authors" and add some docs.
2019-08-02 00:35:17 +02:00
Michael Natterer 82afcf5c85 plug-ins: help: use gimp_procedure_extension_ready() 2019-08-01 23:46:55 +02:00
Michael Natterer a841e0fb06 libgimp: add gimp_procedure_set_image_types()
and remove the "image_types" parameter from gimp_procedure_set_strings(),
which is only a bad hack copied from the core procedure class.
2019-08-01 23:09:01 +02:00
Michael Natterer e0a6eb38da libgimp: add run_data and run_data_destroy parameters to procedure_new()
so bindings work properly. Change plug-ins accordingly.
2019-08-01 22:45:49 +02:00
Michael Natterer 6a0ef1f7fe plug-ins: help: remove the temp proc using new API 2019-07-30 21:21:36 +02:00
Michael Natterer 46cacb5ebd plug-ins: help: use new API to call the help browser 2019-07-30 21:16:07 +02:00
Michael Natterer 941165961d plug-ins: port help to the new plug-in API, to test temp procs
and they do work :)
2019-07-30 21:04:11 +02:00
Michael Natterer 1c650801e8 plug-ins: follow gimp_procedure_new() API change in goat-exercise 2019-07-30 21:03:34 +02:00
Michael Natterer 1e10cfc53f plug-ins: register an icon for goat-exercise 2019-07-30 19:25:06 +02:00
Michael Natterer a47789fcb8 plug-ins: and in ifs-compose too... 2019-07-30 18:37:05 +02:00
Jehan 67f33cb6ec plug-ins: add button mnemonics. 2019-07-30 16:34:06 +02:00
Michael Natterer c0fb66254e Use g_ascii_dtostr() instead of g_ascii_formatd()
The latter is broken and doesn't guarantee a decimal point with the
current bug. Also, g_ascii_dtostr() doesn't need the format parameter
and produces nicer output.
2019-07-30 15:57:36 +02:00
Jehan f1351df9eb plug-ins: replace set_alternative_button_order_from_array() by the...
... Gimp.Dialog alternative version.
Just to get rid of the warning.
2019-07-30 14:05:38 +02:00
Jehan 62d87f15d9 plug-ins: port python-console to new GObject-introspected API.
I may have missed things. That is the problem of non-compiled script
languages. There is also a known warning:
> DeprecationWarning: Gtk.Dialog.set_alternative_button_order_from_array is deprecated
I'll see later about this one.

Push-time note: calling various functions is actually broken right now
in the console since the late API changes (it was working fine yesterday
evening when I tested the same python-console code). Pushing anyway for
now.
2019-07-30 12:57:59 +02:00
Jehan aab75bb1d0 plug-ins: install the pygimp.interp file.
Python scripts should already properly run, whether you run them with a
direct python shebang or a `env python` one (cf. previous commit). But
it's still nice to install a `.interp` file, which allows to control
exactly the interpreter to use, overriding the shebang. With this file,
Python scripts will use installation-time Python interpreter.

Also update old code to make the interp contents about Python 3 instead
of 2.
2019-07-29 14:28:29 +02:00
Jehan 9e844ae1d7 app: when interpreter not found in interpreter DB, leave shebang as-is.
In particular, if the shebang is `#!/usr/bin/env lang` and we have not
registered a specific interpreter for `lang`, the system should leave
the env tool search the right interpreter for us. We only bypass env
when we set our own explicit interpreter.

Apply this to palette-to-gradient.py plug-in.
2019-07-29 14:11:25 +02:00
Jehan c63ae2f945 plug-ins: one more missing backslash.
Come on!
2019-07-29 00:15:56 +02:00
Jehan ee4e9bfee5 plug-ins: missing backslash broke EXTRA_DIST.
Because of this, EXTRA_DIST was empty, hence images and XML resource
file were missing from the distributed files.
2019-07-28 23:47:05 +02:00
Jehan 0f0cf4df87 po-python: install again localization for Python plug-ins.
This used to be deactivated. Let's install them again.
Also activate localization in the palette-to-gradient plug-in.
2019-07-28 21:06:36 +02:00
Jehan 65fb7536e1 plug-ins: port Python plug-in palette-to-gradient to introspected API.
Localization still doesn't work, but this is normal (po-python is not
installed). I will later make the proper tests for this.

Other than this, it is a pretty simple port. It lost all particularities
and facilities of pygimp, but the fact that it now works similarly to
the C API is quite nice too.
It still uses the legacy API for plug-ins though and will have to be
ported further when the new API will be stable.

Also I still haven't figured out why we need to return the number of
returned values. With the proper annotations, an array length parameter
disappears in introspected Python (because it is useless as Python lists
know their length). But it would seem that this annotation doesn't work
the same for returned values, which is a bit sad as it creates ugly
redundancy.

It can be noted that I an going to move all Python plug-ins from
plug-ins/pygimp/plug-ins/ to plug-ins/python/. The whole pygimp/
subdirectory will actually be deleted eventually (I keep it around for
now as reference) as Python plug-in should not need to be considered
particularly from now on. They can just be considered as generic
executables.
2019-07-28 18:43:00 +02:00
Michael Natterer 32ea28b6b1 app, libgimp, libgimpbase: plug-in and PDB protocol refactoring part two
- Change the wire protocol's GPProcInstall to transmit the entire
  information needed for constructing all GParamSpecs we use, don't
  use GimpPDBArgType in GPProcInstall but an enum private to the wire
  protocol plus the GParamSpec's GType name. Bump the wire protocol
  version.

- Add gimpgpparamspecs.[ch] in both app/plug-in/ and libgimp/ which
  take care of converting between GPParamDef and GParamSpec. They
  share code as far as possible.

- Change pluginrc writing and parsing to re-use GPParamDef and the
  utility functions from gimpgpparamspecs.

- Remove gimp_pdb_compat_param_spec() from app/pdb/gimp-pdb-compat.[ch],
  the entire core uses proper GParamSpecs from the wire protocol now,
  the whole file will follow down the drain once we use a GValue
  representation on the wire too.

- In gimp_plug_in_handle_proc_install(), change the "run-mode"
  parameter to a GParamSpecEnum(GIMP_TYPE_RUN_MODE) (if it is not
  already an enum). and change all places in app/ to treat it as an
  enum value.

- plug-ins: fix cml-explorer to register correctly, a typo in
  "run-mode" was never noticed until now.

- Add gimpgpcompat.[ch] in libgimp to deal with all the transforms
  between old-style wire communication and using GParamSpec and
  GValue, it contains some functions that are subject to change or
  even removal in the next steps.

- Change the libgimp GimpProcedure and GimpPlugIn in many ways to be
  able to actually install procedures the new way.

- plug-ins: change goat-exercise to completely use the new GimpPlugIn
  and GimpProcedure API, look here to see how plug-ins will look in
  the future, of course subject to change until this is finished.

- Next: changing GPParam to transmit all information about a GValue.
2019-07-28 17:34:40 +02:00
Federico Mena Quintero 16660c5928 file-svg: Use rsvg_handle_new_from_gfile_sync() instead of GIOChannel
The latter is obsolete, and rsvg_handle_write()/close() are deprecated
anyway.
2019-07-22 17:26:22 -05:00
Federico Mena Quintero b2027c40b7 Issue #2561: Fix computation of SVG image sizes
The librsvg API was being called in an incorrect order.  One cannot
call rsvg_handle_get_dimensions() until after rsvg_handle_close() is
done.
2019-07-22 17:26:22 -05:00
Michael Natterer 6bb03dc21a plug-ins: revive animation-play, and draw stuff with cairo
Still lots of deprecated stuff, but mostly GtkAction and friends.
2019-07-22 17:28:20 +02:00
Jehan ef3c13c6c5 plug-ins: use global gegl_init() in file-pdf-load run() function.
As noted by Mitch, this is simpler and what we do in other plug-ins.
2019-07-22 14:56:04 +02:00
Jehan 443c171f8d plug-ins: babl_init|exit() for non-interactive "file-pdf-load" too.
Improve my previous commit: I added babl_init|exit() for
"file-pdf-load-thumb". But these was actually also missing from
non-interactive calls to "file-pdf-load", since the initialization was
done as part of gimp_ui_init() so far.
Just run them down the call stack around the needed part. It's not a
problem if it's called double (for the interactive code path).
2019-07-22 12:39:45 +02:00
Michael Natterer f4b88c0a9e plug-ins: link file-pdf against GEGL/babl 2019-07-22 12:19:07 +02:00
Jehan e0a24a27de plug-ins: babl_init|exit() needs to be run for "file-pdf-load-thumb".
This is run as part of gimp_ui_init() in the normal "file-pdf-load"
calls, but such calls have been forgotten for the thumbnail load
procedure.

Also the GimpRunMode is only a parameter in "file-pdf-load". For
"file-pdf-load-thumb", the first parameter is directly the filename. The
fact it might have used to work is chance as it were only tested against
GIMP_RUN_INTERACTIVE, which is 0, so the test would end up FALSE, which
is what we want for thumbnail loading. Anyway now we get a proper call
(thumbnail loading always considered non-interactive).
2019-07-22 12:13:38 +02:00
Michael Natterer b9b8879ba0 plug-ins: some GTK3 undeprecation in imagemap 2019-07-22 10:28:37 +02:00
Michael Natterer 8e809160f0 plug-ins: port file-dds to GtkGrid 2019-07-22 01:37:11 +02:00
Michael Natterer 618fbc6b17 plug-ins: clean up the file-dds GUI, remove the "Advanced" expander
(cherry picked from commit d578aa67f5)
2019-07-22 01:14:00 +02:00
Michael Natterer 7208fba663 plug-ins: don't use deprecated icon API in compose 2019-07-22 00:05:46 +02:00
Michael Natterer 82cdd69e0c plug-ins: completely undeprecate curve-bend 2019-07-21 21:23:28 +02:00
Michael Natterer 98f9205faa plug-ins: completely undeprecate sample-colorize 2019-07-21 20:56:07 +02:00
Michael Natterer b347cc73a1 plug-ins: don't use GtkStyle in ifs-compose, it's deprecated 2019-07-21 20:36:01 +02:00
Michael Natterer d223522b8b plug-ins: suppress deprecation warnings from the OpenEXR headers
"Fix" straight from stackoverflow, I have no idea how this builds
on anything except gcc or clang.
2019-07-21 19:56:29 +02:00
Michael Natterer 32d789e355 plug-ins: port imagemap to named icons from a resource 2019-07-21 19:47:39 +02:00
Michael Natterer 3a453fa918 plug-ins: gfig-icons.c doesn't need an i18n include any longer 2019-07-21 16:52:24 +02:00
Jehan a7a7cd7710 plug-ins: fix VPATH build.
XML files need to be found by the tools when the build is out of the
source tree.
2019-07-21 13:15:14 +02:00
Michael Natterer d3400542f2 plug-ins: port map-object to icon names too
it uses the same icons as lighting so didn't build since the last
commit.
2019-07-20 17:32:27 +02:00
Michael Natterer f6b60e08f2 plug-ins: port lighting from stock icons to using a resource
and icons names. Also fix two more warnings so it's now completely
undeprecated.
2019-07-20 17:23:54 +02:00
Michael Natterer 91f27dfc02 plug-ins: replace stock icons in gfig by a resource 2019-07-20 16:27:32 +02:00
Michael Natterer 3811a65218 plug-ins: remove unused declaration of a GimpDrawable variable 2019-07-20 01:49:21 +02:00
Michael Natterer 23f373e916 plug-ins: remove filter-pack without any replacement 2019-07-19 19:01:51 +02:00
Michael Natterer 3914e04722 plug-ins: port gimpressionist to GEGL, stupid 8-bit port only 2019-07-19 18:58:24 +02:00
Michael Natterer b7cf850671 plug-ins: remove the oilify plug-in and add a PDB compat procedure 2019-07-19 17:35:13 +02:00
Michael Natterer 3c73d42e97 plug-ins: port imagemap to GEGL 2019-07-19 17:20:58 +02:00
Michael Natterer d944a7b9a4 plug-ins: port warp to GEGL, stupid 8-bit port only
And put it back in the menus, it's just too weird not to have.
2019-07-19 13:10:42 +02:00
Michael Natterer 8a51993e3f pdb, plug-ins: remove the emboss plug-in and add a PDB compat procedure
Not for 2.10 because it looks a bit different.
2019-07-18 15:05:48 +02:00
Michael Natterer 31fc338ab0 pdb, plug-ins: remove the newsprint plug-in and add a PDB compat procedure 2019-07-18 12:52:18 +02:00
Jehan fb3007edef plug-ins: get rid of babl_format() in file-heif too. 2019-07-17 14:21:23 +02:00
Jehan 4f1ac48dd3 plug-ins: get rid of babl_format() in file-jpeg.
Same as previous commits.
2019-07-17 13:55:51 +02:00
Jehan 9d54d81a8c plug-ins: get rid of babl_format() in file-webp.
Same as commit 74abdfa377, this time for file-webp.
2019-07-17 13:55:19 +02:00
Jehan 74abdfa377 plug-ins: improve a bit the space invasion code.
No need to call babl_format() to then use the encoding part only with
babl_format_get_encoding(). Just keep the encoding as constant string
and use it on babl_format_with_space() at the end.

This doesn't actually change the logics, but make code a bit simpler,
and also remove calls to babl_format(), which makes discovering non
space-invaded code with grep-s easier.
2019-07-17 12:46:00 +02:00
Michael Natterer 7cd78f436d plug-ins: port depth-merge to GEGL, stupid 8-bit port only 2019-07-17 12:18:50 +02:00
Michael Natterer 4c1677078e plug-ins: port van-gogh-lic to GEGL
Special effects that nobody understands, now in floating point.
2019-07-17 01:03:48 +02:00
Michael Natterer fd9b6ab834 plug-ins: remove the colorify plug-in without any replacement
The colorize tool does something far more reasonable.
2019-07-15 12:33:50 +02:00
Michael Natterer 9d33a9a9ca plug-ins: port animation-optimize to GEGL, stupid 8-bit port only 2019-07-15 12:24:24 +02:00
Michael Natterer acea533a9a plug-ins: remove the sharpen plug-in without replacement 2019-07-15 00:39:01 +02:00
Michael Natterer 496b5ab9b4 plug-ins: remove color-cube-analyze without replacement
because WTF do we need a histogram plug-in for?
2019-07-14 23:45:57 +02:00
Michael Natterer 4074cec138 plug-ins: remove the blur plug-in without replacement
because.
2019-07-14 23:31:58 +02:00
Michael Natterer dd89f4a3d5 plug-ins: remove the max-rgb plug-in without replacement
To quote the author (from a comment): "After adding preview mode
realised just exactly how useless this plugin is"
2019-07-14 23:08:12 +02:00
Michael Natterer 2ead56096d plug-ins, pdb: remove the softglow plug-in and add a PDB compat procedure
Not for 2.10 because the GEGL op's result looks different. I have no
clue how softglow is supposed to look at all, but the removed plug-in
did things that can't possibly be done with physical light in a
darkroom, so chances are the GEGL op is more correct.
2019-07-14 21:34:27 +02:00
Michael Natterer a0ae31d337 plug-ins, pdb: remove the edge-dog plug-in and add a PDB compat procedure
This is not for 2.10 because the result of the GEGL op looks different,
but without doubt more correct.
2019-07-14 20:09:11 +02:00
Michael Natterer 8fcccf3f88 plug-ins, pdb: remove the contrast-normalize plug-in
and add a PDB compat procedure.
2019-07-14 14:28:40 +02:00
Michael Natterer 3d049f565a Issue #360 - scripts that require brushes that GIMP no longer installs
carve-it.scm, chrome-it.scm: apply slightly modified patch from Carol
Spears which replaces hardcoding round brush names by creating a brush
on the fly and setting its radius.

Also fixed both scripts to not use deprecated color API which is
even completely gone from master.
2019-07-14 13:59:11 +02:00
Michael Natterer 8b08f958ba plug-ins, pdb: remove the edge-neon plug-in and add a PDB compat procedure 2019-07-13 23:59:31 +02:00
Michael Natterer 12bed7be5b plug-ins: port twain to GEGL, 8-bit port only
This has only be tested to build, somebody please test if
it actually works.
2019-07-13 12:52:36 +02:00
Michael Natterer 98be067874 plug-ins: port destripe to GEGL, stupid 8-bit port only 2019-07-13 12:47:45 +02:00
Michael Natterer f9e149dc1e plug-ins: port cml-explorer to GEGL, stupid 8-bit port only 2019-07-13 00:24:52 +02:00
Jehan 6d4a11a261 plug-ins: properly free return values of gimp_image_get_layers()...
... and gimp_item_get_children().
I know plug-ins are shortlived. Still I don't like this!
2019-07-12 13:11:47 +02:00
Michael Natterer 075b34baea plug-ins: port sparkle to GEGL, stupid 8-bit port only 2019-07-12 13:05:38 +02:00
Jehan 5b2d89f794 plug-ins: clean up a bit file-pdf-save.
This improves commit bbd5ebbe8a. Several parameters did not need to go
inside draw_layer(). In particular this function should not take care of
filling return values on errors. It should just return a success boolean
with a GError which is processed on the main function. This also allows
proper shortcut to end the loop earlier on the first error.
Also the layer index parameter does not need to be a pointer since it
never requires updates.
Finally declare variables in smaller scopes for cleaner code.
2019-07-12 00:02:34 +02:00
Lionel bbd5ebbe8a Issue #1002: Fix for layer groups in PDF export
Added a recursive loop to draw layer children in layer groups. Text
layers in layer groups are now exported correctly.
2019-07-11 23:34:03 +02:00
Jehan fea8000743 plug-ins: use profile space for TIFF export. 2019-07-11 16:55:49 +02:00
Michael Natterer 32a229b049 plug-ins: hot's dest_buffer can have another format than src_buffer 2019-07-11 16:18:21 +02:00
Michael Natterer bad956cb1f plug-ins: port hot to GEGL, stupid 8-bit port only 2019-07-11 15:08:44 +02:00
Michael Natterer ceb327f357 plug-ins, pdb: remove the photocopy plug-in and add a PDB compat procedure
The results are different here too, but tweakable like for cartoon.
2019-07-11 12:33:56 +02:00
Michael Natterer 0e23d7262b plug-ins: port contrast-retinex to GEGL, stupid 8-bit port only 2019-07-11 12:17:01 +02:00
Michael Natterer 529ee9efc8 plug-ins, pdb: remove the cartoon plug-in and add a PDB compat procedure
The result of the GEGL op is a bitt different but so what, this is an
artistic effect and the result can be tweaked with parameters.
2019-07-11 11:41:06 +02:00
Michael Natterer 0188853b23 plug-ins: port sphere-designer to GEGL, stupid 8-bit port only 2019-07-11 10:39:13 +02:00
Michael Natterer c59feead89 plug-ins: port despeckle to GEGL, stupid 8-bit port only 2019-07-10 15:40:20 +02:00
Michael Natterer 0326a3e79a plug-ins: port grid to GEGL, stupid 8-bit port only 2019-07-10 12:43:27 +02:00
Michael Natterer eaed92e7a0 plug-ins: port lighting to GEGL 2019-07-10 12:19:13 +02:00
Michael Natterer 75114b1c40 plug-ins: port map-object to GEGL 2019-07-09 17:10:45 +02:00
Michael Natterer bbcc7ca5f5 Issue #3630 - postscript plugin crashes
gsapi_new_instance() now expects a pointer to a NULL-initialized
pointer. Initialize "void *instance" with NULL. Found by massimo.
2019-07-09 15:36:13 +02:00
Michael Natterer 2a54b1b41c plug-ins: forgot one deprecated call in sample-colorize 2019-07-09 13:17:31 +02:00
Michael Natterer df7699b814 plug-ins: port sample-colorize to GEGL, stupid 8-bit port only 2019-07-09 13:15:12 +02:00
Michael Natterer 0b4b8d75ea plug-ins: port curve-bend to GEGL, stupid 8-bit port only 2019-07-08 21:23:03 +02:00
Michael Natterer 8ac6ec2a00 plug-ins: a ton of cleanup in curve-bend
- move use of deprecated function to very few places
- indentation, formatting
- fix insane variable names, it's now much more readable
2019-07-08 21:05:49 +02:00
Michael Natterer 069d4345bb plug-ins: port tile-small to GEGL, stupid 8-bit port only
...GimpPixelFetcher use down to one!
2019-07-07 18:34:54 +02:00
Michael Natterer c6934a67e7 plug-ins: tile-small was still using "expose-event", port to "draw" 2019-07-07 17:57:14 +02:00
Michael Natterer 775abb03f3 plug-ins: replace calls to GimpRegionIterator functions
by plain pixel region code, copied right out of gimpregioniterator.c.
Makes porting to GEGL easier and GimpRegionIterator unused.
2019-07-07 17:09:17 +02:00
Michael Natterer 8f621ec91d plug-ins: port checkerboard to GEGL, stupid 8-bit port only
just for the sake of not using "Psychobilly", hello pippin :)
2019-07-07 16:04:07 +02:00