Commit Graph

801 Commits

Author SHA1 Message Date
Ell 2736cee577 app: remove gimp_parallel_distribute(); use gegl_parallel_distribute()
The parallel_distribute() family of functions has been migrated to
GEGL.  Remove the gimp_parallel_distribute() functions from
gimp-parallel, and replace all uses of these functions with the
corresponding gegl_parallel_distrubte() functions.
2018-11-14 10:52:06 -05:00
Øyvind Kolås 4b77831e03 app: migrate gimp-gegl-mask to new iterator api 2018-09-11 00:36:29 +02:00
Øyvind Kolås fcf113a39c app: migrate gegl-mask-combine to new iterator api 2018-09-11 00:36:12 +02:00
Øyvind Kolås 567ffe94ff app: migrate gegl-loops to new iterator api 2018-09-11 00:35:50 +02:00
Michael Natterer 6938d11716 Issue #1997 - Colors not properly converted to image's color space
Add a Babl space parameter to gimp_gegl_color_new() and all utility
functions using it. Pass NULL if the GimpRGB actually is sRGB, pass
the image's layer space if the color was already converted using
gimp_pickable_srgb_to_image_color() or similar.
2018-08-09 20:04:44 +02:00
Michael Natterer 6798f7d4cd app: add precondition checks to gimp_gegl_convert_color_profile() 2018-08-08 23:04:08 +02:00
Ell 9530b5cea3 Issue #1980 - Color picker wrong results when picking from non-sRGB...
...image using "Sample Average"

Also fix gimp_gegl_average_color(), which is where all current
implementers of GimpPickable actually calculate the average.
2018-08-06 09:02:42 -04:00
Ell eeed4778a2 app: add gimp_tile_handler_validate_buffer_copy()
Add gimp_tile_handler_validate_buffer_copy(), which can be used
instead of gegl_buffer_copy(), to copy a (subregion of a) source
buffer to a destination buffer with a GimpTileHandlerValidate,
uninvalidating, and avoiding unnecessarily rendering, the
affected region.  Additionally, if the source buffer also uses a
GimpTileHandlerValidate, the relevant parts of the source buffer's
dirty region are copied to the destination's dirty region as well.
2018-08-03 13:50:13 -04:00
Ell 12530e21b2 app: add gimp_tile_handler_validate_unassign()
... which should be used to properly remove a
GimpTileHandlerValidate from a buffer, instead of using
gegl_buffer_remove_handler() directly.

Use gimp_tile_handler_validate_unassign(), instead of
gegl_buffer_remove_handler(), in gimp_projection_free_buffer().
2018-08-03 13:50:13 -04:00
Ell e1e4ba9c8b app: in GimpTileHandlerValidate, clear data when allocating tile
In GimpTileHandlerValidate, when allocating a new tile upon a
TILE_GET command, but not rendering the whole tile, clear the tile
data before rendering, so that the unrendered regions of the tile
contain zeros, rather than junk.
2018-08-03 13:50:13 -04:00
Jehan a03e52ea08 app: add "cairo-ARGB32" to "R'G'B'A u8" in gimp_babl_init_fishes().
This fish is used for text layers, so if we let it to be
lazy-initialized, the first time one writes text in a text layer, it
generates a few seconds delay, which is really not great.
2018-08-01 16:45:16 +02:00
Michael Natterer e09e563a70 Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.

libgimp:

- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
  as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
  NON_LINEAR and PERCPTUAL for each encoding, matching the babl
  encoding variants RGB, R'G'B' and R~G~B~.

- gimp_color_transform_can_gegl_copy() now returns TRUE if both
  profiles can return a babl space, increasing the amount of fast babl
  color conversions significantly.

- TODO: no solution yet for getting libgimp drawable proxy buffers in
  the right format with space.

plug-ins:

- follow the GimpPrecision change.

- TODO: everything else unchanged and partly broken or sub-optimal,
  like setting a new image's color profile too late.

app:

- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
  replacement for all "linear" booleans.

- change gimp-babl functions to take babl spaces and GimpTRCType
  parameters and support all sorts of new perceptual ~ formats.

- a lot of places changed in the early days of goat invasion didn't
  take advantage of gimp-babl utility functions and constructed
  formats manually. They all needed revisiting and many now use much
  simpler code calling gimp-babl API.

- change gimp_babl_format_get_color_profile() to really extract a
  newly allocated color profile from the format, and add
  gimp_babl_get_builtin_color_profile() which does the same as
  gimp_babl_format_get_color_profile() did before. Visited all callers
  to decide whether they are looking for the format's actual profile,
  or for one of the builtin profiles, simplifying code that only needs
  builtin profiles.

- drawables have a new get_space_api(), get_linear() is now get_trc().

- images now have a "layer space" and an API to get it,
  gimp_image_get_layer_format() returns formats in that space.

- an image's layer space is created from the image's color profile,
  change gimpimage-color-profile to deal with that correctly

- change many babl_format() calls to babl_format_with_space() and take
  the space from passed formats or drawables

- add function gimp_layer_fix_format_space() which replaces the
  layer's buffer with one that has the image's layer format, but
  doesn't change pixel values

- use gimp_layer_fix_format_space() to make sure layers loaded from
  XCF and created by plug-ins have the right space when added to the
  image, because it's impossible to always assign the right space upon
  layer creation

- "assign color profile" and "discard color profile" now require use
  of gimp_layer_fix_format_space() too because the profile is now
  embedded in all formats via the space.  Add
  gimp_image_assign_color_profile() which does all that and call it
  instead of a simple gimp_image_set_color_profile(), also from the
  PDB set-color-profile functions, which are essentially "assign" and
  "discard" calls.

- generally, make sure a new image's color profile is set before
  adding layers to it, gimp_image_set_color_profile() is more than
  before considered know-what-you-are-doing API.

- take special precaution in all places that call
  gimp_drawable_convert_type(), we now must pass a new_profile from
  all callers that convert layers within the same image (such as
  image_convert_type, image_convert_precision), because the layer's
  new space can't be determined from the image's layer format during
  the call.

- change all "linear" properties to "trc", in all config objects like
  for levels and curves, in the histogram, in the widgets. This results
  in some GUI that now has three choices instead of two.
  TODO: we might want to reduce that back to two later.

- keep "linear" boolean properties around as compat if needed for file
  pasring, but always convert the parsed parsed boolean to
  GimpTRCType.

- TODO: the image's "enable color management" switch is currently
  broken, will fix that in another commit.
2018-07-21 16:42:57 +02:00
Ell 432a884715 app: flush async-operations queue when setting async thread count to 0
In gimp-parallel, always flush the async-operations queue (by
executing all remaining operations on the caller thread) when
setting the async-pool thread count to 0 (as happens when setting
GEGL_THREADS=1, per the previous commit,) and not only when
shutting GIMP down.  Otherwise, pending asynchronous operations
can "get lost" when setting GEGL_THREADS to 1.

Additionally, in gimp_gegl_init(), initialize gimp-parallel before
before connecting to GimpGeglConfig's "notify::num-processors"
signal, so that the number of async threads is set *before*
GEGL_THREADS, in order to avoid setting GEGL_THREADS to 1 while
async operations are still executing.

Also, allow setting the number of gimp-parallel-distribute threads
while a gimp-parallel-distribute function is running (which can
happen if gimp-parallel-distribute is used in an async operation,
as is the case for histogram calculation), by waiting for the
parallel-distribute function to finish before setting the number of
threads.
2018-07-15 05:07:20 -04:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell a0a62656d2 Issue #1792 - Xcf file crashing gimp-console-2.10 ...
... (valgrind reports Invalid read)

Add gimp_babl_is_valid(), which takes a GimpImageBaseType and a
GimpPrecision, and determines whether the image-type/precision
combination is valid.  Use this function to validate that loaded
XCFs use a valid type/precision combination, before trying to
create the image.  Otherwise, we get a CRITICAL, and eventually a
segfault, when the combination is invalid.

Use the same function to validate the arguments of
gimp_image_new().
2018-07-06 13:06:46 -04:00
Michael Natterer 3089a20167 app: remove all calls to gdk_window_process_updated()
- remove gimp_widget_flush_expose()
- remove the "now" argument to gimp_display_shell_flush() and make it
  only update widget states
- rename gimp_display_flush_whenever() to gimp_display_flush_update_region()
  and call gimp_display_shell_flush() separately in the only case we
  passed FALSE to flush_whenever()
- remove th flush_now interval logic from GimpDisplay, as soon as we
  have exposed the canvas, we are in the loop for the next frame clock
  tick anyway, so delaying a useless and removed process_updates serves
  no purpose
- in gimptool-progress.c, create the invisible grab widget also for
  non-cencelable cases, so we can always safely run the main loop
  manually to make the progress updates visible
- in gimp-gegl-apply-operation.c, always run the main loop manually
  to make the progress updates visible
- in gimpstatusbar.c, leave some FIXME comments as reminder that
  we might need the same logic as in gimptool-progress.c
2018-07-01 16:40:27 +02:00
Ell 8a881ca61a app: properly handle NULL rectangle arguments in gimp-gegl-loops
... and gimppaintcore-loops

When a rectangle argument is NULL, use the extents of the
corresponding buffer, instead of raising a CRITICAL, to match the
old behavior.
2018-06-21 08:11:16 -04:00
Michael Natterer 1b7d63cce9 Use g_set_object() in a lot of places, and splrinkle some g_clear_object() 2018-06-01 12:59:52 +02:00
Ell 08ff2ac8c8 app: use gimp_gegl_buffer_copy() all over the place
Replace all uses of gegl_buffer_copy() in app/ with
gimp_gegl_buffer_copy(), added in the previous commit.
2018-05-25 08:12:27 -04:00
Ell fded25b38c app: add gimp_gegl_buffer_copy()
... which is a drop-in replacement for gegl_buffer_copy(),
parallelizing the copy operation when the source and destination
formats are different, requiring a conversion.
2018-05-25 08:12:27 -04:00
Ell d272368251 app: add gimp_gegl_average_color()
... which takes a GeglBuffer and calculates the average color over
a given area.
2018-05-18 15:07:32 -04:00
Ell 2e68088c35 app: use gimp:normal instead of gegl:over in gimp_gegl_apply_cached_operation()
When the operation doesn't have an input pad, composite it over the
input using gimp:normal, instead of gegl:over, for consistency with
the rest of our compositing code (although the result should be the
same).
2018-05-07 14:38:53 -04:00
Michael Natterer d87259ccf9 app: fix gimp_gegl_apply_operation() for source OPs
Blend them on top of the source buffer using gegl:over like
GimpDrawableFilter does interactively. Fixes "Repeat Last" and
probably some other stuff for source OPs.
2018-05-07 14:26:26 +02:00
luz.paz 7fdb963e01 Bug 794996 - Misc. typo fixes in comments in app/
Found via `codespell -q 3 --skip="./po*"`
2018-04-08 21:25:56 +02:00
Michael Natterer 8994246be2 Bug 791519 - Unexpected selection from channel
One additional fix for the gimp-channel-combine-masks procedure,
it needs both the combined *and* combined-to buffer in
gimp_gegl_mask_combine_buffer() to be treated specially.
2018-04-08 20:26:32 +02:00
Michael Natterer bb4ac7c829 Bug 791519 - Unexpected selection from channel
Storing selections and layer masks as linear grayscale, but channels
as whatever-the-layers-are caused severe problems in images with
gamma-corrected layers: when combining channels with the selection,
they would go thorugh a gamma conversion before being combined, giving
unexpected results.

