[gimp/soc-2009-siox-drb] 7.22
- From: Jie Ding <jieding src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp/soc-2009-siox-drb] 7.22
- Date: Wed, 22 Jul 2009 08:45:24 +0000 (UTC)
commit 4ac143cad21c66aa6fa409c5bd951f50f21ee69e
Author: Jie Ding <jieding src gnome org>
Date: Wed Jul 22 16:44:18 2009 +0800
7.22
app/base/base-enums.h | 2 +-
app/base/siox.c | 21 ++++++++++++---------
app/base/siox.h | 6 +++---
app/core/gimpdrawable-foreground-extract.c | 13 ++++++++-----
app/core/gimpdrawable-foreground-extract.h | 4 ++--
app/tools/gimpforegroundselectoptions.c | 2 +-
app/tools/gimpforegroundselecttool.c | 22 ++++++++++------------
7 files changed, 37 insertions(+), 33 deletions(-)
---
diff --git a/app/base/base-enums.h b/app/base/base-enums.h
index e135838..4f6bed7 100644
--- a/app/base/base-enums.h
+++ b/app/base/base-enums.h
@@ -147,7 +147,7 @@ typedef enum /*< pdb-skip, skip >///(new)
SIOX_DRB_ADD = 0,
SIOX_DRB_SUBTRACT = 1,
SIOX_DRB_NO_CHANGE = (1 << 1),
- // SIOX_DRB_CHANGE_THRESHOLD = (1 << 2),/* threshold /
+//SIOX_DRB_CHANGE_THRESHOLD = (1 << 2),/* threshold /
SIOX_DRB_RECALCULATE = 0xFF
} SioxDRBType;*/
diff --git a/app/base/siox.c b/app/base/siox.c
index 8e42064..2a11e94 100644
--- a/app/base/siox.c
+++ b/app/base/siox.c
@@ -104,8 +104,6 @@ struct _SioxState
gint xsbpp;
};
-static SioxState *drbstate;//
-static TileManager *drbmask;//
/* A struct that holds the classification result */
typedef struct
@@ -1289,7 +1287,7 @@ siox_drb (SioxState *state,
gint x,
gint y,
gint brush_radius,
- gint brush_mode,
+ SioxDRBType optionsrefinement,
gfloat threshold)
{
PixelRegion srcPR;
@@ -1301,14 +1299,19 @@ siox_drb (SioxState *state,
g_return_if_fail (state != NULL);
g_return_if_fail (mask != NULL && tile_manager_bpp (mask) == 1);
-
+ if (optionsrefinement & SIOX_DRB_ADD)
+ g_hash_table_foreach_remove(state->cache,siox_cache_remove_bg,NULL);
+ if (optionsrefinement & SIOX_DRB_SUBTRACT)
+ g_hash_table_foreach_remove(state->cache,siox_cache_remove_fg,NULL);
+ if (optionsrefinement & SIOX_DRB_CHANGE_THRESHOLD)
+ optionsrefinement = SIOX_DRB_RECALCULATE;
/*pixel_region_init (&srcPR, state->pixels,
x - brush_radius, y - brush_radius, brush_radius * 2,
brush_radius * 2, FALSE);
- pixel_region_init (&mapPR, mask, x - brush_radius, y - brush_radius,
+ pixel_region_init (&mapPR, mask, x - brush_radius, y - brush_radius,
brush_radius * 2, brush_radius * 2, TRUE);
pixel_region_init (&srcPR, state->pixels,
@@ -1319,7 +1322,7 @@ siox_drb (SioxState *state,
*/
pixel_region_init (&srcPR, state->pixels,
- x , y , brush_radius * 2,brush_radius * 2, FALSE);
+ x , y , state->width, state->height, FALSE);
pixel_region_init (&mapPR, mask, x, y,
brush_radius * 2,
brush_radius * 2, TRUE);
@@ -1354,8 +1357,8 @@ siox_drb (SioxState *state,
mindistbg = (gfloat) sqrt (cr->bgdist);
mindistfg = (gfloat) sqrt (cr->fgdist);
- if (brush_mode == 0)
- {printf("SIOX_DRB_ADD \n");
+ if (optionsrefinement & SIOX_DRB_ADD)
+ {
if (*m > SIOX_HIGH)
continue;
@@ -1370,7 +1373,7 @@ siox_drb (SioxState *state,
alpha = MIN (d, 1.0);
}
}
- else if (brush_mode == 1) /*if (brush_mode == SIOX_DRB_SUBTRACT)*/
+ else if (optionsrefinement & SIOX_DRB_SUBTRACT) /*if (brush_mode == SIOX_DRB_SUBTRACT)*/
{
if (*m < SIOX_HIGH)
continue;
diff --git a/app/base/siox.h b/app/base/siox.h
index 5be96d1..f814bc9 100644
--- a/app/base/siox.h
+++ b/app/base/siox.h
@@ -43,8 +43,8 @@
#define SIOX_DEFAULT_SENSITIVITY_B 2.56
/* FIXME: turn this into an enum */
-#define SIOX_DRB_ADD 0
-#define SIOX_DRB_SUBTRACT 1
+//#define SIOX_DRB_ADD 0
+//#define SIOX_DRB_SUBTRACT 1
typedef void (* SioxProgressFunc) (gpointer progress_data,
@@ -77,7 +77,7 @@ void siox_drb (SioxState *state,
gint x,
gint y,
gint brush_radius,
- gint brush_mode,
+ SioxDRBType optionsrefinement,
gfloat threshold);
diff --git a/app/core/gimpdrawable-foreground-extract.c b/app/core/gimpdrawable-foreground-extract.c
index d2dbc34..0cf81d9 100644
--- a/app/core/gimpdrawable-foreground-extract.c
+++ b/app/core/gimpdrawable-foreground-extract.c
@@ -165,9 +165,12 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *mask,
}
else
{
- gimp_drawable_foreground_extract_siox_drb (gimp_drawable_get_tiles (mask),
- state,sioxdrboption,sioxdrbthreshold,
- brush_radius,progress);
+ siox_drb (state,
+ gimp_drawable_get_tiles (mask),
+ state->x,state->y,
+ brush_radius,
+ sioxdrboption,
+ sioxdrbthreshold);
}
if (progress)
gimp_progress_end (progress);
@@ -183,7 +186,7 @@ gimp_drawable_foreground_extract_siox_done (SioxState *state)
siox_done (state);
}
-
+/*
void
gimp_drawable_foreground_extract_siox_drb (TileManager *mask,
SioxState *state,
@@ -208,7 +211,7 @@ gimp_drawable_foreground_extract_siox_drb (TileManager *mask,
}
-
+*/
diff --git a/app/core/gimpdrawable-foreground-extract.h b/app/core/gimpdrawable-foreground-extract.h
index ec638de..d72ae19 100644
--- a/app/core/gimpdrawable-foreground-extract.h
+++ b/app/core/gimpdrawable-foreground-extract.h
@@ -46,11 +46,11 @@ void gimp_drawable_foreground_extract_siox (GimpDrawable *mask,
GimpProgress *progress);
void gimp_drawable_foreground_extract_siox_done (SioxState *state);
-void gimp_drawable_foreground_extract_siox_drb (TileManager *mask,
+/*void gimp_drawable_foreground_extract_siox_drb (TileManager *mask,
SioxState *state,
SioxDRBType optionsrefinement,
gfloat optionsthreshold,
gint radius,
GimpProgress *progress);
-
+*/
#endif /* __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__ */
diff --git a/app/tools/gimpforegroundselectoptions.c b/app/tools/gimpforegroundselectoptions.c
index 2abc0fe..ad0e335 100644
--- a/app/tools/gimpforegroundselectoptions.c
+++ b/app/tools/gimpforegroundselectoptions.c
@@ -95,7 +95,7 @@ gimp_foreground_select_options_class_init (GimpForegroundSelectOptionsClass *kla
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DRB,
"drb",
- _("drb can use"),
+ _("Detail refinement brush can use"),
FALSE,
GIMP_PARAM_STATIC_STRINGS);
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 30d048d..b535bea 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -290,9 +290,9 @@ gimp_foreground_select_tool_control (GimpTool *tool,
g_list_free (fg_select->strokes);
fg_select->strokes = NULL;
-
- g_list_free (fg_select->drbsignals);
- fg_select->drbsignals = NULL;
+ g_list_free (fg_select->drbsignals);
+ fg_select->drbsignals = NULL;
+
if (fg_select->state)
{
gimp_drawable_foreground_extract_siox_done (fg_select->state);
@@ -339,7 +339,7 @@ gimp_foreground_select_tool_oper_update (GimpTool *tool,
if (fg_select->strokes)
{
if(!fg_select->drbsignal)
- status = _("Add more strokes or click buttondrb to drb");
+ status = _("Add more strokes or click button DRB to drb");
else
status = _("Add more drb or press Enter to accept the selection");
}
@@ -437,8 +437,7 @@ gimp_foreground_select_tool_key_press (GimpTool *tool,
{
case GDK_Return:
case GDK_KP_Enter:
- case GDK_ISO_Enter:
- printf("click Enter\n");
+ case GDK_ISO_Enter:
gimp_foreground_select_tool_apply (fg_select, display);
return TRUE;
@@ -720,9 +719,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
drawable = gimp_image_get_active_drawable (image);
fg_select = GIMP_FOREGROUND_SELECT_TOOL (free_sel);
options = GIMP_FOREGROUND_SELECT_TOOL_GET_OPTIONS (free_sel);
- printf("mark_drb = %d\n",mark_drb);
- printf(" fg_select->refinement\n", fg_select->refinement);
- printf("options->refinement\n", options->refinement);
+
if (fg_select->idle_id)
{
g_source_remove (fg_select->idle_id);
@@ -755,15 +752,16 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
0, 0, 128);
gimp_scan_convert_free (scan_convert);
-printf(" fg_select->refinement\n", fg_select->refinement);
+
if (fg_select->strokes)
{
GList *list;
GList *drblist;
gimp_set_busy (image->gimp);
- if(!mark_drb)
+
/* apply foreground and background markers */
+ if (!mark_drb)
for (list = fg_select->strokes; list; list = list->next)
gimp_foreground_select_tool_stroke (mask, list->data);
else if (mark_drb)
@@ -771,7 +769,7 @@ printf(" fg_select->refinement\n", fg_select->refinement);
gimp_foreground_select_tool_stroke (mask, drblist->data);
if (fg_select->state)
- { printf("fg_select->state\n");
+ {
gimp_drawable_foreground_extract_siox (GIMP_DRAWABLE (mask),
fg_select->state,
fg_select->refinement,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]