1. 19 Nov, 2018 2 commits
    • Ell's avatar
      app: add gimp_pickable_contiguous_region_prepare_line_art_async() ... · b4e12fbb
      Ell authored
      ... and use in bucket-fill tool
      
      Add gimp_pickable_contiguous_region_prepare_line_art_async(), which
      computes a line-art asynchronously, and use it in the bucket-fill
      tool, instead of having the tool create the async op.
      
      This allows the async to keep running even after the pickable dies,
      since we only need the pickable's buffer, and not the pickable
      itself.  Previously, we reffed the pickable for the duration of the
      async, but we could still segfault when unreffing it, if the
      pickable was a drawable, and its parent image had already died.
      
      Furthermore, let the async work on a copy of the pickable's buffer,
      rather than the pickable's buffer directly.  This avoids some race
      conditions when the pickable is the image (i.e., when "sample
      merged" is active), since then we're using image projection's
      buffer, which is generally unsafe to use in different threads
      concurrently.
      
      Also, s/! has_alpha/has_alpha/ when looking for transparent pixels,
      and quit early, at least during this stage, if the async in
      canceled.
      b4e12fbb
    • Jehan's avatar
      app: remove now useless erosion size option. · 3f58a385
      Jehan authored
      Since commit b00037b8, erosion size is not used anymore, as this step
      has been removed, and the end point detection now uses local thickness
      of strokes instead.
      3f58a385
  2. 15 Nov, 2018 1 commit
  3. 14 Nov, 2018 9 commits
    • Jehan's avatar
      app: edit the bucket fill tool options with new line art options. · 824af124
      Jehan authored
      I have not added all the options for this new tool yet, but this sets
      the base. I also added a bit of TODO for several places where we need to
      make it settable, in particular the fuzzy select tool, but also simply
      PDB calls (this will need to be a PDB context settings.
      
      Maybe also I will want to make some LineArtOptions struct in order not
      to have infinite list of parameters to functions. And at some point, it
      may also be worth splitting a bit process with other type of
      selection/fill (since they barely share any settings anyway).
      
      Finally I take the opportunity to document a little more the parameters
      to gimp_lineart_close(), which can still be improved later (I should
      have documented these straight away when I re-implemented this all from
      G'Mic code, as I am a bit fuzzy on some details now and will need to
      re-understand code).
      824af124
    • Jehan's avatar
      app: bucket fill tool with a "paint-style" interaction. · e1c40506
      Jehan authored
      Rather than just having a click interaction, let's allow to "paint" with
      the bucket fill. This is very useful for the new "line art" colorization
      since it tends to over-segment the drawing. Therefore being able to
      stroke through the canvas (rather than click, up, move, click, etc.)
      makes the process much simpler. This is also faster since we don't have
      to recompute the line art while a filling is in-progress.
      Note that this new behavior is not only for the line art mode, but also
      any other fill criterion, for which it can also be useful.
      
      Last change of behavior as a side effect: it is possible to cancel the
      tool changes the usual GIMP way (for instance by right clicking when
      releasing the mouse button).
      e1c40506
    • Jehan's avatar
      app: compute line art in advance. · f246f404
      Jehan authored
      Right now, this is mostly meaningless as it is still done sequentially.
      But I am mostly preparing the field to pre-compute the line art as
      background thread.
      f246f404
    • Jehan's avatar
      app: directly update the mask buffer with gegl_node_blit_buffer(). · f02993fb
      Jehan authored
      No need to create a temporary buffer for this.
      f02993fb
    • Jehan's avatar
      app: create a simple priority map for line art selection flooding. · 410c7475
      Jehan authored
      We actually don't need to compute distance map. I just make the simplest
      priority map, with 1 any line art pixel and 0 any other pixel (in mask
      or not), lowest priority being propagated first.
      And let the flooding begin!
      410c7475
    • Jehan's avatar
      app: with recent gegl:watershed-transform, no need for intermediate... · e905ea7b
      Jehan authored
      ... labels buffer.
      We can watershed directly the mask buffer being correctly flagged.
      This commit relies on merge request gegl!8 being accepted and merged.
      e905ea7b
    • Jehan's avatar
      fcd038eb
    • Jehan's avatar
      app: implement second step for line art selection/filling. · 8502b4e7
      Jehan authored
      When filling colors in line arts, you don't want to leave space between
      the strokes and the color, which usually happen with any of the current
      selection methods.
      A "KISS" trick is usually to grow your selection a few pixels before
      filling (adding an additional step in colorization process), which
      obviously does not handle all cases (depending on drawing style and
      stroke size, you may need to grow more or less) as it doesn't take into
      account actual stroke geometry.
      
      Instead, I label the selection and the "rest" differently and leave the
      pixel strokes unlabelled. Then I let these unlabelled pixels be flooded
      by the "gegl:watershed-transform" operation.
      Note that this second step is different from the second step from the
      GREYC research paper, as they use their own watershed algorithm taking
      color spots as sources to color the whole image at once. This is a
      different workflow from the one using bucket fill with a single color
      source.
      8502b4e7
    • Jehan's avatar
      app, libgimpbase: add GIMP_SELECT_CRITERION_LINE_ART selection type. · 8ed12b1b
      Jehan authored
      This commit implements part of the research paper "A Fast and Efficient
      Semi-guided Algorithm for Flat Coloring Line-arts" from the GREYC (the
      people from G'Mic). It is meant to select regions from drawn sketchs in
      a "smart" way, in particular it tries to close non-perfectly closed
      regions, which is a common headache for digital painters and colorists.
      
      The implementation is not finished as it needs some watersheding as well
      so that the selected area does not leave "holes" near stroke borders.
      The research paper proposes a new watersheding algorithm, but I may not
      have to implement it, as it is more focused on automatic colorization
      with prepared spots (instead of bucket fill-type interaction).
      
      This will be used in particular with the fuzzy select and bucket fill
      tools.
      
      Note that this first version is a bit slow once we get to big images,
      but I hope to be able to optimize this.
      Also no options from the algorithm are made available in the GUI yet.
      8ed12b1b
  4. 10 Sep, 2018 1 commit
  5. 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
  6. 11 Jul, 2018 1 commit
  7. 14 May, 2018 1 commit
    • Ell's avatar
      app: don't use mask sampler in gimp_pickable_contiguous_region_by_seed() · 03141fc3
      Ell authored
      In gimp_pickable_contiguous_region_by_seed(), use gegl_buffer_get()
      to sample the mask buffer, instead of using a sampler.  The sampler
      is created at the beginning of the operation, and is subsequently
      used after modifying the mask buffer, which should be avoided,
      since the sampler may return outdated cached data.
      03141fc3
  8. 13 May, 2018 1 commit
  9. 08 Apr, 2018 1 commit
  10. 11 May, 2017 1 commit
  11. 09 May, 2017 1 commit
  12. 22 Sep, 2016 1 commit
  13. 15 Sep, 2016 1 commit
  14. 16 Jan, 2016 1 commit
    • Ell's avatar
      app: Add diagonal_neighbors parameter to... · 93bf78b8
      Ell authored
      ...gimp_pickable_contiguous_region_by_seed(), in preperation
      for adding a similar option to the relevant tools.
      
      When this parameter is TRUE, all eight neighbors of each pixel
      are considered when calculating the resulting region, instead
      of just the four orthogonal ones.
      
      This commit also modifies all callers to pass FALSE for this
      parameter, to retain the current behavior.
      93bf78b8
  15. 22 Oct, 2015 1 commit
  16. 27 Aug, 2014 1 commit
  17. 02 Jul, 2014 1 commit
  18. 17 Jun, 2014 1 commit
  19. 12 Jun, 2014 2 commits
  20. 31 May, 2014 1 commit
  21. 13 Sep, 2013 2 commits
  22. 23 Jun, 2013 1 commit
    • Michael Natterer's avatar
      Add support for both gamma-corrected and linear for all bit depths · caf73f5f
      Michael Natterer authored
      - Add new enum GimpComponentType which contains u8, u16, u32 etc.
      - Change GimpPrecision to be u8-linear, u8-gamma, u16-linear etc.
      - Add all the needed formats to gimp-babl.c
      - Bump the XCF version to 5 and make sure version 4 with the old
        GimpPrecision enum values is loaded correctly
      
      This change blows up the precision enums in "New Image" and
      Image->Precision so we can test all this stuff. It is undecided what
      format will be user-visible options in 2.10.
      caf73f5f
  23. 08 Apr, 2013 5 commits
  24. 07 Apr, 2013 2 commits