This commit changes all channels to always be linear, except in 8-bit
images, where they continue to be "Y' u8", for compatibility with old
XCF files, and because linear 8-bit can't really be used in
compositing (channels can be visible too).

To fix channel -> selection combinations also for these images, add a
small hack to gimp_gegl_mask_combine_buffer() which makes sure the
to-be-combined channel's pixels are always read as-is, without any
gamma conversion. After changing channels to linear, this makes no
difference except in the 8-bit images where we need this hack.
2018-04-08 19:26:48 +02:00
Ell 87a10aaf9e Bug 795048 - Image->mode->Grayscale results in a black or transparent image
In gimp_gegl_convert_color_profile(), when src/dest_rect is NULL,
use the extents of src/dest_buffer, instead of passing a NULL area
to gimp_parallel_distribute_area(), which results in a CRITICAL.

Additionally, only report progress on the main thread.
2018-04-07 12:05:59 -04:00
Ell f7c2ce9b13 app: fix smudge tool artifacts
Commit cb239e60f6 introduced
artifacts when using the smudge tool with multithreads.  Fix this
(caused by a wrong offset passed to an iterator) plus indentation
fixes.
2018-04-05 19:17:45 -04:00
Ell cb239e60f6 app: parallelize gimp-gegl-loops.cc
Ditto.
2018-04-04 17:49:47 -04:00
Ell 828b99b5b3 app: switch gimp-gegl-loops.c to C++
Ditto.
2018-04-04 17:49:47 -04:00
Ell 86b89cf62a app: add gimp-parallel
Add gimp-parallel.[cc,h], which provides a set of parallel
algorithms.

These currently include:

  - gimp_parallel_distribute():  Calls a callback function in
    parallel on multiple threads, passing it the current thread
    index, and the total number of threads.  Allows specifying the
    maximal number of threads used.

  - gimp_parallel_distribute_range():  Splits a range of integers
    between multiple threads, passing the sub-range to a callback
    function.  Allows specifying the minimal sub-range size.

  - gimp_parallel_distribute_area():  Splits a rectangular area
    between multiple threads, passing the sub-area to a callback
    function.  Allows specifying the minimal sub-area.

The callback function is passed using an appropriately-typed
function pointer, and a user-data pointer.  Additionally, when used
in a C++ file, each of the above functions has an overloaded
template version, taking the callback through a generic parameter,
without a user-data pointer, which allows using function objects.
2018-04-04 17:49:46 -04:00
Michael Natterer cad72b1432 app: remove unused variable in gimp_tile_handler_validate_command() 2018-04-02 23:23:54 +02:00
Ell 4acdc7392a app: use gegl_tile_handler_damage_rect() in TileHandlerValidate
Use the recently-added gegl_tile_handler_damage_rect() function
during GimpTileHandlerValidate invalidation, instead of manually
voiding the tile pyramid.  This function avoids voiding mipmapped
tiles entirely when only a subarea of the tile needs to be redrawn.

See GEGL commit 3210f4ffc3c569a2acd9483811cb141070112bc6.
2018-04-02 16:47:45 -04:00
Ell 289ecebd69 Bug 793734 - White alpha border after upscaling
In gimp_gegl_apply_scale(), use a CLAMP abyss policy for the scale
op, to avoid leaking transparency into the image when scaling
drawables.

Note that this (intentionally) only affects whole-image/layer
scaling, and not scaling done using any of the transform tools.
2018-03-22 17:04:13 -04:00
Ell ab4b7ab33a app: crop input to output rect in channel ops
In gimp_gegl_apply_{border,grow,shrink,flood}(), which are used
by the corresponding channel functions, pass crop_input = TRUE to
gimp_gegl_apply_operation(), to clip the input to the output rect.

These operations process the entire input in one go, regardless of
the requested output region; however, the channel functions
calculate the output region according to the known channel bounds,
hence clipping the input to these bounds doesn't affect discard any
information, while avoiding unnecessary work.  In particular, this
makes the corresponding operations on small selections in big images
much faster.
2018-03-22 13:46:28 -04:00
Ell e1b1611ec4 app: add crop_input parameter to gimp_gegl_apply_operation()
Add a crop_input parameter to gimp_gegl_apply_[cached_]operation().
When TRUE, the functions crop the op's input to the destination
rect.  This is particularly useful for functions that process the
entire input in one go (by means of get_cached_region()).  See the
next commit.

Pass crop_input = FALSE at all call sites for now, to keep the
current behavior.
2018-03-22 13:46:28 -04:00
Michael Natterer 539927ebfa app: replace all g_assert() by the newly added gimp_assert()
which is just a #define to g_assert for now, but can now easily be
turned into something that does some nicer debugging using our new
stack trace infrastructure. This commit also reverts all constructed()
functions to use assert again.
2018-02-11 22:23:10 +01:00
Ell 5f58a7a260 app: pass near-plane z-coordinate to gegl:transform
... so that GEGL performs the same clipping we do.
2018-01-28 16:37:34 -05:00
Ell 3c0787e4c3 app: use gimp_transform_polygon() in gimp_transform_resize_boundary()
... so that the transformed boundary is properly clipped.

Adjust the boundary-size algorithms to operate on arbitrary
polygons.

Avoid using gimp_matrix3_will_explode() in
gimp_drawable_transform_buffer_affine() and falling back to
cropping the result, and avoid setting the "clip-to-input" property
of gegl:transform.  Neither of those in needed anymore.

This effectively reverts the app/ part of commit
768d06614f.  The next commit revets
the libgimpmath/ part.
2018-01-28 16:37:34 -05:00
Ell 73d7a81a4d app: restore operation src node in gimp_gegl_apply_[cached_]operation()
When merging a drawable filter, we call
gimp_gegl_apply_cached_operation() on a node that's part of the
drawable's filter stack graph.  The function rewires the node's
input, and doesn't restore its original input connection before
returning, leaving the graph in an inconsistent state.  Currently,
this doesn't matter, since we remove the filter right after that,
but the next commit expects the filter stack graph to remain
consistent.

Remember the original source node of "operation" in
gimp_gegl_apply_cached_operation(), and restore it upon exit, to
fix that.
2017-12-05 16:12:07 -05:00
Ell dec2375a26 app: add gimp:buffer-source-validate operation
gimp:buffer-source-validate is a drop-in replacement for
gegl:buffer-source, however, if the attached buffer has a
validating tile-handler, it makes sure the required region is
validated during process().  This avoids a situation in which
validation happens in different worker threads at the same time
during the processing of a succeeding operation; since validation
is protected by the buffer's tile-storage mutex, this can result in
either a deadlock (currently), or an effective fallback to single-
threaded processing.
2017-12-04 16:02:41 -05:00
Ell f7d6805ebb */Makefile.am: add abbreviations to generated enum files
Update the dprod production of generated enum files to include
abbreviated value descriptions, as per the previous commits.

Add a comment for translators above the abbreviated descriptions,
specifying the full description they abbreviate.
2017-11-30 03:10:14 -05:00
Ell eeddd13209 Revert "app: make GimpTileHandlerValidate thread safe"
This reverts commit 4bd118ec8a.

The mutex introduced by the above commit should no longer be
necessary, after GEGL commit
8b034c437b0162b26f85eb80867914977ac3cf57.
2017-11-24 14:10:47 -05:00
Ell 4bd118ec8a app: make GimpTileHandlerValidate thread safe
Use a mutex to protect the call to
gimp_tile_handler_validate_validate() while fetching tiles, since
it's nowhere near thread safe.
2017-11-15 11:51:58 -05:00
Ell 66bb469a78 Bug 786992 - removing alpha produces a black image (sometimes), with OpenCL
When creating a flatten node, which is used when removing alpha
channels and when flattening an image, use a gimp:normal node to
combine the layer with the background color, instead of a gegl:over
node.  gegl:over can apparently result in completely black output
with OpenCL enabled, under certain (not fully pinned-down)
conditions.

As long as the OpenCL version of gegl:over is borked, there is not
much reason to use it over gimp:normal, which is more consistent
(in intension, if not in extension) with the rest of the
compositing pipeline.
2017-10-21 11:44:27 -04:00
Ell 0c305bdb0f app: use the layer's composite space when flattening it
Add a composite_space parameter to gimp_gegl_create_flatten_node()
and gimp_gegl_apply_flatten(), which controld the color space --
linear or perceptual RGB -- used for the operation (instead of
hardcoding it to linear).

When removing a layer's alpha channel, use the layer's composite
space for the flattening.  When flattening an image, use the bottom
layer's composite space.  Keep using linear space when creating a
channel or a mask from a drawable with alpha.
2017-10-21 11:44:27 -04:00
Øyvind Kolås 415f869f20 app: drop workaround for bug #785521
We now hard depend on a fresher release of GEGL that already has this fix in
it.
2017-09-09 23:54:53 +02:00
Michael Natterer 6b1ed42912 app: add a timer to gimp_gegl_convert_color_profile() 2017-09-03 15:17:58 +02:00
Ell 58fdaae3ad enums: add intermediate generated enum files to .gitignore 2017-08-24 15:35:27 -04:00
Michael Natterer 1c740f0d21 app: update .gitignore in app/gegl/ 2017-08-24 20:14:56 +02:00
Michael Natterer 0cfe550639 app, pdb: change a lot of GIMP_LAYER_MODE_NORMAL_LEGACY to just NORMAL
this commit changes just those which make no difference to
functionality: property and object member defaults that get overridden
anyway, return values of g_return_val_if_fail(), some other stuff.
2017-08-19 20:33:47 +02:00
Øyvind Kolås bac042db39 app/gegl: temp hotfix to disable threading in gegl:copy-buffer 2017-08-19 17:12:15 +02:00
Ell 64ade97702 app: move libappgegl's SSE2 bits to a separate library
Split libappgegl into libappgegl-generic and libappgegl-sse2, and
move the SSE2 code (part of the newly added smudge code) to the
latter, so that the rest of the code can be compiled without SSE2
compiler flags.  This allows building GIMP with SSE acceleration
enabled, while running the resulting binary on a target with no
SSE accelration.
2017-08-17 13:04:27 -04:00
Ell 7ecd3f2783 Bug 785890 - libappgegl doesn't use SSE2 compiler flags ...
... causing compilation to fail on 32 bit targets

Use SSE2 compiler flags when building libappgegl, since it's used by
the new smudge tool code.

Avoid using SSE for the smudge tool if SSE acceleration is disabled
at runtime, or if the buffers are not properly aligned.
2017-08-06 14:13:01 -04:00
Michael Natterer 572063765f app: use "const GeglRectangle*" in the GimpTileHandlerValidate API 2017-08-05 15:49:06 +02:00
Michael Natterer 12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Michael Natterer bcda53ee7b Bug 785001 - Enhanced smudge tool: Smudge with painting
Apply patches from shark0r that alow to mix in both constant and
gradient color while smudging; and clean up the patches.
2017-07-23 14:44:22 +02:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
More than 2000 lines of code less in app/, instead of

if (instance->member)
  {
    g_object_unref/g_free/g_whatever (instance->member);
    instance->member = NULL;
  }

we now simply use

g_clear_object/pointer (&instance->member);
2017-07-15 18:42:44 +02:00
Michael Natterer 1f5739de57 app: set the number of threads on GeglConfig again, it needs testing
- enable the setting code in gimp-gegl.c again
- but set the default to one thread in GimpGeglConfig, with a CPP warning
- rename "processors" to "threads" in the GUI
- add a warning box about unexpected results when increasing #threads
2017-06-28 19:05:58 +02:00
Ell 3ca48a0b30 enums: don't use comments in generated enum recipes
Works in bash, but apparently not portable.
2017-06-02 11:15:43 -04:00
Ell 5bcde32caf enums: run gimp-mkenums from the build dir
Commit 1e6acbd4e1 modified the
generated enum recipes to run gimp-mkenums from the source
directory, instead of the build directory, so that only the
basenames of the corresponding header files would appear in
the comment at the top of the generated files.  This was a
mistake -- $(GIMP_MKENUMS) is expecting to be invoked from the
build directory.

Switch back to running gimp-mkenums from the build directory.  To
avoid including the relative path from the build directory to the
source directory in the generated file, add a @basename@ production
variable to gimp-mkenums, which exapnds to the basename of the
input file, and use it instead of @filename@ in the recipes for the
generated enum files.
2017-05-22 20:29:18 -04:00
Ell f9fa0d1b18 enums: don't write generated enum files to src-dir if unchanged
When regenerating an enum file, don't copy it back to the source
directory if it hasn't actually changed.  This allows using a read-
only source directory where the enum header is newer than the
generated file, as long as they're not really out of sync.

OTOH, *do* touch the generated source-dir file even when unchanged,
in order to avoid re-running its recipe on the next build, however,
allow this to silently fail (which is harmless).
2017-05-22 17:58:04 -04:00
Ell 1e6acbd4e1 enums: generate enum files in source dir
We check them into git, so this makes it easier to keep them in
sync when using a separate build directory.

Case in point -- this commit also syncs a few enum files that went
out-of-sync with their headers.
2017-05-06 17:26:16 -04:00
Ell e0dcf538e5 Bug 781804 - Dodge/Burn tool produces artifacts with negative channel values
The halftones transfer mode of dodge/burn uses pow(), which produces
NaN for negative input values.  This tool doesn't really have OOG
values in mind, but using an odd power function fixes this issue,
and is in line with the behavior of the other modes w.r.t. OOG
values.
2017-04-26 21:30:43 -04:00
Michael Natterer ee6c7ec7b7 Bug 780015 - Filter settings are not properly restored after Gimp restart
Filters settings used to be serialized and deserialized only
when a filter tool's GUI was shown, too late for the code that
re-runs/re-shows filters with previous values.

Move the entire loading/saving code to gimp-operation-config.c, even
adding/removing the dummy separator item between timestamped automatic
history and manually saved settings. Load the settings automatically
when a settings container is requested, but still trigger saving from
the few places the container is changed in the GUI; could also
automate that later.

This commit also moves all settings of filters that have their own
tools from gimpdir/tool-options/ to gimpdir/filters/. Add compat code
to try the old filename if the new doesn't exist, so files are
migrated automatically.

WIP, but this step already fixes the bug.
2017-03-24 01:29:50 +01:00
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Ell 7402127505 app: remove GIMP_LAYER_MODE_FLAG_WANTS_LINEAR_DATA and friends
Instead, add a gimp_layer_mode_get_format() function, which takes
the layer mode, composite space, and blend space, and returns the
I/O format.

Currently, we always use the composite space format as the I/O
format.  This simplifies gimp_composite_blend(), and gives us
composite-space support for the "special" layer mode ops for free.
2017-02-17 18:19:32 -05:00
Michael Natterer 8634b5cbc3 app: make layer blend color space and compositing color space configurable
...they say it's going to get worse before it gets better...
2017-02-12 23:49:26 +01:00
Michael Natterer 891f85e805 app: move gimp-gegl-config.[ch] to operations/
and rename it to gimp-operation-config.[ch].
2017-02-05 20:17:31 +01:00
Michael Natterer 2950fecf07 app: move layer mode enums and gimp-layer-modes.[ch] to operations/
and to operations/layer-modes/, respectively.

Add gimp_layer_modes_init() which asserts on the correct order of the
GimpLayerModeInfo array, and switch to accessing the array directly in
gimp_layer_mode_info().
2017-02-05 15:59:29 +01:00
Michael Natterer 2a96d598c3 app: add internal and PDB API and UI to control a layer's composite mode
Largely based on a patch by Ell, with the enum type renamed and
various small changes. Adds another axis of configurability to the
existing layer mode madness, and is WIP too.
2017-02-02 00:38:25 +01:00
Michael Natterer 2dbf1b46b2 app: rename gimp_layer_mode_is_linear() to gimp_layer_mode_wants_linear_data() 2017-01-31 01:43:48 +01:00
Michael Natterer d3b8a0d007 app: s/trc/space/ in the property names too 2017-01-22 17:14:44 +01:00
Michael Natterer b10fc58802 app: add a "layer-mode" property to GimpOperationLayerMode 2017-01-22 14:41:21 +01:00
Øyvind Kolås 894d4c0c01 app: finish GimpLayerColorSpace rename 2017-01-19 19:33:17 +00:00
Michael Natterer 1262370544 app: remove "gboolean linear" parameters
from gimp_applicator_new() and gimp_gegl_mode_node_set_mode().
Compositing doesn't depend on the layer format any longer, only on the
layer mode. Painting with "use applicator" unchecked is still broken
in some cases and needs more fixing.
2017-01-18 00:15:55 +01:00
Michael Natterer 6e72d3eddf app: add blend-trc and composite-mode properties to GimpOperationPointLayerMode
and set them to unused default values.
2017-01-17 15:09:17 +01:00
Michael Natterer a24e232522 app: move functions on enum GimpLayerMode to new files gimp-layer-modes.[ch] 2017-01-15 15:25:03 +01:00
Michael Natterer 50669fe6d4 app, libgimp: rename BEHIND enum values to be consistent with others
Also update gimplayermodefunctions.c which I forgot before.
2017-01-15 00:01:09 +01:00
Michael Natterer 6bf9e47ba8 app, libgimp: add linear variants of most layer modes
and reorder gimp_gegl_mode_node_set_mode() and friends.
2017-01-14 22:56:54 +01:00
Michael Natterer bd66794e2c app: avoid the second gegl_node_set() in gimp_gegl_mode_node_set_mode() 2017-01-14 18:35:56 +01:00
Øyvind Kolås 4df1af2534 app: add linear variant of behind mode 2017-01-12 14:27:15 +01:00
Øyvind Kolås 377f4687b1 app: add gimp_gegl_mode_is_linear 2017-01-11 22:13:14 +01:00
Øyvind Kolås 5271027510 app: explictly code linear vs gamma for hardlight and softlight 2017-01-11 19:39:46 +01:00
Øyvind Kolås f9aeff5670 app: fix a lingering old gimp:softlight-mode 2017-01-11 15:17:30 +01:00
Michael Natterer 8b5553cef6 app: move the remaining 3 layer modes to layer-modes/
Not exactly sure if all are correct, but the file moving is almost
done now.
2017-01-11 12:55:13 +01:00
Øyvind Kolås 7ed2857695 app: fix type s/legacyy/legacy/ 2017-01-11 05:34:55 +01:00
Øyvind Kolås ec1f7a94e3 app: split legacy out of grain extract and merge 2017-01-11 04:40:26 +01:00
Øyvind Kolås 8f3842434c app: split legacy out of soft and hard light 2017-01-11 04:10:06 +01:00
Øyvind Kolås 784a8ee224 app: split legacy out of burn and divide 2017-01-11 03:17:53 +01:00
Michael Natterer 0891028232 app: forgot to s/gimp:normal-mode/gimp:normal/g 2017-01-11 00:28:57 +01:00
Michael Natterer 9142bb1805 app: move erase and anti-erase to layer-modes/ 2017-01-11 00:23:31 +01:00
Øyvind Kolås 0fcc2cd772 app: also fix multiply enum/name mapping 2017-01-11 00:12:45 +01:00
Øyvind Kolås 2ce25045fe app: fix fix 2017-01-11 00:10:09 +01:00
Øyvind Kolås 33f6398e00 app: fix enum to name mapping for hsv legacy modes 2017-01-10 23:46:01 +01:00
Øyvind Kolås 71030f49e9 app: duplicate hsv layer modes, and fix alpha handling 2017-01-10 21:48:03 +01:00
Øyvind Kolås c3e5e30450 app: split legacy lighten only and darken only ops 2017-01-10 11:18:52 +01:00
Michael Natterer 99189d7a28 app: move dissolve to layer-modes/ 2017-01-10 09:06:16 +01:00
Øyvind Kolås 5a7fd54d34 app: split addition and subract in legacy and new 2017-01-10 01:40:14 +01:00
Michael Natterer 60e1d8e35f app: move the LCH layer modes to layer-modes/ 2017-01-10 01:04:49 +01:00
Michael Natterer b001626b31 app: move overlay to operations/layer-modes/ and call it GimpOperationOverlay 2017-01-09 23:54:51 +01:00
Øyvind Kolås b6be1b768e app: duplicate difference mode, new and legacy 2017-01-09 23:49:08 +01:00
Øyvind Kolås 3a50cdcd4f app: split screen op in legacy and new 2017-01-09 23:19:29 +01:00
Øyvind Kolås 076621dd75 app: split dodge op in legacy and new 2017-01-09 20:10:17 +01:00
Øyvind Kolås c2583faa5a app: add new multiply op 2017-01-09 20:10:04 +01:00
Øyvind Kolås 735887286a app: do not let pixel encoding determine layer modes
See bug #757485 - woth noting that this also enables linear and thus correct
compositing when using 8bpc perceptual gamma as the layer storage format.
2017-01-09 20:09:50 +01:00
Michael Natterer 152adbb1bd Rename GIMP_LAYER_MODE_FOO_BROKEN to GIMP_LAYER_MODE_FOO_LEGACY
"Broken" sounds like it needs fixing, but it's legacy compat stuff
that will have to stay for all eternity.
2017-01-09 01:27:20 +01:00
Michael Natterer 66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
Øyvind Kolås 5627ad589f app: use gegl:dither instead of gegl:reduction 2016-12-24 19:40:12 +01:00
Michael Natterer 54dc424b31 app: better progress indication in gimp_babl_init_fishes() 2016-11-14 19:58:20 +01:00
Øyvind Kolås 3bc2d25ccd app: preinit more fishes commonly used for filters on u8 images 2016-11-11 13:55:05 +01:00
Michael Natterer 17ac37ef8e app: pass a status_callback to gimp_babl_init_fishes()
and make it report progress. Also call it at the end of initialization.
2016-11-11 13:09:12 +01:00
Michael Natterer 0788db4702 app: split babl fish creating to a separate function gimp_babl_init_fishes()
and call that function later in gimp_real_initialize() so the splash
is always fully drawn when it's called.
2016-11-11 01:06:14 +01:00
Øyvind Kolås 99b9a60e8b app: pre-initialize some babl fishes 2016-11-11 00:54:04 +01:00
Michael Natterer ab5a27d74a app: CLAMP(bits, 1, 16) in gimp_gegl_apply_color_reduction()
which is the range of the GEGL op's properties.
2016-11-09 12:33:13 +01:00
Michael Natterer c1ae0864de app: add gimp_babl_linear()
which completes gimp_babl_component_type() and gimp_babl_precision().
2016-11-09 12:02:12 +01:00
Alexis Wilhelm 768d06614f Bug 316479 - The Perspective Tool creates an empy image...
...instead of transforming it

Add gimp_matrix3_will_explode() which determines if a transform
matrix will blow up something in a rectangle to infinity, and use
the function so set both the GIMP and GEGL code paths to clip the
transform to the input size.
2016-11-08 17:26:21 +01:00
Øyvind Kolås e1db36360b gegl-apply-operation: s/dither-strategy/dither-method/ 2016-09-28 12:05:41 +02:00
Michael Natterer 23c3cf7249 app: add gimp_gegl_node_get_format()
which is a wrapper around gegl_operation_get_format().
2016-06-08 00:04:50 +02:00
Michael Natterer 56596da23a app: support premultiplied formats in some gimp_babl functions 2016-06-08 00:03:48 +02:00
Michael Natterer b4f34375b7 Bug 767062 - Lags when zooming or dragging zoomed image (cmsFLAGS_NOOPTIMIZE)
Use cmsFLAGS_NOOPTIMIZE only for actual image buffer or single color
transforms, but not for previews or the image display. Makes things a
lot more responsive again.
2016-06-05 16:50:02 +02:00
Michael Natterer ca349f88cd libgimpcolor: add gimp_color_transform_can_gegl_copy()
Which takes two profiles and returns TRUE if converting between
them works correctly without a GimpColorTransform. Use it in
gimp_color_transform_new() to return a NULL transform if none
is needed. Took the code from gimp-gegl-loops.c.
2016-05-26 23:14:57 +02:00
Michael Natterer 0bfa402c1a Argh, this was meant to be squashed into the previous commit... 2016-05-26 22:18:50 +02:00
Michael Natterer cc92887908 libgimpcolor: add new object GimpColorTransform
which encapsulates a cmsHTRANSFORM and does all the pixel format
conversion magic. It has API to create transforms and proofing
transforms, and to convert pixels arrays and GeglBuffers.

Before, each place which has a transform had to keep around the
transform and its input and output Babl formats, and had to implement
lots of stuff itself. Now all that lives in GimpColorTransform,
removing lots of logic from many places, and pretty much removing lcms
from the public API entirely.

This removes including <lcms2.h>, LCMS_LIBS and LCMS_CFLAGS from
almost all directories and potentially allows to replace lcms by
something else.
2016-05-26 22:15:54 +02:00
Massimo Valentini 9e96996138 Bug 764608: Smudge tool clips out of gamut channel values...
on layers with alpha channels
2016-05-23 18:45:49 +02:00
Michael Natterer 265dfec525 app: split GimpApplicator's opacity and mode API into two functions
Added gimp_applicator_set_opacity() and remove the opacity argument
from set_mode().
2016-05-18 01:51:09 +02:00
Massimo Valentini 2dd4d3a2fa Bug 766369: Split view shows transparency filtering...
... layers with alpha channel

add an operation that selectively outputs aux
or source if out/inside the rectangle (x,y,width,height),
independently of the alpha channel and use it
in filters split preview.

mostly copied from gimp:mask-components
2016-05-16 18:08:48 +02:00
Michael Natterer cea4ea6cff app: require a text in gimp_gegl_progress_connect()
and simplify and fix the progress callback.
2016-05-11 22:50:33 +02:00
Massimo Valentini 85cb525c7e Bug 766128: Use gegl_operation_progress
instead of reimplementing it in two operations
2016-05-11 19:09:56 +02:00
Ell 45efe6c405 app: Modify gimp_gegl_apply_border() to take a style parameter
instead of the feather parameter.

