mirror of https://github.com/GNOME/gimp.git
app: add new XCF property PROP_FLOAT_COLOR
We were still saving channel colors in 8 bit, this additionally saves/loads the color as float values. Still save the old PROP_COLOR for compatibility.
This commit is contained in:
parent
8df8cd03f3
commit
10360c9e13
|
@ -1404,6 +1404,16 @@ xcf_load_channel_props (XcfInfo *info,
|
|||
}
|
||||
break;
|
||||
|
||||
case PROP_FLOAT_COLOR:
|
||||
{
|
||||
gfloat col[3];
|
||||
|
||||
xcf_read_float (info, col, 3);
|
||||
|
||||
gimp_rgb_set (&(*channel)->color, col[0], col[1], col[2]);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_TATTOO:
|
||||
{
|
||||
GimpTattoo tattoo;
|
||||
|
|
|
@ -61,7 +61,8 @@ typedef enum
|
|||
PROP_COLOR_TAG = 34,
|
||||
PROP_COMPOSITE_MODE = 35,
|
||||
PROP_COMPOSITE_SPACE = 36,
|
||||
PROP_BLEND_SPACE = 37
|
||||
PROP_BLEND_SPACE = 37,
|
||||
PROP_FLOAT_COLOR = 38
|
||||
} PropType;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -571,7 +571,6 @@ xcf_save_channel_props (XcfInfo *info,
|
|||
GError **error)
|
||||
{
|
||||
GimpParasiteList *parasites;
|
||||
guchar col[3];
|
||||
|
||||
if (channel == gimp_image_get_active_channel (image))
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_ACTIVE_CHANNEL, error));
|
||||
|
@ -595,10 +594,10 @@ xcf_save_channel_props (XcfInfo *info,
|
|||
gimp_item_get_lock_position (GIMP_ITEM (channel))));
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_SHOW_MASKED, error,
|
||||
gimp_channel_get_show_masked (channel)));
|
||||
|
||||
gimp_rgb_get_uchar (&channel->color, &col[0], &col[1], &col[2]);
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_COLOR, error, col));
|
||||
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_COLOR, error,
|
||||
&channel->color));
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_FLOAT_COLOR, error,
|
||||
&channel->color));
|
||||
xcf_check_error (xcf_save_prop (info, image, PROP_TATTOO, error,
|
||||
gimp_item_get_tattoo (GIMP_ITEM (channel))));
|
||||
|
||||
|
@ -902,14 +901,35 @@ xcf_save_prop (XcfInfo *info,
|
|||
|
||||
case PROP_COLOR:
|
||||
{
|
||||
guchar *color = va_arg (args, guchar *);
|
||||
GimpRGB *color = va_arg (args, GimpRGB *);
|
||||
guchar col[3];
|
||||
|
||||
gimp_rgb_get_uchar (color, &col[0], &col[1], &col[2]);
|
||||
|
||||
size = 3;
|
||||
|
||||
xcf_write_prop_type_check_error (info, prop_type);
|
||||
xcf_write_int32_check_error (info, &size, 1);
|
||||
|
||||
xcf_write_int8_check_error (info, color, 3);
|
||||
xcf_write_int8_check_error (info, col, 3);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_FLOAT_COLOR:
|
||||
{
|
||||
GimpRGB *color = va_arg (args, GimpRGB *);
|
||||
gfloat col[3];
|
||||
|
||||
col[0] = color->r;
|
||||
col[1] = color->g;
|
||||
col[2] = color->b;
|
||||
|
||||
size = 3 * 4;
|
||||
|
||||
xcf_write_prop_type_check_error (info, prop_type);
|
||||
xcf_write_int32_check_error (info, &size, 1);
|
||||
|
||||
xcf_write_float_check_error (info, col, 3);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue