Commit graph

6622 commits

Author SHA1 Message Date
Jehan
6283ec669d app: verify all playground features to forcibly show the playground tab.
Maybe I should find a more "automatic" logic…
2026-03-02 22:25:07 +01:00
Jehan
b87bab9e8c app, libgimp*: add GimpCurve sample API in libgimp and PDB. 2026-03-01 22:33:58 +01:00
Alx Sa
804991a215 libgimp, pdb: Allow access to GimpCurve in PDB
Adds a GimpCurve object and functions in libgimp.
Rather than creating a GimpCurve object in core and
passing it back and forth, we just pass the attributes
and reconstruct it across.
In the future, we may combine this with the app/core one
and put it in libgimpbase.
2026-03-01 13:41:35 +00:00
Jehan
3a53e4743e app: copy the buffer rather than using it as source.
I think the previous code should be OK, but I had some criticals when
painting with a paint tool in the area which got extended:

> (gimp:577203): GLib-GObject-CRITICAL **: 21:37:08.402: value "-31" of type 'gint' is invalid or out of range for property 'y' of type 'gint'

It looks like there lingering pieces from the negative offset in the
buffer, which is probably a bug in GEGL?
Anyway let's go the shorter route for now, which is to copy the buffer
with a different offset. I don't think it's less efficient either
anyway.
2026-02-28 21:52:10 +01:00
Jehan
4c15be6a56 app: fix merging filters with negative top-left point.
When merging filters whose rendering was expanding in negative
ccordinates, I realized that the drawable was not properly resized (it
was resized properly when the width/height increased, but not when the x
or y points became negative, even though this "cropped" part still
showed… until you saved and reloaded your XCF!).

The problem is that drawable buffers are always stored with (0, 0)
top-left and this was just confusing our existing code. So let's check
when trying to set a buffer with a non-(0, 0) origin, and update the
offset subsequently.

I hesitated with an alternative implementation which was to edit the
buffer applied to the drawable in gimp_drawable_merge_filters(). But I
figured this would be more future-proof for other similar cases, though
I hope I did not break any use case where this was actually considered a
normal case.
2026-02-28 21:04:05 +01:00
Bruno Lopes
b7d89728c4 app, libgimpthumb, plug-ins, tools: Fix POSIX namespace warnings on MSVC 2026-02-28 10:06:46 -03:00
balooii balooii
d80ad177af Issue #13401: Fix crash opening channels after apply/undo drawable filter 2026-02-26 15:06:14 +00:00
Jehan
ad936482a2 Revert "Issue #15824: waterpixels filter on a selection appears to hang GIMP."
This reverts commit d91a8b2abe.

As reported by Liam on #15824, this commit was clearly wrong and
reintroduced the old cropping bug with multiple filters. Reverting.

The next commit was likely good, though the real hanging bug is — as far
as my test go — in the GEGL op itself. This second commit 75e665f0ed was
improving things, but obviously, as the bug is still in the op, it can
still be triggered. We'll have to fix the source bug next.
2026-02-25 23:51:56 +01:00
Jehan
75e665f0ed Issue #15824: better detect the first filter.
Ah my previous commit was working fine with a selection in the "Use the
selection as input" case, but was still hanging when "Use the entire
layer as input" was chosen.

The detection of whether we were the first filter was not working fine
when adding a new filter. Now this should work in all cases.

I don't revert the previous commit, because I think it's fine anyway.
When we have a selection, unconditionally adding a cropping-before node
on the selection boundaries seems logical to me.
Hopefully it doesn't bring back any of the cropping issues we had on
filters, but so far I could not reproduce any.
2026-02-25 15:44:29 +01:00
Jehan
d91a8b2abe Issue #15824: waterpixels filter on a selection appears to hang GIMP. 2026-02-25 15:38:23 +01:00
Alx Sa
1282384417 core: Update filter area if changed
Previously, we only updated an NDE filter's
`filter_area` if the filter itself contained a
width or height property.
However, the filter_area is also used by
GimpDrawableFilter to indicate where we
should draw the filter, and needs to be
updated if we scale/rotate/shear the layer
and change its dimensions.

This patch moves the code so that the
filter_area width and height is always
updated if we pass a GeglRectangle in to
gimp_drawable_filter_refresh_crop ().
2026-02-24 11:32:08 +00:00
Jehan
87810ae6fe app: make explicit that "White Balance" auto effect works in linear space.
This commit doesn't actually changes anything, but it fixes the
gimp_histogram_new() call, since the argument is supposed to be a
GimpTRCType, not a boolean. Yet GIMP_TRC_LINEAR is the first value in
the enum type, so it's indeed the same as FALSE.
I also set the "trc" property to "gimp:levels" config object explicitly,
to the same TRC value as the histogram, so that this doesn't depend on
the default anymore (which is linear too, right now; so this part
doesn't change a thing here again), and therefore would survive to any
possible default change in the future.

Note that it was considered to set this all to non-linear, just as it
used to be in 2.10, as requested in #15738. After discussing it with
Øyvind on IRC, we concluded that working in linear space may be a nicer
default for this feature, as we'd be doing a "meaningful rebalancing of
photon count per component". Now there may be cases where doing a
white-balancing in non-linear may yield better result, of course. For
these case, you may still go to "Levels", set to non-linear, and hit
"Auto Input Levels". This is exactly the same code runing (but in
non-linear space). The "White Balance" action still needs to be the
simple non-GUI option and keeping work in linear seems like the more
appropriate default here.
2026-02-24 01:36:32 +01:00
Alx Sa
b9d4e315e8 core: Adjust logic for gimp_drawable_filter_refresh_crop ()
In 0157a958, we prevent the NDE crop refresh
code from running unless the filter's crop
enabled is TRUE. However, this prevents
the width and height settings built into
certain filters from running, separate from
the crop nodes in GimpDrawableFilter.
This patch moves the check to only cover
the calls to gimp_drawable_filter_set_crop ().
This should fix the width/height update issue
without causing a regression to #14442.
2026-02-22 18:10:15 +00:00
Alx Sa
581afd1516 core: Fix GEGL warning after bucket fill
In 6279d7b7, I did not free the GEGL buffer created
by gimp_pickable_get_buffer_with_effects ().
This resulted in an "EEEEeEeek! 1 GeglBuffers leaked"
warning on exit, which of course could cumulate.

This patch makes to sure to clear out the src_buffer
both times it's used.
2026-02-22 00:28:16 +00:00
Alx Sa
6949400a03 core: Fix Equalize TRC compared to 2.10
In GIMP 2.10, gimp_histogram_new () takes a boolean
parameter to indicate if it should be rendered in a linear
or non-linear TRC. In GIMP 3.0, this function instead takes
a GimpTRCType where 0 is equal to the linear enum and 1
is equal to the non-linear enum.

Since gimp_drawable_equalize () still passes FALSE as it
did in 2.10, this is treated as 0 and thus setting it as a linear
operation.

This patch changes the FALSE to be GIMP_TRC_NON_LINEAR,
both for clarify and to better match the 2.10 behavior.
2026-02-20 15:00:39 +00:00
Alx Sa
4bfa65d72d core: Refresh new vector layers when pasting it
When copying and pasting vector layers, if we needed
to add a new path then the layer was not redrawn.
This would require the user to move or edit the path
to see the correct view of it.

This patch adds a call to gimp_vector_layer_refresh ()
after pasting it if it is not rasterized, in order to correct
the initial view.
2026-02-19 23:18:39 +00:00
Jehan
2b45e54b0c app: set the rasterized status properly on opening XCF files. 2026-02-14 18:30:37 +01:00
Jehan
b8e094416f Issue #15119: flipping link layers should not rasterize them. 2026-02-14 18:30:37 +01:00
Alx Sa
31eb0d86cf core: Associate color profile with SBZ palette
Color profiles were not being correctly connected to
Swatchbooker imported palettes, because the path
was included with the profile name (so a direct comparison
did not match). This patch fixes this by comparing the suffix
instead. It also fixes some minor formatting issues.
2026-02-12 02:07:49 +00:00
Alx Sa
dbc1c55de4 core, dialog: Add Procreate swatches import support
Procreate swatches are zipped JSON files.
They contain an object array of HSB
color palette values. Newer versions of the
format also support different color models,
spaces, and color profiles.

This patch adds support for importing the
palette name, colors, and associated color
profile in the original HSB format.
2026-02-12 01:49:47 +00:00
Alx Sa
f08eff5cda core: Retain SamplePoint modes when copying images
Resolves #15833
When we copied images in
gimp_image_duplicate_sample_points (), we only carried
over their X & Y position, not their pick mode.
This patch adds calls to get the original pick mode and
to set it to the new sample point created in the copied
image.
2026-02-09 12:17:11 +00:00
Jehan
d893aa373d Issue #11642: "images-delete" action not disabled when the selected…
… image's displays change in the Images dockable.
2026-02-07 00:39:12 +01:00
Alx Sa
cfba63a932 core, widgets: Don't remove inactive filters on merge
If a filter is inactive/invisible, it does not
affect the appearance of the drawable.
Therefore, when merging all active filters,
those filters should not be removed.

This patch adds conditional checks for
gimp_filter_get_active () and does not
remove filters on merge if it returns
FALSE. It also adds sensitivity checks in
the GUI so that the merge down button is
not active if there are no visible filters.
2026-02-06 21:50:13 +00:00
Jehan
955ff5b765 app: add new migration rule for property (linear) for Curves and Levels.
Property "linear" was replaced by "trc" in commit e09e563a70.
Unfortunately "linear" still stayed "as compat if needed for file
pasring" (cf. commit message) but this made a big mess, because when
setting operation properties at once, these 2 property can mess with
each other.

These migration rules are a first step in cleaning up the mess. Now we
should not have any config file with (linear) property in there,
therefore we can cleanly neutralize this property in further commits.
2026-01-30 23:38:34 +01:00
Jehan
bf6fcac0a9 Issue #14139: wait for fonts to be loaded before loading files.
This was happening when trying to load a file before fonts were fully
loaded, which may happen when loading while starting GIMP (either from
CLI, or from a file browser, etc.), or simply just after start for
people with a lot of fonts, whose font loading may take a long time as
background task.

Note that I didn't manage to reproduce properly because from reports, it
seems like the problem appears where some fonts may be only partly
loaded so gimp_font_get_hash() fails to load the font and get a hash. I
never managed to trigger such a case and no reporters answered my call
for testing of debug builds.
As a consequence, I'll just assume that simply waiting for all fonts to
be loaded before starting to load images would work out.

Note that the crash was not happening when text layers were using the
older syntax (pre-XCF 19) of text layer data, since it was not storing
any font hash, which means that we were not trying to compare hashes. It
would also not crash if fonts were not fully loaded yet, but we didn't
have any weird intermediate state where fonts appeared in the list yet
their file were not hashable (cf. what I failed to reproduce, as
explained in previous paragraph). But both these cases were not ideal
either anyway because then we could load the XCF apparently OK… except
that the correct fonts would not be associated to the related text
layers (hence as soon as you start to edit said texts, the rendering
would break). So we should wait for fonts to be loaded, and that was a
bug even when you can't reproduce the crash.

When starting GIMP without loading an image, or simply when fonts are
loaded quickly enough, it won't make any difference. So it should not
make startup any slower for most common use cases and installations.
2026-01-07 01:06:20 +01:00
Jehan
56a17c73eb app: fix gimp_get_data_factory() to support returning the tool preset…
… factory.
2026-01-07 01:06:20 +01:00
Jehan
d92c237a17 Issue #13709: wait we get our first surface focus before listing…
… input devices.

Per Carlos' advice on gtk#7534, I wait for us to get a focus, since the
pad devices are only created at that point.
Note that this is a Wayland-only issue, but since it doesn't matter too
much that input devices are not initialized before we have a focused GUI
anyway, let's make this simpler.

At the earliest, the splash focus can announce a focus, but since it is
possible to start GIMP without the splash, display shells will also
possibly announce the first focus (there will always be a display shell
focusing at some point for any GUI GIMP!).
2025-12-16 00:02:33 +01:00
Jehan
0157a9581e Issue #14442: undo crops layer rendering out of its off-border effects.
This was happening in multiple cases, such as undoing a "Rasterize
filters" action, but also with a "Layer to Image Size" being undone, and
probably any other undo cases.

In particular here the culprit was that upon undoing, we were setting
the GimpApplicator's "gimp:compose-crop" node, while it was a "gegl:nop"
before. We must be careful not to set a crop unexpectedly when the node
was not set already, explicitly.
2025-12-13 00:11:08 +01:00
Bruno Lopes
e285b70d6a
app/core: Add missing header for getpid() on Windows 2025-11-29 18:18:43 -03:00
Alx Sa
8db97f4eaf core: Create gimp_drawable_convert ()
When a drawable is converted, we check if
it has filters. If any filter has a mask, we convert it
to use the new image instead of the old one.
This prevents several crashes where the filter's mask
still pointed to the old image if it was copy/pasted
into a new one.
2025-11-27 04:56:56 +00:00
Alx Sa
7d89af790d core: Increase clipboard brush/pattern for 64 bit
Resolves #5627
The current limit for Clipboard Brush and
Pattern maximum size is set to 1024 because
that is the largest value that a 32-bit
architecture can safely handle.
64-bit architectures can support larger
dimensions, as confirmed by
Stanislav Grinkov during testing. This patch
therefore uses macros to increase the
size limit if we detect a 64-bit architecture,
and otherwise default to the 32-bit limit.
2025-11-23 05:31:57 +00:00
Jehan
1e800f51a7 app: fix broken #if test.
Argh! Fixed too quick and completely missed to transform the `ifdef` in
`if defined()` to add a second test.
2025-11-20 22:14:28 +01:00
Jehan
229c835d59 Issue #15239: link Layers not monitored on Windows.
MR glib!4901, backported as glib!4912, will be available in version
2.86.3. Let's keep the workaround so that link layers work without
having to bump the minimum requirement, but add a GLIB_CHECK_VERSION
test. This way, it will be clear that we have to get rid of this part of
the code even if we bump the GLib requirements years ago, when we'll
have completely forgotten about this issue.
2025-11-20 22:12:20 +01:00
Jehan
135ed4d2b6 app, libgimp, pdb: set all drawable selection functions as deprecated.
Also fix a bit of "Since:" annotations, some minor spacing fixing and
remove one useless test (if we test if a type is an item, we don't need
to test the children drawable type).
2025-11-17 12:14:56 +01:00
Alx Sa
37a0e37d25 widgets, pdb, libgimp: GimpProcedureDialog Item Widget
This patch adds a GimpItemChooser widget
for use in GimpProcedureDialog Item parameter
GUI creation.
This will deprecate the existing
GimpDrawableChooser, as it covers all the
same cases plus others such as GimpPath.
2025-11-16 16:42:24 +00:00
Alx Sa
bb9c3a85dc core: Fix copied channel naming
Per Jehan's note in the UX repo, we should
call copied channels "Floating Channels" rather
than the default "Floating Selection".
2025-11-16 14:07:55 +00:00
Jacob Boerema
5cc55d078b app: fix #15288 crash when loading malformed xcf
ZDI-CAN-28376 vulnerability

Add extra tests to not crash on a NULL g_class.
2025-11-13 18:49:15 -05:00
Alx Sa
a9dc4ddb2c widgets, pdb, libgimp: GimpProcedureDialog Image Widget
This patch adds a GimpImageChooser widget
for use in GimpProcedureDialog Image parameter
GUI creation.
2025-11-12 03:12:24 +00:00
Alx Sa
ea3c4dfc5a core: Pass through group mask size matches render
In 85d381bd, we fixed pass through layer groups to match
the size of the group render, allowing for filter effects to
be applied on all layers below.
This patch extends that fix to layer masks created on pass
through layer groups. This allows you to create a mask and
then selectively hide/show effects on the layer below,
like a maskable adjustment layer.
2025-11-09 15:47:17 +00:00
Gabriele Barbero
5d03bb847e core, widgets: ensure to add colors of GimpFillEditor in color history once
Previously, changing the color via the GimpFillEditor color button
immediately pushed each intermediate value into the color history,
polluting it with transient previews. Only the final choice
confirmed by the user should be recorded.

Now the color is recorded in the history only when the user explicitly
confirms the selection (e.g. OK/Apply), preventing noisy
history entries while preserving the expected behavior when a color
is accepted.

core: add spaces to fix alignment
2025-11-08 18:50:33 +01:00
Jehan
5ff80c7dfb app: fix duplicating link layers.
Link layer duplicates were reusing the same GimpLink as the original
layer, because the properties sync was done after we created a new link
object.
2025-11-08 13:34:16 +01:00
Jehan
8a0754a5be Issue #15121: link layer positioning problem.
Only store a PROP_TRANSFORM if there is a transform. Otherwise the
stored offsets are bogus and would only break the position at load.
2025-11-08 12:37:45 +01:00
Gabriele Barbero
c5e9b51c0d Revert "core, display: Enable resize for GUI layer copying"
This reverts commit 975d1a4aa3.
2025-11-07 22:50:45 +00:00
Gabriele Barbero
50dfd8d9e9 core: enable the resize undo for drawables inside gimp_item_resize
This commit makes sure each layer has the resize undo enabled
when rezising, in order to make sure that are correctly added to the
undo step.
2025-11-07 22:50:45 +00:00
Alx Sa
ab620151c5 core: Workaround for link layer monitoring on Windows
As of GLib 2.86.1-1, GFileMonitors created with the
G_FILE_MONITOR_WATCH_HARD_LINKS
flag are not monitored on Windows.
This means that link layers will not
automatically update when the external
source is edited.
We will temporarily use the
G_FILE_MONITOR_NONE flag on Windows
until this is resolved
2025-11-06 22:19:54 +00:00
Jehan
dddca29423 app: move the tool swapping code to tool manager and action to tools-action.
Per review, let's avoid having all the tools history in every
GimpContext.

Also a further commit will work on special-casing filter tools, which is
why we are storing up to 3 tool infos, instead of only 2.
2025-10-31 13:54:59 +01:00
Jehan
eeb419a363 Bug 373060 - allow to easily switch to last used tool.
New action "Last Tool" ("context-tools-swap"), defaulted to <shift>X.
Thanks to Damien de Lemeny for the original patch and Alexander Hämmerle
for the test case in test-ui.c.
2025-10-31 13:54:59 +01:00
Jehan
1fa3bc8e51 Issue #14014: do not allow NULL or empty parasite name.
This reverts commit 7b023177a8 and reimplement it as a CRITICAL because
if this happens, a bug has occured. If so, we don't want to hide the
bug, we want to be warned of it so that we can investigate further.

Clearly it should simply not be possible to create a parasite with a
NULL name. First if we look at xcf_load_parasite(), we were already
returning early when the name was NULL. Also even the constructor
gimp_parasite_new() has an early check and will return NULL on a NULL or
empty name.

So the question is: how come we had a parasite with NULL name (if that
is really the problem)? I don't have the answer to this and it's
possible that this bug had already been fixed somehow. But in any case,
if it happens again, we'll want this CRITICAL to run.
2025-10-28 13:48:48 +01:00
Gabriele Barbero
7b023177a8 core: check for NULL name in gimp_parasite_list_remove
Sometimes, probably due to a metadata corruption, a pasarite with a NULL
name can be present in the parasite list. This causes a crash when
trying to remove it, because `gimp_parasite_list_find` does not accept NULL
keys. This commit adds a check for NULL names in `gimp_parasite_list_remove`.
2025-10-28 00:27:51 +00:00
Jehan
8f9b742b51 Issue #14799: sync source and filtered container freeze count at creation.
This one was happening very rarely, which made it hard to track, though
I think it would happen more frequently to people with a lot of fonts
(and therefore font loading would take a lot of time) since the
problematic situation occured when the thread callback
gimp_font_factory_load_async_callback() would run after the
corresponding tagged container was created in constructor
gimp_data_factory_view_constructor().

When this happened, the source and filtered containers were not
synchronized regarding their freeze count. And in particular, the
filtered container would have one less freeze and would try to thaw once
the thread callback ran and thaw the source container, which was
provoking the CRITICAL.
2025-10-27 16:39:55 +01:00