2014-05-31 15:52:44 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2014-05-31 15:52:44 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GIMP_PICKABLE_CONTIGUOUS_REGION_H__
|
|
|
|
#define __GIMP_PICKABLE_CONTIGUOUS_REGION_H__
|
|
|
|
|
|
|
|
|
app: add gimp_pickable_contiguous_region_prepare_line_art_async() ...
... 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.
2018-11-20 03:48:26 +08:00
|
|
|
GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
|
|
|
gboolean antialias,
|
|
|
|
gfloat threshold,
|
|
|
|
gboolean select_transparent,
|
|
|
|
GimpSelectCriterion select_criterion,
|
|
|
|
gboolean diagonal_neighbors,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
|
|
|
|
|
|
|
GeglBuffer * gimp_pickable_contiguous_region_by_color (GimpPickable *pickable,
|
|
|
|
gboolean antialias,
|
|
|
|
gfloat threshold,
|
|
|
|
gboolean select_transparent,
|
|
|
|
GimpSelectCriterion select_criterion,
|
|
|
|
const GimpRGB *color);
|
2014-05-31 15:52:44 +08:00
|
|
|
|
app: do not make line art bucket fill a GimpSelectCriterion anymore.
This was my initial choice, but the more I think about it, the less I am
sure this was the right choice. There was some common code (as I was
making a common composite bucket fill once the line art was generated),
but there is also a lot of different code and the functions were filled
of exception when we were doing a line art fill. Also though there is a
bit of color works (the way we decide whether a pixel is part of a
stroke or not, though currently this is basic grayscale threshold), this
is really not the same as other criterions. In particular this was made
obvious on the Select by Color tool where the line art criterion was
completely meaningless and would have had to be opted-out!
This commit split a bit the code. Instead of finding the line art in the
criterion list, I add a third choice to the "Fill whole selection"/"Fill
similar colors" radio. In turn I create a new GimpBucketFillArea type
with the 3 choices, and remove line art value from GimpSelectCriterion.
I am not fully happy yet of this code, as it creates a bit of duplicate
code, and I would appreciate to move some code away from gimpdrawable-*
and gimppickable-* files. This may happen later. I break the work in
pieces to not get too messy.
Also this removes access to the smart colorization from the API, but
that's probably ok as I prefer to not freeze options too early in the
process since API needs to be stable. Probably we should get a concept
of experimental API.
2018-12-12 01:05:12 +08:00
|
|
|
GeglBuffer * gimp_pickable_contiguous_region_by_line_art (GimpPickable *pickable,
|
|
|
|
GimpLineArt *line_art,
|
|
|
|
gint x,
|
|
|
|
gint y);
|
2014-05-31 15:52:44 +08:00
|
|
|
|
|
|
|
#endif /* __GIMP_PICKABLE_CONTIGUOUS_REGION_H__ */
|