mirror of https://github.com/GNOME/gimp.git
app/xcf: Don't override channel opacity on XCF load
When loading channels, the alpha value is stored separately from the RGB value as "opacity". After the switch to GeglColor, we were overriding the opacity values by always using "R'G'B" format, so the loaded opacity was always reset to 100%. This patch pulls the opacity value before setting the color, then restores the opacity afterwards.
This commit is contained in:
parent
e409a74ec2
commit
54c46ea175
|
@ -2324,22 +2324,34 @@ xcf_load_channel_props (XcfInfo *info,
|
|||
|
||||
case PROP_COLOR:
|
||||
{
|
||||
guchar col[3];
|
||||
guchar col[3];
|
||||
gdouble opacity;
|
||||
|
||||
/* Load existing opacity */
|
||||
opacity = gimp_channel_get_opacity (*channel);
|
||||
|
||||
xcf_read_int8 (info, (guint8 *) col, 3);
|
||||
|
||||
gegl_color_set_pixel ((*channel)->color, babl_format ("R'G'B' u8"), col);
|
||||
|
||||
gimp_channel_set_opacity (*channel, opacity, FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FLOAT_COLOR:
|
||||
{
|
||||
gfloat col[3];
|
||||
gfloat col[3];
|
||||
gdouble opacity;
|
||||
|
||||
/* Load existing opacity */
|
||||
opacity = gimp_channel_get_opacity (*channel);
|
||||
|
||||
xcf_read_float (info, col, 3);
|
||||
|
||||
/* TODO: is the channel color in sRGB or in the image's color space? */
|
||||
gegl_color_set_pixel ((*channel)->color, babl_format ("R'G'B' float"), col);
|
||||
|
||||
gimp_channel_set_opacity (*channel, opacity, FALSE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue