1. 04 Nov, 2018 1 commit
    • Ell's avatar
      app: don't let image component mask affect channel colors · 56920dcd
      Ell authored
      Connect GimpImage's gimp:mask-components node to the layers node
      *before* connecting the channels node, so that the image's
      component mask doesn't affect the channel colors, as is the case in
      2.8.
      56920dcd
  2. 07 Oct, 2018 1 commit
    • Michael Natterer's avatar
      app: remove the image's "Enable Color Management" toggle · c399b894
      Michael Natterer authored
      It was not doing anything right since space invasion. We now treat the
      built-in sRGB profile like any other profile and never bypass
      conversions based on some weird toggle.
      
      Instead, introduce a "Use sRGB Profile" toggle which, when enabled,
      hides whatever profile away so the image actually uses the built-in
      sRGB profile.
      
      This is different from discarding and then re-assigning the same
      profile only by being faster and more convenient.
      c399b894
  3. 29 Sep, 2018 1 commit
    • Ell's avatar
      Issue #2222 - Warp Transform doesn't commit changes upon saving ... · ae628a86
      Ell authored
      ... the XCF file
      
      Add a "saving" signal to GimpImage, which is emitted when the image
      is about to be saved or exported (but before it's actually saved/
      exported).  Connect to this signal in tool-manager, and commit the
      current tool in response (unless its GimpToolControl::preserve is
      TRUE).
      ae628a86
  4. 18 Sep, 2018 1 commit
    • Ell's avatar
      app, libgimp*, modules: don't use g_type_class_add_private() ... · 3b0040c0
      Ell authored
      ... and G_TYPE_INSTANCE_GET_PRIVATE()
      
      g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
      deprecated in GLib 2.58.  Instead, use
      G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
      G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
      foo_get_instance_private() functions, all of which are available in
      the GLib versions we depend on.
      
      This commit only covers types registered using one of the
      G_DEFINE_FOO() macros (i.e., most types), but not types with a
      custom registration function, of which we still have a few -- GLib
      currently only provides a (non-deprecated) public API for adding a
      private struct using the G_DEFINE_FOO() macros.
      
      Note that this commit was 99% auto-generated (because I'm not
      *that* crazy :), so if there are any style mismatches... we'll have
      to live with them for now.
      3b0040c0
  5. 11 Sep, 2018 1 commit
  6. 04 Aug, 2018 2 commits
    • Jehan's avatar
      Issue #1974: Memory leak in gimpimage.c. · 2912fe7c
      Jehan authored
      Ok my previous fix was wrong (at least for the part in the macro). This
      is a macro, not a function. So each time we write _reason, the call to
      g_strdup_printf() is reevaluated, hence data is allocated.
      The right fix is to prepend `tmp` to the list, not `_reason`.
      Thanks to Massimo for the debugging, as always!
      2912fe7c
    • Jehan's avatar
      Issue #1974: Memory leak in gimpimage.c. · 0ab682b0
      Jehan authored
      ADD_REASON macro was leaking the allocated string when version_reason
      return value was NULL (i.e. when we didn't care about the version
      reasons).
      
      Also we were not properly freeing all the reason strings at the end,
      only the list. Use g_list_free_full() instead of g_list_free().
      0ab682b0
  7. 21 Jul, 2018 1 commit
    • Michael Natterer's avatar
      Initial space invasion commit in GIMP · e09e563a
      Michael Natterer authored
      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.
      e09e563a
  8. 15 Jul, 2018 1 commit
  9. 11 Jul, 2018 1 commit
  10. 06 Jul, 2018 2 commits
    • Ell's avatar
      Issue #1792 - Xcf file crashing gimp-console-2.10 ... · a0a62656
      Ell authored
      ... (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().
      a0a62656
    • Ell's avatar
      Issue #1783 - Xcf file crashing gimp-console-2.10 ... · f384a071
      Ell authored
      ... (Invalid read reported by valgrind)
      
      In gimp_image_parasite_validate(), don't segfault when validating
      a "gimp-comment" parasite of size 0 (i.e., whose data is a 0-byte
      array, not an empty string), and just consider it invalid.
      f384a071
  11. 01 Jul, 2018 1 commit
    • Ell's avatar
      app: add config option to enable/disable layer-group previews · 30cc85fd
      Ell authored
      Preview generation for layer groups is more expensive than for
      other types of drawables, mostly since we can't currently generate
      layer-group previews asynchronously.  Add a preferences option for
      enabling layer-group previews separately from the rest of the
      layer/channel previews; both of these options are enabled by
      default.  This can be desirable regardless of performance
      considerations, since it makes layer groups easily distinguishable
      from ordinary layers.
      30cc85fd
  12. 06 Jun, 2018 1 commit
    • Michael Natterer's avatar
      Issue #1291 - Non-intrusive warning when saved XCF version... · a4061a6b
      Michael Natterer authored
      ...won't work with older GIMP?
      
      Make gimp_image_get_xcf_version() return a "reason" string which lists
      all reasons why the image can't be saved with compatibility for older
      GIMP versions. Display the reason as tooltip on the compat hint label
      in the save dialog.
      a4061a6b
  13. 01 Jun, 2018 1 commit
  14. 18 May, 2018 1 commit
    • Ell's avatar
      app: implement GimpPickable::get_pixel_average() in various classes · 25490b02
      Ell authored
      Implement GimpPickable::get_pixel_average(), added in the previous
      commit, in GimpDrawable, GimpImage, and GimpProjection, using
      gimp_gegl_average_color(), added in the commit before last.  This
      is significantly faster than the default implementation.
      25490b02
  15. 02 May, 2018 1 commit
  16. 25 Apr, 2018 1 commit
  17. 22 Apr, 2018 1 commit
    • Ell's avatar
      app: fix undo when moving a group-layer child outside the group · 577e1703
      Ell authored
      In gimp_image_reorder_item(), call gimp_item_start/end_move()
      before/after reordering the item (and use an undo group, so that
      the resulting undo actions are grouped together with the reordering
      undo action,) so that if the item is a child of a group layer, and
      reordering moves it out of the group in a way that causes the
      group's mask to be resized, the mask will be properly restored when
      undoing the operation.
      577e1703
  18. 08 Apr, 2018 1 commit
    • Michael Natterer's avatar
      Bug 791519 - Unexpected selection from channel · bb4ac7c8
      Michael Natterer authored
      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.
      bb4ac7c8
  19. 11 Feb, 2018 1 commit
  20. 05 Feb, 2018 2 commits
    • Ell's avatar
      17fb6447
    • Ell's avatar
      app: add gimp_item_{start,end}_move() · 02a20c6c
      Ell authored
      Add gimp_item_{start,end}_move(), and corresponding
      GimpItem::{start,end}_move() virtual functions, which should be
      called before/after "moving" the item (i.e., translating, scaling,
      resizing, flipping, rotating, or transforming the item).  Moves
      performed between the outermost pair of start/end calls are treated
      atomically.
      
      What exactly does "treated atomically" entail depends on the
      subclasses -- GimpItem doesn't provide a default implementation for
      these functions, so the current commit doesn't change any behavior.
      The next commit, which adds layer-mask support for group layers,
      uses the functions to avoid cropping the mask too early while a
      child is moving.
      
      GimpItem calls {start,end}_move() in the various "move" functions
      (gimp_item_{translate,scale,...}(), before performing the actual
      operation.  Additionally we call the functions in the
      gimp_image_item_list_foo() functions, for each participating item,
      so that the items are moved as a unit.  We call the functions in
      the various gimp_image_remove_foo() functions, since removing an
      item may affect the size of its ancestors, and is therefore akin to
      moving.  We also call the functions in GimpEditSelectionTool, so
      that the move tool moves items atomically while dragging.
      02a20c6c
  21. 23 Jan, 2018 1 commit
  22. 22 Jan, 2018 2 commits
    • Jehan's avatar
      app: all remaining g_assert() replaced by critical warning and return... · 4c2df9b3
      Jehan authored
      ... in app/core.
      Continuing on my crusade against asserting and crashing GIMP.
      4c2df9b3
    • Jehan's avatar
      app: we should not have any g_assert*() code if possible. · f87bc3fe
      Jehan authored
      Replace all g_assert_not_reached() in app/core/ by g_return_if_reached()
      or g_return_val_if_reached(). GIMP may handle a lot of creative work,
      sometimes unsaved for hours. We should not just crash on purpose.
      g_assert*() could theoretically be turned off on a glib build, but this
      is nearly never done, and is not a solution either (actually it is
      probably even worse because the broken code would just continue on a
      forbidden path). It is much better to return with a warning on such
      forbidden code paths, allowing someone to report a bug without
      experiencing a crash and data loss.
      
      For now, I only took care of g_assert_not_reached() inside app/core.
      More g_assert*() code should be replaced.
      Note: assert are acceptable in plug-ins though, but not in the main
      executable, unless absolutely necessary (something happening so bad that
      crash is better than continuing).
      f87bc3fe
  23. 19 Nov, 2017 1 commit
  24. 01 Oct, 2017 1 commit
  25. 21 Aug, 2017 1 commit
    • Michael Natterer's avatar
      Move the new "default_new_layer_mode" APIs to the image... · e16c8a23
      Michael Natterer authored
      ...in both the core and libgimp.
      
      Images now know what the default mode for new layers is:
      
      - NORMAL for empty images
      - NORMAL for images with any non-legacy layer
      - NORMAL_LEGAVY for images with only legacy layers
      
      This changes behavior when layers are created from the UI, but *also*
      when created by plug-ins (yes there is a compat issue here):
      
      - Most (all?) single-layer file importers now create NORMAL layers
      - Screenshot, Webpage etc also create NORMAL layers
      
      Scripts that create images from scratch (logos etc) should not be
      affected because they usually have NORMAL_LEGACY hardcoded.
      
      3rd party plug-ins and scripts will also behave old-style unless they
      get ported to gimp_image_get_default_new_layer_mode().
      e16c8a23
  26. 08 Aug, 2017 1 commit
    • Ell's avatar
      app: add pass-through layer mode · 440d8d68
      Ell authored
      Only add the enum-value/mode-info for now.  Pass-through mode
      appears above normal mode, in the default group, for layer groups
      only.
      440d8d68
  27. 15 Jul, 2017 1 commit
  28. 11 May, 2017 1 commit
    • Ell's avatar
      app: add GimpLayerStack · 07ac78ef
      Ell authored
      A subclass of GimpDrawableStack, for layer stacks.  Invalidates the
      layers' backdrop as/when necessary, according to the value of their
      excludes_backdrop property.
      
      Make gimp_drawable_stack_update() protected, instead of private, so
      that we can use it in GimpLayerStack.
      07ac78ef
  29. 23 Mar, 2017 2 commits
    • Michael Natterer's avatar
      app: change the "XCF compat" stuff to "XCF compression" · a0521a52
      Michael Natterer authored
      Both in the GimpImage API and in the GUI. The toggle in the save
      dialog now controls ZLIB compression directly. Changed the various
      info labels accordingly. Ditch the XCF parasite that saved the XCF
      compat mode.
      a0521a52
    • Michael Natterer's avatar
      Bug 731390 - XCF files have a max size of 4G · dd47e7bc
      Michael Natterer authored
      Enable 64 bit file offsets in XCF files, starting with newly added XCF
      version 11.
      
      We use at least version 11 if:
      
      - we would use the previous version 10 (essentially skipping 10)
      - the in-memory size of the image is larger than 4 Gig
      dd47e7bc
  30. 16 Mar, 2017 1 commit
  31. 15 Mar, 2017 2 commits
    • Ell's avatar
      app: rename "Color (HSV)" mode to "Color (HSL)" · 661c22c0
      Ell authored
      ... since that's the color space it actually works in.
      
      Keep the legacy "Color (HSV)" mode's name as is, wrong as it is,
      since, well, that's what it used to be called...
      661c22c0
    • Ell's avatar
      app: remove mono-mix layer mode · 3fa2c915
      Ell authored
      This effectively reverts commit c6c08996.
      
      Removing due to lack of consensus.  We can always re-add it in the
      future if we decide we want it.
      3fa2c915
  32. 10 Mar, 2017 3 commits
    • Ell's avatar
      app: add split layer mode · ed0fda03
      Ell authored
      Subtracts the source layer from the destination, such that
      recompositing the result with the source using merge mode
      reproduces the original content.
      ed0fda03
    • Ell's avatar
      app: add merge layer mode · 23e6984d
      Ell authored
      Merge mode lays the source layer on top of the destination, same as
      normal mode, however, it assumes the source and destination are two
      parts of an original whole, and are therefore mutually exclusive.
      
      This is useful for blending cut & pasted content without artifacts,
      or for replacing erased content in general.
      23e6984d
    • Ell's avatar
      app: add mono-mix layer mode · c6c08996
      Ell authored
      Calculates the dot product of the two input colors, and uses that
      as the value for all the output color's components.  Basically,
      a per-pixel mono mixer.
      
      Useful for custom desaturation, component extraction, and crazier
      stuff (bump mapping!)
      c6c08996