Commit Graph

22333 Commits

Author SHA1 Message Date
Ell 8c1567f901 app: indentation fix in gimp:offset 2019-06-07 03:54:36 -04:00
Ell 533091055e app: in gimp:offset, fix OFFSET_TRANSPARENT fast-path for chunked input 2019-06-07 03:49:44 -04:00
Øyvind Kolås 5428e5e384 app: gimp:desaturate, improve indentation and reduce overhead
Fetch the red, green and blue luminance factors only in the desaturate
modes that use them.
2019-06-06 15:10:04 +02:00
Elle Stone 762fd66d28 Desaturate to Luminance using AnyRGB
Issue #3436 Replace sRGB Y values with Y values from XYZ for the
image's actual RGB space

This patch is for Colors/Desaturate/Desaturate to Luminance or
Luma.
2019-06-06 15:03:43 +02:00
Ell 42d4255262 app: avoid duplicate offset actions
Blacklist the "tools-offset" action in the GUI, and only keep
"filters-offset", to avoid duplication.  Update gimp:offset's
description, so that "filters-offset" gets a proper tool-tip.
2019-06-06 04:52:25 -04:00
Ell 066827e23c app: add GimpFilterTool::region_changed() virtual function
Add a new GimpFilterTool::region_changed() virtual function, which
gets called whenever the filter region changes, either due to a
change to the tool's "region" option, or a change to the image
mask.

Override GimpFilterTool::region_changed() in GimpOperationTool and
GimpOffsetTool, instead of listening to a change to the "region"
option in GimpTool::options_notify(), so that the tools are
properly updated when the image mask changes.
2019-06-06 03:09:58 -04:00
Ell 428ee0e2ad app: in gimp_filter_tool_get_drawable_area(), don't return empty area
In gimp_filter_tool_get_drawable_area(), when the image mask
doesn't intersect the drawable, return a minimal area, instead of
an empty/invalid area.
2019-06-06 03:08:39 -04:00
Ell 30429e30e2 app: various fixes/cleanups to last commits 2019-06-06 03:08:38 -04:00
Ell 3a4a00c71e Issue #40 - Layer offset tool
Add a new Offset filter tool, as a front-end to gimp:offset.  The
tool replaces, and provides the same interface as, the drawable-
offset dialog, while also providing live preview and on-canvas
interaction.

Note that we don't simply use a custom propgui constructor for
gimp:offset, since we need a little more control.
2019-06-05 19:06:56 -04:00
Ell 5b2f3980bd app: implement gimp_drawable_offset() in terms of gimp:offset
Implement gimp_drawable_offset() in terms of gimp:offset, added in
the previous commit.  Other than avoiding duplication, this also
allows gimp_drawable_offset() to respect the current selection and
component mask (see issue #39.)
2019-06-05 19:06:55 -04:00
Ell 40fefb6076 app, libgimpbase: add gimp:offset operation
Add a new gimp:offset operation, which implements equivalent
functionality to gimp_drawable_offset(), in preparation for adding
an interactive offset tool.

To simplify things, add a GIMP_OFFSET_WRAP_AROUND value to the
GimpOffsetType enum, to avoid the need for a separate wrap-around
flag.  This makes the gimp-drawable-offset procedure parameters a
little superfluous, but whatever.
2019-06-05 19:06:48 -04:00
Ell 2da5cb562d app: update drawable when committing Warp tool
Make sure to update the drawable after committing the Warp tool, if
high-quality-preview is disabled, and we use a non-nearest sampler.

Necessary after commit d928a80b7f.
2019-06-03 09:58:42 -04:00
Michael Natterer a14834e336 Issue #2057 - All tool presets change FG, BG and Pallete color...
...even when not supposed to

Don't use gimp_config_copy() to set the tool options from the ones
stored in the preset. Instead, add utility function
tool_manager_copy_tool_options() that only copies properties of
GimpToolOptions and its subclasses.

Simply set the tool, copy the tool options' context properties, then
copy the tool options' own properties and done. Much more obvious and
works.
2019-06-02 15:13:27 +02:00
Michael Natterer 8d1c36d9ce app: remove redundant assignment in gimptoolpreset.c 2019-06-02 15:04:38 +02:00
Ell d928a80b7f app: avoid unnecessarily updating drawable after merging filter
In gimp_drawable_merge_filter(), add an "update" parameter, which
specifies whether to update the affected region of the drawable
after applying the filter.  Avoid updating the drawable when
commiting a GimpDrawableFilter (and manually update the drawable if
filter application was cancelled), and when anchoring a floating
selection, since in both cases the relevant region of the drawable
has already been updated.
2019-06-01 13:29:00 -04:00
Michael Natterer e6364ffa81 Issue #2194 - Action search dialog behaves as a full window...
...using a tiling window manager

Set GimpSearchPopup's type hint to GDK_WINDOW_TYPE_HINT_DIALOG.
2019-06-01 17:37:49 +02:00
Michael Natterer a1aa179436 Issue #2643 - Conversion to grayscale fails with artifacts
Connect GimpDisplayShell to GimpImage::mode-changed and update its
cached color transforms. Also get rid of a duplicate conection to
GimpImage::precision-changed.
2019-06-01 14:19:05 +02:00
Ell 6425bf820a app: add "alpha" propertry to gimp:mask-components
In gimp:mask-components, add an "alpha" property, which controls
the masked-in alpha value in case there's no aux buffer.  Set it to
0 by default, so that gimp:mask-components behaves normally in the
absence of an aux buffer (as if the aux buffer was empty).  Set it
to 1 in the image's visible-mask node, to maintain the current
alpha-component visibility behavior.

This fixes incorrect results when the output bounding box of a
drawable filter is smaller than the drawable, which can lead to a
NULL aux buffer being fed to the filter's gimp:mask-components
node.
2019-05-31 13:11:14 -04:00
Ell 3766af9ac9 Revert "app: avoid NULL output in layer-mode ops"
On a second thought... nope :)  We'll fix it another way.

This reverts commit 60947b7a34826657395ca485d334ccb302106e07.
2019-05-31 13:11:13 -04:00
Ell 8fcac3298c app: avoid NULL output in layer-mode ops
In GimpOperationLayerMode and GimpOperationReplace, make sure we
don't return a NULL output buffer, or forward a NULL input buffer,
but rather create an appropriate empty buffer in this case.  This
avoids wrong results when the layer-mode op's output is connected
to the aux input of a subsequent op, as a result of the op behaving
differently with a NULL aux buffer (in particular, this can happen
when a drawable filter's output bounding box is smaller than the
drawable.)
2019-05-31 12:25:32 -04:00
Michael Natterer a26ade92a0 app: use GTK_RESPONSE_CLOSE in image-properties-dialog
so the dialog header bar omits the second close button.
2019-05-31 17:44:03 +02:00
Michael Natterer 792264ba6a app: add gimp_suggest_trc_for_component_type()
and use it in GimpTemplateEditor and convert-precision-dialog, instead
of duplicating the logic.
2019-05-31 17:28:20 +02:00
Michael Natterer 317b09c90f app: rename gimp_rec_rm() to gimp_file_delete_recursive()
and move it to the right place in gimp-utils.[ch].
2019-05-31 17:11:50 +02:00
Michael Natterer eec1df23a5 app: clean up most "non-linear" vs. "perceptual" confusion
There should never be an image using GIMP_TRC_PERCEPTUAL, but things
should work if one is encountered anyway.

In the Image -> Precision menu and the Convert Precision dialog, have
menu items / radio buttons for both non-linear and perceptual, but
hide the perceptual choice unless the image is in perceptual TRC mode.

This should eliminate the possibility to create perceptual TRC images
from the GUI.
2019-05-31 16:48:19 +02:00
Michael Natterer add4500a16 app: don't generate profiles from built-in profiles
gimp_image_convert_precision(): if the conversion changes the TRC and
the image's profile is a built-in profile, don't create a profile from
it but instead simply use the new TRC's built-in profile.
2019-05-30 18:42:56 +02:00
Michael Natterer 710cfc1f47 app: fix undoing image parasite attach/detach to emit the right signals
Add "gboolean push_undo" parameters to gimp_image_parasite_attach()
and _detach() and use the API also from undo, instead of implementing
attaching/removing manually and forgetting about the signals.

Fixes updating of the image properties color profile page.
2019-05-30 16:51:29 +02:00
Michael Natterer 07ffef38c3 app: make sure builtin profiles *really* don't get attached to images
gimp_image_parasite_attach(): when we detected that a builtin profile
is about to be attached, actually bail out after removing the old
profile, instead of continuing to attaching the builtin profile
anyway. Gah...
2019-05-30 16:07:57 +02:00
Michael Natterer 8251406b40 app: add the dialog buttons after creating the GimpColorDialog instance
so the "use-header-bar" property is set when the buttons are added,
fixes the order of the "OK" and "Reset" buttons.
2019-05-30 11:48:10 +02:00
Michael Natterer e7307194cf app: use the DEFAULT_USE_PATTERN define instead of TRUE in GimpPreset 2019-05-30 11:47:16 +02:00
Ell 8ef461bb70 app: s/gimp_list_compare()/gimp_g_list_compare()/
... so we don't clash with the GimpList namespace.
2019-05-30 03:31:46 -04:00
Ell 08ebcce2fa app: fix memory leak in previous commit 2019-05-30 02:43:45 -04:00
Ell 1e95481feb app: allow moving an intersecting pair of guides with the Move tool
This commit adds support for moving together an intersecting pair
of guides using the Move tool, by dragging the guides at their
point of intersection.  This is useful when the guides are used to
mark a point, rather than a pair of lines (e.g., as is the case for
the mandala symmetry guides, which mark the symmetry's point of
origin).

Add gimp_image_pick_guides(), which can return a set of guides,
rather than a single guide.  The API allows an arbitrary set of
guides to be returned, but, in practice, at most two intersecting
guides are returned, as per the above.

In GimpMoveTool and GimpGuideTool, add support for moving multiple
guides together, and, in GimpMoveTool, use gimp_image_pick_guides()
to potentially pick multiple guides.
2019-05-30 01:51:06 -04:00
Ell c4ce70a2d3 app: add gimp_list_compare()
... which lexicographically (shallowly) compares a pair of GLists.
2019-05-30 01:51:06 -04:00
Sabri Ünal b1c113c444 Issue #3119 - Two tooltips were marked as translatable 2019-05-29 22:39:37 +00:00
Sabri Ünal df8bad7a44 Issue #3105 - "Maximum Image Size" changed to "Maximum new image size"
Because of the real sentence is "Maximum new image size", this patch
was necessary.

(cherry picked from commit fb03526f92)
2019-05-30 00:25:37 +02:00
Michael Natterer 476cf19747 Issue #2986 - Input controller configuration window is too small by default
Set a minimum size on the event list's scrolled window.
2019-05-29 23:35:13 +02:00
Michael Natterer 04b69e2494 Issue #263 - Add a "Save Keyboard Shortcuts Now" button...
...to the Configure Keyboard Shortcuts dialog

Add the button, based on an old patch from Sven Neumann, and make the
buttons in the keyboard shortcuts and input devices dialogs look and
behave the same.
2019-05-29 16:12:21 +02:00
Ell a6393e6c55 app: add support for offset buffers in gimp_gegl_apply_[cached_]operation()
In gimp_gegl_apply_[cached_]operation(), add support for output
buffers whose extent's top-left corner is not (0, 0).  This is
needed by the previous commit.
2019-05-29 05:38:58 -04:00
Ell a701032b4e app: fix symmetry transform in Clone/Heal tools when brush is cropped
In GimpSourceCore, when applying a symmetry transform to the source
content, combine the transform op with translation to the paint-
buffer coordinates, so that subclasses (namely, GimpClone and
GimpHeal) can use the op to apply the transformation directly from
the source buffer to the paint buffer in a single step.  This is
both more efficient, and avoids incorrect symmetry transforms when
the paint buffer is cropped to the bounds of the drawable.
2019-05-29 05:26:43 -04:00
Ell 60a3965020 app: implement gimp_symmetry_get_operation() in terms of gimp_symmetry_get_matrix()
Remove the GimpSymmetry::get_operation() virtual function, and
instead implement gimp_symmetry_get_operation() by returning an
appropriate gegl:transform node based on the matrix returned by
gimp_symmetry_get_matrix().  The returned node is owned by the
caller; since we no longer use the node's identity for caching
trnasformed brushes, we no longer cache the transformation nodes.

Remove the function's paint_width and paint_height parameters, and
instead return a transformation that should be applied at the
center of the brush.  This simplifies the application of the
transformation in the Clone and Heal tools, as per the next commit.

Remove the implementation of GimpSymmetry::get_operation() from all
its subclasses, which should now only implement
GimpSymmetry::get_transform().
2019-05-29 05:26:42 -04:00
Ell 3895dc07a9 app: add gimp_gegl_create_transform_node()
... which takes a GimpMatrix3, and returns a corresponding
gegl:transform node.
2019-05-29 05:26:42 -04:00
Ell 117734f45f app: use gimp_symmetry_get_matrix() in GimpInk
... instead of calculating the matrix manually.
2019-05-29 05:26:41 -04:00
Ell cd7bcd081b app: add gimp_symmetry_get_matrix()
... which returns the brush transform corresponding to a given
GimpSymmetry stroke as a GimpMatrix3, as per
gimp_symmetry_get_transform().
2019-05-29 05:26:40 -04:00
Ell 86f4d4d41d app: don't add fg color to history in GimpEraser
Add GimpPaintbrush::get_color_history_color() virtual function,
which should return the color to be added to the color history upon
painting, if any.  The default implementation returns the
foreground color, when not using a pixmap brush or color-from-
gradient.

Override this function in GimpEraser, to return the background
color when the affected drawable has no alpha channel, instead of
overriding GimpPaintCore::paint() for this purpose.  This avoids
erroneously adding both the background and foreground colors to the
history.
2019-05-29 05:26:40 -04:00
Michael Natterer 679fd5f231 Issue #2794 - Gimp crash just on File Open and Edit Preferences
As suggested by LRN, change gimp_sigfatal_handler() on Windows to
dstinguish between fatal and non-fatal exceptions so we don't abort on
each minor hickup.
2019-05-28 11:55:59 +02:00
Michael Natterer 0710051e2b app, plug-ins: make sure a GIH brush's spacing is preserved
across load and save, by introducing a gimp-brush-pipe-spacing
parasite.
2019-05-28 00:25:47 +02:00
Michael Natterer 901350ba20 app: use g_clear_pointer() in more places 2019-05-27 17:47:55 +02:00
Jehan 9fa49af470 app: display the screenshot in the extension details GUI.
Further improvements should load screenshots in a thread, especially
since we are loading from a URL taken from metadata, so it makes the GUI
non-responsive for a bit too long. But this is a first working version
for now.
2019-05-27 17:31:18 +02:00
Jehan cc7af306b6 app: new gimp_extension_get_screenshot() screenshot.
This first version of this API only returns the default screenshot.
Further improvements should allow to return all the available extension
screenshots.
2019-05-27 17:31:18 +02:00
Jehan f67ac0f0ca app: improve extension list widget.
Use GtkGrid instead of GtkBox (docs says GtkBox will eventually go
away). Also remove this horrible frame in a frame (though GUI is still
not perfect yet). Finally fix the "extension" object data.
2019-05-27 17:31:18 +02:00
Jehan 400b564648 app: do not crash when an extension has no description tag. 2019-05-27 17:31:18 +02:00
Ell 024bc4cd3f Issue #886 - Artifacts symmetry painting with big brushes
In GimpClone and GimpHeal, use gimp_gegl_apply_operation(), instead
of gegl_node_process(), to apply the symmetry transform, which both
performs chunking and avoids aliasing problems.
2019-05-27 11:09:52 -04:00
Michael Natterer 1e07f00a95 Issue #3067 - "Make New from Visible" produces wrong results
Call gimp_projectable_structure_changed() when the image's profile
changes so the projection buffer gets reallocated.
2019-05-27 15:20:15 +02:00
Michael Natterer 765abcd316 Issue #3398 - colour map picker isn't positioned on the correct...
...-last positioned- monitor

Use gimp_dialog_factory_position_dialog() in GimpColormapEditor and
GimpPaletteEditor so the color dialogs appear where they were before.
2019-05-27 14:53:55 +02:00
Michael Natterer 97b1200b38 app: forgot to remove comment in color_area_color_clicked() 2019-05-27 14:53:14 +02:00
Michael Natterer ebb6b08e62 app: add gimp_dialog_factory_position_dialog()
which is the logic that used to be in color_area_color_clicked()
factored out to proper API. It makes sure that a dialog that was
visible before (and was only hidden not destroyed) appears at the same
point on the same monitor as before. See issue #1093.
2019-05-27 14:15:09 +02:00
Ell 39e1a6dfea app: fix Ink tool symmetry transform
... to take tilt into account.
2019-05-27 02:16:30 -04:00
Michael Natterer c1cba759f8 app: minor formatting fixes in gimpdrawable-bucket-fill.c 2019-05-27 00:29:41 +02:00
Ell aba4eef916 app: derive GimpEraser from GimpPaintbrush
In GimpPaintbrush, factor out the code responsible for determining
the current dab's paint parameters and content to a new
GimpPaintbrush::get_paint_params() virtual function.

Derive GimpEraser from GimpPaintbrush, instead of directly from
GimpBrushCore, implementing get_paint_params() appropriately.
This allows GimpEraser to reuse the paint-buffer content across
dabs, improving performance.
2019-05-26 14:47:44 -04:00
Ell 3b56bd7a9a app: add symmetry-transform support to the Ink tool
In GimpInk, apply the current symmetry transform, as per
gimp_symmetry_get_transform(), to rendered blobs.
2019-05-26 14:45:40 -04:00
Ell b63af476bd app: use gimp_symmetry_get_transform() in paint code
Use gimp_symmetry_get_transform() instead of
gimp_symmetry_get_operation() throughout the paint code, where
possible.  This allows us to combine the symmetry transform with
the ordinary brush transform, simplifying the code, improving
performance, and avoiding multiple resamplings.  This also fixes
the paint-buffer size when using mandala symmetry with non-round
brushes, avoiding artifacts.
2019-05-26 14:45:39 -04:00
Ell e0f2a6f1be app: add gimp_symmetry_get_transform()
Add a GimpSymmetry::get_transform() virtual function, and a
corresponding gimp_symmetry_get_transform() function, which return
the brush transform corresponding to a given symmetry stroke in
terms of the rotation angle and reflection flag (in contrast to
gimp_symmetry_get_operation() which returns the same transforation
in terms of a GeglNode).  This would allow us to simplify, fix, and
improve the painting-code perofmrnace in the next commits.

Implement GimpSymmetry::get_transform() in its various subclasses.
2019-05-26 14:45:38 -04:00
Øyvind Kolås a3f2d734a7 depend on babl-0.1.64 2019-05-25 19:51:42 +02:00
Michael Natterer 1f57675a46 Issue #3124 - layer mask pastes as a greyscale layer/grayscale layer...
...in a color image/colour image

gimp_edit_paste_get_layer(): only use the pasted-to drawable's format
with alpha if this is really a floating paste, use the image's layer
format with alpha for "as new layer" cases.
2019-05-25 17:05:49 +02:00
Michael Natterer e931895f7c Issue #3364 - make check fails with a linker error
Link tests against $(LIBARCHIVE_LIBS).
2019-05-25 16:02:00 +02:00
Massimo Valentini 1a691f77e6 Issue #1220 - Text tool has color from previous line...
...when overwriting existing text

gimp_text_tool_enter_text(): when replacing a selection, use the text
properties from the text style editor for the entered text, otherwise
the style of the text before the selection will be used.
2019-05-25 12:44:13 +02:00
Michael Natterer e249a42226 Issue #3343 - Some translated tooltips are appearing untranslated
Tool options properties must be translated with _() not N_().
2019-05-25 11:42:07 +02:00
Ell c2021d3c5b app: disregard composite space in source-only trivial layer modes
Extend last commit to also disregard the composite space when the
layer mode is trivial and only the source region is included in
compositing, since, in this case, the source color is unmodified.
2019-05-24 02:42:56 -04:00
Ell a5962e4049 app: disregard composite space in non-union alpha-only layer modes
In gimp_layer_mode_get_format(), disregard the requested composite
space when selecting the format, if the input layer mode is alpha-
only, and the requested composite mode is not UNION, since, in this
case, the layer mode doesn't combine the layer/backdrop colors, and
rather only modifies the alpha of one of them.  This allows us to
use the preferred format, avoiding gamma conversion.

This particularly improves the performance of the Eraser tool in
perceptual images.
2019-05-24 01:43:20 -04:00
Ell 1c91578bb2 app: don't show result-size warning when transforming a selection
In gimp_drawable_transform_get_effective_clip(), always return
RESIZE_CLIP when the input drawable is the image mask, since the
presence of a selection doesn't matter in this case.  This avoids
erroneously displaying a result-size warning when transforming the
selection using any of the selection tools.
2019-05-21 08:19:21 -04:00
Ell 853d91b8e4 app: initialize GimpBacktrace earlier on
Initialize GimpBacktrace earlier on in the startup process, so that
the Windows backend installs the thread-name exception handler
early enough to catch threads created before app_run() (in
particular, the GEGL worker threads).
2019-05-19 10:49:57 -04:00
Ell 86a7c053cc app: fix indentation in gimppaintbrush.h 2019-05-15 13:32:59 -04:00
Ell edc99531e6 app: in GimpPaintbrush, reuse existing paint buffer
In GimpPaintbrush, avoid refilling the paint buffer at each dab if
the paint color/pixmap hasn't changed, as gimp_paint_core_paste()
no longer modifies the buffer since the commit before last.

Additionally, fix color-from-gradient dynamics when the image has a
profile.
2019-05-15 10:54:45 -04:00
Ell fcd19a2aeb app: add gimp_brush_core_get_brush_pixmap()
In GimpBrushCore, replace the private
gimp_brush_core_transform_pixmap() function with a public
gimp_brush_core_get_brush_pixmap() function, which, similarly to
gimp_brush_core_get_brush_mask(), returns the transformed brush
pixmap, and can be used by subclasses.
2019-05-15 10:53:13 -04:00
Ell f24bca5156 app: don't modify paint buffer when pasting to canvas
We now have enough machinery in gimppaintcore-loops to avoid
modifying the paint buffer in gimp_paint_core_paste() in the no-
applicator case, by using the same set of algorithms as
gimp_paint_core_replace().  Other than reducing the number of
different code paths we have, this is both more efficient, and
allows us to reuse the paint buffer across dabs, as done in the
following commits.

Implement gimp_paint_core_replace() in terms of
gimp_paint_core_paste().  We keep the two functions separate, since
their implementation is still differnet when using an applicator.

Suppress the paint-buffer-modifying algorithms in
gimppaintcore-loops, but keep them around; using the same logic for
normal painting as we use for REPLACE painting is possible due to
the fact that all our current non-REPLACE modes treat alpha values
and mask values interchangeably.  In the future we might have modes
that distinguish between alpha and mask values, requiring the old
algorithms.
2019-05-15 10:53:12 -04:00
Ell bea1a44672 app: in GimpBrushCore, free old paint buffer before allocating new one
In gimp_brush_core_get_paint_buffer(), when allocating a new paint
buffer, clear the old buffer *before* allocating the new one, to
reduce the amount of simultaneously allocated memory.
2019-05-11 05:14:24 -04:00
Ell 088827e563 app: in GimpDashboard, improve legend logic 2019-05-11 05:14:23 -04:00
Jehan 45f37b9b63 app, libgimp, pdb: s/procesures/procedures/
While we are at it, another typo was missed.
2019-05-10 01:38:33 +09:00
luz.paz 1c91b8d97e Add a few more misc. source comment typos 2019-05-09 09:13:37 -04:00
luz.paz 86edc31b11 Misc. typos
Found via `codespell`
2019-05-09 09:13:37 -04:00
Ell cf54f790fd app: add tile-alloc-total variable to the dashboard
Add a tile-alloc-total varaible to the dashboard's memory and misc
groups, showing the total amount of memory used by the tile
allocator (see commit
gegl@137e66e45138e8316f6403e53e8aa9a02ad523e7.)
2019-05-08 04:22:39 -04:00
Ell 8434ae42a3 app: in GimpDashboard, don't show legend for groups with no meter
in GimpDashboard, don't show field legend colors in groups without
a meter.
2019-05-08 04:22:38 -04:00
Ell 29d575c033 configure.ac: require GEGL >= 0.4.16 2019-05-08 04:22:38 -04:00
Ell c7a29e5f98 Issue #3353 - Gimp 2.10.10 freezes while changing Background color ...
... in LCh colorspace

In gimptoolbox-color-area, when setting the context's background
color in response to a color-dialog change, block the right signal
handler, to avoid re-setting the color dialog's color, which would
cause the GtkAdjustment's "value-changed" signal (assuming it was
the source of the change) to be restarted if the new value doesn't
match the current one exactly, which can happen due to conversion
errors.
2019-05-08 03:45:11 -04:00
Jehan a761ed3ae8 app: round curve point position when displaying it as int.
Int casting results to truncation. First this is a bit counter-intuitive
as we usually expect rounding to the nearest integer. Moreover with the
new GUI updates on curve and curve tool, we end up with a mismatch as
the new Input/Output spin buttons where indeed showing rounded integers
whereas the coordinate indicator was showing truncated integers.

Make all these show same rounded value.

(cherry picked from commit 7b1af1f0cb)
2019-05-08 14:11:31 +09:00
Jehan 90bc9e10f1 Issue #835: warnings building with Clang.
Fix one warning and one error (introduced in commit 3bf2a3c166).
2019-05-07 18:12:47 +09:00
Michael Natterer c9b10ff3bf Issue #3251 - Windows menu shows doc's old name not new
In windows-actions.c, connect to GimpDisplayShell's "notify::title"
and update the action label when it changes.
2019-05-05 16:23:40 +02:00
Michael Natterer 75acae40e3 app: make sure the labels of our GtkImageMenuItem replacements get updated
In GimpAction, connect to the action's "notify::label" and update the
label inside the image-plus-label hbox we use to replace the
deprecated GtkImageMenuItem.
2019-05-05 16:17:50 +02:00
Michael Natterer 3bf2a3c166 app: don't dereference NULL image pointer
windows_menu_display_query_tooltip(): bail out if "image" is
NULL. Can't happen currently but did happen temporarily while hacking
on related code. Better safe than sorry.
2019-05-05 15:36:07 +02:00
Jehan 14d9606c04 app: allow undoing extension removal in the GUI. 2019-05-01 23:13:17 +09:00
Jehan 09ca1e8962 app: add undo_remove ability to the extension manager.
This allows an extension removal to be cancelable for a given session
(at end of session, the extension removal is definitive and you have to
reinstall it if you want it back).
2019-05-01 23:13:06 +09:00
Ell 84e183e5ed Issue #3306 - Memory leak using Crop tool
In gimp_canvas_passe_partout_get_extents(), free the inner region
after XORing it with the outer region.
2019-04-30 16:47:00 -04:00
Ell 068df34a27 Issue #3304 - Invalid write when halting filter tool with controller
In GimpFilterTool, properly clean up the controller's widget weak-
pointer and signal-handlers upon destruction, to avoid invalid
memory access when the widget is destroyed, if the widget outlives
the controller.
2019-04-30 16:46:59 -04:00
Ell 928e5957e3 app: in gimp-gegl-nodes, set underlying operation
In the vairous gimp_gegl_create_foo_node() functions, set the
parent node's underlying operation node, so that
gimp_gegl_apply_cached_operation() avoids duplicating the source
buffer when applying these nodes (all underlying operations are
currently point ops.)
2019-04-30 14:32:18 -04:00
Jehan f760a333a1 app: have the extension GUI listen to manager install/remove events.
The GUI is uglier than ever. I added a frame in a frame to put an
uninstall button. Please don't mind it, this is temporary. I just needed
to test uninstallation and don't know yet what are the proper widgets
to use for a nice design. :P
2019-04-29 20:56:28 +09:00
Jehan 50aa7233b2 app: add extension installation in GimpExtensionManager.
This completes my earlier commit 406279e4ef.
Extension installation is not about just decompressing a file in the
right folder. We must also make the extension manager and the GUI aware
of this newly available extension.
2019-04-29 20:56:28 +09:00
Jehan f7e483dd64 app: add ability to remove an extension.
Removing an extension means just unloading it and temporarily move it to
an "uninstalled" list. The actual files will only be deleted when
cleanly exiting the program, hence finalizing the extension manager.
This will allow undoing an extension removal easily.
2019-04-29 20:56:28 +09:00
Jehan 88f97aedef Issue 2949: Newly Installed Fonts not Registering.
Apparently Microsoft added just recently the feature to install user
font (as opposed to system-wide fonts), without administration rights
(yes, only now, how crazy is that?). Right now GIMP does not see fonts
there.

We have an upstream report at fontconfig where such a default search
path should happen.
See: https://gitlab.freedesktop.org/fontconfig/fontconfig/issues/144
Until it gets fixed there, let's just add the user fonts dir ourselves
in GIMP. This code should get killed later.

Notes:
- I renamed various DEFAULT_* data macros to GIMP_DEFAULT_* because
DEFAULT_PALETTE was conflicting with another macro in Windows API!
- Also I removed the DATADIR macro set under app/config/ because it is
also conflicting and anyway we use it in no files on this level.
- This is not perfectly tested on Windows. Please everyone with Windows
access, could you build and test if it works fine before release?
2019-04-28 22:38:26 +09:00
Ell 71c624c5ab app: flush image when committing free-select tool
In GimpFreeSelectTool, flush the image when committing the tool, if
the seletion is created at the time of the commit (i.e., if the
polygon is not closed prior to the commit).
2019-04-26 03:37:13 -04:00
Ell 3369958525 app: increase GimpSelectionTools idle priority to avoid flickering
In gimp_selection_tool_start_change(), increase the priority of the
idle source used for hiding the selection so that it's run before
the canvas is redrawn, to avoid flickering the previous selection.
2019-04-25 09:54:31 -04:00
Ell 6a2bea733b app: fix dirty mask/action in the rectangle- and free-select tools
In GimpRectangleSelectTool and GimpFreeSelectTool, make sure the
tool is committed when the selection is dirty.
2019-04-25 07:08:54 -04:00
Ell 476833b553 Issue #2328 - Free Select tool should create preliminary marching ants selection
In GimpFreeSelectTool, use gimp_selection_tool_{start,end}_change()
to create the selection as soon as the polygon is closed, and
update it when the polygon, or the relevant tool-options, change,
similarly to GimpRectangleSelectTool.
2019-04-25 06:07:58 -04:00
Ell afab7deaa3 app: factor-out common free/fg-select logic into GimpPolygonSelectTool
We currently derive GimpForegroundSelectTool from
GimpFreeSelectTool, which prevents us from making changes that are
limited to the free-select tool.

Factor out the common free-select and foreground-select logic into
a new GimpPolygonSelectTool base-class, and derive both from this
class.
2019-04-25 06:07:57 -04:00
Ell 134ff92fe0 app: add GimpToolPolygon::change-complete signal
... which is emitted when finishing a change to the polygon,
similarly to GimpToolRectangle::change-complete.
2019-04-25 06:07:57 -04:00
Ell f84f1d89dc app: add gimp_tool_polygon_is_closed() 2019-04-25 06:07:56 -04:00
Ell e8c915af93 app: allow passing NULL pointers to gimp_tool_polygon_get_points() 2019-04-25 06:07:55 -04:00
Ell eda421e852 app: remove unused field from GimpPolygonSelectToolPrivate 2019-04-25 06:07:55 -04:00
Ell 4612105e52 app: move undo/redo logic for GimpRectangleSelectTool to GimpSelectionTool
Move GimpRectangleSelectTool's image undo/redo logic to
GimpSelectionTool, by adding a pair of
gimp_selection_tool_{start,end}_change() functions.  These
functions should be called by subclasses before/after changing the
selection, having the functions take care of undoing/redoing the
existing selection as necessary.  This allows us to reuse this
logic in other selection tools, specifically, the free-select tool.
2019-04-25 06:07:54 -04:00
Ell bb8648a2e9 Issue #3284 - Wrong layer renamed when switching images
In gimp_container_tree_view_clear_items(), temporarily unset the
tree-view's model before clearing it, so that name editing is
stopped beforehand.  Otherwise, name editing is stopped once the
corresponding item is removed from the store, causing us to rename
the wrong item.
2019-04-21 10:34:40 -04:00
Ell b01113741e Issue #3275 - Crash when opening an image after closing existing image
In gimp_open_dialog_set_image(), use a weak pointer for storing the
current image, to avoid a segfault in file_open_dialog_response()
if the active image at the time of the open action has been closed
before confirming the dialog.
2019-04-20 14:53:19 -04:00
Ell eda8b717d5 app: don't leak curve in gimp_curves_config_save_cruft() 2019-04-19 15:30:11 -04:00
Ell 8fc94184a8 app: fix spin-button width in the Curves tool
In the Curves tool, explicitly set the point-coordinate spin-
buttons' width-chars, so that their size remains fixed when their
range changes.
2019-04-19 11:35:27 -04:00
Ell f6d76ff342 app: fix last commit 2019-04-19 11:23:12 -04:00
Ell be719f9070 app: fix Curves tool numeric-entry range/precision for > 8-bpc images
In the Curves tool, when the image precision is greater than 8-bpc,
use a 0.00-100.00 range for the point-coordinate spin-buttons,
instead of a 0-255 range.
2019-04-19 11:13:14 -04:00
Ell 33e47c85a2 app: add smooth/corner curve-point types
Allow setting the type of GimpCurve control-points to either SMOOTH
or CORNER.  Smooth points produce a smooth curve, while corner
points produce a sharp curve (previously, all points were smooth).

In GimpCureView, display corner points using a diamond shape,
instead of a circle.

In the Curves tool, allow changing the curve's point types.
2019-04-19 10:34:32 -04:00
Ell 5140d903b8 Issue #1528 - Allow precise or numeric input in color curves tool
Add input/output spin-buttons to the Curves tool, which allow
setting the selected point's coordinates numerically.
2019-04-19 10:34:31 -04:00
Ell 91ecca7e10 app: add "selection-changed" signal to GimpCruveView
... which gets emitted when the selected point changes.
2019-04-19 10:34:31 -04:00
Ell b6d829a1b2 app: streamline GimpCurve
In GimpCurve, replace the use of a fixed-length control-point array
with a dynamically-sized array.  Adapt GimpCurve's interface, and
the rest of the code.

In addition to simplifying the code, this fixes a bug where the
curve object could be broken by moving the mouse too fast (yep...),
and allows more accurate point placement, both in the GUI editor,
and through canvas interaction in the Curves tool (see issue #814).
2019-04-19 10:34:29 -04:00
Ell dc6ca2cf9a app: fix gimp_operation_levels_map_input() for negative values
... when gamma != 1
2019-04-19 10:32:05 -04:00
Jehan 91c69b782c app: null the pointer after destruction.
Make sure we don't end up with a broken pointer in case it was not
immediately re-set.
2019-04-19 09:28:22 +02:00
Ell 8357c9ad64 app: in GimpCurveView, snap to curve when holding Ctrl
In GimpCurveView, when holding down Ctrl while adding/dragging a
point, snap the y-coordinate to the original curve (at the start of
the drag).  This is particularly useful for adding points along the
curve, without changing their y-coordinate.

Likewise, have the coordinate indicator show the snapped
coordinate.
2019-04-17 18:00:18 -04:00
Ell 0b9737a3ed app: in GimpCurveView, use relative motion when dragging point
In GimpCurveView, when dragging an existing curve point, don't
immediately move the point to the cursor position uppon button
press, but rather move it relative to its current position as the
cursor moves.  This allows selecting a point without moving it, and
adjusting its position more easily.

Additionally, when the cursor hovers above a point, or when
dargging a point, have the coordinate indicator show the point's
position, rather than the cursor's.
2019-04-17 18:00:17 -04:00
Ell 83184d1626 app: add incremental mode to the Dodge/Burn tool
Add an "Incremental" option to the Dodge/Burn tool, which,
similarly to the Paintbrush, Pencil, and Eraser tools, applies the
effect incrementally as the pointer moves.
2019-04-17 10:02:42 -04:00
Jehan 406279e4ef app: new "gex" format (GIMP Extension).
File extension (.gex) may still change if anything better is proposed.
This format is currently just a compressed archive containing the
extension data (plug-in, brushes or whatever) and the metadata file.

For now, opening such file will simply install it as a new extension,
keeping all file permissions and structure. Of course in the future, it
will have to trigger a confirmation dialog.

Currently the compression used is zip, which is just a first draft. This
is not a decisive choice as well. We could use some tarball compressed
in whatever other compression algorithm. I use libarchive as a new
dependency to support unarchiving as it seems to be a common library
(and since it is already used by AppStream-glib anyway, this doesn't add
any actual dependency, just make it direct).
2019-04-12 18:49:18 +02:00
Jehan 5c9114aedf app: allow core file procedure which don't return an image.
This is useful to be able to support file formats other than image
formats. In particular I will use this in the next commit to support a
"GIMP extension" format. When GIMP will open such file, it will
install an extension (not open an image on canvas).

This is an internal flag only, i.e. only usable from core GIMP. File
formats which a plug-in can register are still only image file formats.
2019-04-12 18:42:03 +02:00
Michael Natterer aee6d44b61 app: remove defines GIMP_BRUSH_FILE_VERSION and GIMP_PATTERN_FILE_VERSION
they were unused and wrong. Also clean up the brush and pattern
headers a bit.
2019-04-12 16:30:29 +02:00
Jehan 5d5ced88a8 Issue #3224: Fill by Line Art Detection Bug (Fatal Error with Crash).
Typos in gimp_pickable_contiguous_region_by_line_art().
Thanks to Massimo for debugging these!
2019-04-12 14:48:15 +02:00
Michael Natterer 40863bffdd app: fix legacy .gpb parsing code in gimp_brush_load_brush()
Only seek back to after the end of the actual brush if a following
pattern was *not* found. Got this logic wrong in the original port of
the plug-in code.
2019-04-09 23:11:55 +02:00
Ell 2da6cefa3f Issue #2665 - Settings changes in Rectangle and Ellipse selection don't "stick"
In GimpRectangleSelectTool, update the selection upon changes to
the "antialias", "feather", "feather-radius", "round-corners", and
"corner-radius" options, so that they take effect immediately,
without having to change the selection bounds.
2019-04-06 05:22:18 -04:00
Ell 033082dd9a Issue #3025 - "File/New" doesn't honor "precision" choice ...
... for "Edit/Preferences/Default Image"

In GimpTemplateEditor, don't use gimp_prop_enum_combo_box_new() for
the "Precision" combo-box, and rather synchronize the combo-box and
the template manually, since we only want to update the "Gamma"
combo-box according to the precision when it changes through the
UI, and not when the template's precision otherwise changes.

This fixes an issue where we'd always set the default gamma value
when resetting the editor's template, overwriting the template's
original gamma value.
2019-03-31 15:08:05 -04:00
Ell c95502266a app: in GimpChunkIterator, avoid preparing rect before merging
In GimpChunkIterator, avoid preparing the current rect before
merging it back to the iterator's region, to save some work.

Additionally, strengthen the iterator's invariants and simplify
code.
2019-03-31 05:03:38 -04:00
Ell 50aaeef6a0 app: fix image-window UI-manager update while a projection is being rendered
Set the priority of the image window's UI-manager update idle
slightly higher than the projection idle priority, so that the
image actions are updated during projection rendering.
2019-03-30 19:31:23 -04:00
Ell d182c41f8f app: small fix to GimpChunkIterator 2019-03-30 16:36:26 -04:00
Ell fa31854a66 app: in gimp:fill-source, align result to tile grid
In gimp:fill-source, align the result rect to the drawable buffer's
tile grid, so that all tiles are COWed for solid-color fills.
2019-03-30 12:06:10 -04:00
Ell be7906c05c Issue #2090 - Crash when using transform tools
In GimpTransformGridTool, avoid producing non-finite coordinate
and angle values.  In particular, this fixes a crash in
gimp_transform_grid_tool_get_cursor() as a result of a NaN angle
value being converted to a negative integer, hitting an assert.
2019-03-30 11:18:00 -04:00
Ell 91f4c809d8 app: more responsiveness improvements to GimpChunkIterator
Improve GimpChunkIterator's responsiveness to changes in processing
speed.
2019-03-30 11:18:00 -04:00
Ell 9dabad4cb9 app: don't invalidate viewable preview when thawed unless explicitly requested
In GimpViewable, don't invalidate the preview when thawed, unless
there was an explicit call to gimp_viewable_invalidate_preview()
while it was frozen.  This avoids invalidating the previews of an
invisible drawable's ancestors when the drawable's preview is
frozen/thawed.
2019-03-29 04:54:07 -04:00
Ell 24ed9dbdf5 app: avoid risky alloca() in gimp_brush_save()
Replace an arbitrarily-sized g_alloca() with g_malloc() in
gimp_brush_save().
2019-03-28 16:55:55 -04:00
Ell de36e33347 app: avoid freezing image preview if drawable is not attached
When freezing/thawing a top-level drawable's preview, only freeze/
thaw the image preview if the drawable is attached.
2019-03-28 12:36:44 -04:00
Ell e2ea2e4a82 app: when freezing a drawable's preview, freeze ancestors' previews
Add GimpViewable::preview_{freeze,thaw}() virtual functions, which
get called when the viewable's preview is frozen/thawed.  Implement
the functions in GimpDrawable, recursively freezing the parent
drawable's preview (or the image's preview, for top-level
drawables) while the drawable's preview is frozen.  For layer
masks, freeze the associated layer's parent.

This avoids updating layer-group/image previews while painting on,
or applying a filter to, a descendant layer.  This both reduces
lag, and fixes a discrepancy between the layer's preview, which
isn't updated, and its parents' previews.
2019-03-28 12:26:44 -04:00
Jehan d821b088e2 app: change antialias feature in fill by line art into Feather Edges.
This was actually more of a feathering feature I added earlier, and we
already have a function for that: gimp_gegl_apply_feather(). This is
using a gaussian blur, just as what I was doing anyway. This commit also
adds the "Feather Radius" scale, similar to other tools with the
"Feather Edges". So that makes it consistent (and more useful as you can
adapt to your needs).
2019-03-28 14:06:17 +01:00
Ell 1846764d3b app: include system gimp.css file in theme.css
Include the system-wide gimp.css file, in addition to the user-
specific gimp.css file, in the generated theme.css file, instead of
copying the former into the latter when creating the user's
gimpdir.  This allows us to modify the system-wide gimp.css file,
and having the changes take effect in existing installations.
2019-03-27 20:14:10 -04:00
Ell 846d242f30 app: revert combo-box drop-down changes
Revert the use of gtk_combo_box_set_wrap_width() to change the
combo-box drop-down style, except for the status-bar unit combo.
See https://gitlab.gnome.org/GNOME/gimp/issues/2828#note_421312 for
the rationale.

This reverts commits 1d984542e9,
68a33ab5bd, and
6dfca83c2a.
2019-03-27 20:14:10 -04:00
Ell 234f76b6fb app: use gimp:fill-source in gimp_drawable_edit_fill()
In gimp_drawable_edit_fill(), when performing a non-direct fill,
use a GimpDrawableFilter with gimp:fill-source, added in the
previous commit, instead of using gimp_drawable_apply_buffer() with
an intermediate fill buffer.  This avoids allocating a full-size
fill buffer, which may occupy a lot of space in pattern fills.
2019-03-27 15:45:59 -04:00
Ell 6b0337e384 app: add gimp:fill-source operation
Add a new gimp:fill-source operation, which can act as a source
node for fill operations, instead of a fill buffer.  The op takes
a GimpFillOptions object, a drawable, and a pattern offset, and
uses gimp_fill_options_create_buffer() to produce its output.

This allows performing the entire fill operation in chunks as a
graph, instead of allocating a full-size fill buffer, which can
can occupy a lot of space for pattern fills.
2019-03-27 15:45:59 -04:00
Ell 3c1634ee0d app: improve gimp_drawable_fill_buffer() for patterns
In gimp_drawable_fill_buffer(), when the fill-source is a pattern,
avoid going through an intermediate buffer when there's no profile
transform, and use the destination-buffer format for the
intermediate buffer, instead of the pattern format, when there is a
profile transform.
2019-03-27 15:45:58 -04:00
Ell 245a17c79f app: use compositing format for fill buffer
Add gimp_fill_options_get_format(), which returns the format to be
used for the fill buffer; this is the same format used during
compositing.  Use this format in gimp_fill_options_create_buffer(),
instead of the drawable format.

This fixes the result of fill operations when the fill color/
pattern is not representable in the drawable format, and speeds up
color fills by avoiding color-conversion for the fill buffer during
processing.
2019-03-27 15:45:58 -04:00
Ell b0dfc1e7c7 app: in GimpDrawableFilter, set underlying operation
In GimpDrawableFilter, use
gimp_gegl_node_set_underlying_operation() to the the input
operation node as the underlying operation of the filter node.
2019-03-27 15:45:57 -04:00
Ell 213b126c6e app: use underlying operation in gimp_gegl_apply_cached_operation()
In gimp_gegl_apply_cached_operation(), use the underlying
operation, as returned from
gimp_gegl_node_get_underlying_operation(), for testing whether the
operation is a point operation, for the purpose of avoiding
duplicating the input buffer.  Likewise, avoid duplicating the
buffer when the underlying operation is a source operation.
2019-03-27 15:45:57 -04:00
Ell eb5e473665 app: add gimp_gegl_node_{set,get}_underlying_oepration()
... which allow setting/getting the "underlying operation" node of
a graph node.  For example, GimpDrawableFilter constructs a complex
graph around a given operation node, which would be the underlying
operation of the graph.  This allows querying the properties of the
underlying operation, given only the graph.

In recursive cases, gimp_gegl_node_get_underlying_operation()
returns the most-nested underlying operation; when no underlying
operation has been set, gimp_gegl_node_get_underlying_operation()
returns the input node.
2019-03-27 15:45:55 -04:00
Ell ff13e55c16 app: add gimp_gegl_node_is_source_operation()
... which determines if a node is a source operation.
2019-03-27 15:45:31 -04:00
Ell 8f845d3a51 app: in gimp_drawable_apply_buffer(), work in chunks
In gimp_drawable_real_apply_buffer(), use GimpChunkIterator to blit
the applicator's output to the drawable's buffer in chunks, to
minimize the space used for intermediate results.
2019-03-27 15:45:30 -04:00
Ell e904b71242 app: improve responsiveness of GimpChunkIterator
In GimpChunkIterator, redajust the target area at each step,
instead of at each iteration, to adapt more quickly to the current
processing speed.  To avoid creating uneven chunks as a result,
only change the chunk height at the beginning of rows, unless the
resulting area would be more than twice as big as the target area.
2019-03-27 15:45:30 -04:00
Ell 9d80ccc3e6 app: preserve projection priority rect across structure/bounds changes
In GimpProjection, store the priority rect in image coordinates,
and only convert it to projectable coordinates when initializing
the chunk-iterator's priority rect.  This allows us to preserve the
priority rect across projectable structure/bounds changes.
2019-03-26 04:58:51 -04:00
Ell 30da2f3d6f app: don't disable filter format conversion if != drawable format
In gimp_drawable_merge_filter(), don't disable the filter
applicator's output-format conversion node if the output format is
different than the drawable's format, since it may change the
result.
2019-03-25 09:16:23 -04:00
Ell 733a6ec01c app: skip cache and format conversion when merging a drawable filter
In gimp_drawable_merge_filter(), disable the filter applicator's
cache and output-format conversion nodes before processing the
uncached region of the filter, so that the result is written
directly to the drawable's buffer.
2019-03-25 09:02:27 -04:00
Ell d4689441fe app: small fix to gimp_gegl_mask_combine_ellipse_rect() 2019-03-24 14:45:45 -04:00
Ell 106df3b794 Issue #3142 - Filters on-canvas preview doesn't work ...
... immediately after an image precision change

When flushing a projection, make sure it has a buffer, instead of
bailing if it doesn't.  We rely on the image projection's "update"
signal to update the display after certain operations that free the
buffer, which would previously fail to happen, and cause subsequent
flushes to be ignored until the buffer is explicitly accessed.

This fixes commit b07f810273.
2019-03-24 03:20:39 -04:00
Ell a712308f20 Issue #3134 - Deleting last layer of group not updating image
In gimp_group_layer_get_size(), make sure to always set *width and
*height, even when the group is empty, so that when the function is
called through gimp_projectable_get_size() by the group's
projection, the correct size is reported.  This makes sure we
update the correct area when the group becomes empty.
2019-03-20 17:48:47 -04:00
Ell 8e77347cac app: improve gimpchannel-{combine,select}
In gimpchannel-select, move some of the common functionality of the
various gimp_channel_select_foo() functions to gimpchannel-combine.
Furthermore, don't special-case CHANNEL_OP_INTERSECT, but rather
pass it over to gimpchannel-combine, which is now prepared to
handle it in all functions, as per the previous commits.

In gimpchannel-combine, factor out the common functionality of the
various gimp_channel_combine_foo() functions into a pair of
gimp_channel_combine_{start,end}() functions, which are called
before/after the actual gimp_gegl_mask_combine_foo() function,
respectively.  In particular, these functions deal with calculating
the new channel bounds.  Previously, the various
gimp_gegl_mask_combine_foo() functions would implicitly invalidate
the channel bounds (since commit
d0ae244fe8), rendering the bounds-
recalculation code ineffective.  This avoids manually recalculating
the bounds in many cases, speeding up selection operations.
2019-03-20 16:24:37 -04:00
Ell a227c8e94d app: improve gimp_gegl_mask_combine_buffer()
Simplify code, use gimp_gegl_buffer_copy() for CHANNEL_OP_REPLACE
when possible, improve value clipping, and parallelize processing.
2019-03-20 16:01:57 -04:00
Ell 1044342393 app: improve gimp_gegl_mask_combine_ellipse[_rect]()
Improve gimp_gegl_mask_combine_ellipse_rect() -- the funciton
responsible for rendering ellipse/rounded-rectangle selections.

Most notably, this commit significantly improves the function's
performance, by identifying whole tiles, whole rows, or parts of a
row, that are fully inside, or fully outside, the ellipse, and
filling them in bulk, instead of calculating the anti-aliasing
value at each pixel, which is now only done along the
circumference.

This commit also improves anti-aliasing, by more accurately
approximating the distance from a pixel to the ellipse, and by
normalizing the distance according to the pixel's cross-section
length in the direction of the said point.  In particular, we
guarantee that pixels that are fully inside/outside the ellipse
have a value of 1/0, respectively, facilitating the aforementioned
optimization.

Additionally, this commit fixes various edge cases where several
primitives coincide at a single pixel (in the rounded-rectangle
case), adds support for CHANNEL_OP_INTERSECT, and parallelizes
processing.
2019-03-20 15:58:29 -04:00
Ell 8a6e1c907d app: improve gimp_gegl_mask_combine_rect()
Simplify the code, and add support for CHANNEL_OP_INTERSECT.
2019-03-20 15:58:29 -04:00
Ell 5198d3c32d app: convert gimp-gegl-mask-combine to C++
... in preparation for next commits.
2019-03-20 15:58:28 -04:00
Ell ffaaa81c8a app: add gimp_babl_format_change_{component_type,trc}()
... which change a format's component-type/TRC, without otherwise
affecting it.
2019-03-20 15:57:05 -04:00
Ell d7f12c9d26 app: add gimp_babl_is_bounded()
... which takes a GimpPrecision, and determines if its values are
bounded to the [0,1] range (which is currently only true for
integer precisions).
2019-03-20 15:50:35 -04:00
Jehan 9042e85f3c app: make gimp_prop_gui_chain_toggled() less error-prone.
Don't assume that "toggled" signal means that toggle status actually
changed.

Though issue #3133 got fixed with my previous commit, let's make sure we
never create several GBinding for the same GimpChain by always checking
existence of a previous one after a "toggled" signal.
Also only create a GBinding object if one doesn't already exist.
2019-03-20 15:05:22 +01:00
Jehan 03dc24455a Issue #3133: Gimp freezes after selecting a filter preset and...
... clicking a GimpChain.
Since commit c0c055b4e9, gimp_chain_button_set_active() emits the
"toggled" signal. There is no need to emit it separately from
GimpOperationTool when setting presets with
gimp_operation_tool_set_config().

In particular, since the "toggled" signal was even sent unconditionnally
here, our code was ending creating several GBinding for the same 2
adjustments, which was creating an infinite loop.
2019-03-20 14:48:40 +01:00
Jehan af6760b3c9 app: fixes g_object_unref: assertion 'G_IS_OBJECT (object)' failed.
"binding" data can be set to NULL. Do not assume it is a proper object.

Also I was tempted to use g_object_set_data() to simply free the
GBinding object on setting a new data, but such object will also be
freed when the widget is destroyed by default. So that would also end up
in double destruction. Instead just keep current logics.

This CRITICAL was reported in #3133 but this is not the main bug.
2019-03-20 14:06:18 +01:00
Jehan 7cf06c3f60 app: color widget updated properly when editing colors.
Also note that GimpColorPanel doesn't need to react differently whether
GimpColorDialog returned OK or CANCEL, as the dialog keep track and
return the appropriate color to set in the end of the process.
2019-03-20 11:21:46 +01:00
Jehan 425eb83f8a app: GimpColorDialog follows the user context active image.
(when working in context-aware mode)
2019-03-19 13:37:18 +01:00
Jehan 3dc820c017 app: make active_image member a weak pointer in GimpColorDialog.
This fixes signal handler disconnections wrongly run on images which
have already been freed.
2019-03-18 23:36:31 +01:00
Jehan 0ae3f38f52 Issue #3122: gimp_color_dialog_constructed: 'colormap' action group...
... not found.
So it turns out I cannot just gtk_action_group_get_action("colormap") as
the related action group is not registered unless the Colormap dockable
is opened. Anyway I mostly needed to get icons and tooltips from these
actions. Let's just copy the strings and be done with it.
This still feel a bit like duplicate code but it's not too bad, so…
2019-03-18 17:57:08 +01:00
Jehan 3b0e4d8760 app: update padding color interactively.
We should see the padding color change as we tweak the color dialog to
make it more useful.
2019-03-18 14:58:05 +01:00
Jehan edb90672fb app: again properly disconnect signal handlers. 2019-03-18 14:37:32 +01:00
Jehan 4a3da7d05e app: properly disconnect signal handlers. 2019-03-18 14:02:30 +01:00
Jehan c2ab385207 app: some cleanup in GimpColormapEditor.
I should have cleaned better earlier. :-/
Also add back some horizontal alignment in the colormap entry edit
widgets. This got lost during moving apparently!
2019-03-18 13:00:42 +01:00
Jehan 6e84c47469 app: use a GtkStack instead of GtkNotebook in GimpColorDialog.
This was the original plan since it is closer conceptually to the widget
idea, but I started working on gimp-2-10 where GtkStack was not
available (as it appears in GTK+3).
2019-03-18 12:28:02 +01:00
Jehan 576e804ebf app: make the active_image into a weak pointer.
We should make sure the object exists before using it.
2019-03-18 12:15:18 +01:00
Jehan 6abb55c759 app: GimpColorDialog should actually follow the user context...
... and not the GimpContext passed in.
What we are indeed interested in is the currently active image which is
recorded in the user context.
2019-03-18 12:11:58 +01:00
Jehan 8ab04a2a3a app: use the new GimpColormapSelection in GimpColormapEditor.
Code from GimpColormapSelection is mostly coming from GimpColormapEditor
anyway, except that it is used elsewhere as well.
2019-03-18 12:10:44 +01:00
Jehan 94043529c8 Issue #2938: Painting on indexed images counter-intuitive.
When loading indexed images, the image type is not obvious at all
(basically only reference is in the title bar). The main issue is that
if you don't realize it when editing, GIMP appear broken when the
expected colors don't appear on canvas.
Commit e48c239459 was a first step by showing various color widgets with
out-of-gamut warnings contextually. This additional commits will also
allows color selection for painting tools (i.e. foreground and
background colors) to be done within the image palette by default. This
way, the fact that this image impose working with limited color palette
is obvious as soon as you try to edit colors.
2019-03-18 12:06:11 +01:00
sabri ünal d5ea4c5653 Typo - Preceptual changed to Perceptual 2019-03-14 16:47:39 +00:00
Ell 506f412a05 app: avoid pushing undo while updating colormap entries
In GimpColormapEditor, while updating a colormap entry, only push
an undo step when confirming the new color.
2019-03-13 10:57:09 -04:00
Ell 1e89c161c5 app: more "Readjust" improvements
... technical stuff.
2019-03-13 10:12:08 -04:00
Ell a3fa3b6181 app: improve transform-tools readjustment
In GimpTransformGridTool, extend the functionality of the
"Readjust" button, such that if the transformation is already
adjusted to the view (i.e., when the button is clicked the second
time), readjust the transformation to the item bounds (as when
using the tool "normally"), and vice versa.  This allows switching
back and forth between "normal" mode, and "adjusted-to-view" mode.

Additionally, disable readjustment when the current transforamtion
is invalid, and show an error when readjustment results in an
invalid transformation.
2019-03-13 05:28:29 -04:00
Ell 92216a635a app: in gimp_tool_gui_set_response_sensitive(), allow non-existent ID
In gimp_tool_gui_set_response_sensitive(), silently ignore non-
existent response IDs, instead of emitting a CRITICAL, to match the
behavior of GtkDialog and GimpOverlayDialog.  This simplifies code
with optional dialog responses.
2019-03-13 05:28:29 -04:00
Alexandre Prokoudine fbde5da3b8 Tools presets -> Tool Pre_sets. Fixes #3092 2019-03-11 23:49:46 +03:00
Ell 8954d1f386 libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:28:52 -05:00
Ell 46e16e175c app: take transform-grid handle size into account when readjusting
In the unified-transform, scale, and perspective tools, take the
maximal transform-grid handle size into account when readjusting
the transform, so that the handles themselves are fully within view
under arbitrary rotation, rather than just the corners.
2019-03-08 12:11:13 -05:00
Jehan f6bfc2f23b app: update fg/bg colors when committing a colormap change.
Since the color being currently edited is the selected one, it makes
sense that the fg/bg color should be updated appropriately.

(cherry picked from commit 628960ed22)
2019-03-08 17:39:08 +01:00
Jehan ebc3ef3c5e Issue #3087: error compiling for Windows.
s/THREAD_MODE_ABOVE_NORMAL/THREAD_PRIORITY_ABOVE_NORMAL/
Thanks to Sylvie Alexandre for noticing and searching this.
2019-03-08 17:29:16 +01:00
Jehan 21d131636a app: fix a critical on a colormap editor callback.
On color update, check the existence of a context image before trying to
update the colormap.

(cherry picked from commit d378f19390)
2019-03-08 16:14:49 +01:00
Ell 5ff38e6859 app: fix mnemonic of transform-tools "Readjust" button
... and make sure that the tool implements readjust() when
receiving a RESPONSE_READJUST.
2019-03-08 03:46:12 -05:00
Ell 2c67b29190 app: reset overall transformation in transform tools
In GimpTransformGridTool, reset both transform directions in
response to the "Reset" button, so that the overall transformation
is restored to the identity.  Previously, we would only reset the
active transform direction (possibly compensating in the opposite
direction, if both directions are linked).  This was intentional,
but it's probably a bit too confusing, especially in conjunction
with the newly added "Readjust" button.  Let's just go back to
resetting everything.
2019-03-07 17:49:15 -05:00
Ell 7fb1d05ca4 app: fix unused variable warning in gimp_tool_gui_new()
... due to commit b23fae86f0.
2019-03-07 16:48:57 -05:00
Ell 5e5118c1db app: implement readjust() in various transform tools
Implement GimpTransformGridTool::radjust(), added in the previous
commit, in various transform tools:

The unified-transform, scale, and perspective tools readjust the
transformation such that the grid is centered relative to the view,
and its handles are fully within view under arbitrary rotation.

The rotate tool readjusts the transformation such that the pivot is
centered, and the grid is unrotated, relative to the view.
2019-03-07 16:26:21 -05:00
Ell 5055dd10d5 app: add "Readjust" function to transform-grid tools
Add an optional GimpTransformGridTool::radjust() virtual function,
which subclasses can implement to radjust the transformation based
on the current state of the display, such that it's easy to
control.  This is especially useful when the image is zoomed-in,
and the transform handles, which are initially across the layer
bounds, are out of view.

When a transform tool implements radjust(), show a "Readjust"
button in the tool GUI.  While readjusting the transformation, we
modify the opposite transformation such that the overall transform
remains unchanged, as if both transform-directions were linked, so
that only the transform grid is readjusted.
2019-03-07 16:26:21 -05:00
Ell b23fae86f0 app: add gimp_tool_gui_add_button()
In GimpToolGui, add gimp_tool_gui_add_button() and
gimp_tool_gui_add_buttons_valist(), which allow adding dialog
buttons after construction.
2019-03-07 16:26:19 -05:00
Jehan 31b2b55b28 Issue #3041: Color Picker no longer selects Colormap entry.
Do not take "Sample merge" into account when picking colors in a
single-layer image. The reason is to be able to get the index
information on indexed image. This information is lost otherwise when
using the whole image as a pickable.

Of course, other exceptions are possible, when you'd pick exactly a
colormap color, but I don't think it's worth making the code
extra-complicated for these. My previous commit will anyway already
select the right color in the colormap on common cases. Though it will
still fail to select the right index when several indexes store the same
color, on a multi-layer image, if you check "Sample merged" while the
right index was not the first one amongst the duplicates.
2019-03-07 18:43:05 +01:00
Jehan e47185bf11 Issue #3041: Color Picker no longer selects Colormap entry.
This is not the ultimate fix yet, but at least a first improvement.
2019-03-07 16:56:30 +01:00
Jehan a24957a804 app: direct on-canvas color preview when editing a colormap color. 2019-03-07 15:45:17 +01:00
Jehan f1cca8ee2e app: save the accurate color in the colormap palette when possible.
The colormap saves colors as unsigned char, which can be very inaccurate
compared to high precision colors. When adding colors from GimpRGB into
the colormap, use the original value to fill the colormap palette
instead of making a round trip conversion from double to uchar, then
back to double.

This also fixes a direct bug I encountered when adding the current
foreground color in the image colormap. Yet the GimpFgBgEditor or the
GimpColorHistory would still show the color out-of-gamut in cases when
the returned RGB after the roundtrip was not close enough to the
original RGB (even despite using an epsilon in GimpPalette code).
2019-03-07 00:02:56 +01:00
Jehan 8e8b4e82c1 app: update the GimpFgBgEditor when image colormap is updated. 2019-03-06 23:51:23 +01:00
Ell caad9ca649 app: various fixes to last commit 2019-03-06 15:56:09 -05:00
Ell d8e69d66bc app: allow canceling line-art computation
Line-art computation can take a long time, and it's therefore
desirable for it to be interruptable.  While we do cancel the line-
art async when its result is no longer needed, most parts of the
computation don't respond to the cancelation request, leaving the
async operation running in the background, blocking subsequent
async operations.

Implement cancelation support of line-art computation, by passing
down the async object to the various functions, and periodically
checking for its cancelation at various points.  When the async is
canceled, we quickly abort the operation.

Even though cancelation now happens relatively quickly, some parts
of the computation are still uninterruptable and may incur some
latency, so we avoid waiting for the async opration to be aborted
after cancelation, as we did before.
2019-03-06 15:24:14 -05:00
Jehan 4be9b7a401 app, libgimpwidgets: new gimp_color_area_set_out_of_gamut().
This allows to force a GimpColorArea to display as out-of-gamut color.
Current code was only considering the generic RGB case (outside of [0-1]
range), and in particular not grayscale or indexed images.

Ideally the GimpColorArea widget could be (optionally) made to follow a
context, so that for instance it could update its representation when
the context image changes, or when this image's type changes. Yet since
it is a libgimpwidgets widget, it cannot get such update. Instead I add
a new API function to display the color box with the out-of-gamut
triangle. The decision code for this will have to be done elsewhere.

Use this new API for GimpColorHistory to display non-gray colors in the
history as out-of-gamut on grayscale images, or colors absent of the
palette on indexed images.
2019-03-06 16:30:35 +01:00
Ell bb7f61c919 app: use gimp_gegl_buffer_copy() in various places
... instead of gegl_buffer_copy().  The former parallelizes the
format conversion.
2019-03-06 05:59:57 -05:00
Ell 190095c97b app: fix indepndent-async thread priority on Windows
Positive and negative priorities got swapped...
2019-03-06 00:08:01 -05:00
Ell 652a2a90cf app: use independent async for resolving performance-log symbol information
... so that performance logs can be recorded during long-running
async operations, without those operations blocking the
finalization of the log.
2019-03-06 00:01:59 -05:00
Ell fa2e4dcce0 app: add gimp_parallel_run_async_independent_full()
... which is equivalent to gimp_parallel_run_async_independent(),
except that it takes an additional "priority" parameter, which
specifies the task's priority, with 0 being the default priority,
and lower values indicating higher priority.  Unlike
gimp_parallel_run_async_full(), the priority parameter doesn't
directly control the task's priority in a queue, but rather, we use
it to control the priority of the task's dedicated thread, on
supported platforms (previously, all independent async tasks would
run with low priority.)

Use low priority when loading fonts, which can take a long time, to
keep the existing behavior.
2019-03-06 00:01:59 -05:00
Ell b0de51b6bf app: clean up last commit
Remove gimp_item_tree_clear(), added in last commit, and move its
code to gimp_item_tree_dispose().  Likewise, in
gimp_image_dispose(), use g_object_run_dispose() on the image item-
trees, instead of gimp_item_tree_clear().
2019-03-05 16:42:44 -05:00
Ell d7e3a1e226 app: fix segfault when closing an image with a floating selection
Add gimp_item_tree_clear(), which removes all the items of a
GimpItemTree, and clear the layers/channels/vectors item trees in
gimp_image_dispose(), *before* finalizing the image, so that the
corresponding items' desctructors are called while the image is
still alive.  In particular, this allows the destructors to safely
call gimp_item_is_attached(), which happens when the image has a
floating selection, since commit
8d4e5e0ff7.
2019-03-05 09:32:58 -05:00
Ell 9886b69dac Issue #3062 - Picking by hue using "Select by Color" goes awry ...
... in GIMP 2.10.9 from git

In gimppickable-contiguous-region's pixel_difference() function,
which is used, among other things, by the select-by-color and
fuzzy-select tools, when selecting by LCh/HSV hue, treat a pair of
colors as inifinitely far apart if one of them has positive chroma/
saturation, and the other has chroma/saturation that's very close
to 0; conversely, treat a pair of colors as equal if both of them
have chroma/sautation that's close to 0.

As a result, when the seed color is saturated, gray pixels are
never selected, while when the seed color is desaturated, all, and
only, gray pixels are selected.
2019-03-05 09:01:36 -05:00
Jehan f310db6c21 app: improve line art filling when clicking on a line art closure.
When clicking on a line art pixel, only this pixel gets colored, which
is fine for actual (original) line art pixels. But on generated ones
(closure pixels, which are internal only), you end up with a single
pixel colored while the whole surrounding area is empty. This feels like
a bug (even though it was not one technically) as you have no way to
guess you are clicking on a closure pixel.
Instead, when this happens, simulate clicks on all neighbour pixels,
hence potentially coloring all surrounding regions, which is most likely
what you wanted.
2019-03-04 18:31:13 +01:00
Jehan 3a317e72aa app: fixing the line art GimpBusyBox visibility.
Commit bc187cc5cc was a bit wrong as it was possible to get some race
conditions when changing settings quickly in a short time frame.
2019-03-04 16:55:51 +01:00
Jehan c0996241f6 app: avoid useless line art closure recomputation.
On various property changes, only recompute the line art when the
property actually changed. Also add a gimp_line_art_bind_gap_length() to
avoid computing twice the line art when changing both type of closure
(splines and segments) together, as is currently the case.
2019-03-04 16:43:19 +01:00
Jehan bc187cc5cc app: add a GimpBusyBox near the "Line Art Detection" label in…
… Bucket Fill tool options.
This will provide feedback when the line art closure is being computed,
which may be useful on big images where it may take some time. Otherwise
painter may be left hanging without knowing what takes time.
2019-03-04 16:06:59 +01:00
Ell daa09ef602 app: improve warp-tool cropped-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
affected drawable area to which the filter is cropped, to account
for box filtering.
2019-03-04 08:44:20 -05:00
Ell a93af839fe app: add "real-time preview" option to the warp tool
Add a "real-time preview" option to the warp tool, which, when
toggled, causes the preview to be rendered synchronously during
motion.  This is slower, but gives better feedback.
2019-03-03 16:23:23 -05:00
Ell e8a39d5c49 app: properly implement "spacing" option in the warp tool
The "spacing" option of the warp tool used to be handled by the
gegl:warp op, and have little effect.  Instead, implement it in the
warp tool directly, having the same effect as the other paint
tools.

