mirror of https://github.com/GNOME/gimp.git
app: add gimp_gegl_node_set_color() and use it in GimpChannel
This commit is contained in:
parent
e0c64a817d
commit
41c92af49b
|
@ -401,7 +401,6 @@ gimp_channel_get_node (GimpFilter *filter)
|
|||
GeglNode *node;
|
||||
GeglNode *source;
|
||||
GeglNode *mode_node;
|
||||
GeglColor *color;
|
||||
const Babl *color_format;
|
||||
|
||||
node = GIMP_FILTER_CLASS (parent_class)->get_node (filter);
|
||||
|
@ -409,8 +408,6 @@ gimp_channel_get_node (GimpFilter *filter)
|
|||
source = gimp_drawable_get_source_node (drawable);
|
||||
gegl_node_add_child (node, source);
|
||||
|
||||
color = gimp_gegl_color_new (&channel->color);
|
||||
|
||||
g_warn_if_fail (channel->color_node == NULL);
|
||||
|
||||
if (gimp_drawable_get_linear (drawable))
|
||||
|
@ -420,11 +417,10 @@ gimp_channel_get_node (GimpFilter *filter)
|
|||
|
||||
channel->color_node = gegl_node_new_child (node,
|
||||
"operation", "gegl:color",
|
||||
"value", color,
|
||||
"format", color_format,
|
||||
NULL);
|
||||
|
||||
g_object_unref (color);
|
||||
gimp_gegl_node_set_color (channel->color_node,
|
||||
&channel->color);
|
||||
|
||||
g_warn_if_fail (channel->mask_node == NULL);
|
||||
|
||||
|
@ -1699,13 +1695,8 @@ gimp_channel_set_color (GimpChannel *channel,
|
|||
|
||||
if (gimp_filter_peek_node (GIMP_FILTER (channel)))
|
||||
{
|
||||
GeglColor *gegl_color = gimp_gegl_color_new (&channel->color);
|
||||
|
||||
gegl_node_set (channel->color_node,
|
||||
"value", gegl_color,
|
||||
NULL);
|
||||
|
||||
g_object_unref (gegl_color);
|
||||
gimp_gegl_node_set_color (channel->color_node,
|
||||
&channel->color);
|
||||
}
|
||||
|
||||
gimp_drawable_update (GIMP_DRAWABLE (channel),
|
||||
|
@ -1758,13 +1749,8 @@ gimp_channel_set_opacity (GimpChannel *channel,
|
|||
|
||||
if (gimp_filter_peek_node (GIMP_FILTER (channel)))
|
||||
{
|
||||
GeglColor *gegl_color = gimp_gegl_color_new (&channel->color);
|
||||
|
||||
gegl_node_set (channel->color_node,
|
||||
"value", gegl_color,
|
||||
NULL);
|
||||
|
||||
g_object_unref (gegl_color);
|
||||
gimp_gegl_node_set_color (channel->color_node,
|
||||
&channel->color);
|
||||
}
|
||||
|
||||
gimp_drawable_update (GIMP_DRAWABLE (channel),
|
||||
|
|
|
@ -184,6 +184,9 @@ gimp_gegl_mode_node_set_mode (GeglNode *node,
|
|||
"opacity", &opacity,
|
||||
NULL);
|
||||
|
||||
/* setting the operation creates a new instance, so we have to set
|
||||
* all its properties
|
||||
*/
|
||||
gegl_node_set (node,
|
||||
"operation", operation,
|
||||
"linear", linear,
|
||||
|
@ -219,3 +222,21 @@ gimp_gegl_node_set_matrix (GeglNode *node,
|
|||
|
||||
g_free (matrix_string);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_gegl_node_set_color (GeglNode *node,
|
||||
const GimpRGB *color)
|
||||
{
|
||||
GeglColor *gegl_color;
|
||||
|
||||
g_return_if_fail (GEGL_IS_NODE (node));
|
||||
g_return_if_fail (color != NULL);
|
||||
|
||||
gegl_color = gimp_gegl_color_new (color);
|
||||
|
||||
gegl_node_set (node,
|
||||
"value", gegl_color,
|
||||
NULL);
|
||||
|
||||
g_object_unref (gegl_color);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,8 @@ void gimp_gegl_mode_node_set_opacity (GeglNode *node,
|
|||
gdouble opacity);
|
||||
void gimp_gegl_node_set_matrix (GeglNode *node,
|
||||
const GimpMatrix3 *matrix);
|
||||
void gimp_gegl_node_set_color (GeglNode *node,
|
||||
const GimpRGB *color);
|
||||
|
||||
|
||||
#endif /* __GIMP_GEGL_NODES_H__ */
|
||||
|
|
Loading…
Reference in New Issue