Commit Graph

5777 Commits

Author SHA1 Message Date
Ell
9ea30995d7 app: in polynomial_odd_roots(), fix derivative array size
(cherry picked from commit db678ad212)
2020-02-07 00:56:11 +02:00
Ell
8722629aac app: add missing file to last commit
(cherry picked from commit 3a8725a409)
2020-02-05 01:19:21 +02:00
Ell
21d6c8a8da app: add support for offset buffers in GimpScanConvert
Ditto.

(cherry picked from commit d920569771)
2020-02-03 21:21:16 +02:00
Ell
901b0e7211 app: add support for offset buffers in gimp_channel_select_buffer() ...
... and gimp_gegl_mask_combine_buffer()

Allow the functions to work with buffers whose top-left corner is
not at (0, 0).

(cherry picked from commit 24534338e7)
2020-02-03 21:21:16 +02:00
Ell
9362e89b50 app: add a "Use tool groups" option to the toolbox preferences
Add a new Gimp::tool_item_ui_list, which is a GimpTreeProxy over
Gimp::tool_item_list.  This allows us to use either a hierarchical
or a flat tool list in the UI, by setting the "flat" property of
the new list.

Use Gimp::tool_item_ui_list in GimpToolPalette, so that the toolbox
layout is affected by this choice.

Add a "Use tool groups" toggle to the toolbox preferences, and bind
it to the "flat" property of Gimp::tool_item_ui_list.

(cherry picked from commit 3cda972100)
2020-02-01 13:20:23 +02:00
Ell
6c86a4c611 app: add GimpTreeProxy
Add a new GimpTreeProxy container class, which proxies a
GimpViewable tree.  The proxy has a dynamically-settable boolean
"flat" property, which controls if the tree hierarchy is preserved,
or if it's viewed as a flat list.

(cherry picked from commit 2caa518b19)
2020-02-01 13:16:03 +02:00
Ell
01cebc4307 app: add gimp_container_search()
Add a new GimpContainer::search() virtual function, and a
corresponding gimp_container_search() function, which works
similarly to gimp_container_foreach(), except that the callback
returns a boolean.  When the callback returns TRUE, the search is
stopped, and the current object is returned.

Implement GimpContainer::search() in GimpList.

(cherry picked from commit c4cc015c43)
2020-02-01 13:15:53 +02:00
Ell
f95decdc9f app: add GimpToolItem::shown property
Add a new read-only GimpToolItem::shown property, and a
corresponding GimpToolItem::shown-changed signal, which determines
if a tool item is visible throughtout the hierarchy, i.e., if it
and all its ancestors are visible.  This replaces
gimp_tool_item_is_visible().

Use the new property and signal in GimpToolPalette and
GimpToolEditor, to simplify the code, and in preparation for a flat
toolbox view.

(cherry picked from commit ee9661237e)
2020-02-01 13:15:52 +02:00
Ell
defc949724 app: use a weak pointer for tool-manager active group
In GimpToolManager, use a weak pointer for tracking the active tool
group, instead of taking a reference on it.  This avoids
erroneously extending the group's lifetime, which can cause
problems with the tool-item hierarchy.

In GimpToolGroup, make sure that newly-added tools don't already
have a parent.

(cherry picked from commit 30d833d00f)
2020-02-01 13:15:52 +02:00
Ell
0bd3c2e18e app: add gimp_tool_info_get_action_name()
Move the logic for translating a tool identifier to a corresponding
action name to GimpToolInfo.  It's currently only used in
tools-actions.c, but the next commits will use it in tool buttons.
2020-01-30 02:46:53 +02:00
Ell
6b11e098da app: don't register action for GimpOperationTool
Allow creating GimpToolInfo objects with a NULL menu label, and do
that for GimpOperationTool.  The previous commit effectively
removed it from the Preferences tool editor, and this commit also
removes it from the action search.
2020-01-30 02:46:53 +02:00
Ell
207c6b283f app: add support for tool groups in toolrc
Add a new Gimp::tool_item_list list, in addition to
Gimp::tool_info_list.  The latter may contain arbitrary tool items,
including tool groups, and is intended for use in the UI (namely,
the toolbox and the preferences tool editor).

In gimp-tools, use Gimp::tool_item_list for representing the UI
tool order (while still using Gimp::tool_info_list as a flat list
of all GimpToolInfo objects), and add support for saving and
loading tool groups to/from toolrc.

Introduce file-version tracking in toolrc, and drop its contents on
version mismatch, or when new tools are introduced.  This is
slightly disruptive, but merging new changes with existing toolrc
files is non-trivial, and it doesn't happen very often.

Add support for a sysconf toolrc file, which is used if there's no
user toolrc file (i.e., on first use).  If neither file is found,
the hard-coded flat tool order is used.  This commit doesn't
provide a default toolrc file, but the next commits will.

Make the gimp-tools serialization and deserialization functions
public, for use in GimpToolEditor in the next commits.
2020-01-30 02:46:53 +02:00
Ell
85c986efdf app: don't merge similarly-named objects during GimpContainer deserialization ...
... if not using unique names

Add a new GimpContainer::get_unique_names() virtual function, and a
corresponding gimp_container_get_unique_names() function, which
determines if the container uses unique names for its objects.
Override get_unique_names() in GimpList, to return the corresponding
property.

In gimp_container_deserialize(), don't merge new objects with
existing objects sharing the same name if the container doesn't use
unique names.
2020-01-30 02:46:53 +02:00
Ell
160b17c8a8 app: add GimpToolGroup as a subclass of GimpToolItem
Add GimpToolGroup as a new subclass of GimpToolItem, representing a
collection of tools.  The end goal is to display tool groups using
a single button in the toolbox.

Tool groups are not recursive: they can only contain individual
tools, not other groups.  Each group has a single "active tool",
normally the most-recently-used tool of the group, which is
activated when clicking on the tool's button.
2020-01-30 02:46:52 +02:00
Ell
b3583041ac app: add GimpToolItem; derive GimpToolInfo from it
Add GimpToolItem as a common base class for toolbox items.
Derive GimpToolInfo from GimpToolItem, representing an individual
tool.  The next commits add support for tool groups, represented by
an alternative subclass of GimpToolItem.

Most of the tool-info properties remain in GimpToolInfo, however,
GimpToolItem takes care of tool-item visibility.
2020-01-30 02:46:52 +02:00
817e83bb27 app: Fix Mandala Symmetry Kaleidoscope mode - brush transform and stroke order
Changed the reflection method to find the middle of the slice the
user is drawing on, and reflecting on that. This reflects the slice
in place, making it easier to rotate it to the intended location.
This fix preserves the order the dabs are drawn on the
slices, to be counterclockwise.

Fixed the brush transform, by setting the reflect output variable,
and calculating accordingly.

(cherry picked from commit ed6517f094)
2020-01-22 01:17:30 +02:00
Ell
4f9c3f2a6a app: avoid deleting empty layer groups when downscaling image
When dowscaling an image (or a layer group), empty layer groups
can be discarded as a result of their new dimensions being too
small, since we're calculating their new dimensions according to
their fake 1x1 dimensions.  However, these dimensions are purely an
implementation detail and shouldn't affect the result, and neither
do we show a warning for them.

Instead, simply avoid discarding empty layer groups.

(cherry picked from commit b99a2631ef)
2020-01-21 20:16:02 +02:00
Ell
e14b95820c app: restrict whole-drawable updates to groups with filters
Restrict last commit's workaround to layer groups only (which is
the only relevant case ATM), since it negatively impacts the warp
tool, which does rely on the ability to perform (accurate) partial
updates with filters to improve performance.  It's only a temporary
hack anyway.

(cherry picked from commit 18870975b8)
2020-01-20 00:38:19 +02:00
Ell
3b8f01282b app: always update full drawable region if it has filters
When a drawable has filters attached, they may influence the area
affected by drawable updates.  Currently, we ignore that, updating
the original region regardless.  This can lead to drawable updates
not affecting the correct regions.  This couldn't be triggered
until now, but since layer groups can now have a transform op
attached as a filter, updates to their sublayers -- which can
happen while the transform tool is active -- run into this problem.

Fix it for now by simply updating the full drawable region when the
drawable has filters.  This is a very conservative approach -- we
don't even bother checking if we're only dealing with point
filters, as this change only influences transformed groups right
now.  Ultimately, we need to rely on node invalidation to drive
updates, which takes this into account.

(cherry picked from commit 8be0e646bc)
2020-01-19 21:08:07 +02:00
Ell
79b3fb5ce7 app: don't emit GimpImage::linked-items-changed for non-attached items
In gimp_item_set_linked(), don't emit the
GimpImage::linked-items-changed signal if the item is not attached.

(cherry picked from commit 1e26ce8a60)
2020-01-19 21:08:06 +02:00
Ell
fbcabeb99f app: add GimpImage::linked-items-changed signal
Add a new GimpImage::linked-items-changed signal, which is emitted
whenever the set of linked items in an image changes.

(cherry picked from commit 7d6737fe9a)
2020-01-18 15:18:46 +02:00
Ell
44bf74a8d0 app: disable transform clipping for layer groups
Using any clipping mode other than ADJUST is currently broken for
layer groups, since each layer in the group is clipped
individually, instead of clipping being applied to the group as a
whole.  Ultimately, we should fix that, but for now, simply disable
clipping for layer groups, by overriding GimpItem::get_clip() to
always return ADJUST.

(cherry picked from commit 203bc9d893)
2020-01-18 11:13:30 +02:00
Ell
75d5eb7800 Issue #1975 - Color to alpha now requires an alpha-channel ...
... (used to add one automatically)

In GimpFilterTool and gimp_drawable_apply_operation(), use
gimp_drawable_filter_set_add_alpha() to add an alpha channel when
applying an operation that specifies "needs-alpha" to a drawable
that can have alpha.

Don't disable gegl:color-to-alpha (which has "needs-alpha") when
the drawable doesn't have an alpha channel, if one can be added.
2020-01-17 12:12:57 +02:00
Ell
29a02b2949 app: add GimpDrawable::supports_alpha() vfunc
Add a new GimpDrawable::supports_alpha() virtual function, and a
corresponding gimp_drawable_supports_alpha() function, which
determine if the drawable supports an alpha channel.  The default
implementation returns FALSE, and GimpLayer overrides it to return
TRUE.
2020-01-17 12:12:57 +02:00
Ell
6c0d20c9e6 app: silence warning in gimp_transform_resize_crop()
The crop-to-result and crop-with-aspect transform-boundary
algorithms seem to consistently fail in some cases, and spit out a
warning, which can be too verbose if it triggers the debug dialog.

Demote the warning to a g_printerr(), with an eye to just dropping
these algorithms altogether.

(cherry picked from commit 0103fe2c19)
2020-01-17 00:29:46 +02:00
Ell
6d7e18ff8a app: add gimp_drawable_filter_set_override_constraints()
In GimpDrawableFilter, add a
gimp_drawable_filter_set_override_constraints() function, which
allows bypassing certain constraints applied to the filter, based
on the drawable type and state.

Yes, this is a bit of a hack, added mostly as a quick-and-dirty way
to allow us to add filters to layer masks that affect their
bounding box, in preparation for composited transform previews.
2020-01-16 00:35:06 +02:00
Ell
1485e1d143 app: add gimp_drawable_filter_set_add_alpha()
Add an optional "format" parameter to gimp_drawable_merge_filter(),
which specifies the format to use for the output, possibly changing
the drawable's format.

In GimpDrawableFilter, add a gimp_drawable_filter_set_add_alpha()
function, which allows the filter to add an alpha channel to the
drawable when committed (by passing an appropriate format to
gimp_drawable_merge_filter()).
2020-01-16 00:35:06 +02:00
Ell
41ca26523c app: calculate drawable bounding box according to graph by default
Change the default implementation of
GimpDrawable::get_bounding_box() to return the drawable source
node's bounding box, instead of the drawable's item bounds.  This
allows filters to affect the size of all drawables, including, in
particular, layer masks.

Change GimpLayer's implementation of get_bounding_box() to return
the intersection of the layer's own bounding box, and the layer
mask's bounding box (if it has one), and update the layer's
bounding box when the mask is enabled/disabled, or when its
bounding box changes.
2020-01-16 00:35:06 +02:00
Ell
a2654ef7ce app: implement GimpPickable::flush in GimpGroupLayer
... by synchronously flushing the group's projection.  This is
necessary for pass-through groups, since their projection is
normally flushed asynchronously.

(cherry picked from commit 7f84f10154)
2020-01-15 22:05:35 +02:00
ec10b37421 Issue #4484: Add reflection option for mandala symmetry
(cherry picked from commit 36dd48aea6)
2020-01-11 23:57:25 +01:00
Ell
e884af8f42 app: clip transform-tools preview according to clipping mode
Add a "clip" property to GimpCanvasTransformPreview, specifying the
transform's clipping mode, and clip the preview accordingly.

In GimpTransformGridTool, sync the tool's clipping mode with the
preview's clipping mode.

(cherry picked from commit 7b2e6b7595)
2020-01-11 17:13:11 +02:00
Ell
818cbdbf4c app: fix wrong fix to gimpbacktrace-windows.c
This fixes commit 468f3e84d8.

(cherry picked from commit c93e5a2eae)
2020-01-07 22:18:55 +02:00
Ell
d8d05b9908 app: add gimp-transform-3d-utils.c
Add gimp-transform-3d-utils.c with various utility functions for
performing 3D transformations, in preparation for adding a 3D
transform tool.
2020-01-06 23:10:04 +02:00
61a2d53c9d Issue 2862 - Error message. Unable to decode abr...
...format version 10.

Simply allow the parser to read version 10, seems to work
with the brushes in issue #2862.

(cherry picked from commit c39d8fde33)
2020-01-06 19:38:12 +01:00
07b3acd69b Issue #3588 - Add Yu'v' (CIE 1976 UCS) to GIMP color picker
Which is a linear transform of xyY that is more perceptually
uniform, and so well-suited for eventually adding chromaticity
diagrams to GIMP color tools. ACES documentation uses this color
space instead of xyY for showing chromaticity diagrams. Moving
forward I expect other venues also will start using Yu'v' as
the advantages over xyY chromaticity diagrams are fairly obvious.

(cherry picked from commit bb660c5821)
2020-01-06 19:24:24 +01:00
b69c2ef9ce app: fix missing const qualifier.
Thanks to frogonia for noticing.

(cherry picked from commit 5ec22b6720)
2020-01-01 02:24:22 +01:00
f50cb339c0 Core: Fix cast to pointer from integer of different size warning on gimpbacktrace-windows.c 2019-12-01 01:33:51 +00:00
ce4865670b Windows backtrace: VEH must use stdcall
Fixes issue #2794

(cherry picked from commit cd54a8fee9)
2019-11-22 00:08:38 +01:00
Ell
f04d72d008 Issue #4218 - Color>Invert doesn't work on saved selection channel ...
... or copied RGB channel

In gimp_drawable_merge_filter(), make sure the drawable's source
node is constructed before applying the operation.  The
construction of the source node connects the drawable's filter
stack to the udnerlying source node (usually, the buffer-source
node), which we rely on when calling
gimp_gegl_apply_cached_operation(), since we pass
connect_src_buffer == FALSE.  Otherwise, the operation is applied
to an empty input, instead of the drawable content.

(cherry picked from commit 0e29fc1b21)
2019-11-11 19:01:40 +02:00
Ell
f16ce35f8d app: in GimpHistogram, don't initialize n_bins to 256
... it's no longer needed, and breaks the type's invariants.

(cherry picked from commit 2a292b02e3)
2019-11-11 18:18:55 +02:00
e7478071e8 Issue #4194: resolution passes from 300ppi to 72ppi after saving.
We are running gimp_image_set_imported_file() when saving, with NULL to
drop the tie with the imported file. Let's only change the default
resolutions when we actually set an imported file.

Also set the `resolution_set` flag even when it doesn't change the
current values (hence no undo or signals), for instance setting from 300
to 300 PPI. In such case, even though nothing changes, the resolution
has to still be considered as explicitly set.

In the reporter case, any one of these 2 fixes is enough.
See also commit fef9b1d2a3 (set to 72 PPI as default for imported files
only) and commit a8f552da2f (set imported file to NULL).

(cherry picked from commit 417bf199c8)
2019-11-08 14:07:51 +01:00
04997fc0ae Replace finite() with isfinite() by default
This is part of the C standard also also causing warning on macOS.
2019-11-07 09:09:22 +00:00
4cd23c64e9 Revert finite() fix as it needs to be done in pdb and configure 2019-11-06 21:16:26 +01:00
aff49550ee Fix "finite() is depricated" warning on macOS 2019-11-06 17:04:35 +01:00
Ell
6349453ad3 app: in GimpLineArt, ref input pickable
... in particular, so that the GimpLineArt object can take
ownership over newly-created GimpImageProxy inputs.

(cherry picked from commit c8b5c81a41)
2019-11-04 13:33:47 +02:00
Ell
c5ff92d71d app: in GimpLineArt, add support for arbitrary buffer extents
In GimpLineArt, add support for arbitrary input-buffer extents,
by shifting/unshifting the input/output buffers before/after
passing them to the main algorithm, so that the algorithm keeps
working with buffers whose top-left corner is at (0, 0).

(cherry picked from commit bce96eb690)
2019-11-04 13:33:47 +02:00
Ell
174f1ea622 app: in GimpImageProxy, implement GimpPickable
In GimpImageProxy, implement the GimpPickable interface, so that
the proxy can be used as both a viewable and a pickable for the
image projection, with direct control over the show-all mode.  This
will allow us to use a GimpImageProxy as input for a GimpLineArt.

(cherry picked from commit 0e02795128)
2019-11-04 13:33:47 +02:00
Ell
d1324ad802 app: rename GimpImageViewable to GimpImageProxy
We're going to have GimpImageProxy implement GimpPickable, so that
it can be used as either a viewable or a pickable proxy for an
image.

(cherry picked from commit 8d8cc12f40)
2019-11-04 13:33:47 +02:00
Ell
defe920d43 app: rename gimpimageviewable.[ch] to gimpimageproxy.[ch]
... in preparation for actually renaming the class, but as a
separate step to keep the history.

(cherry picked from commit 0ddd3330b8)
2019-11-04 13:33:47 +02:00
Ell
e2fe79d859 app: add gimp_image_get_preview_format()
Add an internal gimp_image_get_preview_format(), which returns the
format to use for preview buffers, and use it in both
gimpimage-preview and GimpImageViewable, to reduce duplication.

(cherry picked from commit 74009c8b1e)
2019-11-04 13:33:47 +02:00