The BORDER_STYLE_HARD and BORDER_STYLE_FEATHERED styles are implemented
using the "gimp:border" operation, as was done previously.  The
BORDER_STYLE_SMOOTH style is implemented by performing a "gimp:grow" and
a "gimp:shrink", and subtracting the shrunk image from the grown image
using "gegl:substract".

gimp_channel_border() is modified to pass either BORDER_STYLE_HARD or
BORDER_STYLE_FEATHER, depending on its feather parameter, to maintain
the current behavior.  The next commit replaces it with a style
parameter as well.

Mass parameter alignment changes to gimp-gegl-apply-operation.h.  Sigh...
2016-05-08 19:22:24 +00:00
Michael Natterer b5f5a1cd28 app: add gimp_gegl_config_connect_node()
which connects the properties of a config GObject and a GeglNode, much
like g_object_bind_property() which we can't be used because GeglNode
properties can't be registered with the GObjectClass.
2016-04-16 03:02:05 +01:00
Michael Natterer 3fd6435198 app: add gimp_babl_format_get_color_profile()
and remove the code duplication added a few commits before.
2016-04-15 23:02:19 +01:00
Michael Natterer 5f8b6ce8da app: s/gimp_babl_get_description/gimp_babl_format_get_description/ 2016-04-15 19:19:09 +01:00
Michael Natterer f34aa5fa6b Bug 756389 - Color-managing grayscale images
Rename profile constructors to say "d65_gray" instead of just "gray",
"srgb_trc" instead of "srgb_gamma", and drop the "srgb" from
"srgb_linear" because we now say "d65". This should be a naming scheme
that doesn't conflict with whatever future functions we might add.
2016-04-09 18:47:51 +02:00
Michael Natterer 47ef3be145 Initialize GValues with G_VALUE_INIT instead of { 0, } 2016-03-26 15:59:26 +01:00
Michael Natterer 1b71731cb8 app: clean up the GEGL progress code a bit
Includes code from Massimo from bug #763135.
2016-03-23 22:53:09 +01:00
Michael Natterer 1051082189 app: use gimp_gegl_config_register() in gimp_gegl_config_new()
instead of manually interting the new type into the table.
2016-03-19 21:08:29 +01:00
Michael Natterer a0b18c7929 app: make GimpApplicator's preview feature optional
Don't add the preview nodes if use_preview_cache is FALSE in
gimp_applicator_new().
2016-02-16 21:36:35 +01:00
Michael Natterer e3144ecc4c app: add support for a "preview rectangle" to GimpApplicator
When set, it crops the effect to that rectangle, using a cache for
quickly changing the previewed area. When disabling the preview rect,
make sure we don't lose the cached result by processing it into the
output cache through the mode and affect nodes which is cheap-ish.
2016-02-16 21:36:21 +01:00
Massimo Valentini b9ba90589a Bug 678085 - Cage tool freezes GIMP
Use a proper "progress" signal instead of a property "notify" one
to update the on-canvas progress widget.

This way the graph is not invalidated while processing it
2016-02-02 12:21:15 +01:00
Ell c63bee3440 app: Add "gimp:flood" GEGL operation
This operation assigns to each pixel the minimum of the
maxima of all paths from it to the outside, as if the
input image represents a height map, and the operation
floods it with water.
2016-01-25 22:58:24 +01:00
Michael Natterer b72d73377a app: change the include guards of gegl/gimp-gegl-config.h
They can't be the same as in config/gimpgeglconfig.h.
2016-01-22 21:28:33 +01:00
Michael Natterer 1ef06fdbb2 app: add gimp_gegl_config_register()
which registers config classes for operations that don't want their
config objects to be auto-generated. Register all color tools' config
objects. Change gimp_gegl_config_sync_node() to correctly handle ops
that have an object property of the right config object type.
2016-01-22 21:28:33 +01:00
Michael Natterer 39cc3eccd5 app: rename gimp-gegl-config-proxy.[ch] to gimp-gegl-config.[ch]
and rename its functions to make more sense.
2016-01-20 12:18:35 +01:00
Michael Natterer d21ab943c1 app: make gimp_gegl_get_config_proxy() work without a passed icon_name
Keeps the GEGL tool from crashing.
2016-01-17 16:10:19 +01:00
Michael Natterer 6541c6b80b app: add icons to the generated gimp-gegl-config-proxy classes 2016-01-16 22:01:07 +01:00
Thomas Manni ca189b7a90 Bug 758769 - Smudge tool not working correctly...
...with alpha layers creates black edges

Fix the missing division in the pixels blending formula
2015-12-27 20:34:50 +01:00
Michael Natterer a33daf99fe libgimpcolor: rename RGB and GRAY gimp_color_profile_new_*() functions
to be more consistent, as discussed in bug #756389.
2015-12-15 20:42:21 +01:00
Michael Natterer 5098338470 Bug 756389 - Color-managing grayscale images
Allow to set profiles on grayscale images. Change profile validation
to check for image type and profile type. Actually the patch simply
makes some pieces of code less restrictive. Change user-visible
strings in the profile dialogs accordingly. Change PDB docs
accordingly.
2015-12-14 23:25:02 +01:00
Michael Natterer 69abd4d972 app: add progress handling to gimp_gegl_convert_color_profile,transform() 2015-10-19 01:29:22 +02:00