1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

core, widgets: Convert HSV/A to float

Per Pippin, the only color model that can
have double precision is RGB/A.
Therefore, we need to switch all others to
use float instead. This patch converts the
HSV and HSVA double babl formats.
This commit is contained in:
Alx Sa
2024-04-21 03:42:27 +00:00
parent 2dc6f41114
commit 32d64ab1c9
11 changed files with 117 additions and 102 deletions

View File

@@ -1030,6 +1030,7 @@ gimp_scanner_parse_deprecated_color (GimpScanner *scanner,
case G_TOKEN_SYMBOL:
{
gdouble col[4] = { 0.0, 0.0, 0.0, 1.0 };
gdouble col_f[4] = { 0.0, 0.0, 0.0, 1.0 };
gint n_channels = 4;
gboolean is_hsv = FALSE;
gint i;
@@ -1056,11 +1057,13 @@ gimp_scanner_parse_deprecated_color (GimpScanner *scanner,
{
if (! gimp_scanner_parse_float (scanner, &col[i]))
goto finish;
col_f[i] = (gfloat) col[i];
}
*color = gegl_color_new (NULL);
if (is_hsv)
gegl_color_set_pixel (*color, babl_format ("HSVA double"), col);
gegl_color_set_pixel (*color, babl_format ("HSVA float"), col_f);
else
gegl_color_set_pixel (*color, babl_format ("R'G'B'A double"), col);