Commit Graph

70 Commits

Author SHA1 Message Date
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
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Michael Natterer c46044534a libgimp: remove gimp_drawable_preview_draw_region()
It's deprecated and now unused.
2019-07-19 19:01:13 +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 f5ecc53f3e Fix a lot of warnings all over the place
Deprecated stuff, unused variables. Includes parts of a patch from
Shlomi Fish from bug #768855.
2016-10-31 01:36:35 +01:00
Michael Natterer e7dc21d795 libgimp: fix return values in g_return_val_if_fail() statements
GLib master fixed the missing warnings since whatever GCC version.
2015-09-24 21:32:33 +02:00
Michael Natterer d9de706946 libgimp: deprecate GimpDrawablePreview's GimpDrawable API
and add drawable_ID functions instead.
2015-09-15 00:49:45 +02:00
Michael Natterer 8ace6bf45d libgimp: start getting rid of using GimpDrawable in the drawable previews
Start with the internal APIs that need no deprecations.
2015-09-14 19:47:18 +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 6a33302009 fixed calculation of offset into the source buffer (bug #353639).
2006-09-11  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_area):
	fixed calculation of offset into the source buffer (bug #353639).
2006-09-11 12:04:49 +00:00
Sven Neumann d34ff5537d libgimpbase/Makefile.am libgimpbase/gimpbase.h added new files that hold
2006-08-29  Sven Neumann  <sven@gimp.org>

	* libgimpbase/Makefile.am
	* libgimpbase/gimpbase.h
	* libgimpbase/gimprectangle.[ch]: added new files that hold
	gimp_rectangle_intersect(), factored out of the core.

	* libgimpbase/gimpbase.def: updated.

	* app/core/gimp-edit.c
	* app/core/gimp-utils.c
	* app/core/gimp-utils.h
	* app/core/gimpchannel-combine.c
	* app/core/gimpdrawable-foreground-extract.c
	* app/core/gimpdrawable-transform.c
	* app/core/gimpdrawable.c
	* app/core/gimpimage-preview.c
	* app/core/gimplayer.c
	* app/core/gimpscanconvert.c
	* app/display/gimpdisplayshell-draw.c: changed includes accordingly.

	* libgimp/gimpdrawablepreview.c: don't duplicate
	gimp_rectangle_intersect() here, use the function in libgimpbase.

	* app/base/siox.c: use gimp_rectangle_intersect() to reduce the
	working area to the region of interest. Fixes bug #340422.
2006-08-29 14:46:32 +00:00
Michael Natterer 24d9af3702 draw only within the intersection of the the passed coordinates and the
2006-08-14  Michael Natterer  <mitch@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_area):
	draw only within the intersection of the the passed coordinates
	and the selection to avoid access to non-existant (out-of-image)
	selction tiles. Fixes bug #350760.
2006-08-14 12:17:34 +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 4202231231 increased SELECTION_BORDER to 8.
2006-04-11  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c: increased SELECTION_BORDER to 8.
2006-04-11 20:59:20 +00:00
Sven Neumann a154f2c61e added "drawable" as construct-only property so that the widget can be
2006-02-26  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c: added "drawable" as construct-only
	property so that the widget can be constructed using g_object_new().
2006-02-26 00:25:05 +00:00
Sven Neumann 39c5fcbea9 libgimp/gimpdrawablepreview.[ch] reduced code duplication by exporting two
2006-02-07  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.[ch]
	* libgimp/gimpzoompreview.c: reduced code duplication by exporting
	two GimpDrawablePreview functions for internal use.
2006-02-07 15:36:17 +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 70955c0e6d initialize all fields of the struct passed to gimp_set_data().
2005-12-06  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_destroy):
	initialize all fields of the struct passed to gimp_set_data().
2005-12-06 13:09:27 +00:00
David Odin fb5707241e made the navigation popup respect the aspect ratio of the selection or the
* libgimp/gimpdrawablepreview.c: made the navigation popup respect the
  aspect ratio of the selection or the drawable.
2005-10-08 23:08:12 +00:00
Sven Neumann 5590a5f77c respect the selection (fixes bug #301523).
2005-04-23  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_thumb):
	respect the selection (fixes bug #301523).
2005-04-23 11:53:09 +00:00
William Skaggs 5fce783eab Bill Skaggs <weskaggs@primate.ucdavis.edu>
* libgimp/gimpdrawablepreview.c: set preview bounds correctly
	when previewed drawable extends beyond image edges,
	fixes bug #165372.
2005-01-28 18:11:57 +00:00
David Odin d9e414fd8d new function: gimp_scrolled_preview_set_position () to set the position of
* libgimpwidgets/gimpscrolledpreview.[ch]: new function:
  gimp_scrolled_preview_set_position () to set the position of the
  preview content wrt the drawable.  This function might be moved to a
  virtual function of GimpPreview in a near future.

* libgimp/gimpdrawablepreview.c: use this function, so a preview
  remembers its position from one invocation to the next.  This is done
  using the current executable name as a key for gimp_set/get_data () so
  each plug-in can have its preview on a different place.

  More informations could be saved this way: the update toggle, the checks, etc.

  Addresses bug #162286.

* libgimpwidgets/gimppreview.c: smallish cleanup.
2005-01-05 22:33:44 +00:00
Sven Neumann c783f3f2d1 unset the dirty flag on the GimpPixelRgn used to iterate the region.
2004-12-20  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_region):
	unset the dirty flag on the GimpPixelRgn used to iterate the region.

	* libgimp/gimppixelrgn.c (gimp_pixel_rgn_init): improved docs.
2004-12-20 21:39:48 +00:00
Michael Natterer 998c895a67 More final API cleanup:
2004-11-02  Michael Natterer  <mitch@gimp.org>

	More final API cleanup:

	* tools/pdbgen/pdb/image.pdb: added gimp_image_set,get_colormap()
	and deprecated set,get_cmap().

	* libgimpwidgets/gimppreviewarea.[ch]: renamed
	gimp_preview_area_set_cmap() to set_colormap().

	* libgimp/gimp.def
	* libgimp/gimpdrawablepreview.c
	* libgimp/gimpexport.c
	* libgimp/gimpimage.[ch]
	* libgimpwidgets/gimpwidgets.def: changed accordingly.

	* app/pdb/image_cmds.c
	* app/pdb/internal_procs.c
	* libgimp/gimpimage_pdb.[ch]: regenerated.

	(undeprecation of plug-ins will follow...)
2004-11-02 11:30:49 +00:00
Sven Neumann 168c5b5a42 take drawable offsets into account when masking the preview with the
2004-10-04  Sven Neumann  <sven@gimp.org>

	* libgimp/gimpdrawablepreview.c (gimp_drawable_preview_draw_area):
	take drawable offsets into account when masking the preview with
	the selection mask.
2004-10-04 19:38:26 +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
Sven Neumann c4bf786cc2 libgimpwidgets/gimppreview.[ch] libgimpwidgets/gimpscrolledpreview.[ch]
2004-09-29  Sven Neumann  <sven@gimp.org>

	* libgimpwidgets/gimppreview.[ch]
	* libgimpwidgets/gimpscrolledpreview.[ch]
	* libgimpwidgets/gimpwidgets.def: moved the offsets and the
	draw_thumb method back to the GimpPreview class.

	* libgimp/gimpdrawablepreview.c: changed accordingly.

	* 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: back to using gimp_preview_get_position().

	* libgimp/gimpregioniterator.c (gimp_rgn_iterator_new): corrected
	gtk-doc comment.
2004-09-29 13:39:23 +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