Functions creating a new GeglBuffer should trigger a warning if the
result if unused, because this is potentially a big memory leak.
Similarly objects created by functions creating new layers should be
handled (usually by adding the layer to the image with
gimp_image_insert_layer()), because they also come with a buffer and
possibly quite some important memory leak.
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
… 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).
which call gimp_item_get_by_id() and additionally check if the
returned item has the right type, and return NULL if not.
This is both shorter and more readable than
layer = GIMP_LAYER (gimp_item_get_by_id (id));
and additionally makes sure we don't cast e.g. a non-layer with
GIMP_LAYER(), which will give criticals but shouldn't, because the
wrong IDs can come from anywhere and are an input problem and not a
programming error (criticals are for programming errors).
I did the same trick with GIMP_DEPRECATED_REPLACE_NEW_API macro, apart
for some minor widget API to preview drawable, which I will fix right
away in our plug-ins.
The GimpDrawable abstraction is completely gone, GimpTile is now a
small struct in gimptilebackendplugin.c.
All tile handling code is now in GimpTileBackendPlugin, the backend
functions are simply calling gimp_tile_get() and gimp_tile_put()
directly.
and simply add them to the list of "compat_procs" which have a
replacement with identical signature. Move the libgimp C functions to
non-generated files.
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
2004-12-14 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/drawable.pdb: added gimp_drawable_sub_thumbnail()
to enable plug-ins avoiding #142074-alike bugs if they need to.
* app/pdb/drawable_cmds.c
* app/pdb/internal_procs.c
* libgimp/gimpdrawable_pdb.[ch]: regenerated.
* libgimp/gimpdrawable.[ch]
* libgimp/gimppixbuf.[ch]: wrap it with the same convenience
APIs as gimp_drawable_thumbnail().
* libgimp/gimp.def
* libgimp/gimpui.def: changed accordingly.
2004-03-12 Michael Natterer <mitch@gimp.org>
Cleaned up the remaining libgimp API issues:
* libgimp/gimppixelfetcher.[ch] (enum GimpPixelFetcherEdgeMode):
added new enum value GIMP_PIXEL_FETCHER_EDGE_BACKGROUND so we
can actually use the bg_color feature of the GimpPixelFetcher.
(gimp_pixel_fetcher_new): added "gboolean shadow" parameter
because it must not change while the GimpPixelFetcher exists.
(gimp_pixel_fetcher_set_shadow): removed.
(gimp_pixel_fetcher_set_bg_color): added "GimpRGB *color"
parameter and don't call gimp_palette_get_foreground().
(gimp_pixel_fetcher_get_pixel): handle BACKGROUND mode. Cleaned up
the function.
(gimp_get_bg_guchar)
(gimp_get_fg_guchar): removed these functions...
* libgimp/gimpdrawable.[ch]: ...and added
gimp_drawable_get_color_uchar() instead.
* libgimp/gimp.def
* plug-ins/common/blinds.c
* plug-ins/common/checkerboard.c
* plug-ins/common/cubism.c
* plug-ins/common/curve_bend.c
* plug-ins/common/displace.c
* plug-ins/common/edge.c
* plug-ins/common/illusion.c
* plug-ins/common/mblur.c
* plug-ins/common/mosaic.c
* plug-ins/common/plasma.c
* plug-ins/common/polar.c
* plug-ins/common/ripple.c
* plug-ins/common/shift.c
* plug-ins/common/spread.c
* plug-ins/common/tileit.c
* plug-ins/common/whirlpinch.c
* plug-ins/gflare/gflare.c
* plug-ins/libgimpoldpreview/gimpoldpreview.c: changed accordingly.
(Didn't test the changed plug-ins because I wanted to get this
API change into CVS as soon as possible)
2003-12-03 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/channel.pdb
* tools/pdbgen/pdb/layer.pdb: removed gimp_layer_delete() and
gimp_channel_delete() PDB wrappers...
* tools/pdbgen/pdb/drawable.pdb: ...added gimp_drawable_delete().
* libgimp/gimpdrawable.[ch]: removed gimp_drawable_delete()
(having this function work on the GimpDrawable wrapper and not on
the drawable_id was more than questionable anyway).
* libgimp/gimpcompat.h: added gimp_layer_delete and
gimp_channel_delete cruft #defines.
* app/pdb/channel_cmds.c
* app/pdb/drawable_cmds.c
* app/pdb/internal_procs.c
* app/pdb/layer_cmds.c
* libgimp/gimpchannel_pdb.[ch]
* libgimp/gimpdrawable_pdb.[ch]
* libgimp/gimplayer_pdb.[ch]: regenerated.
* plug-ins/script-fu/scripts/add-bevel.scm
* plug-ins/xjt/xjt.c: changed accordingly.
* plug-ins/imagemap/imap_main.c: just removed the call to
gimp_channel_delete(), it was wrong anyway.
2003-12-03 Michael Natterer <mitch@gimp.org>
* libgimp/libgimp-sections.txt
* libgimp/tmpl/gimpchannel.sgml
* libgimp/tmpl/gimpdrawable.sgml
* libgimp/tmpl/gimplayer.sgml: updated again.
2003-07-01 Sven Neumann <sven@gimp.org>
* libgimp/gimp.[ch]
* libgimp/gimpchannel.[ch]
* libgimp/gimpdrawable.[ch]
* libgimp/gimpimage.[ch]
* libgimp/gimplayer.[ch]
* libgimp/gimpmisc.[ch]
* libgimp/gimpmiscui.[ch]
* libgimp/gimppixelrgn.[ch]
* libgimp/gimpproceduraldb.[ch]: added const qualifiers to the
libgimp API. Will cause lots of compiler warnings until the
generated PDB code has been constified as well.
* libgimpbase/gimpparasite.[ch]: use gconstpointer, not const
gpointer.
2001-11-23 Sven Neumann <sven@gimp.org>
* configure.in: bumped version number to 1.3.1.
Require Glib/GTK+-1.3.11 and Pango-0.22. Removed GDK_DISABLE_COMPAT_H
and GTK_DISABLE_COMPAT_H from our default CFLAGS since they don't
exist any longer.
* RELEASE-TO-CVS.patch: removed since the glib/gtk+ API is supposed to
be frozen now.
* HACKING: removed reference to RELEASE-TO-CVS.patch
* app/gui/menus.c
* app/tools/gimptexttool.c: applied RELEASE-TO-CVS.patch to conform
to the new GTK+/Pango API.
* app/core/Makefile.am: generate marshallers with gimp_marshal prefix.
* app/core/gimpmarshal.list: added all marshallers we use.
* app/core/gimpmarshal.[ch]: regenerated.
* app/[lots of .c files]: use gimp_marshal_* for all marshallers.
* data/images/
* app/app_procs.c
* app/gui/splash.c:
* libgimpbase/Makefile.am
* libgimpbase/gimpbase.h
* libgimpbase/gimputils.[ch]: removed since they are no longer needed.
* app/gimprc.c
* plug-ins/common/ps.c
* plug-ins/gdyntext/gdyntext.c
* plug-ins/gdyntext/gdyntextcompat.c
* plug-ins/gfig/gfig.c
* plug-ins/gflare/gflare.c
* plug-ins/script-fu/script-fu-scripts.c: use glib functions instead
of gimp_strescape() and gimpstrcompress().
* cleaned up all header files: use G_BEGIN_DECLS/G_END_DECLS, declared
all _get_type function as G_GNUC_CONST.
* tools/pdbgen/enumcode.pl
* tools/pdbgen/lib.pl: make them generate header files using
G_BEGIN_DECLS/G_END_DECLS.
* pixmaps/Makefile.am
* pixmaps/wilber3.xpm: removed ...
* data/images/tips_wilber.png: ... and added here as PNG
* app/gui/tips-dialog.c: load the Wilber on demand using GdkPixbuf.
* data/images/gimp_splash.ppm: removed ...
* data/images/gimp_splash.png: ... and added as PNG
* app/app_procs.c
* app/gui/splash.[ch]: load the splash image using GdkPixbuf.
* app/gui/about-dialog.c: sink the GtkPreview.
2001-06-14 Michael Natterer <mitch@gimp.org>
* app/gdisplay.c: fixed a FIXME: set the sensitivity of the
color tools' menu entries again.
* libgimp/gimpcolorselector.h
* libgimp/gimpdrawable.h
* libgimp/gimpmenu.h: removed the usage of "id" from the public
interface because it's a reserved keyword of Objective C.
* libgimp/gimpdrawable.c
* libgimp/gimptile.c
* plug-ins/[lotsa plugins].c: changed accordingly.
2001-06-12 Michael Natterer <mitch@gimp.org>
* libgimp/gimpdrawable.h: removed one more
gimp_channel_ops_duplicate #define.
* plug-ins/gap/gap_mov_dialog.c
* plug-ins/gap/gap_mov_exec.c
* plug-ins/gap/gap_pdb_calls.[ch]: removed a handmade PDB wrapper
and use gimp_image_duplicate().
2001-05-21 Michael Natterer <mitch@gimp.org>
* Makefile.am
* configure.in
* gimptool-1.4.in: added new directory libgimpbase/
* app/Makefile.am: link against the new lib.
* app/appenums.h: removed the PDB enums which are in
libgimpbase/gimpbasetypes.h now. They are all "Gimp" prefixed.
* app/apptypes.h: #include "libgimpbase/gimpbasetypes.h"
* app/[lots]
* app/core/[of]
* app/gui/[files]
* app/tools/: changed includes and all PDB types.
* app/pdb/*: regenerated.
* libgimp/Makefile.am: don't build libgimpi.a uglyness any more.
* libgimp/gimpenv.[ch]
* libgimp/gimplimits.[hh]
* libgimp/gimpparasite.[ch]
* libgimp/gimpparasiteio.[ch]
* libgimp/gimpprotocol.[ch]
* libgimp/gimpsignal.[ch]
* libgimp/gimpunit.h
* libgimp/gimputils.[ch]
* libgimp/gimpwire.[ch]: removed...
* libgimpbase/*: ...and added here as new library.
* libgimp/gimp.[ch]
* libgimp/gimpdrawable.[ch]
* libgimp/gimpenums.h
* libgimp/gimpimage.[ch]
* libgimp/gimptile.c
* libgimp/gimptypes.h
* libgimp/gimpunit.c: changed accordingly. Added the
gimp_*_add_new_parasite to gimp.[ch], gimpdrawable.[ch] and
gimpimage.[ch].
* libgimpwidgets/gimppatheditor.c
* libgimpwidgets/gimpquerybox.c
* libgimpwidgets/gimpsizeentry.c
* libgimpwidgets/gimpunitmenu.c
* libgimpwidgets/gimpwidgets.c
* libgimpwidgets/gimpwidgetstypes.h: changed includes accordingly.
* plug-ins/*/Makefile.am
* plug-ins/common/mkgen.pl: link against libgimpbase.
* tools/pdbgen/Makefile.am: scan libgimpbase/gimpbasetypes.h, so
the enums are known to pdbgen...
* tools/pdbgen/enumcode.pl: ...but don't write them out to
libgimp/gimpenums.h
* tools/pdbgen/app.pl: include libgimp/gimpbase.h in all *_cmds.c
files. Added GIMP_ to the type names ganerated in app/.
* tools/pdbgen/enums.pl: regenerated.
* tools/pdbgen/pdb.pl
* tools/pdbgen/pdb/fileops.pdb
* tools/pdbgen/pdb/procedural_db.pdb
* tools/pdbgen/pdb/unit.pdb: changed includes.
2000-06-09 Sven Neumann <sven@gimp.org>
* gimp.h
* gimpchannel.h
* gimpcompat.h
* gimpdrawable.h
* gimpimage.h
* gimplayer.h: moved convenience defines from gimp.h into
relevant header files so you have a chance to find them.
2000-06-09 Sven Neumann <sven@gimp.org>
* libgimp/libgimp-decl.txt
* libgimp/libgimp-sections.txt
* tmpl/gimp.sgml
* tmpl/gimpchannel.sgml
* tmpl/gimpdrawable.sgml
* tmpl/gimpimage.sgml
* tmpl/gimplayer.sgml: relocated defines as happened to
reflect changes in libgimp
2000-06-01 Michael Natterer <mitch@gimp.org>
Sven Neumann <sven@gimp.org>
* libgimp/gimpdrawable_pdb.[ch]
* libgimp/gimplayer_pdb.[ch]
* libgimp/gimppalette_pdb.[ch]: replaced with code based on files
generated using pdbgen
* libgimp/Makefile.am
* libgimp/gimplayer.[ch]: new files wrapping around the
autogenerated PDB wrappers as found in *_pdb.[ch].
* libgimp/gimpdrawable.[ch]: added wrappers around PDB wrappers
* libgimp/gimp.h
* libgimp/gimpimage.c
* libgimp/gimpimage_pdb.c
* libgimp/gimpparasite_pdb.c: various smaller changes