Commit Graph

40 Commits

Author SHA1 Message Date
Alx Sa 048b2c437d libgimp, libgimpcolor, libgimpconfig: Convert to derivable types
Also converted GimpPreview and
GimpScrolledPreview as they are the
parents of several of these widgets.
2024-08-02 14:02:30 +00:00
Jehan 7a03b3ea09 libgimp: gimp_pdb_get_data() and gimp_pdb_set_data() are made internal.
These are not usable by plug-ins anymore which should store their data between
runs as arguments or aux arguments (in case of values which should be stored
from one run to another but are not really usable for non-interactive scripts).
These are per-plug-in (not polluting the whole process space with just random
strings as identifiers which could be used by other plug-ins) and even survive
restarts of GIMP.

I still keep these functions, but only internally, as they are used to store
settings of GimpAspectPreview, GimpDrawablePreview and GimpZoomPreview across
plug-in runs. Still I changed their API to set and return a GBytes directly
(mimicking the private PDB functions' API).
Also I remove gimp_pdb_get_data_size() which is useless when exchanging GBytes
directly.

Note that the 2 functions are still exported in the library, and only not
advertized through headers (so they are not really internal, just hidden), on
purpose, because we need to call them in libgimpui. So it is still relatively
easy for a plug-in to use them. Nevertheless I made clear in the function
documentation that these must not be considered public and could end up deleted
at any time. Any plug-in still trying to call these takes the risk of having
their code relying on unreliable API.
2023-10-27 10:16:45 +00: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
Ben Rogalski d90b84ba9d Custom transparency checkerboard colors
Reviewer (Jehan) note: cherry picked from MR !274. Still deciding
whether this will be pushed to gimp-2-10 branch too.

Fixed Conflicts from !274:
	app/dialogs/preferences-dialog.c
	app/display/gimpdisplayshell-draw.c
	app/plug-in/gimppluginmanager-call.c
	libgimp/gimp.c
	libgimp/gimp.h
	libgimpwidgets/gimppreviewarea.c
	libgimpwidgets/gimppreviewarea.h
	libgimpwidgets/gimpscrolledpreview.c
2022-05-14 16:27:15 +02:00
Jehan ca8bc2bc1d app, libgimp, pdb, plug-ins: more functions moved to get|set().
The gimp_drawable_type() is an issue though as gimp_drawable_get_type()
is already defined as a common GObject API.
Though I'm actually wondering if GimpImageType is well called. Rather
than Type, shouldn't we go with ColorModel?

sed -i 's/\<gimp_drawable_bpp\>/gimp_drawable_get_bpp/g' "$@"
sed -i 's/\<gimp_drawable_width\>/gimp_drawable_get_width/g' "$@"
sed -i 's/\<gimp_drawable_height\>/gimp_drawable_get_height/g' "$@"
sed -i 's/\<gimp_drawable_offsets\>/gimp_drawable_get_offsets/g' "$@"
2021-04-06 14:34:31 +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 5e6d4d8fbd libgimp: fix the non-generated API with the new class types. 2019-08-22 15:54:36 +02:00
Jehan 3f1491e572 libgimp: update non-generated API using GimpItem/GimpDrawable/GimpLayer.
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.
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
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04: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 d87eddb1c4 libgimpwidgets: move all GimpPreview members to private
and add tons of API so subclasses can still do their thing, probably
subject to change/fix.
2018-05-20 21:06:33 +02:00
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 0dd8459a1f libgimp: deprecate more cruft, everything not needed by cruft plug-ins 2018-05-20 21:06:29 +02:00
Michael Natterer f3d65fdb59 Implement GtkWidget::style_updated() instead of ::style_set() 2018-05-20 21:06:28 +02:00
Michael Natterer f9ee38ea33 libgimp: add blurbs to all object properties for the docs
and some minor doc fixes.
2017-06-06 21:19:17 +02:00
Michael Natterer bbe667f291 libgimp: deprecate GimpAspectPreview's GimpDrawable API
and add drawable_ID functions instead.
2015-09-17 00:24:03 +02: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
Michael Natterer ec9879ea6e libgimp: also include <gegl.h> when we include "libgimpwidgets/gimpwidgets.h" 2013-11-01 22:29:46 +01:00
Michael Natterer 908f727f0a Chain up unconditionally in GObject::constructed()
It's supported since GLib 2.28.
2012-11-12 21:51:22 +01:00
Michael Natterer 8d2d16ac25 libgimp*: implement GObject::constructed() instead of ::constructor() 2011-01-12 22:03:33 +01:00
Michael Natterer 38999b7dd4 libgimp: implement GObject::dispose() instead of GtkObject::destroy() 2010-10-15 12:04:36 +02:00
Michael Natterer ce9ea1e8d7 libgimp: use item API instead of deprecated drawable API 2010-07-09 11:29:35 +02:00
Michael Natterer c78e4c8d63 libgimp: move docs from template files to inline comments
Also split up the "tools" docs into separate files so it matches
the new autogenerated PDB section headers.
2010-07-07 11:48:10 +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
Sven Neumann 24c4243f28 General fix for bug #478657:
2007-09-21  Sven Neumann  <sven@gimp.org>

	General fix for bug #478657:

	* libgimp/gimpaspectpreview.c
	* libgimp/gimpdrawablepreview.c
	* libgimp/gimpzoompreview.c: let all preview widgets store the
	state of the Preview toggle. Declared "toggle" parameter as unused.

	* plug-ins/common/*.c: pass NULL for "toggle" to
	gimp_drawable_preview_new() and gimp_aspect_preview_new().

svn path=/trunk/; revision=23603
2007-09-21 13:27:33 +00:00
Sven Neumann 50103f6ee3 implement GimpPreview's transform() and untransform() methods.
2007-01-13  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpaspectpreview.c: implement GimpPreview's 
transform()
	and untransform() methods.


svn path=/trunk/; revision=21702
2007-01-13 17:25:49 +00:00
Sven Neumann 6ebcf700d1 removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15  Sven Neumann  <sven@gimp.org>

	* app/*/*.c:
	* lib*/*.c: removed erroneous semicolon after G_DEFINE_TYPE macros.
2006-05-15 09:46:31 +00:00
Sven Neumann f2df31a50e converted tabs to spaces.
2006-04-12  Sven Neumann  <sven@gimp.org>

	* libgimp*/gimp*.[ch]: converted tabs to spaces.
2006-04-12 10:53:28 +00:00
Sven Neumann 9a6e032446 don't need a constructor here 2006-02-26 00:43:30 +00:00
Sven Neumann 12343c88e1 added "drawable" as construct-only property so that the widget can be
2006-02-26  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpaspectpreview.c: added "drawable" as construct-only
	property so that the widget can be constructed using g_object_new().
2006-02-26 00:37:50 +00:00
Michael Natterer 33ae55f873 libgimp/*.c libgimpconfig/*.c libgimpmodule/*.c libgimpthumb/*.c port to
2005-12-20  Michael Natterer  <mitch@gimp.org>

	* libgimp/*.c
	* libgimpconfig/*.c
	* libgimpmodule/*.c
	* libgimpthumb/*.c
	* libgimpwidgets/*.c: port to G_DEFINE_TYPE() and friends. Some
	related cleanup.
2005-12-20 20:35:23 +00:00
Sven Neumann d4d69df6d9 libgimp/gimpaspectpreview.c added missing API docs.
2005-10-05  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpaspectpreview.c
	* libgimp/gimpzoompreview.c: added missing API docs.

2005-10-05  Sven Neumann  <sven@gimp.org>

	* libgimp/libgimp-docs.sgml
	* libgimp/libgimp-sections.txt
	* libgimp/tmpl/gimpgrid.sgml: added new Grid PDB API.

	* libgimp/tmpl/gimpzoompreview.sgml: updated.
2005-10-05 13:50:09 +00:00
David Odin 48470a093f really use the second parameter of gimp_aspect_preview_new (), so plug-ins
* libgimp/gimpaspectpreview.c: really use the second parameter of
  gimp_aspect_preview_new (), so plug-ins can now really remember the
  state of the preview between invocations.

* libgimpwidgets/gimpscrolledpreview.c: fix a little typo

* plug-ins/common/channel_mixer.c: fix a warning by using TRUE for a
  boolean value (initial state of the preview) instead of a weird NULL.
2004-10-27 11:38:15 +00:00
Sven Neumann cb18a9bd42 no need to set bpp before calling gimp_drawable_get_thumbnail_data().
2004-10-04  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpaspectpreview.c (gimp_aspect_preview_draw_buffer):
	no need to set bpp before calling gimp_drawable_get_thumbnail_data().
2004-10-04 18:23:43 +00:00
David Odin 2f27c5d453 only apply the effect inside the current selection. This, together with my
* libgimp/gimpaspectpreview.c: (gimp_aspect_preview_draw_buffer) only
  apply the effect inside the current selection. This, together with my
  previous commit fixes bug #132194.
2004-10-04 17:40:45 +00:00
David Odin c1ab97ec4b limit the size of the preview to 512 pixels. This prevents plug-ins using
* libgimp/gimpaspectpreview.c: limit the size of the preview to 512 pixels.
  This prevents plug-ins using gimp_drawable_get_thumbnail_data to crash.
2004-10-03 16:08:01 +00:00
Sven Neumann de37bbb7f8 libgimpwidgets/gimppreview.[ch] added gimp_preview_draw_buffer().
2004-09-29  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppreview.[ch]
	* libgimpwidgets/gimpwidgets.def: added gimp_preview_draw_buffer().

	* libgimp/gimpaspectpreview.[ch]
	* libgimp/gimpdrawablepreview.[ch]
	* libgimp/gimpui.def: removed the public draw_buffer API.
	Implement the virtual GimpPreview::draw_buffer method instead.

	* plug-ins/common/cartoon.c
	* plug-ins/common/deinterlace.c
	* plug-ins/common/despeckle.c
	* plug-ins/common/dog.c
	* plug-ins/common/edge.c
	* plug-ins/common/engrave.c
	* plug-ins/common/exchange.c
	* plug-ins/common/gauss.c
	* plug-ins/common/grid.c
	* plug-ins/common/neon.c
	* plug-ins/common/noisify.c
	* plug-ins/common/oilify.c
	* plug-ins/common/photocopy.c
	* plug-ins/common/plasma.c
	* plug-ins/common/sel_gauss.c
	* plug-ins/common/sharpen.c
	* plug-ins/common/shift.c
	* plug-ins/common/snoise.c
	* plug-ins/common/sobel.c
	* plug-ins/common/spread.c
	* plug-ins/common/struc.c: changed accordingly. Don't pass the
	preview around as GimpDrawablePreview or GimpAspectPreview. It
	should whenever possible be accessed as GimpPreview.
2004-09-29 15:33:02 +00:00
David Odin a001920ead libgimpwidgets/gimppreview.c split this widget into itself (more abstract
* libgimpwidgets/gimppreview.c
* libgimpwidgets/gimppreview.h: split this widget into itself (more
  abstract now) and ...

* libgimpwidgets/gimpscrolledpreview.c
* libgimpwidgets/gimpscrolledpreview.h: this widget which also have
  some scrollbars and a nagivation preview.

* libgimpwidgets/Makefile.am
* libgimpwidgets/gimpwidgetstypes.h: changed accordingly.

* libgimp/gimpaspectpreview.c
* libgimp/gimpaspectpreview.h: Added this widget, derived from
  GimpPreview, which has always the same ratio has the given drawable.
  This widget has almost the same api as GimpDrawablePreview, and is
  useful for plug-ins that show the whole (scaled) drawable in their
  preview.

* libgimp/gimpdrawablepreview.c
* libgimp/gimpdrawablepreview.h: GimpDrawablePreview is now derived
  from GimpScrolledPreview.

* libgimp/Makefile.am
* libgimp/gimpui.h
* libgimp/gimpuitypes.h: changed accordingly.

* plug-ins/common/plasma.c: use a GimpAspectPreview.

* plug-ins/common/bumpmap.c
* plug-ins/common/cartoon.c
* plug-ins/common/deinterlace.c
* plug-ins/common/despeckle.c
* plug-ins/common/dog.c
* plug-ins/common/edge.c
* plug-ins/common/engrave.c
* plug-ins/common/exchange.c
* plug-ins/common/gauss.c
* plug-ins/common/grid.c
* plug-ins/common/mblur.c
* plug-ins/common/neon.c
* plug-ins/common/noisify.c
* plug-ins/common/oilify.c
* plug-ins/common/photocopy.c
* plug-ins/common/sel_gauss.c
* plug-ins/common/sharpen.c
* plug-ins/common/shift.c
* plug-ins/common/sobel.c
* plug-ins/common/softglow.c
* plug-ins/common/spread.c
* plug-ins/common/struc.c
* plug-ins/common/unsharp.c
* plug-ins/common/wind.c: use gimp_scrolled_preview_get_position
  instead of gimp_preview_get_position.
2004-09-28 23:23:09 +00:00