stage: Add :use-alpha property
The ClutterStage:use-alpha property is used to let a stage know that it should honour the alpha component of the ClutterStage:color property. If :use-alpha is set to FALSE the stage always uses the full opacity when clearing itself before a paint(); otherwise, the alpha value is used.
This commit is contained in:
parent
1d87ecc6a1
commit
2f7ff4d3e3
@ -96,6 +96,7 @@ struct _ClutterStagePrivate
|
||||
guint is_user_resizable : 1;
|
||||
guint use_fog : 1;
|
||||
guint throttle_motion_events : 1;
|
||||
guint use_alpha : 1;
|
||||
};
|
||||
|
||||
enum
|
||||
@ -110,7 +111,8 @@ enum
|
||||
PROP_TITLE,
|
||||
PROP_USER_RESIZE,
|
||||
PROP_USE_FOG,
|
||||
PROP_FOG
|
||||
PROP_FOG,
|
||||
PROP_USE_ALPHA
|
||||
};
|
||||
|
||||
enum
|
||||
@ -250,7 +252,9 @@ clutter_stage_paint (ClutterActor *self)
|
||||
priv->color.red,
|
||||
priv->color.green,
|
||||
priv->color.blue,
|
||||
priv->color.alpha);
|
||||
priv->use_alpha
|
||||
? priv->color.alpha
|
||||
: 255);
|
||||
cogl_clear (&stage_color,
|
||||
COGL_BUFFER_BIT_COLOR |
|
||||
COGL_BUFFER_BIT_DEPTH);
|
||||
@ -289,7 +293,8 @@ clutter_stage_pick (ClutterActor *self,
|
||||
*/
|
||||
|
||||
clutter_container_foreach (CLUTTER_CONTAINER (self),
|
||||
CLUTTER_CALLBACK (clutter_actor_paint), NULL);
|
||||
CLUTTER_CALLBACK (clutter_actor_paint),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -660,6 +665,11 @@ clutter_stage_set_property (GObject *object,
|
||||
clutter_stage_set_fog (stage, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
case PROP_USE_ALPHA:
|
||||
stage->priv->use_alpha = g_value_get_boolean (value);
|
||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -712,6 +722,10 @@ clutter_stage_get_property (GObject *gobject,
|
||||
g_value_set_boxed (value, &priv->fog);
|
||||
break;
|
||||
|
||||
case PROP_USE_ALPHA:
|
||||
g_value_set_boolean (value, priv->use_alpha);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -939,6 +953,24 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_FOG, pspec);
|
||||
|
||||
/**
|
||||
* ClutterStage:use-alpha:
|
||||
*
|
||||
* Whether the #ClutterStage should honour the alpha component of the
|
||||
* #ClutterStage:color property when painting. If Clutter is run under
|
||||
* a compositing manager this will result in the stage being blended
|
||||
* with the underlying window(s)
|
||||
*
|
||||
* Since: 1.2
|
||||
*/
|
||||
pspec = g_param_spec_boolean ("use-alpha",
|
||||
"Use Alpha",
|
||||
"Whether to honour the alpha component of "
|
||||
"the stage color",
|
||||
FALSE,
|
||||
CLUTTER_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_USE_ALPHA, pspec);
|
||||
|
||||
/**
|
||||
* ClutterStage::fullscreen
|
||||
* @stage: the stage which was fullscreened
|
||||
|
Loading…
Reference in New Issue
Block a user