app: edit the bucket fill tool options with new line art options.
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).
This commit is contained in:
@ -522,6 +522,7 @@ gimp_channel_select_fuzzy (GimpChannel *channel,
|
|||||||
select_transparent,
|
select_transparent,
|
||||||
select_criterion,
|
select_criterion,
|
||||||
diagonal_neighbors,
|
diagonal_neighbors,
|
||||||
|
0.92, -1, /* TODO */
|
||||||
x, y);
|
x, y);
|
||||||
|
|
||||||
if (! sample_merged)
|
if (! sample_merged)
|
||||||
|
@ -56,6 +56,8 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
|
|||||||
gdouble threshold,
|
gdouble threshold,
|
||||||
gboolean sample_merged,
|
gboolean sample_merged,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gdouble seed_x,
|
gdouble seed_x,
|
||||||
gdouble seed_y)
|
gdouble seed_y)
|
||||||
{
|
{
|
||||||
@ -75,6 +77,7 @@ gimp_drawable_bucket_fill (GimpDrawable *drawable,
|
|||||||
fill_transparent, fill_criterion,
|
fill_transparent, fill_criterion,
|
||||||
threshold, sample_merged,
|
threshold, sample_merged,
|
||||||
diagonal_neighbors,
|
diagonal_neighbors,
|
||||||
|
stroke_threshold, erosion,
|
||||||
seed_x, seed_y, NULL,
|
seed_x, seed_y, NULL,
|
||||||
&mask_x, &mask_y, &width, &height);
|
&mask_x, &mask_y, &width, &height);
|
||||||
|
|
||||||
@ -138,6 +141,8 @@ gimp_drawable_get_bucket_fill_buffer (GimpDrawable *drawable,
|
|||||||
gdouble threshold,
|
gdouble threshold,
|
||||||
gboolean sample_merged,
|
gboolean sample_merged,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gdouble seed_x,
|
gdouble seed_x,
|
||||||
gdouble seed_y,
|
gdouble seed_y,
|
||||||
GeglBuffer **mask_buffer,
|
GeglBuffer **mask_buffer,
|
||||||
@ -199,6 +204,8 @@ gimp_drawable_get_bucket_fill_buffer (GimpDrawable *drawable,
|
|||||||
fill_transparent,
|
fill_transparent,
|
||||||
fill_criterion,
|
fill_criterion,
|
||||||
diagonal_neighbors,
|
diagonal_neighbors,
|
||||||
|
stroke_threshold,
|
||||||
|
erosion,
|
||||||
(gint) seed_x,
|
(gint) seed_x,
|
||||||
(gint) seed_y);
|
(gint) seed_y);
|
||||||
if (mask_buffer && *mask_buffer)
|
if (mask_buffer && *mask_buffer)
|
||||||
|
@ -27,6 +27,8 @@ void gimp_drawable_bucket_fill (GimpDrawable *drawabl
|
|||||||
gdouble threshold,
|
gdouble threshold,
|
||||||
gboolean sample_merged,
|
gboolean sample_merged,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y);
|
gdouble y);
|
||||||
GeglBuffer * gimp_drawable_get_bucket_fill_buffer (GimpDrawable *drawable,
|
GeglBuffer * gimp_drawable_get_bucket_fill_buffer (GimpDrawable *drawable,
|
||||||
@ -37,6 +39,8 @@ GeglBuffer * gimp_drawable_get_bucket_fill_buffer (GimpDrawable *drawabl
|
|||||||
gdouble threshold,
|
gdouble threshold,
|
||||||
gboolean sample_merged,
|
gboolean sample_merged,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gdouble seed_x,
|
gdouble seed_x,
|
||||||
gdouble seed_y,
|
gdouble seed_y,
|
||||||
GeglBuffer **mask_buffer,
|
GeglBuffer **mask_buffer,
|
||||||
|
@ -169,24 +169,34 @@ static void gimp_edgelset_next8 (const GeglBuffer *buffer,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_lineart_close:
|
* gimp_lineart_close:
|
||||||
* @line_art: the input #GeglBuffer
|
* @line_art: the input #GeglBuffer.
|
||||||
* @select_transparent: whether we binarize the alpha channel or the
|
* @select_transparent: whether we binarize the alpha channel or the
|
||||||
* luminosity.
|
* luminosity.
|
||||||
* @stroke_threshold: [0-1] threshold value for detecting stroke pixels
|
* @stroke_threshold: [0-1] threshold value for detecting stroke pixels
|
||||||
* (higher values will detect more stroke pixels).
|
* (higher values will detect more stroke pixels).
|
||||||
* @erosion:
|
* @erosion: size (in pixels) of the rectangular structure used to erode
|
||||||
* @minimal_lineart_area:
|
* the stroke pixels. 0 means no erosion will be done, and a
|
||||||
|
* negative value will compute a median approximation of the
|
||||||
|
* stroke width, for base of erosion.
|
||||||
|
* @minimal_lineart_area: the minimum size in number pixels for area to
|
||||||
|
* be considered as line art.
|
||||||
* @normal_estimate_mask_size:
|
* @normal_estimate_mask_size:
|
||||||
* @end_point_rate: [0-1] range value.
|
* @end_point_rate: threshold to estimate if a curvature is an end-point
|
||||||
* @spline_max_length:
|
* in [0-1] range value.
|
||||||
* @spline_max_angle:
|
* @spline_max_length: the maximum length for creating splines between
|
||||||
|
* end points.
|
||||||
|
* @spline_max_angle: the maximum angle between end point normals for
|
||||||
|
* creating splines between them.
|
||||||
* @end_point_connectivity:
|
* @end_point_connectivity:
|
||||||
* @spline_roundness:
|
* @spline_roundness:
|
||||||
* @allow_self_intersections:
|
* @allow_self_intersections: whether to allow created splines and
|
||||||
|
* segments to intersect.
|
||||||
* @created_regions_significant_area:
|
* @created_regions_significant_area:
|
||||||
* @created_regions_minimum_area:
|
* @created_regions_minimum_area:
|
||||||
* @small_segments_from_spline_sources:
|
* @small_segments_from_spline_sources:
|
||||||
* @segments_max_length:
|
* @segments_max_length: the maximum length for creating segments
|
||||||
|
* between end points. Unlike splines, segments
|
||||||
|
* are straight lines.
|
||||||
*
|
*
|
||||||
* Creates a binarized version of the strokes of @line_art, detected either
|
* Creates a binarized version of the strokes of @line_art, detected either
|
||||||
* with luminosity (light means background) or alpha values depending on
|
* with luminosity (light means background) or alpha values depending on
|
||||||
@ -299,7 +309,7 @@ gimp_lineart_close (GeglBuffer *line_art,
|
|||||||
{
|
{
|
||||||
gimp_lineart_erode (strokes, erosion);
|
gimp_lineart_erode (strokes, erosion);
|
||||||
}
|
}
|
||||||
else if (erosion == -1)
|
else if (erosion < 0)
|
||||||
{
|
{
|
||||||
const gfloat stroke_width = gimp_lineart_estimate_stroke_width (strokes);
|
const gfloat stroke_width = gimp_lineart_estimate_stroke_width (strokes);
|
||||||
const gint erode_size = (gint) roundf (stroke_width / 5);
|
const gint erode_size = (gint) roundf (stroke_width / 5);
|
||||||
|
@ -101,7 +101,9 @@ static void find_contiguous_region (GeglBuffer *src_buffer,
|
|||||||
|
|
||||||
GeglBuffer *
|
GeglBuffer *
|
||||||
gimp_pickable_contiguous_region_prepare_line_art (GimpPickable *pickable,
|
gimp_pickable_contiguous_region_prepare_line_art (GimpPickable *pickable,
|
||||||
gboolean select_transparent)
|
gboolean select_transparent,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion)
|
||||||
{
|
{
|
||||||
GeglBuffer *lineart;
|
GeglBuffer *lineart;
|
||||||
gboolean has_alpha;
|
gboolean has_alpha;
|
||||||
@ -159,10 +161,8 @@ gimp_pickable_contiguous_region_prepare_line_art (GimpPickable *pickable,
|
|||||||
|
|
||||||
lineart = gimp_lineart_close (lineart,
|
lineart = gimp_lineart_close (lineart,
|
||||||
select_transparent,
|
select_transparent,
|
||||||
/*contour_detection_level,*/
|
stroke_threshold,
|
||||||
0.92,
|
erosion,
|
||||||
/* erosion, */
|
|
||||||
-1,
|
|
||||||
/*minimal_lineart_area,*/
|
/*minimal_lineart_area,*/
|
||||||
5,
|
5,
|
||||||
/*normal_estimate_mask_size,*/
|
/*normal_estimate_mask_size,*/
|
||||||
@ -201,6 +201,8 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
|||||||
gboolean select_transparent,
|
gboolean select_transparent,
|
||||||
GimpSelectCriterion select_criterion,
|
GimpSelectCriterion select_criterion,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gint x,
|
gint x,
|
||||||
gint y)
|
gint y)
|
||||||
{
|
{
|
||||||
@ -225,7 +227,8 @@ gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
|||||||
* but it may not be always possible (for instance when
|
* but it may not be always possible (for instance when
|
||||||
* selecting/filling through a PDB call).
|
* selecting/filling through a PDB call).
|
||||||
*/
|
*/
|
||||||
line_art = gimp_pickable_contiguous_region_prepare_line_art (pickable, select_transparent);
|
line_art = gimp_pickable_contiguous_region_prepare_line_art (pickable, select_transparent,
|
||||||
|
stroke_threshold, erosion);
|
||||||
free_line_art = TRUE;
|
free_line_art = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@
|
|||||||
|
|
||||||
|
|
||||||
GeglBuffer * gimp_pickable_contiguous_region_prepare_line_art (GimpPickable *pickable,
|
GeglBuffer * gimp_pickable_contiguous_region_prepare_line_art (GimpPickable *pickable,
|
||||||
gboolean select_transparent);
|
gboolean select_transparent,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion);
|
||||||
GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable *pickable,
|
||||||
GeglBuffer *line_art,
|
GeglBuffer *line_art,
|
||||||
gboolean antialias,
|
gboolean antialias,
|
||||||
@ -28,6 +30,8 @@ GeglBuffer * gimp_pickable_contiguous_region_by_seed (GimpPickable
|
|||||||
gboolean select_transparent,
|
gboolean select_transparent,
|
||||||
GimpSelectCriterion select_criterion,
|
GimpSelectCriterion select_criterion,
|
||||||
gboolean diagonal_neighbors,
|
gboolean diagonal_neighbors,
|
||||||
|
gfloat stroke_threshold,
|
||||||
|
gint erosion,
|
||||||
gint x,
|
gint x,
|
||||||
gint y);
|
gint y);
|
||||||
|
|
||||||
|
@ -171,6 +171,7 @@ drawable_edit_bucket_fill_invoker (GimpProcedure *procedure,
|
|||||||
GIMP_PDB_CONTEXT (context)->sample_threshold,
|
GIMP_PDB_CONTEXT (context)->sample_threshold,
|
||||||
GIMP_PDB_CONTEXT (context)->sample_merged,
|
GIMP_PDB_CONTEXT (context)->sample_merged,
|
||||||
GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
|
GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
|
||||||
|
0.92, -1, /* TODO */
|
||||||
x, y);
|
x, y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -53,9 +53,20 @@ enum
|
|||||||
PROP_DIAGONAL_NEIGHBORS,
|
PROP_DIAGONAL_NEIGHBORS,
|
||||||
PROP_ANTIALIAS,
|
PROP_ANTIALIAS,
|
||||||
PROP_THRESHOLD,
|
PROP_THRESHOLD,
|
||||||
|
PROP_LINE_ART_THRESHOLD,
|
||||||
|
PROP_LINE_ART_EROSION,
|
||||||
PROP_FILL_CRITERION
|
PROP_FILL_CRITERION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _GimpBucketFillOptionsPrivate
|
||||||
|
{
|
||||||
|
GtkWidget *diagonal_neighbors_checkbox;
|
||||||
|
GtkWidget *antialias_checkbox;
|
||||||
|
GtkWidget *threshold_scale;
|
||||||
|
|
||||||
|
GtkWidget *line_art_threshold_scale;
|
||||||
|
GtkWidget *line_art_erosion_scale;
|
||||||
|
};
|
||||||
|
|
||||||
static void gimp_bucket_fill_options_config_iface_init (GimpConfigInterface *config_iface);
|
static void gimp_bucket_fill_options_config_iface_init (GimpConfigInterface *config_iface);
|
||||||
|
|
||||||
@ -69,10 +80,12 @@ static void gimp_bucket_fill_options_get_property (GObject *object,
|
|||||||
GParamSpec *pspec);
|
GParamSpec *pspec);
|
||||||
|
|
||||||
static void gimp_bucket_fill_options_reset (GimpConfig *config);
|
static void gimp_bucket_fill_options_reset (GimpConfig *config);
|
||||||
|
static void gimp_bucket_fill_options_update_criterion (GimpBucketFillOptions *options);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GimpBucketFillOptions, gimp_bucket_fill_options,
|
G_DEFINE_TYPE_WITH_CODE (GimpBucketFillOptions, gimp_bucket_fill_options,
|
||||||
GIMP_TYPE_PAINT_OPTIONS,
|
GIMP_TYPE_PAINT_OPTIONS,
|
||||||
|
G_ADD_PRIVATE (GimpBucketFillOptions)
|
||||||
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG,
|
||||||
gimp_bucket_fill_options_config_iface_init))
|
gimp_bucket_fill_options_config_iface_init))
|
||||||
|
|
||||||
@ -144,6 +157,20 @@ gimp_bucket_fill_options_class_init (GimpBucketFillOptionsClass *klass)
|
|||||||
0.0, 255.0, 15.0,
|
0.0, 255.0, 15.0,
|
||||||
GIMP_PARAM_STATIC_STRINGS);
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
GIMP_CONFIG_PROP_DOUBLE (object_class, PROP_LINE_ART_THRESHOLD,
|
||||||
|
"line-art-threshold",
|
||||||
|
_("Line art detection threshold"),
|
||||||
|
_("Threshold to detect contour (higher values will include more pixels)"),
|
||||||
|
0.0, 1.0, 0.92,
|
||||||
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
|
GIMP_CONFIG_PROP_INT (object_class, PROP_LINE_ART_EROSION,
|
||||||
|
"line-art-erosion",
|
||||||
|
_("Line art erosion"),
|
||||||
|
_("Size in pixel to erode the line art"),
|
||||||
|
-1, 200, -1,
|
||||||
|
GIMP_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
|
GIMP_CONFIG_PROP_ENUM (object_class, PROP_FILL_CRITERION,
|
||||||
"fill-criterion",
|
"fill-criterion",
|
||||||
_("Fill by"),
|
_("Fill by"),
|
||||||
@ -164,6 +191,7 @@ gimp_bucket_fill_options_config_iface_init (GimpConfigInterface *config_iface)
|
|||||||
static void
|
static void
|
||||||
gimp_bucket_fill_options_init (GimpBucketFillOptions *options)
|
gimp_bucket_fill_options_init (GimpBucketFillOptions *options)
|
||||||
{
|
{
|
||||||
|
options->priv = gimp_bucket_fill_options_get_instance_private (options);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -197,8 +225,15 @@ gimp_bucket_fill_options_set_property (GObject *object,
|
|||||||
case PROP_THRESHOLD:
|
case PROP_THRESHOLD:
|
||||||
options->threshold = g_value_get_double (value);
|
options->threshold = g_value_get_double (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_LINE_ART_THRESHOLD:
|
||||||
|
options->line_art_threshold = g_value_get_double (value);
|
||||||
|
break;
|
||||||
|
case PROP_LINE_ART_EROSION:
|
||||||
|
options->line_art_erosion = g_value_get_int (value);
|
||||||
|
break;
|
||||||
case PROP_FILL_CRITERION:
|
case PROP_FILL_CRITERION:
|
||||||
options->fill_criterion = g_value_get_enum (value);
|
options->fill_criterion = g_value_get_enum (value);
|
||||||
|
gimp_bucket_fill_options_update_criterion (options);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -238,6 +273,12 @@ gimp_bucket_fill_options_get_property (GObject *object,
|
|||||||
case PROP_THRESHOLD:
|
case PROP_THRESHOLD:
|
||||||
g_value_set_double (value, options->threshold);
|
g_value_set_double (value, options->threshold);
|
||||||
break;
|
break;
|
||||||
|
case PROP_LINE_ART_THRESHOLD:
|
||||||
|
g_value_set_double (value, options->line_art_threshold);
|
||||||
|
break;
|
||||||
|
case PROP_LINE_ART_EROSION:
|
||||||
|
g_value_set_int (value, options->line_art_erosion);
|
||||||
|
break;
|
||||||
case PROP_FILL_CRITERION:
|
case PROP_FILL_CRITERION:
|
||||||
g_value_set_enum (value, options->fill_criterion);
|
g_value_set_enum (value, options->fill_criterion);
|
||||||
break;
|
break;
|
||||||
@ -264,9 +305,38 @@ gimp_bucket_fill_options_reset (GimpConfig *config)
|
|||||||
parent_config_iface->reset (config);
|
parent_config_iface->reset (config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gimp_bucket_fill_options_update_criterion (GimpBucketFillOptions *options)
|
||||||
|
{
|
||||||
|
/* GUI not created yet. */
|
||||||
|
if (! options->priv->antialias_checkbox)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (options->fill_criterion)
|
||||||
|
{
|
||||||
|
case GIMP_SELECT_CRITERION_LINE_ART:
|
||||||
|
gtk_widget_hide (options->priv->antialias_checkbox);
|
||||||
|
gtk_widget_hide (options->priv->diagonal_neighbors_checkbox);
|
||||||
|
gtk_widget_hide (options->priv->threshold_scale);
|
||||||
|
|
||||||
|
gtk_widget_show (options->priv->line_art_erosion_scale);
|
||||||
|
gtk_widget_show (options->priv->line_art_threshold_scale);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
gtk_widget_hide (options->priv->line_art_erosion_scale);
|
||||||
|
gtk_widget_hide (options->priv->line_art_threshold_scale);
|
||||||
|
|
||||||
|
gtk_widget_show (options->priv->antialias_checkbox);
|
||||||
|
gtk_widget_show (options->priv->diagonal_neighbors_checkbox);
|
||||||
|
gtk_widget_show (options->priv->threshold_scale);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
|
gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
|
||||||
{
|
{
|
||||||
|
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_OPTIONS (tool_options);
|
||||||
GObject *config = G_OBJECT (tool_options);
|
GObject *config = G_OBJECT (tool_options);
|
||||||
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
|
GtkWidget *vbox = gimp_paint_options_gui (tool_options);
|
||||||
GtkWidget *vbox2;
|
GtkWidget *vbox2;
|
||||||
@ -335,17 +405,34 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
|
|||||||
/* the diagonal neighbors toggle */
|
/* the diagonal neighbors toggle */
|
||||||
button = gimp_prop_check_button_new (config, "diagonal-neighbors", NULL);
|
button = gimp_prop_check_button_new (config, "diagonal-neighbors", NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||||
|
options->priv->diagonal_neighbors_checkbox = button;
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
/* the antialias toggle */
|
/* the antialias toggle */
|
||||||
button = gimp_prop_check_button_new (config, "antialias", NULL);
|
button = gimp_prop_check_button_new (config, "antialias", NULL);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
|
||||||
|
options->priv->antialias_checkbox = button;
|
||||||
gtk_widget_show (button);
|
gtk_widget_show (button);
|
||||||
|
|
||||||
/* the threshold scale */
|
/* the threshold scale */
|
||||||
scale = gimp_prop_spin_scale_new (config, "threshold", NULL,
|
scale = gimp_prop_spin_scale_new (config, "threshold", NULL,
|
||||||
1.0, 16.0, 1);
|
1.0, 16.0, 1);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
||||||
|
options->priv->threshold_scale = scale;
|
||||||
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
|
/* Line Art: erosion */
|
||||||
|
scale = gimp_prop_spin_scale_new (config, "line-art-erosion", NULL,
|
||||||
|
1, 10, 1);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
||||||
|
options->priv->line_art_erosion_scale = scale;
|
||||||
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
|
/* Line Art: stroke threshold */
|
||||||
|
scale = gimp_prop_spin_scale_new (config, "line-art-threshold", NULL,
|
||||||
|
0.05, 0.1, 2);
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox2), scale, FALSE, FALSE, 0);
|
||||||
|
options->priv->line_art_threshold_scale = scale;
|
||||||
gtk_widget_show (scale);
|
gtk_widget_show (scale);
|
||||||
|
|
||||||
/* the fill criterion combo */
|
/* the fill criterion combo */
|
||||||
@ -354,5 +441,7 @@ gimp_bucket_fill_options_gui (GimpToolOptions *tool_options)
|
|||||||
gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox2), combo, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (combo);
|
gtk_widget_show (combo);
|
||||||
|
|
||||||
|
gimp_bucket_fill_options_update_criterion (options);
|
||||||
|
|
||||||
return vbox;
|
return vbox;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
typedef struct _GimpBucketFillOptions GimpBucketFillOptions;
|
typedef struct _GimpBucketFillOptions GimpBucketFillOptions;
|
||||||
|
typedef struct _GimpBucketFillOptionsPrivate GimpBucketFillOptionsPrivate;
|
||||||
typedef struct _GimpPaintOptionsClass GimpBucketFillOptionsClass;
|
typedef struct _GimpPaintOptionsClass GimpBucketFillOptionsClass;
|
||||||
|
|
||||||
struct _GimpBucketFillOptions
|
struct _GimpBucketFillOptions
|
||||||
@ -44,7 +45,13 @@ struct _GimpBucketFillOptions
|
|||||||
gboolean diagonal_neighbors;
|
gboolean diagonal_neighbors;
|
||||||
gboolean antialias;
|
gboolean antialias;
|
||||||
gdouble threshold;
|
gdouble threshold;
|
||||||
|
|
||||||
|
gdouble line_art_threshold;
|
||||||
|
gint line_art_erosion;
|
||||||
|
|
||||||
GimpSelectCriterion fill_criterion;
|
GimpSelectCriterion fill_criterion;
|
||||||
|
|
||||||
|
GimpBucketFillOptionsPrivate *priv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -379,6 +379,8 @@ gimp_bucket_fill_tool_preview (GimpBucketFillTool *tool,
|
|||||||
options->threshold / 255.0,
|
options->threshold / 255.0,
|
||||||
options->sample_merged,
|
options->sample_merged,
|
||||||
options->diagonal_neighbors,
|
options->diagonal_neighbors,
|
||||||
|
options->line_art_threshold,
|
||||||
|
options->line_art_erosion,
|
||||||
x, y, &tool->priv->fill_mask,
|
x, y, &tool->priv->fill_mask,
|
||||||
&x, &y, NULL, NULL);
|
&x, &y, NULL, NULL);
|
||||||
if (line_art)
|
if (line_art)
|
||||||
@ -680,6 +682,8 @@ typedef struct
|
|||||||
GimpBucketFillTool *tool;
|
GimpBucketFillTool *tool;
|
||||||
GimpPickable *pickable;
|
GimpPickable *pickable;
|
||||||
gboolean fill_transparent;
|
gboolean fill_transparent;
|
||||||
|
gdouble line_art_threshold;
|
||||||
|
gint line_art_erosion;
|
||||||
} PrecomputeData;
|
} PrecomputeData;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -697,7 +701,9 @@ gimp_bucket_fill_compute_line_art_async (GimpAsync *async,
|
|||||||
GeglBuffer *line_art;
|
GeglBuffer *line_art;
|
||||||
|
|
||||||
line_art = gimp_pickable_contiguous_region_prepare_line_art (data->pickable,
|
line_art = gimp_pickable_contiguous_region_prepare_line_art (data->pickable,
|
||||||
data->fill_transparent);
|
data->fill_transparent,
|
||||||
|
data->line_art_threshold,
|
||||||
|
data->line_art_erosion);
|
||||||
precompute_data_free (data);
|
precompute_data_free (data);
|
||||||
if (gimp_async_is_canceled (async))
|
if (gimp_async_is_canceled (async))
|
||||||
{
|
{
|
||||||
@ -760,6 +766,8 @@ gimp_bucket_fill_compute_line_art (GimpBucketFillTool *tool)
|
|||||||
data->tool = g_object_ref (tool);
|
data->tool = g_object_ref (tool);
|
||||||
data->pickable = pickable;
|
data->pickable = pickable;
|
||||||
data->fill_transparent = options->fill_transparent;
|
data->fill_transparent = options->fill_transparent;
|
||||||
|
data->line_art_threshold = options->line_art_threshold;
|
||||||
|
data->line_art_erosion = options->line_art_erosion;
|
||||||
|
|
||||||
if (tool->priv->async)
|
if (tool->priv->async)
|
||||||
{
|
{
|
||||||
@ -799,6 +807,12 @@ gimp_bucket_fill_tool_connect_handlers (gpointer data)
|
|||||||
g_signal_connect (options, "notify::fill-transparent",
|
g_signal_connect (options, "notify::fill-transparent",
|
||||||
G_CALLBACK (gimp_bucket_fill_tool_options_notified),
|
G_CALLBACK (gimp_bucket_fill_tool_options_notified),
|
||||||
tool);
|
tool);
|
||||||
|
g_signal_connect (options, "notify::line-art-erosion",
|
||||||
|
G_CALLBACK (gimp_bucket_fill_tool_options_notified),
|
||||||
|
tool);
|
||||||
|
g_signal_connect (options, "notify::line-art-threshold",
|
||||||
|
G_CALLBACK (gimp_bucket_fill_tool_options_notified),
|
||||||
|
tool);
|
||||||
|
|
||||||
g_signal_connect (context, "image-changed",
|
g_signal_connect (context, "image-changed",
|
||||||
G_CALLBACK (gimp_bucket_fill_tool_image_changed),
|
G_CALLBACK (gimp_bucket_fill_tool_image_changed),
|
||||||
@ -817,6 +831,9 @@ gimp_bucket_fill_tool_options_notified (GimpBucketFillOptions *options,
|
|||||||
{
|
{
|
||||||
if ((! strcmp (pspec->name, "fill-criterion") ||
|
if ((! strcmp (pspec->name, "fill-criterion") ||
|
||||||
! strcmp (pspec->name, "fill-transparent") ||
|
! strcmp (pspec->name, "fill-transparent") ||
|
||||||
|
! strcmp (pspec->name, "line-art-erosion") ||
|
||||||
|
! strcmp (pspec->name, "line-art-erosion") ||
|
||||||
|
! strcmp (pspec->name, "line-art-threshold") ||
|
||||||
! strcmp (pspec->name, "sample-merged")) &&
|
! strcmp (pspec->name, "sample-merged")) &&
|
||||||
options->fill_criterion == GIMP_SELECT_CRITERION_LINE_ART)
|
options->fill_criterion == GIMP_SELECT_CRITERION_LINE_ART)
|
||||||
{
|
{
|
||||||
|
@ -128,5 +128,6 @@ gimp_fuzzy_select_tool_get_mask (GimpRegionSelectTool *region_select,
|
|||||||
options->select_transparent,
|
options->select_transparent,
|
||||||
options->select_criterion,
|
options->select_criterion,
|
||||||
options->diagonal_neighbors,
|
options->diagonal_neighbors,
|
||||||
|
0.92, -1, /* TODO */
|
||||||
x, y);
|
x, y);
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,7 @@ HELP
|
|||||||
GIMP_PDB_CONTEXT (context)->sample_threshold,
|
GIMP_PDB_CONTEXT (context)->sample_threshold,
|
||||||
GIMP_PDB_CONTEXT (context)->sample_merged,
|
GIMP_PDB_CONTEXT (context)->sample_merged,
|
||||||
GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
|
GIMP_PDB_CONTEXT (context)->diagonal_neighbors,
|
||||||
|
0.92, -1, /* TODO */
|
||||||
x, y);
|
x, y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user