Having a properly-working "spacing" option allows us to use EXACT
motion mode without cirppling down performance, which means that
the stroke now follows the pointer exactly, even when processing
takes a while.

Decrease the default "spacing" value to 10.
2019-03-03 16:21:57 -05:00
Ell aa91528084 app: improve warp-tool invalidated-area calculation
In the warp tool, use the gegl:map-relative node to calculate the
invalidated drawable area when the displacement field changes, to
account for box filtering.
2019-03-03 16:21:24 -05:00
Ell 6acedc7ebb app: set warp-tool scroll-lock to TRUE
In the warp tool, set scroll-lock to TRUE, so that the image isn't
scrolled when click-dragging outside the canvas, like the rest of
our paint tools.
2019-03-03 16:21:24 -05:00
Michael Natterer 8d4e5e0ff7 app: optimize gimp_layer_invalidate_boundary()
Don't mess with the image's mask if the layer is not attached or not
visible.

(cherry picked from commit 1c66573f4c)
2019-03-03 20:28:20 +01:00
Michael Natterer cc7e07fecb app, plug-ins: move brush pipe saving from the file-gih plug-in to the core
As with .gbr and .pat, only the actual saving code, not the export
logic and GUI.
2019-03-03 19:56:04 +01:00
Michael Natterer 861106a0b3 app: factor file_gbr_drawable_to_brush() out of file_gbr_image_to_brush() 2019-03-03 19:44:02 +01:00
Michael Natterer e742b4a95b app: factor out gimp_brush_pipe_set_params() from gimp_brush_pipe_load() 2019-03-03 19:44:02 +01:00
sabri ünal 3c64697878 #3050 - Four tooltips marked as translatable 2019-03-03 16:50:21 +00:00
Ell 03810861d2 app: in gimppaintcore-loops, improve CanvasBufferIterator algorithm helper-class
In gimppaintcore-loops, fix the CanvasBufferIterator algorithm
helper-class so that it may appear more than twice in the
hierarchy, and integrate it into the normal dispatch-dependency
system, instead of having dependent algorithms inherit it directly.
2019-03-02 16:24:48 -05:00
Ell 371e35eeb8 app: in gimp:mask-components, don't forward empty aux when mask is fully set
... since the result needs to be fully opaque in this case, rather
than fully transparent.
2019-03-01 14:35:52 -05:00
Ell a8a29312de app: small fix to last commit 2019-03-01 14:15:22 -05:00
Ell 6419ed3246 app: fix toggling-off of alpha channel
Fix gimp:mask-components to use full-oapcity value for the alpha
component when it's masked-in and there's no "aux" input, so that
the image is rendered with full opacity when the alpha channel's
visiblity is toggled off, as per bug #143315.
2019-03-01 14:11:15 -05:00
Ell 6166f9ae14 app: disable spec. 8-bpp version of gimp:mask-components for non-little-endian platforms 2019-03-01 14:11:15 -05:00
Ell 1e739675a4 Issue #3037 - Crash in transform tools after transforming an out-of-bounds selection
In GimpTransformGridTool, fix weak-pointer initialization for the
out-of-bounds selection-boundary canvas item, to avoid a CRITICAL
when initializing the tool in transform-selection mode for a fully
out-of-bounds selection, and a subsequent segfault when re-
initializing the tool.
2019-03-01 09:07:14 -05:00
Øyvind Kolås dde7108584 build,app: require GEGL-0.4.14 2019-03-01 14:42:26 +01:00
Øyvind Kolås 3e2d9e6b9e build,app: require babl-0.1.62 2019-03-01 14:42:23 +01:00
Ell ac4b0fe9f1 app: add "Constrain handles", "Around center" options to the perspective tool
Add "Constrain handles" and "Around center" options to the
perspective-transform tool's GUI, which are similar to the
corresponding options of the unified-transform tool.  Both of these
options can already be controlled using Shift and Ctrl,
respectively, through the transform-grid widget, so we might as
well provide GUI toggles for them.
2019-02-28 15:46:41 -05:00
Ell cdc5782b3c app: fix transform-grid center point for non-affine transforms; use as pivot
In GimpToolTransformGrid, use the transformed center-point of the
original polygon as the position of the center-point handle, and as
a snapping point for the pivot when "cornersnap" is TRUE, instead
of using the center-point of the transformed polygon.  These two
points are different for non-affine transformations.

Furthermore, when "use-pivot-handle" is FALSE, use the center-
point as the reference point when transforming around the pivot,
instead of the pivot itself, which might not be set.  In
particular, this fixes transformation around the pivot in the
perspective tool.

Don't explicitly set the center-point as the pivot in the scale
tool, since this commit makes it unnecessary.
2019-02-28 15:46:41 -05:00
Ell a6c79770c3 Issue #1554 - Select by Color tool does not select pixel(s) or area(s) of pixel(s)
In gimp_pickable_contiguous_region_by_color(), add a small epsilon
to the threshold value, to allow for small errors due to the input
color and pickable pixel-colors being converted to the common
format through different paths.

While we *could* special-case threshold == 0 when the input color
comes from the same pickable, as is the case for the select-by-
color tool, and perform an exact comparison in the original format,
in the more general case the input color can come from an arbitrary
source, such as a plug-in.
2019-02-28 09:27:43 -05:00
Ell ebf2c2fef1 app: in gimp_gegl_create_flatten_node(), explicitly set color node format
In gimp_gegl_create_flatten_node(), explicitly set the output
format of the background gegl:color node according to the composite
space, so that no conversion is required during compositing.
2019-02-25 11:30:49 -05:00
Ell e83d8ac4f2 app: merge layers in chunks, and show progress
In gimp_image_merge_layers() -- the internal function used by the
various layer-merging/flattenning functions -- process the merged-
layer graph in chunks, using gimp_gegl_apply_operation(), instead
of in one go, using gegl_node_blit_buffer().  Processing in chunks
better utilizes the cache, since it reduces the size of
intermediate buffers, reducing the chances of hitting the swap when
merging large images (see, for example, issue #3012.)

Additionally, this allows us to show progress indication.  Have the
relevant gimpimage-merge functions take a GimpProgress, and pass it
down to gimp_image_merge_layers().  Adapt all callers.
2019-02-25 05:10:50 -05:00
Ell 914200f3ad app: streamline action_data_get_foo() functions
Streamline the various action_data_get_foo() functions, by having
each function only match the action data directly against its
specific type(s), and use the other functions to match the action
data against their corresponding types, instead of having each
function directly exhaust all possible matches.

Other than reducing depulication, it fixes certain cases in which
some action_data_get_foo() functions would fail to find a match,
even though one exists, since they failed to exhaust all the
options.
2019-02-25 05:10:48 -05:00
Ell fb5987fd57 app: in GimpSmudge, avoid copying brush pixmap when flow = 0
In GimpSmudge, avoid copying the brush's dab to the paint buffer
when using a pixmap brush if the flow parameter is 0 -- it has no
effect in this case.
2019-02-24 13:22:22 -05:00
Ell 5b09af4390 app: improve gimp_brush_core_color_area_with_pixmap()
Reimplement gimp_brush_core_color_area_with_pixmap(), which copies
the brush's dab to the paint buffer when using a pixmap brush, in
terms of gimp-gegl-loops.  This simplifies the functions,
parallelizes processing, and transparently handles float brushes.

Replace the "mode" parameter of the function with an "apply_mask"
parameter, which specifies whether to apply the brush's mask to
the dab as part of copying.  Avoid applying the mask in
GimpPaintbrush; previously, we would erroneously apply the mask
twice when using the paintbrush tool: once when copying the
dab to the paint buffer, and again when pasting the paint buffer
to the canvas.

We still apply the mask in GimpSmudge, which results in the same
double-application behavior, however, this might be less practical
to fix.
2019-02-24 13:22:20 -05:00
Ell 0a1e62768a app: accept a const GimpTempBuf in more temp-buf functions
In gimp_temp_buf_{ref,unref}(), and
gimp_temp_buf_create_{buffer,pixmap}(), accept a const GimpTempBuf
argument.
2019-02-24 13:20:31 -05:00
Michael Natterer aee097fa97 app: implement saving of GimpBrushPipes in the core
Just the GimpData::save() and ::copy() part that is needed to
duplicate and rename them, the image-to-pipe logic from the export
plug-in remains to be ported.
2019-02-23 19:41:06 +01:00
Ell bb645bae17 app: add temp-buf-total varaible to the dashboard
Add a temp-buf-total variable to the dashboard's misc group,
showing the total size of all GimpTempBuf objects.
2019-02-22 08:47:05 -05:00
Ell 7489f0aece app: replace use of deprecated dont-cache/no_cache with cache-policy
Replace the use of the deprecated GeglNode::dont-cache property,
and GeglOperationClass::no_cache field, with GeglNode::cache-policy
and GeglOperationClass::cache_policy, respectively.

See commit gegl@7f24430cda0d8c3eff311868823d445edc2a4e12.
2019-02-21 13:09:45 -05:00
Ell 8c96c3d1bb app, libgimp: communicate dark-theme preference to plug-ins through theme.css
The GUI implementation of gimp_wait() relies on the ability to run
plug-ins (namely, the busy-dialog plug-in) without entering the
main loop.  This prohibits the said plug-ins from making any PDB
calls, which would result in a deadlock.  However, we're currently
calling gimp_gimprc_query() to fetch the prefer-dark-theme option
during gimp_ui_init() (or any time the theme.css file changes).

Instead, communicate this preference through the theme.css file
itself, by writing a /* prefer-dark-theme */ comment to the file
when the option is set.  Yes, it's a bit of a hack :P
2019-02-20 14:40:11 -05:00
Michael Natterer 569f3e1bc2 app: use NON_LINEAR not PERCEPTUAL in file-pat-load and file-gbr-load 2019-02-19 23:43:58 +01:00