mirror of https://github.com/GNOME/gimp.git
app: add "real-time preview" option to the warp tool
Add a "real-time preview" option to the warp tool, which, when toggled, causes the preview to be rendered synchronously during motion. This is slower, but gives better feedback.
This commit is contained in:
parent
e8a39d5c49
commit
a93af839fe
|
@ -47,6 +47,7 @@ enum
|
|||
PROP_INTERPOLATION,
|
||||
PROP_ABYSS_POLICY,
|
||||
PROP_HIGH_QUALITY_PREVIEW,
|
||||
PROP_REAL_TIME_PREVIEW,
|
||||
PROP_STROKE_DURING_MOTION,
|
||||
PROP_STROKE_PERIODICALLY,
|
||||
PROP_STROKE_PERIODICALLY_RATE,
|
||||
|
@ -137,6 +138,13 @@ gimp_warp_options_class_init (GimpWarpOptionsClass *klass)
|
|||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_REAL_TIME_PREVIEW,
|
||||
"real-time-preview",
|
||||
_("Real-time preview"),
|
||||
_("Render preview in real time (slower)"),
|
||||
FALSE,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_STROKE_DURING_MOTION,
|
||||
"stroke-during-motion",
|
||||
_("During motion"),
|
||||
|
@ -205,6 +213,9 @@ gimp_warp_options_set_property (GObject *object,
|
|||
case PROP_HIGH_QUALITY_PREVIEW:
|
||||
options->high_quality_preview = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_REAL_TIME_PREVIEW:
|
||||
options->real_time_preview = g_value_get_boolean (value);
|
||||
break;
|
||||
case PROP_STROKE_DURING_MOTION:
|
||||
options->stroke_during_motion = g_value_get_boolean (value);
|
||||
break;
|
||||
|
@ -258,6 +269,9 @@ gimp_warp_options_get_property (GObject *object,
|
|||
case PROP_HIGH_QUALITY_PREVIEW:
|
||||
g_value_set_boolean (value, options->high_quality_preview);
|
||||
break;
|
||||
case PROP_REAL_TIME_PREVIEW:
|
||||
g_value_set_boolean (value, options->real_time_preview);
|
||||
break;
|
||||
case PROP_STROKE_DURING_MOTION:
|
||||
g_value_set_boolean (value, options->stroke_during_motion);
|
||||
break;
|
||||
|
@ -337,6 +351,10 @@ gimp_warp_options_gui (GimpToolOptions *tool_options)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gimp_prop_check_button_new (config, "real-time-preview", NULL);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* the stroke frame */
|
||||
frame = gimp_frame_new (_("Stroke"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
|
||||
|
|
|
@ -47,6 +47,7 @@ struct _GimpWarpOptions
|
|||
GimpInterpolationType interpolation;
|
||||
GeglAbyssPolicy abyss_policy;
|
||||
gboolean high_quality_preview;
|
||||
gboolean real_time_preview;
|
||||
|
||||
gboolean stroke_during_motion;
|
||||
gboolean stroke_periodically;
|
||||
|
|
|
@ -128,7 +128,8 @@ static GeglRectangle
|
|||
static void gimp_warp_tool_clear_node_bounds (GeglNode *node);
|
||||
static void gimp_warp_tool_update_bounds (GimpWarpTool *wt);
|
||||
static void gimp_warp_tool_update_area (GimpWarpTool *wt,
|
||||
const GeglRectangle *area);
|
||||
const GeglRectangle *area,
|
||||
gboolean synchronous);
|
||||
static void gimp_warp_tool_update_stroke (GimpWarpTool *wt,
|
||||
GeglNode *node);
|
||||
static void gimp_warp_tool_stroke_append (GimpWarpTool *wt,
|
||||
|
@ -1091,7 +1092,8 @@ gimp_warp_tool_update_bounds (GimpWarpTool *wt)
|
|||
|
||||
static void
|
||||
gimp_warp_tool_update_area (GimpWarpTool *wt,
|
||||
const GeglRectangle *area)
|
||||
const GeglRectangle *area,
|
||||
gboolean synchronous)
|
||||
{
|
||||
GeglRectangle rect = *area;
|
||||
|
||||
|
@ -1105,7 +1107,28 @@ gimp_warp_tool_update_area (GimpWarpTool *wt,
|
|||
rect = gegl_operation_get_invalidated_by_change (operation, "aux", &rect);
|
||||
}
|
||||
|
||||
gimp_drawable_filter_apply (wt->filter, &rect);
|
||||
if (synchronous)
|
||||
{
|
||||
GimpTool *tool = GIMP_TOOL (wt);
|
||||
GimpImage *image = gimp_display_get_image (tool->display);
|
||||
|
||||
g_signal_handlers_block_by_func (wt->filter,
|
||||
gimp_warp_tool_filter_flush,
|
||||
wt);
|
||||
|
||||
gimp_drawable_filter_apply (wt->filter, &rect);
|
||||
|
||||
gimp_projection_flush_now (gimp_image_get_projection (image), TRUE);
|
||||
gimp_display_flush_now (tool->display);
|
||||
|
||||
g_signal_handlers_unblock_by_func (wt->filter,
|
||||
gimp_warp_tool_filter_flush,
|
||||
wt);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_drawable_filter_apply (wt->filter, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1137,7 +1160,7 @@ gimp_warp_tool_update_stroke (GimpWarpTool *wt,
|
|||
bounds.width, bounds.height);
|
||||
#endif
|
||||
|
||||
gimp_warp_tool_update_area (wt, &bounds);
|
||||
gimp_warp_tool_update_area (wt, &bounds, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1175,7 +1198,7 @@ gimp_warp_tool_stroke_append (GimpWarpTool *wt,
|
|||
gimp_warp_tool_update_bounds (wt);
|
||||
}
|
||||
|
||||
gimp_warp_tool_update_area (wt, &area);
|
||||
gimp_warp_tool_update_area (wt, &area, options->real_time_preview);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue