mirror of https://github.com/GNOME/gimp.git
libgimpwidgets, app/core: Fix babl formats to float
This patch converts the last instances of non-RGBA color models from double to float for babl formats.
This commit is contained in:
parent
3833ab2b1d
commit
2286a447c1
|
@ -132,8 +132,8 @@ gimp_gradient_class_init (GimpGradientClass *klass)
|
|||
fish_linear_rgb_to_srgb = babl_fish (babl_format ("RGB double"),
|
||||
babl_format ("R'G'B' double"));
|
||||
fish_srgb_to_cie_lab = babl_fish (babl_format ("R'G'B' double"),
|
||||
babl_format ("CIE Lab double"));
|
||||
fish_cie_lab_to_srgb = babl_fish (babl_format ("CIE Lab double"),
|
||||
babl_format ("CIE Lab float"));
|
||||
fish_cie_lab_to_srgb = babl_fish (babl_format ("CIE Lab float"),
|
||||
babl_format ("R'G'B' double"));
|
||||
}
|
||||
|
||||
|
@ -552,6 +552,7 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
|
|||
|
||||
if (seg->color == GIMP_GRADIENT_SEGMENT_RGB)
|
||||
{
|
||||
gfloat float_components[3];
|
||||
gdouble left_components[3];
|
||||
gdouble right_components[3];
|
||||
gdouble ret_components[3];
|
||||
|
@ -559,8 +560,13 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
|
|||
switch (blend_color_space)
|
||||
{
|
||||
case GIMP_GRADIENT_BLEND_CIE_LAB:
|
||||
gegl_color_get_pixel (left_color, babl_format ("CIE Lab double"), left_components);
|
||||
gegl_color_get_pixel (right_color, babl_format ("CIE Lab double"), right_components);
|
||||
gegl_color_get_pixel (left_color, babl_format ("CIE Lab float"), float_components);
|
||||
for (gint i = 0; i < 3; i++)
|
||||
left_components[i] = float_components[i];
|
||||
|
||||
gegl_color_get_pixel (right_color, babl_format ("CIE Lab float"), float_components);
|
||||
for (gint i = 0; i < 3; i++)
|
||||
right_components[i] = float_components[i];
|
||||
break;
|
||||
|
||||
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
|
||||
|
@ -582,7 +588,9 @@ gimp_gradient_get_color_at (GimpGradient *gradient,
|
|||
switch (blend_color_space)
|
||||
{
|
||||
case GIMP_GRADIENT_BLEND_CIE_LAB:
|
||||
gegl_color_set_pixel (*color, babl_format ("CIE Lab double"), ret_components);
|
||||
for (gint i = 0; i < 3; i++)
|
||||
float_components[i] = (gfloat) ret_components[i];
|
||||
gegl_color_set_pixel (*color, babl_format ("CIE Lab float"), float_components);
|
||||
break;
|
||||
|
||||
case GIMP_GRADIENT_BLEND_RGB_LINEAR:
|
||||
|
|
|
@ -583,11 +583,11 @@ gimp_palette_load_aco (GimpContext *context,
|
|||
}
|
||||
else if (color_space == 7) /* CIE Lab */
|
||||
{
|
||||
gdouble lab[3] = { ((gdouble) w) / 10000.0,
|
||||
((gdouble) xLab) / 25500.0,
|
||||
((gdouble) yLab) / 25500.0 };
|
||||
gfloat lab[3] = { ((gfloat) w) / 10000.0f,
|
||||
((gfloat) xLab) / 25500.0f,
|
||||
((gfloat) yLab) / 25500.0f };
|
||||
|
||||
gegl_color_set_pixel (color, babl_format ("CIE Lab double"), lab);
|
||||
gegl_color_set_pixel (color, babl_format ("CIE Lab float"), lab);
|
||||
color_ok = TRUE;
|
||||
}
|
||||
else if (color_space == 8) /* Grayscale */
|
||||
|
|
|
@ -896,7 +896,7 @@ gimp_color_scales_scale_changed (GtkWidget *scale,
|
|||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
|
||||
GeglColor *color = gimp_color_selector_get_color (selector);
|
||||
gdouble value = gimp_label_spin_get_value (GIMP_LABEL_SPIN (scale));
|
||||
gdouble lch[4];
|
||||
gfloat lch[4];
|
||||
gfloat hsv[4];
|
||||
gdouble rgb[4];
|
||||
gint i;
|
||||
|
@ -907,7 +907,7 @@ gimp_color_scales_scale_changed (GtkWidget *scale,
|
|||
|
||||
gegl_color_get_pixel (color, babl_format_with_space ("R'G'B'A double", scales->format), rgb);
|
||||
gegl_color_get_pixel (color, babl_format_with_space ("HSVA float", scales->format), hsv);
|
||||
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) alpha double"), lch);
|
||||
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) alpha float"), lch);
|
||||
|
||||
switch (i)
|
||||
{
|
||||
|
@ -940,15 +940,15 @@ gimp_color_scales_scale_changed (GtkWidget *scale,
|
|||
break;
|
||||
|
||||
case GIMP_COLOR_SELECTOR_LCH_LIGHTNESS:
|
||||
lch[0] = value;
|
||||
lch[0] = (gfloat) value;
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_SELECTOR_LCH_CHROMA:
|
||||
lch[1] = value;
|
||||
lch[1] = (gfloat) value;
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_SELECTOR_LCH_HUE:
|
||||
lch[2] = value;
|
||||
lch[2] = (gfloat) value;
|
||||
break;
|
||||
|
||||
case GIMP_COLOR_SELECTOR_RED_U8:
|
||||
|
@ -977,7 +977,7 @@ gimp_color_scales_scale_changed (GtkWidget *scale,
|
|||
else if ((i >= GIMP_COLOR_SELECTOR_LCH_LIGHTNESS) &&
|
||||
(i <= GIMP_COLOR_SELECTOR_LCH_HUE))
|
||||
{
|
||||
gegl_color_set_pixel (color, babl_format ("CIE LCH(ab) alpha double"), lch);
|
||||
gegl_color_set_pixel (color, babl_format ("CIE LCH(ab) alpha float"), lch);
|
||||
}
|
||||
else if (((i >= GIMP_COLOR_SELECTOR_RED) &&
|
||||
(i <= GIMP_COLOR_SELECTOR_BLUE)) ||
|
||||
|
|
|
@ -176,7 +176,7 @@ struct _ColorSelectFill
|
|||
gint height;
|
||||
gfloat rgb[3];
|
||||
gfloat hsv[3];
|
||||
gdouble lch[4];
|
||||
gfloat lch[4];
|
||||
guchar oog_color[3];
|
||||
|
||||
ColorSelectRenderFunc render_line;
|
||||
|
@ -1433,7 +1433,7 @@ gimp_color_select_render (GtkWidget *preview,
|
|||
|
||||
gegl_color_get_pixel (color, rgbf_format, csf.rgb);
|
||||
gegl_color_get_pixel (color, hsvf_format, csf.hsv);
|
||||
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) alpha double"), csf.lch);
|
||||
gegl_color_get_pixel (color, babl_format ("CIE LCH(ab) alpha float"), csf.lch);
|
||||
|
||||
csf.oog_color[0] = oog_color[0];
|
||||
csf.oog_color[1] = oog_color[1];
|
||||
|
|
Loading…
Reference in New Issue