gboolean invert_color(ClutterActor * actor) { ClutterColor color; clutter_actor_get_background_color(actor, & color); color.red = ~ color.red; color.green = ~ color.green; color.blue = ~ color.blue; clutter_actor_set_background_color(actor, & color); }
/* Sets our material to paint with a 1x1 texture of the stage's background * color; doing this when we have no pixmap allows the application to turn * off painting the stage. There might be a performance benefit to * painting in this case with a solid color, but the normal solid color * case is a 1x1 root pixmap, so we'd have to reverse-engineer that to * actually pick up the (small?) performance win. This is just a fallback. */ static void set_texture_to_stage_color (MetaScreenBackground *background) { ClutterActor *stage = meta_get_stage_for_screen (background->screen); ClutterColor color; CoglTexture *texture; clutter_actor_get_background_color (stage, &color); /* Slicing will prevent COGL from using hardware texturing for * the tiled 1x1 pixmap, and will cause it to draw the window * background in millions of separate 1x1 rectangles */ texture = meta_create_color_texture_4ub (color.red, color.green, color.blue, 0xff, COGL_TEXTURE_NO_SLICING); set_texture (background, texture); cogl_object_unref (texture); }