mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
libgimpcolor: gimp_color_is_perceptually_identical() also checks transparency.
When I implemented CIEDE2000 distance for verifying perceptual identity, I mistakenly lost checking the alpha channel.
This commit is contained in:
parent
b53da69f3c
commit
d1c3b104bf
1 changed files with 10 additions and 0 deletions
|
@ -122,9 +122,19 @@ gboolean
|
||||||
gimp_color_is_perceptually_identical (GeglColor *color1,
|
gimp_color_is_perceptually_identical (GeglColor *color1,
|
||||||
GeglColor *color2)
|
GeglColor *color2)
|
||||||
{
|
{
|
||||||
|
gdouble a1;
|
||||||
|
gdouble a2;
|
||||||
|
|
||||||
g_return_val_if_fail (GEGL_IS_COLOR (color1), FALSE);
|
g_return_val_if_fail (GEGL_IS_COLOR (color1), FALSE);
|
||||||
g_return_val_if_fail (GEGL_IS_COLOR (color2), FALSE);
|
g_return_val_if_fail (GEGL_IS_COLOR (color2), FALSE);
|
||||||
|
|
||||||
|
gegl_color_get_rgba (color1, NULL, NULL, NULL, &a1);
|
||||||
|
gegl_color_get_rgba (color2, NULL, NULL, NULL, &a2);
|
||||||
|
|
||||||
|
/* With different transparency, don't look further. */
|
||||||
|
if (ABS (a1 - a2) > 1e-4)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
/* All CIE deltaE distances were designed with a 1.0 JND (Just Noticeable
|
/* All CIE deltaE distances were designed with a 1.0 JND (Just Noticeable
|
||||||
* Difference), though there was some revision to 2.3 for the CIE76 version.
|
* Difference), though there was some revision to 2.3 for the CIE76 version.
|
||||||
* I could not find a reliable source about whether such a revision happened
|
* I could not find a reliable source about whether such a revision happened
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue