Commit Graph

96 Commits

Author SHA1 Message Date
Alx Sa e8df68fb65 libgimp, app, pdb: Rename GimpVectors to GimpPath
This commit renames the GimpVectors
object to GimpPath in both app/core and
in libgimp. It also renames the files
to gimppath.[ch] and updates the relevant
build and translation files.
There are still outstanding gimp_vectors_* ()
functions on the app side that need to be renamed
in a subsequent commit.
2024-07-12 06:16:25 +00:00
Alx Sa d0bdbdfdf6 pdb, libgimp: Rename libgimp GimpImage vectors API...
...to paths

The first step in converting GimpVectors
to GimpPath. The PDB API for any
gimp_image_*_vectors () is now
gimp_image_*_paths ().
This commit only covers libgimp, and
the app/core versions will be renamed in
a following commit.
2024-07-08 02:09:42 +00:00
Jehan 703305d270 libgimp, gimp-data: now skipping the _list_ array functions.
In most bindings, they would just result in the same signature as the
_get_ variants (which people have been used to, since the GIMP 2
series). Also I was told that apparently in some bindings where this
would make a different signature, the (skip) annotation could be ignored
anyway.
2024-07-06 14:51:23 +02:00
Jehan dfe803e882 Issue #9478: gimp_image_get_thumbnail_data() is not introspectable. 2023-10-05 22:58:29 +02:00
Niels De Graef 89c359ce47 Remove GimpUint8Array in favor of GBytes
GLib has a specific type for byte arrays: `GBytes` (and it's underlying
GType `G_TYPE_BYTES`).

By using this type, we can avoid having a `GimpUint8Array` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GBytes`, we allow other languages to pass on byte arrays as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with byte arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2023-05-23 23:37:50 +02:00
Jehan 18c21abf0c libgimp: fix a memory leak.
Discovered while playing with b_sanitize=address flag.
2023-02-16 20:59:33 +01:00
Jehan 8f288bf722 libgimp: add gimp_image_list_selected_drawables().
Similar to other functions, we want a variant which returns a GList.
2022-10-20 23:17:07 +02:00
Jehan b73278f1a8 app, libgimp, pdb: add missing functions for selected items.
Missing functions were:
* gimp_image_get_selected_channels()
* gimp_image_get_selected_vectors()
* gimp_image_list_selected_channels()
* gimp_image_list_selected_vectors()
* gimp_image_set_selected_channels()
* gimp_image_set_selected_vectors()
* gimp_image_take_selected_channels()
* gimp_image_take_selected_vectors()

There are discussions of renaming GimpVectors to GimpPath, which would
also be consistent with the GUI and make the always-plural less akward
in API. We'll see. For now keeping named like this.
2022-10-20 18:25:43 +02:00
Jehan 32310f5e4b libgimp: use G_DECLARE_DERIVABLE_TYPE and G_DECLARE_FINAL_TYPE for…
… the public API.

This was initially proposed by Niels De Graef in !101, and though I
still think this is much less practical for day-to-day development, it
is actually much nicer for the public part of the API. So let's use
these only in public libgimp* API only, not in core.

I actually already started to use these for some of the libgimpwidgets
classes and am now moving libgimp main classes to these macros.

* It doesn't expose the priv member (which is completely useless for
  plug-in developers, only to be used for core development).
* It forces us to never have any variable members in the public API
  (which we were doing fine so far in newest API, but it's nice to be
  enforced with these macros).
* When using G_DECLARE_FINAL_TYPE in particular, it adds flexibility as
  we can change the structure size and the members order as these are
  not exposed. And if some day, we make the class derivable with some
  signals to handle, only then will we expose the class with some
  _gimp_reserved* padding (instead of from the start when none is
  needed). Therefore we will allow for further extension far in the
  future.

Moreover most of these libgimp classes were so far not using any private
values, so we were declaring a `priv` member with a bogus contents just
"in case we needed it in future" (as we couldn't change the struct
size). So even the easiness of having a priv member was very relative
for this public API so far (unlike in core code where we actually have
much more complex interactions and using priv data all the time).
2021-04-06 13:02:03 +02:00
Jehan 3f1cae4d6b libgimp: gimp_image_take_selected_layers() with boolean return.
Since it can fail, we should return the success value.
2021-03-08 22:40:33 +01:00
Jacob Boerema 43b25781dc libgimp: fix annotations of gimp_image_list(_selected)_layers.
Looks like a copy paste error where element-type was
specified as GimpImage instead of GimpLayer.
2021-03-06 12:10:57 -05:00
Jehan a44de4679f libgimp: fix annotation.
Fixing the GIR warning:
>  Warning: Gimp: gimp_image_take_selected_layers: argument layers: Missing (element-type) annotation
2021-03-02 18:43:41 +01:00
Jehan 6e7ce32446 libgimp: new gimp_image_take_selected_layers().
Similar to gimp_image_set_selected_layers() except that it takes a GList
(instead of a C array) and also it takes ownership of the list pointer.
This makes it much easier to use in some specific situations.
2021-02-24 12:06:45 +01:00
Jehan ac56b1ed14 app, libgimp, pdb: add PDB function gimp_image_get_selected_layers().
Also add gimp_image_list_selected_layers() which is the GList version.
2020-05-17 18:32:16 +02:00
Niels De Graef 57d3837e40 gir: More missing annotations
Especially need to watch out with forgetting `(array)` and `(out)`
annotations, as they can really give a different API in certain (if not
most) bindings.
2020-05-08 16:57:45 +02:00
Niels De Graef 9c9e310a67 gir: Add missing annotations
Otherwise we won't be able to generate proper API for our bindings
2020-05-04 02:11:57 +02:00
Michael Natterer f764fd0f82 pdb, libgimp: change all generated ID array return values to object arrays
and remove the manual libgimp wrappers which now have the same
signature as the generated functions.
2019-09-05 13:01:00 +02:00
Michael Natterer a351ce9126 Remove the entire old plug-in interface 2019-09-04 00:03:12 +02:00
Michael Natterer 660ad6c41a libgimp: use the new get_by_id() functions
except in code that is about to go away.
2019-09-03 10:57:41 +02:00
Michael Natterer d67eb6f438 libgimp: remove all deprecated stuff from gimpimage.[ch] 2019-08-31 12:10:06 +02:00
Michael Natterer 2fd35e77b5 Revert "libgimp: API with new object classes are since 3.0."
This reverts commit e24375e64a.

The API is semantically the same, and there is no danger of confusion,
no need to update the Since: tags.
2019-08-30 18:44:56 +02:00
Jehan e24375e64a libgimp: API with new object classes are since 3.0.
Even when the function names may have stayed the same in most cases, the
API has changed. The "Since:" tag must therefore be bumped.

Also adding docs for gimp_drawable_get_sub_thumbnail_data() which had
none.
2019-08-30 16:42:08 +02:00
Michael Natterer 37897b13fe libgimp: fix legacy plug-ins, which I broke with the big ID removal
- hand out and leak proxy object objects to legacy API like candy,
  bypassing the factory in GimpPlugIn, because there is no plug-in
  singleton.

- gimpgpcompat.c: image, item etc. are now objects, simply forgot this
  file.
2019-08-29 18:36:59 +02:00
Michael Natterer 392f00baf5 app, libgimp: get rid of all ID GTypes and ID param specs
Turn all ID param specs into object param specs (e.g. GimpParamImageID
becomes GimpParamImage) and convert between IDs and objects in
gimpgpparams.c directly above the the wire protocol, so all of app/,
libgimp/ and plug-ins/ can deal directly with objects down to the
lowest level and not care about IDs.

Use the actual object param specs for procedure arguments and return
values again instead of a plain g_param_spec_object() and bring back
the none_ok parameter.

This implies changing the PDB type checking functions to work on pure
integers instead of IDs (one can't check whether object creation is
possible if performing that check requires the object to already
exist).

For example gimp_foo_is_valid() becomes gimp_foo_id_is_valid() and is
not involved in automatic object creation magic at the protocol
level. Added wrappers which still say gimp_foo_is_valid() and take the
respective objects.

Adapted all code, and it all becomes nicer and less convoluted, even
the generated PDB wrappers in app/ and libgimp/.
2019-08-29 11:39:34 +02:00
Michael Natterer 91d9e4d08f libgimp: remove deprecated metadata functions 2019-08-27 18:41:22 +02:00
Michael Natterer f57725a96a libgimp: add instance-private struct to all new objects
Just in case we need it later.
2019-08-27 16:47:17 +02:00
Michael Natterer 96c1f754ba libgimp: remove a ton of deprecated API that is unused 2019-08-27 16:32:25 +02:00
Michael Natterer 0b3e02be10 libgimp: again, redo all APIs returning list of images, items, children
We now have both variants, one returning a GList, and another
returning an array. Turns out that while a list is often nicer,
sometimes a random-access array really keeps the code much simpler.

Adapt all plug-ins, and clean up a bit (like use g_list_reverse() once
instead of iterating the list reversed).
2019-08-27 13:26:27 +02:00
Michael Natterer 75bf3865b8 libgimp: memory/lifecycle manage the new libgmp proxy objects
Turn GimpPlugIn into the main factory for all proxies and keep the
main hash tables there. The hash tables keep the initial reference.

For each GimpProcedure::run(), have s "sub-factory" which hands out
proxies to the actual procedure code. Each run() has hash tables of
its own which hold additional references. When run() is done, get rid
of its hash tables and their references, *and* drop the main plug-in
reference counts from the global hashes if the proxies' refcount has
dropped to one.
2019-08-23 17:30:04 +02:00
Jehan 08849a584c libgimp: GimpItem now also belong to libgimp. 2019-08-22 15:54:36 +02:00
Jehan cfd30ec62a libgimp: s/gimp_image_new_by_id()/gimp_image_get_by_id()/
This means that images' ownership is not given to caller in particular.
libgimp will now keep a reference of all GimpImage-s it creates and
return this same reference if called again. It also means that you can
now compare images by pointer comparison (as 2 GimpImage objects
representing the same image ID will be equal).
Obviously as a side effect, gimp_image_list() is changed to (transfer
container) as you must only free the container now, not the elements.
Also various other functions creating new images are now (transfer none)
too.

Long-time plug-ins will have to be taken in consideration in a further
step (we currently never free GimpImage for destroyed images in
particular).
2019-08-22 15:54:36 +02:00
Jehan 75f8a3804d libgimp: nicer API for functions returning a list.
I.e.: gimp_image_get_(layers|channels|vectors)(), gimp_image_list() and
gimp_item_get_children().
Instead of returning an array of IDs, these will now return a GList with
the right objects ready to use.
2019-08-22 15:54:36 +02:00
Jehan 09f0530dab libgimp: update non-generated API to allow old and new API.
Same as previous commit: by default the new API will be used. But if a
plug-in builds with GIMP_DEPRECATED_REPLACE_NEW_API macro, then the same
function names will call the old API with ids.
2019-08-22 15:54:36 +02:00
Jehan 688c3230d0 libgimp: create and use gimp_image_new_by_id().
Simpler than using g_object_new() in a bunch of places.
2019-08-22 15:54:36 +02:00
Jehan bb72504ea9 libgimp: change all non-generated API to use GimpImage.
We shouldn't pass as parameter nor return gint32 anymore.
2019-08-22 15:54:36 +02:00
Jehan 4db8cda24e app, pdb, libgimp: add a new GimpImage class for plug-ins.
This means that all functions which were returning or taking as
parameter an image id (as gint32) are now taking a GimpImage object
instead.
The PDB is still passing around an id only over the wire. But we create
an object for plug-ins to work on.

This is quite a huge API break, but is probably the best bet for the
future quality. It will make nicer API instrospection (and nicer API in
binding), will fix the issues with pspec on GimpImageID in Python
bindings (which makes the current Python API unusable as soon as we need
to work on images, which is most of our plug-ins!), etc.
Also it will allow to use signals on images, which will be a great asset
when we will finally have bi-directionnal communications (i.e. plug-ins
would be able to connect to image changes, destructions, and whatnot).
2019-08-22 15:54:36 +02:00
Michael Natterer b2582e80f6 libimp: merge public gimppixbuf functions into gimplayer and gimpdrawable
and remove gimppuxbuf.h from the public API. Keep the files privately
for _gimp_pixbuf_from_data().
2019-08-07 22:26:05 +02:00
Niels De Graef 5f92ced1f3 Add (nullable) if applicable
Basically this commit makes sure that all return values that are marked
as "Returns:" also have a `(nullable)` annotation if it is mentioned on
the same line that NULL can also be returned.

This will prevent a few problems in GObject-introspection.
2019-08-03 07:53:47 +00:00
Jehan 6fe2508301 libgimp*: fix various missing (transfer) annotations. 2019-08-01 01:52:07 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 9525c646e1 libgimp: remove tons of deprecated cruft 2018-05-20 21:06:29 +02:00
Jehan eeab960b78 libgimp: update function documentation.
Two deprecated functions were not following the same documentation
pattern as the others.
2015-11-02 17:43:38 +01:00
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Hartmut Kuhse 21bed1e2fb Completely rewrite metadata handling using gexiv2
Based on original patches from Hartmut Kuhse and modified
by Michael Natterer. Changes include:

- remove libexif dependency and add a hard dependency on gexiv2
- typedef GExiv2Metadata to GimpMetadata to avoid having to
  include gexiv2 globally
- add basic GimpMetadata handling functions to libgimpbase
- add image and image file specific metadata functions to libgimp,
  including the exif orientation image rotate dialog
- port plug-ins to use the new APIs
- port file-tiff-save's UI to GtkBuilder
- add new plug-in "metadata" to view the image's metadata
- keep metadata around as GimpImage member in the core
- update the image's metadata on image size, resolution and precision
  changes
- obsolete the old metadata parasites
- migrate the old parasites to new GimpMetadata object on XCF load
2013-10-27 01:02:17 +02:00
Michael Natterer 0d481702c7 libgimp*: add GIMP_DEPRECATED macros using G_DEPRECATED
and start using them instead of GIMP_DISABLE_DEPRECATED where possible.
2012-05-03 00:54:21 +02:00
Michael Natterer 3d5758d209 libgimp: fix docs of deprecated functions
(cherry picked from commit 569c122137)
2012-05-03 00:26:26 +02:00
Michael Natterer 87646e9ace libgimp: deprecate and rename the image parasite functions
in exactly the way the drawable functios were turned into item ones.
2011-03-08 13:19:21 +01:00
Michael Natterer 92b6d70448 libgimp: remove the layer/channel/vectors raise/lower/position procedures
and add them to the list of compat_procs instead.
2011-02-13 18:29:08 +01:00
Michael Natterer 611877783c libgimp: deprecate gimp_image_attach_new_parasite()
and port all its users to gimp_image_parasite_attach().
2010-07-09 14:15:55 +02:00
Michael Natterer d9b5207aa2 Change licence to GPLv3 (and to LGPLv3 for libgimp).
2009-01-17  Michael Natterer  <mitch@gimp.org>

	* all files with a GPL header and all COPYING files:

	Change licence to GPLv3 (and to LGPLv3 for libgimp).

	Cleaned up some copyright headers and regenerated the parsers in
	the ImageMap plugin.


svn path=/trunk/; revision=27913
2009-01-17 22:28:01 +00:00