static void gimp_threshold_tool_auto_clicked (GtkWidget *button, GimpThresholdTool *t_tool) { GimpTool *tool = GIMP_TOOL (t_tool); GimpWaitable *waitable; waitable = gimp_trivially_cancelable_waitable_new ( GIMP_WAITABLE (t_tool->histogram_async)); gimp_wait (tool->tool_info->gimp, waitable, _("Calculating histogram...")); g_object_unref (waitable); if (gimp_async_is_synced (t_tool->histogram_async) && gimp_async_is_finished (t_tool->histogram_async)) { GimpHistogramChannel channel; gint n_bins; gdouble low; g_object_get (GIMP_FILTER_TOOL (t_tool)->config, "channel", &channel, NULL); n_bins = gimp_histogram_n_bins (t_tool->histogram); low = gimp_histogram_get_threshold (t_tool->histogram, channel, 0, n_bins - 1); gimp_histogram_view_set_range (t_tool->histogram_box->view, low, n_bins - 1); } }
static void gimp_threshold_tool_auto_clicked (GtkWidget *button, GimpThresholdTool *t_tool) { GimpDrawable *drawable = GIMP_IMAGE_MAP_TOOL (t_tool)->drawable; gdouble low; low = gimp_histogram_get_threshold (t_tool->histogram, gimp_drawable_is_rgb (drawable) ? GIMP_HISTOGRAM_RGB : GIMP_HISTOGRAM_VALUE, 0, 255); gimp_histogram_view_set_range (t_tool->histogram_box->view, low, 255.0); }