app: enable gegl:color-to-alpha custom GUI

gegl:color-to-alpha-plus was merged back to gegl:color-to-alpha in
GEGL, so we can change the custom propgui constructor to refer to
gegl:color-to-alpha.

Remove the threshold-range compression toggle and logic, since the
corresponding property was removed in GEGL.
This commit is contained in:
Ell 2018-02-15 08:55:33 -05:00
parent f234920487
commit 4190f400b0
2 changed files with 4 additions and 83 deletions

View File

@ -37,39 +37,6 @@
#include "gimp-intl.h"
static gdouble
get_max_color_extent (GObject *config)
{
GimpRGB *color;
gdouble max_extent = 0.0;
g_object_get (config,
"color", &color,
NULL);
max_extent = MAX (max_extent, MAX (color->r, 1.0 - color->r));
max_extent = MAX (max_extent, MAX (color->g, 1.0 - color->g));
max_extent = MAX (max_extent, MAX (color->b, 1.0 - color->b));
g_free (color);
return max_extent;
}
static gdouble
compress_threshold (GObject *config,
gdouble threshold)
{
return MIN (threshold / get_max_color_extent (config), 1.0);
}
static gdouble
uncompress_threshold (GObject *config,
gdouble threshold)
{
return threshold * get_max_color_extent (config);
}
static void
threshold_picked (GObject *config,
gpointer identifier,
@ -78,22 +45,17 @@ threshold_picked (GObject *config,
const Babl *sample_format,
const GimpRGB *picked_color)
{
GimpRGB *color;
gboolean compress_threshold_range;
gdouble threshold = 0.0;
GimpRGB *color;
gdouble threshold = 0.0;
g_object_get (config,
"color", &color,
"compress-threshold-range", &compress_threshold_range,
"color", &color,
NULL);
threshold = MAX (threshold, fabs (picked_color->r - color->r));
threshold = MAX (threshold, fabs (picked_color->g - color->g));
threshold = MAX (threshold, fabs (picked_color->b - color->b));
if (compress_threshold_range)
threshold = compress_threshold (config, threshold);
g_object_set (config,
identifier, threshold,
NULL);
@ -101,37 +63,6 @@ threshold_picked (GObject *config,
g_free (color);
}
static void
compress_threshold_range_clicked (GtkWidget *toggle,
GObject *config)
{
gdouble transparency_threshold;
gdouble opacity_threshold;
gboolean compress_threshold_range;
g_object_get (config,
"transparency-threshold", &transparency_threshold,
"opacity-threshold", &opacity_threshold,
"compress-threshold-range", &compress_threshold_range,
NULL);
if (compress_threshold_range)
{
transparency_threshold = compress_threshold (config, transparency_threshold);
opacity_threshold = compress_threshold (config, opacity_threshold);
}
else
{
transparency_threshold = uncompress_threshold (config, transparency_threshold);
opacity_threshold = uncompress_threshold (config, opacity_threshold);
}
g_object_set (config,
"transparency-threshold", transparency_threshold,
"opacity-threshold", opacity_threshold,
NULL);
}
GtkWidget *
_gimp_prop_gui_new_color_to_alpha (GObject *config,
GParamSpec **param_specs,
@ -146,7 +77,6 @@ _gimp_prop_gui_new_color_to_alpha (GObject *config,
GtkWidget *button;
GtkWidget *hbox;
GtkWidget *scale;
GtkWidget *toggle;
const gchar *label;
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
@ -206,14 +136,5 @@ _gimp_prop_gui_new_color_to_alpha (GObject *config,
gtk_widget_show (button);
}
toggle = gimp_prop_widget_new (config, "compress-threshold-range",
area, context, NULL, NULL, NULL, &label);
gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
g_signal_connect (toggle, "clicked",
G_CALLBACK (compress_threshold_range_clicked),
config);
return vbox;
}

View File

@ -442,7 +442,7 @@ gui_new_funcs[] =
_gimp_prop_gui_new_hue_saturation },
{ "GimpGegl-gegl-color-rotate-config",
_gimp_prop_gui_new_color_rotate },
{ "GimpGegl-gegl-color-to-alpha-plus-config",
{ "GimpGegl-gegl-color-to-alpha-config",
_gimp_prop_gui_new_color_to_alpha },
{ "GimpGegl-gegl-convolution-matrix-config",
_gimp_prop_gui_new_convolution_matrix },