Commit Graph

67 Commits

Author SHA1 Message Date
Alx Sa 32d64ab1c9 core, widgets: Convert HSV/A to float
Per Pippin, the only color model that can
have double precision is RGB/A.
Therefore, we need to switch all others to
use float instead. This patch converts the
HSV and HSVA double babl formats.
2024-04-21 03:42:27 +00:00
Jehan ce887767e7 app, libgimpconfig: color history is now space-invaded.
I also changed a bit the new color serialization by adding a (color …)
symbol framing the contents, for cases where we don't have a specific
property name, e.g. for the color history list stored in colorrc, unlike
for GimpConfig GeglColor properties.

While doing this, I moved GeglColor property deserialization code into
gimp_scanner_parse_color() which is now able to recognize both older
(color-rgb|rgba|hsv|hsva with no color space) and newer serialization
formats ("color", color model agnostic and space aware).
2024-02-11 23:28:03 +01:00
Niels De Graef 5ca9a38ea4 Fix some gobject-introspection annotations 2021-12-02 12:46:05 +01:00
Jehan 49e534247a app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup()
Since it appeared with GLib 2.68.0, we could not change this until we
bumped the dependency which has only become possible a few days ago
(since Debian testing is our baseline for dependency bumps). Cf.
previous commit.

As this is a drop-in replacement (just a guint parameter changed to
gsize to avoid integer overflow), search-and-replace with:

> sed -i 's/g_memdup\>/g_memdup2/g' `grep -rIl 'g_memdup\>' *`

… followed by a few manual alignment tweaks when necessary.

This gets rid of the many deprecation warnings which we had lately when
building with a recent GLib version.
2021-08-26 17:32:09 +02:00
Jacob Boerema 71ad53ebcf libgimpconfig: fix conversion of negative int values in gimp_scanner_parse_float()
Negative int values were not correctly handled because value.v_int is unsigned
causing a conversion to a large positive value.

To fix this we cast it to gint64 first before making it negative.
2020-09-21 19:36:25 -04: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 99a7d5f7dd gir: Found some more missing (out) annotations 2020-05-03 18:12:37 +02:00
Niels De Graef 52a146604b gir: Add some missing (array length) annotations
This will make sure that bindings can generate a more "native" API so
they don't have to pass the length explicitly.
2020-05-03 18:11:29 +02:00
Ell dcea2348c6 libgimpconfig: allow calling gimp_scanner_new_string (NULL, -1, ...)
Allow calling gimp_scanner_new_string() with a NULL `text` and a
negative `text_len` (which is interpreted as 0), instead of
requiring `text_len == 0` in this case.  This allows passing a
negative `text_len` unconditionally to infer the length, even when
the string may be NULL.
2020-01-30 02:51:56 +02:00
Michael Natterer dbd793d631 libgimpconfig: get rid of filenames in all config related APIs
and rename function names which say "gfile" to just "file".
2019-09-21 12:55:12 +02:00
Michael Natterer 81bb3237ef libgimpconfig: add weird hack to gimp_scanner_parse_float()
because for whatever reason, writing

*dest = -scanner->value.v_int;

fails and writes some positive value instead.
2019-08-18 18:28:32 +02:00
Michael Natterer d3d621b502 libgimpconfig: add a GimpScanner typedef and make it a boxed type
Replace _destroy() by _ref() and _unref().
2019-08-09 12:42:52 +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 c12c031f2d pdb, libgimp*: add (out caller-allocates) to all GimpRGB* return values 2019-08-01 15:39:13 +02:00
Michael Natterer 2c97bc8327 libgimpconfig: make gimp_scanner_parse_float() less strict
A number without a decimal point can be put into a gdouble just fine,
no need to refuse them. Moreover, g_ascii_dtostr() serializes doubles
without fractional part without a decimal point, and we are soon going
to use it.
2019-07-30 14:31:14 +02:00
Jehan bc427479e0 libgimpconfig: update some description comments.
Second parameter of gimp_scanner_parse_token() and
gimp_scanner_parse_identifier() is not a return value. It is a value to
compare with.
2018-07-17 19:45:51 +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
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
Ell f16ba7d1a7 libgimpconfig: remove negative value handling from gimp_scanner_parse_color()
Handled internally by gimp_scanner_parse_float(), since last commit.
2017-05-27 16:40:26 -04:00
Ell b8505a4eac libgimpconfig: fix negative float parsing 2017-05-27 15:50:56 -04:00
Michael Natterer 05874c1268 libgimpconfig: don't gimp_rgb_clamp() in gimp_scanner_parse_color()
so config files can now contain oog RGB values too.
2017-05-19 02:05:57 +02:00
Michael Natterer 865d8796e0 libgimpconfig: gimp_scanner_parse_color(): parse nevative color values
instead of choking and aborting parsing of the entire config file. The
negative values are still clamped away after parsing, but at least we
properly read them now.
2016-10-18 22:34:51 +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 d7812173f4 libgimpconfig: add gimp_config_deserialize_stream()
and gimp_scanner_new_stream().
2014-07-04 03:29:09 +02:00
Michael Natterer 581a6e16e7 libgimpconfig: port GimpScanner to GIO
Move all code from gimp_scanner_new_file() to gimp_scanner_new_gfile().
If the passed GFile has a path, use a GMappedFile like before, otherwise
GIO-read the entire file into an allocated buffer and parse that buffer.
2014-07-02 16:05:23 +02:00
Michael Natterer 6ec5fb80e4 libgimpconfig: add API operating on GFiles instead of filenames
to GimpConfigInterface's wrappers, to GimpConfigWriter and to
GimpScanner.
2014-07-01 01:57:31 +02:00
Michael Natterer 3cc53dab0b libgimpconfig: add gimp_scanner_parse_int64() 2013-06-28 22:02:29 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer 3e119c5af7 libgimpcolor: add gimp_rgb[a]_set,get_pixel()
which converts from/to any pixel format using Babl. Added tons of
includes and CFLAGS now that libgimpcolor publically uses Babl.
2012-05-02 17:50:43 +02:00
Michael Natterer 847deffc86 libgimpbase: add gimp_scanner_parse_boolean()
and complete many api doc stubs.
2011-11-05 17:02:51 +01:00
Michael Natterer cc47b2a600 libgimpwidgets/color: move the cairo color utility functions to libgimpcolor
Add CAIRO_CFLAGS to a lot of Makefiles to make this possible, and
because they pull in cairo via the libgimp headers.
2011-04-28 15:50:39 +02:00
Michael Natterer 1af54c7874 libgimpconfig: move docs from template files to inline comments 2010-06-29 20:59:07 +02:00
Javier Jardón 525347d9f6 Remove deprecated glib symbol: g_mapped_free 2009-11-09 09:28:12 +01:00
Martin Nordholts 5ad570e3cc Fix compilation errors
Fix compilation errors with obvious fixes.
2009-07-20 12:48:05 +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 91d29f48b2 initialize GimpRGB, just to be sure.
2007-10-27  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpscanner.c (gimp_scanner_parse_color):
	initialize GimpRGB, just to be sure.


svn path=/trunk/; revision=23975
2007-10-27 20:13:17 +00:00
Sven Neumann 3b9f1cc4fa libgimpconfig/gimpscanner.c allocate structs using GSlice.
2007-05-22  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpscanner.c
	* libgimpwidgets/gimpwidgets.c: allocate structs using GSlice.


svn path=/trunk/; revision=22581
2007-05-22 17:58:02 +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 19656be202 mmap the config file using GMappedFile. Let's see how well this works...
2005-09-28  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpscanner.c (gimp_scanner_new_file): mmap the
	config file using GMappedFile. Let's see how well this works...
2005-09-28 18:48:42 +00:00
Sven Neumann e6285abfc8 libgimpbase/gimpdatafiles.c libgimpbase/gimpenv.c
2005-02-07  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpdatafiles.c
	* libgimpbase/gimpenv.c
	* libgimpconfig/gimpconfigwriter.c
	* libgimpconfig/gimpscanner.c
	* libgimpthumb/gimpthumb-utils.c
	* libgimpthumb/gimpthumbnail.c: include gstdio.h.
2005-02-07 01:10:50 +00:00
Sven Neumann 8e1aefac24 libgimpbase/gimpdatafiles.c libgimpbase/gimpenv.c
2005-02-07  Sven Neumann  <sven@gimp.org>

	* libgimpbase/gimpdatafiles.c
	* libgimpbase/gimpenv.c
	* libgimpconfig/gimpconfigwriter.c
	* libgimpconfig/gimpscanner.c
	* libgimpthumb/gimpthumb-utils.c
	* libgimpthumb/gimpthumbnail.c: use gstdio wrappers.
	Unfortunately this causes compiler warnings, see bug #166512.
2005-02-07 00:49:36 +00:00
Sven Neumann b4a68e9569 libgimpconfig/gimpconfig-deserialize.c libgimpconfig/gimpconfig-error.c
2005-01-29  Sven Neumann  <sven@gimp.org>

	* libgimpconfig/gimpconfig-deserialize.c
	* libgimpconfig/gimpconfig-error.c
	* libgimpconfig/gimpconfig-iface.c
	* libgimpconfig/gimpconfig-path.c
	* libgimpconfig/gimpconfig-serialize.c
	* libgimpconfig/gimpconfig-utils.c
	* libgimpconfig/gimpconfigwriter.c
	* libgimpconfig/gimpscanner.c: use libgimp header,
	added "Since: GIMP 2.4" to the gtk-doc comments.
2005-01-29 12:54:48 +00:00
William Skaggs 1cee9b7298 continuing commit after broken pipe 2005-01-25 19:11:26 +00:00
Manish Singh 5d01581069 Fix a bunch of warnings from Sparse:
2004-11-13  Manish Singh  <yosh@gimp.org>

        Fix a bunch of warnings from Sparse:

        * app/actions/dockable-commands.c
        * app/actions/layers-actions.c
        * app/actions/view-commands.c
        * app/base/pixel-surround.c
        * app/config/gimpconfig-utils.c
        * app/config/gimpscanner.c
        * app/core/gimpbrushgenerated.c
        * app/core/gimpcontainer.c
        * app/core/gimpimage.c
        * app/dialogs/palette-import-dialog.c
        * app/file/gimprecentlist.c
        * app/plug-in/plug-in-params.c
        * app/text/gimptext-compat.c
        * app/text/gimptext-parasite.c
        * app/vectors/gimpbezierstroke.c
        * app/vectors/gimpstroke.c
        * app/widgets/gimpcellrendereraccel.c
        * app/widgets/gimpselectiondata.c
        * app/xcf/xcf.c
        * libgimp/gimp.c
        * libgimpthumb/gimpthumb-utils.c
        * libgimpthumb/gimpthumbnail.c
        * modules/cdisplay_proof.c
        * plug-ins/Lighting/lighting_ui.c
        * plug-ins/common/csource.c
        * plug-ins/common/glasstile.c
        * plug-ins/common/nova.c
        * plug-ins/common/pcx.c
        * plug-ins/common/pnm.c
        * plug-ins/common/randomize.c
        * plug-ins/common/screenshot.c
        * plug-ins/common/sel_gauss.c
        * plug-ins/common/spheredesigner.c
        * plug-ins/common/wind.c
        * plug-ins/gfig/gfig-dialog.c
        * plug-ins/gfig/gfig-dobject.c
        * plug-ins/gimpressionist/gimpressionist.c
        * plug-ins/ifscompose/ifscompose.c
        * plug-ins/print/gimp_main_window.c
        * plug-ins/print/print.c: Cleanup integer vs. pointer confusion.

        * app/base/temp-buf.c
        * app/dialogs/about-dialog.c
        * plug-ins/common/bumpmap.c
        * plug-ins/common/jigsaw.c
        * plug-ins/gfig/gfig-dobject.c: Cosmetic cleanups.

        * app/config/gimpconfig-deserialize.c
        * app/config/gimpconfig-path.c
        * app/config/gimpconfigwriter.c
        * app/core/gimpgradient.c
        * app/tools/gimpdrawtool.c
        * plug-ins/common/nlfilt.c
        * plug-ins/common/unsharp.c
        * plug-ins/common/zealouscrop.c: Define inline functions before they
        are used.

        * app/core/gimpdrawable-blend.c: PixelRegion definition was changed
        some time ago, but the initialization here didn't change. Fix it.

        * app/plug-in/plug-in-rc.c (plug_in_extra_deserialize): No need to
        assign token twice in a row.

        * libgimpbase/gimpdatafiles.c (gimp_datafiles_read_directories): No
        need to initialize file_data, since the code fills out all the fields.

        * plug-ins/common/CML_explorer.c
        * plug-ins/common/vpropagate.c: Declare function pointers fully.

        * plug-ins/common/grid.c (pix_composite): G_INLINE_FUNC isn't needed,
        we assume we can use the "inline" keyword always.

        * plug-ins/common/psd_save.c
        * plug-ins/common/vinvert.c
        * plug-ins/gfig/gfig-arc.c
        * plug-ins/gfig/gfig-bezier.c
        * plug-ins/gfig/gfig-circle.c
        * plug-ins/gfig/gfig-dialog.c
        * plug-ins/gfig/gfig-dobject.c
        * plug-ins/gfig/gfig-ellipse.c
        * plug-ins/gfig/gfig-line.c
        * plug-ins/gfig/gfig-poly.c
        * plug-ins/gfig/gfig-spiral.c
        * plug-ins/gfig/gfig-star.c
        * plug-ins/gfig/gfig.c
        * plug-ins/gimpressionist/orientmap.c
        * plug-ins/gimpressionist/placement.c
        * plug-ins/gimpressionist/sizemap.c
        * plug-ins/imagemap/imap_grid.c
        * plug-ins/imagemap/imap_main.c
        * plug-ins/imagemap/imap_preferences.c
        * plug-ins/imagemap/imap_settings.c
        * plug-ins/maze/maze.c
        * plug-ins/sel2path/curve.c
        * plug-ins/sel2path/fit.c
        * plug-ins/sel2path/pxl-outline.c
        * plug-ins/sel2path/spline.c
        * plug-ins/xjt/xjt.c: Functions with no args should be declared
        with (void).

        * plug-ins/common/retinex.c (MSRCR): Initialize max_preview to quiet
        the compiler.
2004-11-14 02:50:33 +00:00
Michael Natterer caabe7f334 removed GIMP_TYPE_COLOR.
2004-07-26  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpconfig-types.h: removed GIMP_TYPE_COLOR.

	* app/config/gimpconfig-params.[ch]: renamed GimpParamSpecColor
	to GimpParamSpecRGB.

	* app/config/gimpconfig-deserialize.c
	* app/config/gimpconfig-dump.c
	* app/config/gimpconfig-serialize.c
	* app/config/gimpscanner.c
	* app/core/gimp-utils.c
	* app/core/gimpcontext.c
	* app/core/gimpgrid.c
	* app/display/gimpdisplayoptions.c
	* app/text/gimptext.c
	* app/tools/gimpcolortool.c
	* app/widgets/gimpaction.c
	* app/widgets/gimpcolorbar.c
	* app/widgets/gimppropwidgets.c: changed accordingly.
2004-07-26 19:56:47 +00:00
Michael Natterer 3fb934b2a4 Allow plug-ins to register menu icons. Fixes bug #120500.
2004-05-18  Michael Natterer  <mitch@gimp.org>

	Allow plug-ins to register menu icons. Fixes bug #120500.

	* app/core/core-enums.[ch]: added enum GimpIconType which can
	be one of { STOCK_ID, IMAGE_FILE, INLINE_PIXBUF }.

	* app/config/gimpconfigwriter.[ch] (gimp_config_writer_data)
	* app/config/gimpscanner.[ch] (gimp_scanner_parse_data): new
	functions which write/parse raw binary data. Needed for storing
	inline pixbufs in pluginrc.

	* app/config/gimpconfigwriter.[ch] (gimp_config_writer_identifier):
	new function which writes out an unquoted and unescaped string.

	* app/plug-in/plug-in-proc.[ch] (struct PlugInProcDef): added
	new members "icon_type", "icon_data_length" and "icon_data".
	Reordered members so file_proc specific stuff is at the end.

	(plug_in_proc_def_get_stock_id)
	(plug_in_proc_def_get_pixbuf): new functions to access the
	procedure's icon.

	* app/plug-in/plug-in-rc.c: save/restore the registered icons.

	* app/actions/file-dialog-actions.c
	* app/actions/plug-in-actions.c: set the action's stock ID from
	the procedure's stock ID.

	* app/widgets/gimppluginaction.c
	(gimp_plug_in_action_connect_proxy): if the procedure provides a
	pixbuf, set it as icon for the menu item.

	* app/menus/file-dialog-menu.[ch]
	* app/menus/file-open-menu.c
	* app/menus/file-save-menu.c
	* app/xcf/xcf.c: changed accordingly.

	* tools/pdbgen/pdb/plug_in.pdb (plugin_icon_register): new PDB
	function which can be called during query().

	* tools/pdbgen/enums.pl
	* app/pdb/internal_procs.c
	* app/pdb/plug_in_cmds.c
	* libgimp/gimpenums.h
	* libgimp/gimpplugin_pdb.c
	* libgimp/gimpplugin_pdb.h
	* plug-ins/pygimp/gimpenums.py
	* plug-ins/script-fu/script-fu-constants.c: regenerated.

	* plug-ins/common/plugindetails.c
	* plug-ins/common/uniteditor.c
	* plug-ins/print/print.c: register stock_id icons.

	* plug-ins/common/screenshot.c: register an inline_pixbuf icon for
	testing purposes (used emblem-camera.png from gnome-icon-theme).

	* app/actions/dialogs-actions.c
	* app/actions/file-actions.c: unrelated: added some more icons
	to menu items.
2004-05-18 21:19:43 +00:00
Michael Natterer de7a940501 app/config/gimpconfig-deserialize.c app/config/gimpscanner.c
2004-05-12  Michael Natterer  <mitch@gimp.org>

	* app/config/gimpconfig-deserialize.c
	* app/config/gimpscanner.c
	* app/core/gimp-edit.c
	* app/core/gimpchannel-combine.c
	* app/core/gimpcontainer.c
	* app/core/gimpdrawable-bucket-fill.c
	* app/core/gimpdrawable-combine.c
	* app/core/gimpdrawable.c
	* app/core/gimpgradient.c
	* app/core/gimpimage-flip.c
	* app/core/gimpimage-merge.c
	* app/core/gimpimage-projection.c
	* app/core/gimpimage.c
	* app/display/gimpdisplay-handlers.c
	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpprogress.c
	* app/gui/info-dialog.c
	* app/gui/module-browser.c
	* app/gui/offset-dialog.c
	* app/plug-in/plug-in.c
	* app/tools/gimpdrawtool.c
	* app/tools/tool_manager.c
	* app/widgets/gimpactiongroup.c
	* app/widgets/gimpdialogfactory.c
	* app/widgets/gimpgradienteditor.c
	* app/widgets/gimpitemfactory.c
	* app/widgets/gimppropwidgets.c
	* app/widgets/gimpwidgets-utils.c
	* app/xcf/xcf-save.c
	* libgimp/gimpexport.c
	* libgimpwidgets/gimphelpui.c
	* libgimpwidgets/gimppixmap.c
	* libgimpwidgets/gimpunitmenu.c: replaced G_GNUC_FUNCTION,
	G_GNUC_PRETTY_FUNCTION, G_STRLOC and hardcoded function names in
	g_warning()s by G_STRFUNC.
2004-05-12 08:13:33 +00:00
Sven Neumann 6d506d51bb include "libgimpbase/gimpbase.h" where needed; removed now unnecessary
2004-01-19  Sven Neumann  <sven@gimp.org>

	* app/*/*.c: include "libgimpbase/gimpbase.h" where needed; removed
	now unnecessary inclusions of "file/file-utils.h".
2004-01-19 01:54:11 +00:00
Sven Neumann a70698c4d9 removed file_utils_filename_to_utf8() ...
2004-01-19  Sven Neumann  <sven@gimp.org>

	* app/file/file-utils.[ch]: removed file_utils_filename_to_utf8() ...

	* libgimpbase/gimputils.[ch]: ... and added it here as
	gimp_filename_to_utf8(). Added some docs that promise less than
	the current implementation holds so that we can change the
	implementation later.

	* app/*/*.c: use gimp_filename_to_utf8() where
	file_utils_filenames_to_utf8() has been used before.

	* libgimpbase/gimpbase.def: changed accordingly.

	* configure.in: reset GIMP_INTERFACE_AGE.
2004-01-19 01:08:43 +00:00
Tor Lillqvist 18485018b3 Add new function file_utils_filename_to_utf8(), which is to be used when
2004-01-14  Tor Lillqvist  <tml@iki.fi>

	* app/file/file-utils.[ch]: Add new function
	file_utils_filename_to_utf8(), which is to be used when converting
	file names (which are kept in the on-disk encoding) to UTF-8 for
	passing to GTK, or to g_print() etc.

	* app/*/*.c: Call file_utils_filename_to_utf8(). Should fix most
	of the warnings generated by non-UTF8 pathnames. See #130118.

	* libgimpbase/gimpenv.b: Document that gimp_directory() etc return
	strings in the on-disk encoding.

	* libgimpmodule/gimpmodule.c: Convert filenames to UTF-8 (using
	g_filename_to_utf8()) before passing to g_print().
2004-01-14 02:03:37 +00:00