app/base/siox.[ch] app/core/gimpdrawable-foreground-extract.[ch]

2005-08-09  Sven Neumann  <sven@gimp.org>

	* app/base/siox.[ch]
	* app/core/gimpdrawable-foreground-extract.[ch]
	* app/tools/gimpforegroundselectoptions.[ch]
	* app/tools/gimpforegroundselecttool.c: renamed Granularity to
	Color Sensitivity, both in the GUI and in the APIs.
This commit is contained in:
Sven Neumann 2005-08-09 20:43:44 +00:00 committed by Sven Neumann
parent c2dc887fee
commit ce8dcfb497
8 changed files with 63 additions and 55 deletions

View File

@ -1,6 +1,14 @@
2005-08-09 Sven Neumann <sven@gimp.org> 2005-08-09 Sven Neumann <sven@gimp.org>
* plug-ins/common/dicom.c: use an empty field instead of "?" for * app/base/siox.[ch]
* app/core/gimpdrawable-foreground-extract.[ch]
* app/tools/gimpforegroundselectoptions.[ch]
* app/tools/gimpforegroundselecttool.c: renamed Granularity to
Color Sensitivity, both in the GUI and in the APIs.
2005-08-09 Sven Neumann <sven@gimp.org>
* plug-ins/common/dicom.c: use an empty string instead of "?" for
the unknown value (bug #313008). the unknown value (bug #313008).
2005-08-09 Sven Neumann <sven@gimp.org> 2005-08-09 Sven Neumann <sven@gimp.org>

View File

@ -757,7 +757,7 @@ siox_foreground_extract (TileManager *pixels,
gint width, gint width,
gint height, gint height,
gint smoothness, gint smoothness,
const gdouble limits[SIOX_DIMS], const gdouble sensitivity[SIOX_DIMS],
SioxProgressFunc progress_callback, SioxProgressFunc progress_callback,
gpointer progress_data) gpointer progress_data)
{ {
@ -775,7 +775,7 @@ siox_foreground_extract (TileManager *pixels,
lab *surefg; lab *surefg;
lab *bgsig; lab *bgsig;
lab *fgsig; lab *fgsig;
gfloat flimits[3]; gfloat limits[3];
g_return_if_fail (pixels != NULL); g_return_if_fail (pixels != NULL);
g_return_if_fail (mask != NULL && tile_manager_bpp (mask) == 1); g_return_if_fail (mask != NULL && tile_manager_bpp (mask) == 1);
@ -790,11 +790,11 @@ siox_foreground_extract (TileManager *pixels,
siox_progress_update (progress_callback, progress_data, 0.0); siox_progress_update (progress_callback, progress_data, 0.0);
flimits[0] = limits[0]; limits[0] = sensitivity[0];
flimits[1] = limits[1]; limits[1] = sensitivity[1];
flimits[2] = limits[2]; limits[2] = sensitivity[2];
clustersize = get_clustersize (flimits); clustersize = get_clustersize (limits);
/* count given foreground and background pixels */ /* count given foreground and background pixels */
pixel_region_init (&mapPR, mask, x, y, width, height, FALSE); pixel_region_init (&mapPR, mask, x, y, width, height, FALSE);
@ -870,7 +870,7 @@ siox_foreground_extract (TileManager *pixels,
siox_progress_update (progress_callback, progress_data, 0.2); siox_progress_update (progress_callback, progress_data, 0.2);
/* Create color signature for the background */ /* Create color signature for the background */
bgsig = create_signature (surebg, surebgcount, flimits, &bgsiglen); bgsig = create_signature (surebg, surebgcount, limits, &bgsiglen);
g_free (surebg); g_free (surebg);
if (bgsiglen < 1) if (bgsiglen < 1)
@ -882,7 +882,7 @@ siox_foreground_extract (TileManager *pixels,
siox_progress_update (progress_callback, progress_data, 0.3); siox_progress_update (progress_callback, progress_data, 0.3);
/* Create color signature for the foreground */ /* Create color signature for the foreground */
fgsig = create_signature (surefg, surefgcount, flimits, &fgsiglen); fgsig = create_signature (surefg, surefgcount, limits, &fgsiglen);
g_free (surefg); g_free (surefg);
siox_progress_update (progress_callback, progress_data, 0.4); siox_progress_update (progress_callback, progress_data, 0.4);

View File

@ -39,9 +39,9 @@
#define SIOX_DEFAULT_SMOOTHNESS 3 #define SIOX_DEFAULT_SMOOTHNESS 3
#define SIOX_DEFAULT_GRANULARITY_L 0.66 #define SIOX_DEFAULT_SENSITIVITY_L 0.66
#define SIOX_DEFAULT_GRANULARITY_A 1.25 #define SIOX_DEFAULT_SENSITIVITY_A 1.25
#define SIOX_DEFAULT_GRANULARITY_B 2.5 #define SIOX_DEFAULT_SENSITIVITY_B 2.5
typedef void (* SioxProgressFunc) (gpointer progress_data, typedef void (* SioxProgressFunc) (gpointer progress_data,
@ -58,7 +58,7 @@ void siox_foreground_extract (TileManager *pixels,
gint width, gint width,
gint height, gint height,
gint smoothness, gint smoothness,
const gdouble limits[3], const gdouble sensitivity[3],
SioxProgressFunc progress_callback, SioxProgressFunc progress_callback,
gpointer progress_data); gpointer progress_data);

View File

@ -45,10 +45,10 @@ gimp_drawable_foreground_extract (GimpDrawable *drawable,
GimpDrawable *mask, GimpDrawable *mask,
GimpProgress *progress) GimpProgress *progress)
{ {
const gint smoothness = SIOX_DEFAULT_SMOOTHNESS; const gint smoothness = SIOX_DEFAULT_SMOOTHNESS;
const gdouble limits[3] = { SIOX_DEFAULT_GRANULARITY_L, const gdouble sensitivity[3] = { SIOX_DEFAULT_SENSITIVITY_L,
SIOX_DEFAULT_GRANULARITY_A, SIOX_DEFAULT_SENSITIVITY_A,
SIOX_DEFAULT_GRANULARITY_B }; SIOX_DEFAULT_SENSITIVITY_B };
g_return_if_fail (GIMP_IS_DRAWABLE (mask)); g_return_if_fail (GIMP_IS_DRAWABLE (mask));
g_return_if_fail (mode == GIMP_FOREGROUND_EXTRACT_SIOX); g_return_if_fail (mode == GIMP_FOREGROUND_EXTRACT_SIOX);
@ -57,7 +57,7 @@ gimp_drawable_foreground_extract (GimpDrawable *drawable,
0, 0, 0, 0,
gimp_item_width (GIMP_ITEM (mask)), gimp_item_width (GIMP_ITEM (mask)),
gimp_item_height (GIMP_ITEM (mask)), gimp_item_height (GIMP_ITEM (mask)),
smoothness, limits, smoothness, sensitivity,
progress); progress);
} }
@ -69,7 +69,7 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *drawable,
gint width, gint width,
gint height, gint height,
gint smoothness, gint smoothness,
const gdouble limits[3], const gdouble sensitivity[3],
GimpProgress *progress) GimpProgress *progress)
{ {
GimpImage *gimage; GimpImage *gimage;
@ -113,7 +113,7 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *drawable,
siox_foreground_extract (gimp_drawable_data (drawable), colormap, siox_foreground_extract (gimp_drawable_data (drawable), colormap,
offset_x, offset_y, offset_x, offset_y,
gimp_drawable_data (mask), x, y, width, height, gimp_drawable_data (mask), x, y, width, height,
smoothness, limits, smoothness, sensitivity,
(SioxProgressFunc) gimp_progress_set_value, (SioxProgressFunc) gimp_progress_set_value,
progress); progress);

View File

@ -33,7 +33,7 @@ void gimp_drawable_foreground_extract_siox (GimpDrawable *drawabl
gint width, gint width,
gint height, gint height,
gint smoothness, gint smoothness,
const gdouble limits[3], const gdouble sensitivity[3],
GimpProgress *progress); GimpProgress *progress);
#endif /* __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__ */ #endif /* __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__ */

View File

@ -42,9 +42,9 @@ enum
PROP_BACKGROUND, PROP_BACKGROUND,
PROP_STROKE_WIDTH, PROP_STROKE_WIDTH,
PROP_SMOOTHNESS, PROP_SMOOTHNESS,
PROP_GRANULARITY_L, PROP_SENSITIVITY_L,
PROP_GRANULARITY_A, PROP_SENSITIVITY_A,
PROP_GRANULARITY_B PROP_SENSITIVITY_B
}; };
@ -116,20 +116,20 @@ gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *kla
"in the selection"), "in the selection"),
0, 8, SIOX_DEFAULT_SMOOTHNESS, 0, 8, SIOX_DEFAULT_SMOOTHNESS,
0); 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GRANULARITY_L, GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SENSITIVITY_L,
"granularity-l", "sensitivity-l",
_("Resolution for brightness component"), _("Sensitivity for brightness component"),
0.0, 10.0, SIOX_DEFAULT_GRANULARITY_L, 0.0, 10.0, SIOX_DEFAULT_SENSITIVITY_L,
0); 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GRANULARITY_A, GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SENSITIVITY_A,
"granularity-a", "sensitivity-a",
_("Resolution for red/green component"), _("Sensitivity for red/green component"),
0.0, 10.0, SIOX_DEFAULT_GRANULARITY_A, 0.0, 10.0, SIOX_DEFAULT_SENSITIVITY_A,
0); 0);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GRANULARITY_B, GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_SENSITIVITY_B,
"granularity-b", "sensitivity-b",
_("Resolution for yellow/blue component"), _("Sensitivity for yellow/blue component"),
0.0, 10.0, SIOX_DEFAULT_GRANULARITY_B, 0.0, 10.0, SIOX_DEFAULT_SENSITIVITY_B,
0); 0);
} }
@ -155,14 +155,14 @@ gimp_foreground_select_options_set_property (GObject *object,
case PROP_SMOOTHNESS: case PROP_SMOOTHNESS:
options->smoothness = g_value_get_int (value); options->smoothness = g_value_get_int (value);
break; break;
case PROP_GRANULARITY_L: case PROP_SENSITIVITY_L:
options->limits[0] = g_value_get_double (value); options->sensitivity[0] = g_value_get_double (value);
break; break;
case PROP_GRANULARITY_A: case PROP_SENSITIVITY_A:
options->limits[1] = g_value_get_double (value); options->sensitivity[1] = g_value_get_double (value);
break; break;
case PROP_GRANULARITY_B: case PROP_SENSITIVITY_B:
options->limits[2] = g_value_get_double (value); options->sensitivity[2] = g_value_get_double (value);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -192,14 +192,14 @@ gimp_foreground_select_options_get_property (GObject *object,
case PROP_SMOOTHNESS: case PROP_SMOOTHNESS:
g_value_set_int (value, options->smoothness); g_value_set_int (value, options->smoothness);
break; break;
case PROP_GRANULARITY_L: case PROP_SENSITIVITY_L:
g_value_set_double (value, options->limits[0]); g_value_set_double (value, options->sensitivity[0]);
break; break;
case PROP_GRANULARITY_A: case PROP_SENSITIVITY_A:
g_value_set_double (value, options->limits[1]); g_value_set_double (value, options->sensitivity[1]);
break; break;
case PROP_GRANULARITY_B: case PROP_SENSITIVITY_B:
g_value_set_double (value, options->limits[2]); g_value_set_double (value, options->sensitivity[2]);
break; break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@ -274,7 +274,7 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
_("Smoothing:"), 0.0, 0.5, scale, 2, FALSE); _("Smoothing:"), 0.0, 0.5, scale, 2, FALSE);
/* granularity */ /* granularity */
frame = gimp_prop_expander_new (config, "expanded", _("Granularity")); frame = gimp_prop_expander_new (config, "expanded", _("Color Sensitivity"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame); gtk_widget_show (frame);
@ -288,17 +288,17 @@ gimp_foreground_select_options_gui (GimpToolOptions *tool_options)
gtk_container_add (GTK_CONTAINER (inner_frame), table); gtk_container_add (GTK_CONTAINER (inner_frame), table);
gtk_widget_show (table); gtk_widget_show (table);
adj = gimp_prop_opacity_entry_new (config, "granularity-l", adj = gimp_prop_opacity_entry_new (config, "sensitivity-l",
GTK_TABLE (table), 0, row++, "L"); GTK_TABLE (table), 0, row++, "L");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)), gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)),
GTK_UPDATE_DELAYED); GTK_UPDATE_DELAYED);
adj = gimp_prop_opacity_entry_new (config, "granularity-a", adj = gimp_prop_opacity_entry_new (config, "sensitivity-a",
GTK_TABLE (table), 0, row++, "a"); GTK_TABLE (table), 0, row++, "a");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)), gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)),
GTK_UPDATE_DELAYED); GTK_UPDATE_DELAYED);
adj = gimp_prop_opacity_entry_new (config, "granularity-b", adj = gimp_prop_opacity_entry_new (config, "sensitivity-b",
GTK_TABLE (table), 0, row++, "b"); GTK_TABLE (table), 0, row++, "b");
gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)), gtk_range_set_update_policy (GTK_RANGE (GIMP_SCALE_ENTRY_SCALE (adj)),
GTK_UPDATE_DELAYED); GTK_UPDATE_DELAYED);

View File

@ -42,7 +42,7 @@ struct _GimpForegroundSelectOptions
gboolean background; gboolean background;
gint stroke_width; gint stroke_width;
gint smoothness; gint smoothness;
gdouble limits[3]; gdouble sensitivity[3];
}; };

View File

@ -652,7 +652,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
GIMP_DRAWABLE (mask), GIMP_DRAWABLE (mask),
x1, y1, x2 - x1, y2 - y1, x1, y1, x2 - x1, y2 - y1,
options->smoothness, options->smoothness,
options->limits, options->sensitivity,
GIMP_PROGRESS (gdisp)); GIMP_PROGRESS (gdisp));
gimp_unset_busy (gimage->gimp); gimp_unset_busy (gimage->gimp);
@ -823,7 +823,7 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
if (pspec->name && if (pspec->name &&
(strcmp (pspec->name, "smoothness") == 0 || (strcmp (pspec->name, "smoothness") == 0 ||
strncmp (pspec->name, "granularity", strlen ("granularity")) == 0)) strncmp (pspec->name, "sensitivity", strlen ("sensitivity")) == 0))
{ {
if (fg_select->idle_id) if (fg_select->idle_id)
g_source_remove (fg_select->idle_id); g_source_remove (fg_select->idle_id);