mirror of https://github.com/GNOME/gimp.git
propgui: Port Color-To-Alpha GUI to GeglColor
The two threshold color pick buttons needed to have a GeglColor parameter for their GimpPickerCallback rather than a const GimpRGB. This also fixes a crash caused by trying to free the GeglColor rather than unreferencing it.
This commit is contained in:
parent
2c664fac72
commit
2b62976260
|
@ -43,24 +43,30 @@ threshold_picked (GObject *config,
|
||||||
gdouble x,
|
gdouble x,
|
||||||
gdouble y,
|
gdouble y,
|
||||||
const Babl *sample_format,
|
const Babl *sample_format,
|
||||||
const GimpRGB *picked_color)
|
GeglColor *picked_color)
|
||||||
{
|
{
|
||||||
GimpRGB *color;
|
GeglColor *color;
|
||||||
gdouble threshold = 0.0;
|
gdouble threshold = 0.0;
|
||||||
|
gdouble rgb[3];
|
||||||
|
gdouble picked_rgb[3];
|
||||||
|
|
||||||
g_object_get (config,
|
g_object_get (config,
|
||||||
"color", &color,
|
"color", &color,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
threshold = MAX (threshold, fabs (picked_color->r - color->r));
|
gegl_color_get_pixel (color, babl_format ("R'G'B' double"), rgb);
|
||||||
threshold = MAX (threshold, fabs (picked_color->g - color->g));
|
gegl_color_get_pixel (picked_color, babl_format ("R'G'B' double"),
|
||||||
threshold = MAX (threshold, fabs (picked_color->b - color->b));
|
picked_rgb);
|
||||||
|
|
||||||
|
threshold = MAX (threshold, fabs (picked_rgb[0] - rgb[0]));
|
||||||
|
threshold = MAX (threshold, fabs (picked_rgb[1] - rgb[1]));
|
||||||
|
threshold = MAX (threshold, fabs (picked_rgb[2] - rgb[2]));
|
||||||
|
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
identifier, threshold,
|
identifier, threshold,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
g_free (color);
|
g_object_unref (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
|
|
Loading…
Reference in New Issue