GNOME Bugzilla – Bug 721412
Add blending color/string for ClutterImage
Last modified: 2021-06-10 11:31:11 UTC
Following a request on the mailing list, just proposing a patch. I'm pretty sure we could fine a more generic way to do this, given that people might want thing for ClutterCanvas too.
Created attachment 265234 [details] [review] image/texture-node: add blend-string/blend-color strings
Created attachment 265235 [details] JS test showing how to use blending
Review of attachment 265234 [details] [review]: ::: clutter/clutter-image.c @@ +190,3 @@ + * ClutterImage:blend-string: + * + * A string describing the blending algorithm. I *definitely* don't want ClutterImage to start speaking Cogl blend strings. ::: clutter/clutter-paint-nodes.c @@ +673,3 @@ +static ClutterPaintNode * +_clutter_texture_node_new (CoglTexture *texture, static functions do not need the '_' prefix. it should also be called 'new_internal'. @@ +675,3 @@ +_clutter_texture_node_new (CoglTexture *texture, + const ClutterColor *color, + const gchar *blend, no, I don't want blend strings from Cogl in the public API. I want to minimize the amount of Cogl concepts in the Clutter API, and blend strings are a pure Cogl concept (one that is pretty much superseded by shaders anyway). accessing Cogl should be a conscious decision made by a developer, mostly through the implementation of a new ClutterContent using ClutterPipelineNode, since *that* exposes the Cogl guts. @@ +715,3 @@ + g_warning ("Couldn't set blending string `%s' : %s", blend, error->message); + clutter_paint_node_unref ((ClutterPaintNode *) tnode); + return NULL; constructors should never return NULL without a corresponding GError. @@ +725,3 @@ + blend_color->blue, + blend_color->alpha); + } wrong comment style. also, debugging code leftover? @@ +793,3 @@ + */ +ClutterPaintNode * + return _clutter_texture_node_new (texture, color, NULL, NULL, min_filter, mag_filter); I don't think you should modify the constructor. instead, adding a clutter_texture_node_set_blend_color() should be enough.
the "color" parameter to clutter_texture_node_new() is the tinting for the texture data; I may accept functions that modify the internal CoglPipeline for a ClutterTextureNode, but they should: • set through setters (and getters) to be applied after the TextureNode is created • not use Cogl data types or Cogl concepts like blend strings
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version of clutter, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a ticket at https://gitlab.gnome.org/GNOME/clutter/-/issues/ Thank you for your understanding and your help.