mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
libgimpconfig: support the GimpRGB format for GeglColor.
Some old config files will contain (color-rgb) contents. Also some data, such as historical tool presets (.gtp files) will have such values in their (tool-options).
This commit is contained in:
parent
cd32b3bffa
commit
b1178c51a3
1 changed files with 17 additions and 1 deletions
|
@ -1101,7 +1101,23 @@ gimp_config_deserialize_color (GValue *value,
|
||||||
|
|
||||||
token = g_scanner_peek_next_token (scanner);
|
token = g_scanner_peek_next_token (scanner);
|
||||||
|
|
||||||
if (token == G_TOKEN_IDENTIFIER)
|
if (token == G_TOKEN_LEFT_PAREN)
|
||||||
|
{
|
||||||
|
GeglColor *color;
|
||||||
|
GimpRGB rgb;
|
||||||
|
|
||||||
|
/* Support historical GimpRGB format which may be stored in various config
|
||||||
|
* files, but even some data (such as GTP tool presets which contains
|
||||||
|
* tool-options which are GimpContext).
|
||||||
|
*/
|
||||||
|
if (! gimp_scanner_parse_color (scanner, &rgb))
|
||||||
|
return G_TOKEN_NONE;
|
||||||
|
|
||||||
|
color = gegl_color_new (NULL);
|
||||||
|
gegl_color_set_pixel (color, babl_format ("R'G'B'A double"), &rgb);
|
||||||
|
g_value_take_object (value, color);
|
||||||
|
}
|
||||||
|
else if (token == G_TOKEN_IDENTIFIER)
|
||||||
{
|
{
|
||||||
g_scanner_get_next_token (scanner);
|
g_scanner_get_next_token (scanner);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue