mirror of https://github.com/GNOME/gimp.git
Issue #10853: support GeglColor return type in script-fu.
Right now, I just transform any GeglColor return value into a RGB u8 triplet, because that's also how we were supporting GimpRGB anyway, though it's seriously limited. Ideally we'd add some real concept of generic color abstraction in Script-fu too, which could support any color model, space and precision.
This commit is contained in:
parent
5ad18094db
commit
9955c00076
|
@ -381,6 +381,29 @@ marshal_returned_PDB_value (scheme *sc,
|
|||
}
|
||||
/* Ensure result holds a string, possibly empty. */
|
||||
}
|
||||
else if (GIMP_VALUE_HOLDS_COLOR (value))
|
||||
{
|
||||
GeglColor *color;
|
||||
guchar rgb[3] = { 0 };
|
||||
gpointer temp_val;
|
||||
|
||||
color = g_value_get_object (value);
|
||||
if (color)
|
||||
gegl_color_get_pixel (color, babl_format ("R'G'B' u8"), rgb);
|
||||
|
||||
temp_val = sc->vptr->cons
|
||||
(sc,
|
||||
sc->vptr->mk_integer (sc, rgb[0]),
|
||||
sc->vptr->cons
|
||||
(sc,
|
||||
sc->vptr->mk_integer (sc, rgb[1]),
|
||||
sc->vptr->cons
|
||||
(sc,
|
||||
sc->vptr->mk_integer (sc, rgb[2]),
|
||||
sc->NIL)));
|
||||
|
||||
result = temp_val;
|
||||
}
|
||||
else if (G_VALUE_HOLDS_OBJECT (value))
|
||||
{
|
||||
/* G_VALUE_HOLDS_OBJECT only ensures value derives from GObject.
|
||||
|
@ -612,4 +635,4 @@ marshal_returned_PDB_value (scheme *sc,
|
|||
|| (result != NULL && *error == NULL));
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue