[gimp] app: add correct options for seamless clone operation.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add correct options for seamless clone operation.
- Date: Tue, 29 Apr 2014 21:18:48 +0000 (UTC)
commit 5077a149f327b49b689ca370d911df3235d05e04
Author: Jehan <jehan girinstud io>
Date: Sun Apr 27 22:31:41 2014 +1200
app: add correct options for seamless clone operation.
app/tools/gimpseamlesscloneoptions.c | 35 +++++++++++++++++++--------------
app/tools/gimpseamlesscloneoptions.h | 1 +
app/tools/gimpseamlessclonetool.c | 14 +++++++++++-
3 files changed, 33 insertions(+), 17 deletions(-)
---
diff --git a/app/tools/gimpseamlesscloneoptions.c b/app/tools/gimpseamlesscloneoptions.c
index 914496b..6e69712 100644
--- a/app/tools/gimpseamlesscloneoptions.c
+++ b/app/tools/gimpseamlesscloneoptions.c
@@ -27,6 +27,8 @@
#include "tools-types.h"
+#include "widgets/gimpspinscale.h"
+
#include "gimpseamlesscloneoptions.h"
#include "gimptooloptions-gui.h"
@@ -36,7 +38,7 @@
enum
{
PROP_0,
- PROP_TEMP
+ PROP_MAX_REFINE_STEPS,
};
@@ -64,10 +66,11 @@ gimp_seamless_clone_options_class_init (GimpSeamlessCloneOptionsClass *klass)
object_class->set_property = gimp_seamless_clone_options_set_property;
object_class->get_property = gimp_seamless_clone_options_get_property;
- GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEMP,
- "temp", NULL,
- FALSE,
- GIMP_PARAM_STATIC_STRINGS);
+ GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MAX_REFINE_STEPS,
+ "max-refine-steps",
+ N_("Maximal amount of refinement points to be used for the interpolation
mesh"),
+ 0, 100000, 2000,
+ GIMP_PARAM_STATIC_STRINGS);
}
static void
@@ -85,8 +88,8 @@ gimp_seamless_clone_options_set_property (GObject *object,
switch (property_id)
{
- case PROP_TEMP:
- options->temp = g_value_get_boolean (value);
+ case PROP_MAX_REFINE_STEPS:
+ options->max_refine_steps = g_value_get_int (value);
break;
default:
@@ -105,8 +108,8 @@ gimp_seamless_clone_options_get_property (GObject *object,
switch (property_id)
{
- case PROP_TEMP:
- g_value_set_boolean (value, options->temp);
+ case PROP_MAX_REFINE_STEPS:
+ g_value_set_int (value, options->max_refine_steps);
break;
default:
@@ -120,12 +123,14 @@ gimp_seamless_clone_options_gui (GimpToolOptions *tool_options)
{
GObject *config = G_OBJECT (tool_options);
GtkWidget *vbox = gimp_tool_options_gui (tool_options);
- GtkWidget *button;
-
- button = gimp_prop_check_button_new (config, "temp",
- _("Temp property"));
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- gtk_widget_show (button);
+ GtkWidget *scale;
+
+ scale = gimp_prop_spin_scale_new (config, "max-refine-steps",
+ _("Refinement points"),
+ 1.0, 10.0, 0);
+ gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale), 0.0, 100000.0);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, FALSE, FALSE, 0);
+ gtk_widget_show (scale);
return vbox;
}
diff --git a/app/tools/gimpseamlesscloneoptions.h b/app/tools/gimpseamlesscloneoptions.h
index 3a952fe..4de4a4a 100644
--- a/app/tools/gimpseamlesscloneoptions.h
+++ b/app/tools/gimpseamlesscloneoptions.h
@@ -39,6 +39,7 @@ struct _GimpSeamlessCloneOptions
{
GimpToolOptions parent_instance;
+ gint max_refine_steps;
gboolean temp;
};
diff --git a/app/tools/gimpseamlessclonetool.c b/app/tools/gimpseamlessclonetool.c
index 85634c4..c095119 100644
--- a/app/tools/gimpseamlessclonetool.c
+++ b/app/tools/gimpseamlessclonetool.c
@@ -572,6 +572,8 @@ gimp_seamless_clone_tool_options_notify (GimpTool *tool,
GimpToolOptions *options,
const GParamSpec *pspec)
{
+ GimpSeamlessCloneTool *sc = GIMP_SEAMLESS_CLONE_TOOL (tool);
+
GIMP_TOOL_CLASS (parent_class)->options_notify (tool, options, pspec);
if (! tool->display)
@@ -579,7 +581,11 @@ gimp_seamless_clone_tool_options_notify (GimpTool *tool,
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
- /* TODO: Modify data here */
+ if (! strcmp (pspec->name, "max-refine-steps"))
+ {
+ gimp_seamless_clone_tool_render_node_update (sc);
+ gimp_seamless_clone_tool_image_map_update (sc);
+ }
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
@@ -627,6 +633,7 @@ gimp_seamless_clone_tool_create_render_node (GimpSeamlessCloneTool *sc)
* +----+------------------------+
* <output>
*/
+ GimpSeamlessCloneOptions *options = GIMP_SEAMLESS_CLONE_TOOL_GET_OPTIONS (sc);
GeglNode *node;
GeglNode *op, *paste, *overlay;
GeglNode *input, *output;
@@ -642,7 +649,8 @@ gimp_seamless_clone_tool_create_render_node (GimpSeamlessCloneTool *sc)
NULL);
op = gegl_node_new_child (node,
- "operation", "gegl:seamless-clone",
+ "operation", "gegl:seamless-clone",
+ "max-refine-steps", options->max_refine_steps,
NULL);
overlay = gegl_node_new_child (node,
@@ -673,6 +681,7 @@ gimp_seamless_clone_tool_create_render_node (GimpSeamlessCloneTool *sc)
static void
gimp_seamless_clone_tool_render_node_update (GimpSeamlessCloneTool *sc)
{
+ GimpSeamlessCloneOptions *options = GIMP_SEAMLESS_CLONE_TOOL_GET_OPTIONS (sc);
GimpDrawable *bg = GIMP_TOOL (sc)->drawable;
gint off_x, off_y;
@@ -681,6 +690,7 @@ gimp_seamless_clone_tool_render_node_update (GimpSeamlessCloneTool *sc)
gegl_node_set (sc->sc_node,
"xoff", (gint) sc->xoff - off_x,
"yoff", (gint) sc->yoff - off_y,
+ "max-refine-steps", (gint) options->max_refine_steps,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]