Commit Graph

6187 Commits

Author SHA1 Message Date
Jehan 231ca0c505 Issue #9994: do not call g_file_info_get_is_hidden() (and others) directly.
This is not the main reason for the specific output in #9994. These ones are
more probably because of similar usage in GTK (which updated its own calls to
g_file_info_get_is_hidden|backup() in version 3.24.38). But we should likely
also update the various calls we have to use the generic
g_file_info_get_attribute_*() variants.

To be fair, it is unclear to me when we can be sure that an attribute is set.
For instance, when we call g_file_enumerate_children() or g_file_query_info()
with specific attributes, docs say that it is still possible for these
attributes to not be set. So I assume it means we should never use direct
accessor functions.

The only exception is that I didn't remove usage of g_file_info_get_name(),
since its docs says:

> * Gets a display name for a file. This is guaranteed to always be set.

Even though it also says just after:

> * It is an error to call this if the #GFileInfo does not contain
> * %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Which is very contradictory. But assuming that this error warning was
over-zealous documentation, I kept the direct accessors since they are supposed
to be slightly more optimized (still according to in-code documentation) so
let's priorize them when we know they are set for sure.
2023-09-19 15:34:48 +02:00
Alx Sa 9a15f65a64 core: Improve security of ASE palette loading
Per @Wormnest comment on ACB palette loading,
g_utf16_to_utf8 () now uses the string length rather than -1 to prevent malicious non-NULL terminated strings.
2023-09-14 23:00:07 +00:00
Alx Sa ab29c4478e core: Add support for Adobe Color Book (ACB) Palettes 2023-09-14 23:00:07 +00:00
Jehan 6d5aaa995f app: new storage format for the text layer parasite implies XCF version bump.
The new parasite format cannot be loaded by old versions of GIMP. This means we
must bump the XCF version (even though technically we didn't really touch the
XCF format itself because text layers are stored in a hackish way, yet text
layers are just too important nowadays to not care).

Nevertheless if an old XCF with text layers was loaded and the text layers left
untouched, the old parasite will be saved back as-is. Therefore no need to bump
the XCF version in this specific case. Only when we created new text layers or
edited existing ones.
2023-09-12 14:23:40 +00:00
Idriss Fekir a966297498 Port GimpText to GimpFont
In GimpText, The font used to be stored as a string containing its name,
Now, it is stored as a GimpFont object, which makes more sense and makes
operations on fonts easier (such as serialization).
2023-09-12 14:23:40 +00:00
Alx Sa a69c7736c2 core: Handle ASE palettes with header padding
This removes any padding the color space label might have originally,
which interfered with g_str_has_prefix ().
2023-09-06 20:15:59 +00:00
Alx Sa 6597dabeb3 core: Add support for SwatchBooker palettes 2023-09-06 01:12:48 +00:00
Alx Sa caff8dbb7b core: Fix crash when filling with Middle Gray color
Filling with Middle Gray requires getting the image format
for conversion from CIE Lab. This works when filling a layer,
but new images are not yet available in the context.
This adds the image to the context before gimp_drawable_fill ()
is called so it has access to the image format.
2023-08-28 22:42:31 +00:00
Alx Sa 38495c7b2d Issue #9901: Add Adobe Swatch Exchange palette import 2023-08-27 16:51:02 +00:00
Anders Jonsson 369a7782a1 app, libgimp, libgimpbase: fix gi-docgen rendering 2023-08-12 14:52:52 +00:00
Stanislav Grinkov cbcb477182
core: add FG to Transparent (Hardedge) gradient
Fixes: #9849 (GNOME/Gimp tracker)
2023-08-11 13:01:20 +06:00
lillolollo 8432c555a6 app: silencing warnings in switch statement
See MR !1007.
2023-08-09 15:20:52 +00:00
mr.fantastic 75d758881d don't allow snapping hidden layers in bbox/equidistance snapping 2023-08-08 15:13:52 +00:00
Jacob Boerema 72ee6ff469 app: incorrect order of parameters in gimp_channel_select_round_rect
in gimpchannel-select.h
Looking at the version in gimpchannel-select.c, the calls made to it,
and also what is usual, the corner_radius_x should be before
corner_radius_y.

Found looking at the cppcheck logs.
2023-08-02 11:24:43 -04:00
Jehan 1a9c470b82 app: fix gimp_data_get_identifier() and add a concept of data collection.
The way we were creating a GimpData identifier was simply wrong, because it was
based on the assumption that the source file uniquely identifies a GimpData (cf.
gimp_tagged_get_identifier() which clearly says that the returned string must
uniquely identify this data). The very simple counter-examples for why this is
a mistake to consider a data file to be a good unique identifier are collection
files. For instance, TTC files (TrueType Collection) contain multiple fonts.

Instead I am adding the concept of "collection" with the assumption that
**within a given collection**, data names are unique (I do hope this to be and
stay true). So I add gimp_data_get_identifiers() and gimp_data_identify() to get
identifiers and check for identity.

The collection will use the old implementation of gimp_data_get_identifier()
because it is quite nice to have paths relative to data and config directories
(it allows some cases of data relocation without losing data identification).

The new implementation to compute a GimpTagged identifier on the other hand will
construct a string from the quality of being internal or not, the data name and
its collection.
2023-07-27 15:29:58 +02:00
Jehan 9f9c0b4ea6 app: GimpFontFactory doesn't force anymore unique font names.
Note that there is a `container_obsolete` too in GimpDataFactory and I don't
apply the "unique-name" property to it because I'm unsure what it is.

Furthermore, eventually we'll want all types of data to allow duplicate names
(brushes, patterns or whatnot may come from all sources and may be named the
same by different people). But for now, let's focus on fonts before breaking
other parts of the codebase which we might not look into right now.
2023-07-25 23:10:26 +02:00
Idriss Fekir 5972d8d97f Implement support for custom fonts
Remap font names to unique generated names
so that pango sees them.

keep the font name for display and the internal
name for everything else.

* Fonts are still broken When exporting to pdf

* Not sure if xcf files would be usable on other systems
maybe use hash of psname internally instead

* Not sure if plug-ins using text layer work correctly
(do they use internal font name or the actual name?)
2023-07-25 21:16:04 +02:00
Jehan 490cb4ca3a app: rename snap data type to GimpImageSnapData and remove it from core-types.
This is definitely not core type material. Also it's much better in the proper
header gimpimage-snap.h and the type name should reflect the file namespace,
especially as we make it public.
2023-07-25 16:07:06 +02:00
mr.fantastic 58d85efe75 Adding visuals to snapping by bounding boxes and equidistance
- Avoid conflict between snapping to active point and bbox/alignment snapping
- rearrange bbox snapping calls to give layer center more priority
2023-07-25 15:31:16 +02:00
mr.fantastic c47f4954ef Adding snapping by equidistance functionality 2023-07-25 15:31:16 +02:00
mr.fantastic 0aa8ac4660 Adding initial support for snapping layers/path_points by layers bounding boxes 2023-07-25 15:31:16 +02:00
Jacob Boerema f65d8e8730 app: silence warning in gimpimage-convert-indexed
We had the following warning:
In function 'make_remap_table',
    inlined from 'gimp_image_convert_indexed' at
  ../../gimp/app/core/gimpimage-convert-indexed.c:1057:7:
D:/msys64/mingw64/include/glib-2.0/glib/gmem.h:261:19: warning: argument 1
 range [18446744071562067968, 18446744073709551615] exceeds maximum object
 size 9223372036854775807 [-Walloc-size-larger-than=]

This is apparently caused by inlining in combination with using a signed
int.
See also: https://gcc.gnu.org/bugzilla//show_bug.cgi?id=85783

Casting to (guint) silences the warning here.
2023-06-27 14:15:34 -04:00
Alx Sa ca3c709d56 core: Add color/pattern only fill options
Resolves issue with #8461.
This provides a conditional value for the fill options to only show
a color and pattern, rather than fore/background colors.
Currently only used for the text editor.
2023-06-24 19:42:58 +00:00
Jehan cdc9fa9907 app: migrated (style solid) in gimprc.
Since MR !706, (style solid) doesn't exist anymore which makes gimprc parsing
fails (hence losing configuration).

This fixes:

> Gimp-Config-Message: 21:20:21.018: Error while parsing '/home/jehan/.config/GIMP/2.99/gimprc' in line 18: invalid value 'solid' for token style
> Gimp-Config-Message: 21:20:21.018: There was an error parsing your 'gimprc' file. Default values will be used. A backup of your configuration has been created at '/home/jehan/.config/GIMP/2.99/gimprc~'.
2023-06-22 21:30:13 +02:00
Alx Sa ce6f7179ab core: Replace "Solid Colors" with "FG/BG Colors"
Replaces "Solid Colors" option in Fill Path with Foreground/Background
Colors options. This allows users to fill with either, rather than
having to switch the foreground color each time.
GIMP_CONTEXT_PROP_MASK_BACKGROUND was added to the fill and stroke
contexts to allow the background color to be recognized.
In places where Solid Color was used as a default, Foreground Color is
now used instead.
2023-06-22 18:46:14 +00:00
Øyvind Kolås 21411047ee app,pdb,plug-ins: %s/gegl_node_connect_to/gegl_node_connect/ 2023-06-13 19:58:42 +02:00
Øyvind Kolås e7dcfb2927 app: use gegl_node_link and gegl_node_link_many
Instead of gegl_node_connect_to which is rather verbose, and slated for
deprecation in GEGL.
2023-06-13 17:14:03 +02:00
Michael Natterer bb7ed43eac app: make the GimpResource dummy class the parent of GimpData
It does absolutely nothing except sitting there, providing an is-a
relation (both ways because GimpData is its only subclass). This will
simplify having more libgimp API on GimpResource, without having to
add different PDB code for app and libgimp.
2023-06-05 14:33:23 +02:00
Michael Natterer a4920611d1 libgimp: remove gimpparamspecs-resource.h
and merge it into libgimp/gimpparamspecs.h
2023-06-05 13:06:01 +02:00
Alx Sa 9058a460b0 core: Import .aco palettes with Babl
This replaces the various GimpHSV/GimpCMYK .aco palette conversions with
Babl.
As a result, it now possible to support importing CIE Lab palettes
(colorspace 7)
2023-06-01 10:56:10 -04:00
Michael Natterer 9638102418 Introduce a global ID space for GimpData/GimpResource objects
Much like for images and items. Change the PDB to transmit IDs
instead of names for brush, pattern etc. and refactor a whole
lot of libgimp code to deal with it.

	modified:   libgimp/gimpplugin-private.h
2023-05-31 16:12:04 +02:00
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Simon Budig c9122fed2f gimp-atomic: drop the use of the volatile qualifier.
The underlying functions don't actually use thaat, so it gets dropped
anyway, causing a compiler warning.
2023-05-26 14:29:42 +02:00
Michael Natterer dc25c2bc97 Revert "app: add a "Filters > Generic > GEGL Operations" submenu with generated actions."
This reverts commit 747cbf70db.
2023-05-25 02:31:28 +02:00
Alx Sa e1e30c6f72 app: Scale pattern preview to show full image
Currently, patterns are loaded as-is - if the full pattern is larger
than the preview, its cut off and you only see the left corner.
In those cases, the pattern is scaled using gegl_buffer_get ()'s scale
parameter.
2023-05-24 19:44:11 +00:00
Michael Natterer 15d81b6b10 app: plug leaks in GimpExtensionManager 2023-05-24 18:27:00 +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
Michael Natterer e4f0bb0dfe app: valgrind found a bunch of memory leaks 2023-05-23 00:11:23 +02:00
Michael Natterer 7ada432690 app: big porting of weak pointers to g_set,clear_weak_pointer()
This started as review of weak pointers, but using
g_set_weak_pointer() and g_clear_weak_pointer() is almost always
better, and shorter.
2023-05-22 18:16:09 +02:00
Michael Natterer 9886062dca app: don't leave around a dangling weak pointer to some memory on the
stack in gimp_create_image_from_buffer()
2023-05-22 14:30:37 +02:00
Niels De Graef da585065d6 Revert "app: Port GimpParasiteList to GListModel"
This reverts commit 3054901af0.

GimpParazite is not a GObject, so using a GListModel is not an option
for now
2023-05-22 01:26:18 +02:00
Niels De Graef 3054901af0 app: Port GimpParasiteList to GListModel
GListModels are fun. They will also prove to be useful in the future.
2023-05-21 01:30:53 +02:00
Niels De Graef a4c3eacc02 libgimpmodule: Convert ModuleDB to GListModel
This commit converts `GimpModuleDB` into a `GListModel`. This allows us
to drop quite a bit of custom code to have an adaptive list of modules
by just becoming a `GListModel` implementation.

Next to that, this commit also rewrites `GimpModule` to use the `notify`
signal for its 2 new properties: "auto-load" and "on-disk", rather than
trying to define a custom signal for that. This in turn allows us to use
basic methods like `g_object_bind_property()`.

Finally, the module manager dialog now uses `GtkListBox`, which can
easily bind to that new `GListModel` infrastructure.
2023-05-20 22:15:13 +00:00
Simon Budig 289999ad52 core: remove the workaround, neither gcc nor clang generate a warning here. 2023-05-20 23:32:18 +02:00
Simon Budig 27af306a8a libgimp: un-deprecate and fix gexiv2 usage. 2023-05-20 18:06:21 +02:00
Alx Sa 0790d6c9d5 widgets: Add Grayscale color picking mode 2023-05-14 10:19:54 +00:00
Jehan f9993b85b6 app: use G_DECLARE_INTERFACE() to declare GimpAction interface.
Less boiler plate code so less reasons to mess up.
For this to be feasible, I also had to define a cleanup function for
GimpObject.
2023-05-11 12:46:57 +02:00
Jehan bb4438789a app: fix some s/G_TYPE_FROM_CLASS/G_TYPE_FROM_INTERFACE/ calls. 2023-05-11 12:46:57 +02:00
Alx Sa 7e371c7884 libgimpbase: Add Middle Gray fill option
Uses CIELAB's 50% lightness (18.42% luminance) for the Middle Gray
color.
2023-04-24 10:25:58 +00:00
Alx Sa 769e36d7cf core: color pick in image's RGB space
Replaces GimpPickableInterface's pixel_to_srgb () functions with
pixel_to_rgb(). Now GimpRGB's values should be in the correct
image color space from the beginning of the process.
2023-04-23 22:03:29 +00:00