Commit Graph

5774 Commits

Author SHA1 Message Date
c484a0c17b Issue #3641: gimp-drawable-offset does no longer work in script-fu...
... when one of the offsets is zero.

Found by Ell.

(cherry picked from commit a49a79e244)
2019-07-11 11:59:43 +02:00
3242eeb527 Issue #2685: Crash when distributing layers horizontally.
Make the returned values of g_list_length() a gint to avoid implicit
type conversion converting a possibly negative integer numberator into
unsigned int (which ends as a huge unsigned int instead of being
negative).

Found by Massimo!

(cherry picked from commit a6ad02a60a)
2019-07-10 17:28:07 +02:00
ff7ca87c09 app: GtkAction -> GAction madness part two
Change all action callbacks so they can be invoked by a GAction:

- add GimpActionCallback typedef:
  void (* cb) (GimpAction*, GVariant*, gpointer)
- change all action callbacks to the GimpActionCallback signature
- add "gimp-activate" and "gimp-change-state" signals to GimpAction,
  with the same signature as the resp. GAction signals
- remove all other custom action signals and only use the new
  GimpAction signals
- pass around appropriate GVariants containing booleans, int32,
  strings
- badly hack around to force a GimpProcedure pointer into a
  uint64 variant
- remove all G_CALLBACK() casts from all action callbacks,
  they all have the same signature now

(cherry picked from commit 3b6b3fc189)
2019-07-04 01:32:18 +02:00
90d0fb4a6e app: get rid of manual object type registration
and all deprecated use of private instance registration.

(cherry picked from commit e72a9d88a5)
2019-06-29 16:43:12 +02:00
0c2bad823c app: allocate GimpCurve's points with g_new0() and not just g_new()
so gimp_curve_equal() doesn't fail on random uninitialized padding
bits. Fixes finding previously used settings in the curves tool (they
were piling up just by re-applying a previously used setting).

(cherry picked from commit 4c58386ead)
2019-06-26 16:28:18 +02:00
f73e31571a Issue #3500 - Preferences option to convert to Preferred RGB profile...
...doesn't work

Rename the labels to "built-in sRGB color profile" and "built-in
grayscale color profile" because that's what the option does, it never
converted to the preferred profiles from preferences.

(cherry picked from commit d67f4604aa)
2019-06-21 12:50:38 +02:00
28b20af6b2 Issue #3532 - Wrong color profile on nikon taken photos, it's...
...always AdobeRGB!

Enable the code in gimp_image_metadata_update_colorspace() which syncs
the DCF information to the image's actual color profile, at least as
good as it can, and otherwise sets it to "unspecified".

Also fixes issue #301.

(cherry picked from commit c4ee350f02)
2019-06-21 10:06:04 +02:00
da33bb5107 app: consolidate all metadata syncing code into gimpimage-metadata.c
Add gimp_image_metadata_update_pixel_size(), _bits_per_sample(),
_resolution() and use them from gimp_image_set_metadata() and from
various places in gimpimage.c which had identical copies of the same
code.

Also add gimp_image_metadata_update_colorspace() which syncs the color
space stored in the image's metadata with the color space of the
image's actual color profile. Call the function from the right places.

The body of gimp_image_metadata_update_colorspace() is currently
disabled because the syncing of color space information is
controversial, see issue ##3532 and issue #301.

(cherry picked from commit b9829eddfe)
2019-06-20 16:19:25 +02:00
45aaa3a45d app: some files were missing from the previous commit
(cherry picked from commit 5160f51676)
2019-06-16 17:07:55 +02:00
a65042aebf Issue #3512 - feather selection doesn't work at edges of images
Add a "gboolean edge_lock" parameter to GimpChannel::feather() and a
"Selected areas continue outside the image" toggle to the "Feather
Selection" dialog, just like they exist for shrink selection and
border selection. At the end, convert the boolean to the right abyss
policy for gegl:gaussian-blur.

(cherry picked from commit aace6b179b)
2019-06-16 16:55:03 +02:00
Ell
9c8e1704c4 Issue #3484 - While moving a nested layer group, some area isn't updated
In gimp_group_layer_translate(), when translating a nested group
layer, call gimp_drawable_update_all() to update the child-layers'
original area *before* updating the group's offset, at which point
the group parent's size is updated, causing subsequent area-updates
during translation to be clipped to the parent's new bounds,
preventing the original areas from being properly cleared.

(cherry picked from commit 4a20a75dc3)
2019-06-10 03:55:44 -04:00
Ell
854374b2ce app: add gimp_drawable_update_all()
Add a new GimpDrawable::update_all() virtual function, and a
corresponding gimp_drawable_update_all() function, which updates
the full contents of the drawable.  Unlike calling
`gimp_drawable_update (drawable, 0, 0, -1, -1)`, which updates the
entire drawable area, gimp_drawable_update_all() only updates the
area that has actual content.  While the default implentation does
simply update the entire drawable area, GimpGroupLayer overrides
this function to recursively update its child layers, rather than
the its entire area.

(cherry picked from commit 3e5cbb03d9)
2019-06-10 03:55:43 -04:00
Ell
175e3ea7d9 app: various fixes/cleanups to last commits
(cherry picked from commit 30429e30e2)
2019-06-06 03:10:03 -04:00
Ell
003b138ee6 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.)

(cherry picked from commit 5b2f3980bd)
2019-06-05 19:10:51 -04:00
46f94d2c75 app: remove redundant assignment in gimptoolpreset.c
(cherry picked from commit 8d1c36d9ce)
2019-06-02 15:14:28 +02:00
Ell
9db555149f 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.

(cherry picked from commit d928a80b7f)
2019-06-01 13:29:04 -04:00
Ell
fe9c1732b9 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.

(cherry picked from commit 6425bf820a)
2019-05-31 13:11:26 -04:00
8d05d01820 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.

(cherry picked from commit 710cfc1f47)
2019-05-30 16:58:53 +02:00
29ef374228 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...

(cherry picked from commit 07ffef38c3)
2019-05-30 16:15:51 +02:00
20b47618d0 app: use the DEFAULT_USE_PATTERN define instead of TRUE in GimpPreset
(cherry picked from commit e7307194cf)
2019-05-30 11:50:46 +02:00
Ell
0c4c1f1a8c app: s/gimp_list_compare()/gimp_g_list_compare()/
... so we don't clash with the GimpList namespace.

(cherry picked from commit 8ef461bb70)
2019-05-30 03:31:51 -04:00
Ell
38e954ba25 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.

(cherry picked from commit 1e95481feb)
2019-05-30 01:52:03 -04:00
Ell
4dd3e73aaa app: add gimp_list_compare()
... which lexicographically (shallowly) compares a pair of GLists.

(cherry picked from commit c4ce70a2d3)
2019-05-30 01:52:03 -04:00
Ell
c75ba806be 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().

(cherry picked from commit 60a3965020)
2019-05-29 05:26:54 -04:00
Ell
a474e69573 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().

(cherry picked from commit cd7bcd081b)
2019-05-29 05:26:52 -04:00
de568a0f61 app: use g_clear_pointer() in more places
(cherry picked from commit 901350ba20)
2019-05-27 17:51:14 +02:00
7a6926a50b 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.

(cherry picked from commit 1e07f00a95)

(Picking this is not strictly needed, but did it anyway because it
doesn't hurt and this commit is hard to miss if we finally merge space
invasion to stable).
2019-05-27 15:24:28 +02:00
6fa861cec6 app: minor formatting fixes in gimpdrawable-bucket-fill.c
(cherry picked from commit c1cba759f8)
2019-05-27 00:31:25 +02:00
Ell
e961b13ae6 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.

(cherry picked from commit b63af476bd)
2019-05-26 14:47:55 -04:00
Ell
85340f4b30 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.

(cherry picked from commit e0f2a6f1be)
2019-05-26 14:47:55 -04:00
52a182eaed 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.

(cherry picked from commit 1f57675a46)
2019-05-25 17:11:42 +02:00
Ell
7313686192 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.

(cherry picked from commit a5962e4049)
2019-05-24 01:43:26 -04:00
Ell
275c2f9978 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.

(cherry picked from commit 1c91578bb2)
2019-05-21 08:19:26 -04:00
9a60382f69 Misc. typos
Found via `codespell`

(cherry picked from commit 86edc31b11)
2019-05-10 01:42:12 +09:00
Ell
001acb7d18 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.

(cherry picked from commit 33e47c85a2)
2019-04-19 10:36:28 -04:00
Ell
b5da9918f1 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).

(cherry picked from commit b6d829a1b2)
2019-04-19 10:36:25 -04:00
2608a7e2d6 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.

(cherry picked from commit aee6d44b61)
2019-04-12 16:33:15 +02:00
dcc297b6f7 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!

(cherry picked from commit 5d5ced88a8)
2019-04-12 14:50:25 +02:00
dd5c4458c9 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.

(cherry picked from commit 40863bffdd)
2019-04-09 23:14:53 +02:00
Ell
522e497457 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.

(cherry picked from commit c95502266a)
2019-03-31 05:03:47 -04:00
Ell
191c9812f3 app: small fix to GimpChunkIterator
(cherry picked from commit d182c41f8f)
2019-03-30 16:36:33 -04:00
Ell
4d2a5d1a94 app: more responsiveness improvements to GimpChunkIterator
Improve GimpChunkIterator's responsiveness to changes in processing
speed.

(cherry picked from commit 91f4c809d8)
2019-03-30 11:18:05 -04:00
Ell
f0b5080f83 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.

(cherry picked from commit 9dabad4cb9)
2019-03-29 04:54:12 -04:00
Ell
c8ea2f45f9 app: avoid risky alloca() in gimp_brush_save()
Replace an arbitrarily-sized g_alloca() with g_malloc() in
gimp_brush_save().

(cherry picked from commit 24ed9dbdf5)
2019-03-28 16:56:01 -04:00
Ell
c347f8770c 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.

(cherry picked from commit de36e33347)
2019-03-28 12:36:48 -04:00
Ell
b9ca245736 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.

(cherry picked from commit e2ea2e4a82)
2019-03-28 12:26:54 -04:00
273a0c4395 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).

(cherry picked from commit d821b088e2)
2019-03-28 14:12:12 +01:00
Ell
7edbad3144 app: include system gtkrc file in themerc
Include the system-wide gtkrc file, in addition to the user-
specific gtkrc file, in the generated themerc file, instead of
copying the former into the latter when creating the user's
gimpdir.  This allows us to modify the system-wide gtkrc file, and
having the changes take effect in existing installations.
2019-03-27 20:15:50 -04:00
Ell
9063b937fe 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.

(cherry picked from commit 234f76b6fb)
2019-03-27 15:48:22 -04:00
Ell
2341117517 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.

(cherry picked from commit 3c1634ee0d)
2019-03-27 15:48:21 -04:00