mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
2007-01-30 Tomas Frydrych <tf@openedhand.com>
* clutter/clutter-actor.c: * clutter/clutter-actor.h: Added new clutter_actor_move_anchor_point_ API. * clutter/clutter-behaviour-scale.c: * clutter/clutter-behaviour-scale.h: * clutter/clutter-effect.c: * clutter/clutter-effect.h: * tests/test-actors.c: * tests/test-effects.c: * tests/test-scale.c: Removed gravity from ClutterBehaviourScale.
This commit is contained in:
parent
5bf265fbae
commit
4a1e765e19
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2007-01-30 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
* clutter/clutter-actor.h:
|
||||
Added new clutter_actor_move_anchor_point_ API.
|
||||
|
||||
* clutter/clutter-behaviour-scale.c:
|
||||
* clutter/clutter-behaviour-scale.h:
|
||||
* clutter/clutter-effect.c:
|
||||
* clutter/clutter-effect.h:
|
||||
* tests/test-actors.c:
|
||||
* tests/test-effects.c:
|
||||
* tests/test-scale.c:
|
||||
Removed gravity from ClutterBehaviourScale.
|
||||
|
||||
2008-01-27 Emmanuele Bassi <ebassi@openedhand.com>
|
||||
|
||||
* tests/test-depth.c (main): Use a group instead of pushing
|
||||
|
@ -49,6 +49,9 @@
|
||||
* </listitem>
|
||||
* </orderedlist>
|
||||
*
|
||||
* NB: the position of any children is referenced from the top-left corner of
|
||||
* the parent, not the parent's anchor point.
|
||||
*
|
||||
* Event handling
|
||||
* <orderedlist>
|
||||
* <listitem><para>Actors emit pointer events if set reactive, see
|
||||
@ -186,14 +189,14 @@ struct _ClutterActorPrivate
|
||||
|
||||
/* depth */
|
||||
ClutterUnit z;
|
||||
|
||||
|
||||
guint8 opacity;
|
||||
|
||||
|
||||
ClutterActor *parent_actor;
|
||||
|
||||
|
||||
gchar *name;
|
||||
guint32 id; /* Unique ID */
|
||||
|
||||
|
||||
ClutterFixed scale_x;
|
||||
ClutterFixed scale_y;
|
||||
|
||||
@ -203,7 +206,7 @@ struct _ClutterActorPrivate
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
|
||||
PROP_NAME,
|
||||
|
||||
PROP_X,
|
||||
@ -214,7 +217,7 @@ enum
|
||||
|
||||
PROP_CLIP,
|
||||
PROP_HAS_CLIP,
|
||||
|
||||
|
||||
PROP_OPACITY,
|
||||
PROP_VISIBLE,
|
||||
PROP_REACTIVE,
|
||||
@ -4035,6 +4038,44 @@ clutter_actor_set_anchor_point (ClutterActor *self,
|
||||
priv->anchor_y = CLUTTER_UNITS_FROM_DEVICE (anchor_y);
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_move_anchor_point:
|
||||
* @self: a #ClutterActor
|
||||
* @anchor_x: X coordinate of the anchor point
|
||||
* @anchor_y: Y coordinate of the anchor point
|
||||
*
|
||||
* Sets an anchor point for the @actor, and adjusts the actor postion so that
|
||||
* the relative position of the actor toward its parent remains the same.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_move_anchor_point (ClutterActor *self,
|
||||
gint anchor_x,
|
||||
gint anchor_y)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
ClutterUnit ax = CLUTTER_UNITS_FROM_DEVICE (anchor_x);
|
||||
ClutterUnit ay = CLUTTER_UNITS_FROM_DEVICE (anchor_y);
|
||||
ClutterUnit dx;
|
||||
ClutterUnit dy;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
dx = ax - priv->anchor_x;
|
||||
dy = ay - priv->anchor_y;
|
||||
|
||||
priv->anchor_x = ax;
|
||||
priv->anchor_y = ay;
|
||||
|
||||
priv->coords.x1 -= dx;
|
||||
priv->coords.x2 -= dx;
|
||||
priv->coords.y1 -= dy;
|
||||
priv->coords.y2 -= dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_anchor_point:
|
||||
* @self: a #ClutterActor
|
||||
@ -4091,6 +4132,42 @@ clutter_actor_set_anchor_pointu (ClutterActor *self,
|
||||
priv->anchor_y = anchor_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_move_anchor_pointu:
|
||||
* @self: a #ClutterActor
|
||||
* @anchor_x: X coordinate of the anchor point
|
||||
* @anchor_y: Y coordinate of the anchor point
|
||||
*
|
||||
* Sets an anchor point for the @actor, and adjusts the actor postion so that
|
||||
* the relative position of the actor toward its parent remains the same.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_move_anchor_pointu (ClutterActor *self,
|
||||
ClutterUnit anchor_x,
|
||||
ClutterUnit anchor_y)
|
||||
{
|
||||
ClutterActorPrivate *priv;
|
||||
ClutterUnit dx;
|
||||
ClutterUnit dy;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
dx = anchor_x - priv->anchor_x;
|
||||
dy = anchor_y - priv->anchor_y;
|
||||
|
||||
priv->anchor_x = anchor_x;
|
||||
priv->anchor_y = anchor_y;
|
||||
|
||||
priv->coords.x1 -= dx;
|
||||
priv->coords.x2 -= dx;
|
||||
priv->coords.y1 -= dy;
|
||||
priv->coords.y2 -= dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_get_anchor_pointu:
|
||||
* @self: a #ClutterActor
|
||||
@ -4119,6 +4196,42 @@ clutter_actor_get_anchor_pointu (ClutterActor *self,
|
||||
*anchor_y = priv->anchor_y;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_move_anchor_point_from_gravity:
|
||||
* @self: a #ClutterActor
|
||||
* @gravity: #ClutterGravity.
|
||||
*
|
||||
* Sets an anchor point of the actor based on the given gravity, adjusting the
|
||||
* actor postion so that its relative position within its parent remainst
|
||||
* unchanged.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
|
||||
ClutterGravity gravity)
|
||||
{
|
||||
ClutterUnit ax, ay, dx, dy;
|
||||
ClutterActorPrivate *priv;
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
priv = self->priv;
|
||||
|
||||
ax = priv->anchor_x;
|
||||
ay = priv->anchor_y;
|
||||
|
||||
clutter_actor_set_anchor_point_from_gravity (self, gravity);
|
||||
|
||||
dx = ax - priv->anchor_x;
|
||||
dy = ay - priv->anchor_y;
|
||||
|
||||
priv->coords.x1 -= dx;
|
||||
priv->coords.x2 -= dx;
|
||||
priv->coords.y1 -= dy;
|
||||
priv->coords.y2 -= dy;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_set_anchor_point_from_gravity:
|
||||
* @self: a #ClutterActor
|
||||
|
@ -432,18 +432,26 @@ void clutter_actor_set_shader_param (ClutterActor *self,
|
||||
void clutter_actor_set_anchor_point (ClutterActor *self,
|
||||
gint anchor_x,
|
||||
gint anchor_y);
|
||||
void clutter_actor_move_anchor_point (ClutterActor *self,
|
||||
gint anchor_x,
|
||||
gint anchor_y);
|
||||
void clutter_actor_get_anchor_point (ClutterActor *self,
|
||||
gint *anchor_x,
|
||||
gint *anchor_y);
|
||||
void clutter_actor_set_anchor_pointu (ClutterActor *self,
|
||||
ClutterUnit anchor_x,
|
||||
ClutterUnit anchor_y);
|
||||
void clutter_actor_move_anchor_pointu (ClutterActor *self,
|
||||
ClutterUnit anchor_x,
|
||||
ClutterUnit anchor_y);
|
||||
void clutter_actor_get_anchor_pointu (ClutterActor *self,
|
||||
ClutterUnit *anchor_x,
|
||||
ClutterUnit *anchor_y);
|
||||
void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
|
||||
ClutterGravity gravity);
|
||||
|
||||
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
|
||||
ClutterGravity gravity);
|
||||
gboolean clutter_actor_transform_stage_point (ClutterActor *self,
|
||||
ClutterUnit x,
|
||||
ClutterUnit y,
|
||||
|
@ -56,8 +56,6 @@ struct _ClutterBehaviourScalePrivate
|
||||
ClutterFixed y_scale_start;
|
||||
ClutterFixed x_scale_end;
|
||||
ClutterFixed y_scale_end;
|
||||
|
||||
ClutterGravity gravity;
|
||||
};
|
||||
|
||||
#define CLUTTER_BEHAVIOUR_SCALE_GET_PRIVATE(obj) \
|
||||
@ -73,7 +71,6 @@ enum
|
||||
PROP_Y_SCALE_START,
|
||||
PROP_X_SCALE_END,
|
||||
PROP_Y_SCALE_END,
|
||||
PROP_SCALE_GRAVITY
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
@ -89,13 +86,6 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
|
||||
ClutterBehaviourScalePrivate *priv =
|
||||
CLUTTER_BEHAVIOUR_SCALE (behaviour)->priv;
|
||||
ScaleFrameClosure *closure = data;
|
||||
ClutterGravity gravity = priv->gravity;
|
||||
|
||||
/* Don't mess with the actor anchor point of gravity is set to
|
||||
* none
|
||||
*/
|
||||
if (gravity != CLUTTER_GRAVITY_NONE)
|
||||
clutter_actor_set_anchor_point_from_gravity (actor, gravity);
|
||||
|
||||
clutter_actor_set_scalex (actor, closure->scale_x, closure->scale_y);
|
||||
}
|
||||
@ -152,9 +142,6 @@ clutter_behaviour_scale_set_property (GObject *gobject,
|
||||
case PROP_Y_SCALE_END:
|
||||
priv->y_scale_end = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||
break;
|
||||
case PROP_SCALE_GRAVITY:
|
||||
priv->gravity = g_value_get_enum (value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -185,9 +172,6 @@ clutter_behaviour_scale_get_property (GObject *gobject,
|
||||
case PROP_Y_SCALE_END:
|
||||
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->y_scale_end));
|
||||
break;
|
||||
case PROP_SCALE_GRAVITY:
|
||||
g_value_set_enum (value, priv->gravity);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@ -263,22 +247,6 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
|
||||
0.0, G_MAXDOUBLE,
|
||||
1.0,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
/**
|
||||
* ClutterBehaviourScale:gravity:
|
||||
*
|
||||
* The gravity of the scaling.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_SCALE_GRAVITY,
|
||||
g_param_spec_enum ("scale-gravity",
|
||||
"Scale Gravity",
|
||||
"The gravity of the scaling",
|
||||
CLUTTER_TYPE_GRAVITY,
|
||||
CLUTTER_GRAVITY_CENTER,
|
||||
CLUTTER_PARAM_READWRITE));
|
||||
|
||||
|
||||
behave_class->alpha_notify = clutter_behaviour_scale_alpha_notify;
|
||||
|
||||
@ -294,7 +262,6 @@ clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
||||
|
||||
priv->x_scale_start = priv->x_scale_end = CFX_ONE;
|
||||
priv->y_scale_start = priv->y_scale_end = CFX_ONE;
|
||||
priv->gravity = CLUTTER_GRAVITY_CENTER;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -304,7 +271,6 @@ clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
* @gravity: a #ClutterGravity for the scale.
|
||||
*
|
||||
* Creates a new #ClutterBehaviourScale instance.
|
||||
*
|
||||
@ -317,8 +283,7 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end,
|
||||
ClutterGravity gravity)
|
||||
gdouble y_scale_end)
|
||||
{
|
||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||
|
||||
@ -326,8 +291,7 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
CLUTTER_FLOAT_TO_FIXED (x_scale_start),
|
||||
CLUTTER_FLOAT_TO_FIXED (y_scale_start),
|
||||
CLUTTER_FLOAT_TO_FIXED (x_scale_end),
|
||||
CLUTTER_FLOAT_TO_FIXED (y_scale_end),
|
||||
gravity);
|
||||
CLUTTER_FLOAT_TO_FIXED (y_scale_end));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -337,7 +301,6 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
* @y_scale_start: initial scale factor on the Y axis
|
||||
* @x_scale_end: final scale factor on the X axis
|
||||
* @y_scale_end: final scale factor on the Y axis
|
||||
* @gravity: a #ClutterGravity for the scale.
|
||||
*
|
||||
* A fixed point implementation of clutter_behaviour_scale_new()
|
||||
*
|
||||
@ -350,8 +313,7 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||
ClutterFixed x_scale_start,
|
||||
ClutterFixed y_scale_start,
|
||||
ClutterFixed x_scale_end,
|
||||
ClutterFixed y_scale_end,
|
||||
ClutterGravity gravity)
|
||||
ClutterFixed y_scale_end)
|
||||
{
|
||||
ClutterBehaviourScale *behave;
|
||||
|
||||
@ -364,8 +326,6 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||
behave->priv->x_scale_end = x_scale_end;
|
||||
behave->priv->y_scale_end = y_scale_end;
|
||||
|
||||
behave->priv->gravity = gravity;
|
||||
|
||||
return CLUTTER_BEHAVIOUR (behave);
|
||||
}
|
||||
|
||||
@ -539,42 +499,3 @@ clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||
*y_scale_end = priv->y_scale_end;
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_behaviour_scale_set_gravity:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
* @gravity: the gravity of the scaling
|
||||
*
|
||||
* Sets the #ClutterGravity applied by the scale behaviour.
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
clutter_behaviour_scale_set_gravity (ClutterBehaviourScale *scale,
|
||||
ClutterGravity gravity)
|
||||
{
|
||||
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||
|
||||
if (scale->priv->gravity != gravity)
|
||||
{
|
||||
scale->priv->gravity = gravity;
|
||||
|
||||
g_object_notify (G_OBJECT (scale), "scale-gravity");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* clutter_behaviour_scale_get_gravity:
|
||||
* @scale: a #ClutterBehaviourScale
|
||||
*
|
||||
* Retrieves the #ClutterGravity applied by the scale behaviour.
|
||||
*
|
||||
* Return value: the gravity used by the behaviour
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
ClutterGravity
|
||||
clutter_behaviour_scale_get_gravity (ClutterBehaviourScale *scale)
|
||||
{
|
||||
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale), CLUTTER_GRAVITY_NONE);
|
||||
|
||||
return scale->priv->gravity;
|
||||
}
|
||||
|
@ -80,14 +80,12 @@ ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||
gdouble x_scale_start,
|
||||
gdouble y_scale_start,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end,
|
||||
ClutterGravity gravity);
|
||||
gdouble y_scale_end);
|
||||
ClutterBehaviour *clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||
ClutterFixed x_scale_start,
|
||||
ClutterFixed y_scale_start,
|
||||
ClutterFixed x_scale_end,
|
||||
ClutterFixed y_scale_end,
|
||||
ClutterGravity gravity);
|
||||
ClutterFixed y_scale_end);
|
||||
|
||||
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||
gdouble x_scale_start,
|
||||
@ -110,10 +108,6 @@ void clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||
ClutterFixed *x_scale_end,
|
||||
ClutterFixed *y_scale_end);
|
||||
|
||||
void clutter_behaviour_scale_set_gravity (ClutterBehaviourScale *scale,
|
||||
ClutterGravity gravity);
|
||||
ClutterGravity clutter_behaviour_scale_get_gravity (ClutterBehaviourScale *scale);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */
|
||||
|
@ -31,7 +31,7 @@
|
||||
*
|
||||
* The #ClutterEffectTemplate class provides a simple API for applying
|
||||
* pre-defined effects to a single actor. It works as a wrapper around
|
||||
* the #ClutterBehaviour objects
|
||||
* the #ClutterBehaviour objects
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
@ -63,9 +63,9 @@ typedef struct ClutterEffectClosure
|
||||
ClutterTimeline *timeline;
|
||||
ClutterAlpha *alpha;
|
||||
ClutterBehaviour *behave;
|
||||
|
||||
|
||||
gulong signal_id;
|
||||
|
||||
|
||||
ClutterEffectCompleteFunc completed_func;
|
||||
gpointer completed_data;
|
||||
ClutterEffectTemplate *template;
|
||||
@ -136,24 +136,24 @@ clutter_effect_template_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_template_set_property (GObject *object,
|
||||
clutter_effect_template_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterEffectTemplate *template;
|
||||
ClutterEffectTemplatePrivate *priv;
|
||||
|
||||
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||
priv = template->priv;
|
||||
priv = template->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TIMELINE:
|
||||
priv->timeline = g_value_dup_object (value);
|
||||
break;
|
||||
case PROP_DO_CLONE:
|
||||
clutter_effect_template_set_timeline_clone (template,
|
||||
clutter_effect_template_set_timeline_clone (template,
|
||||
g_value_get_boolean (value));
|
||||
break;
|
||||
default:
|
||||
@ -163,9 +163,9 @@ clutter_effect_template_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_effect_template_get_property (GObject *object,
|
||||
clutter_effect_template_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ClutterEffectTemplate *template;
|
||||
@ -174,7 +174,7 @@ clutter_effect_template_get_property (GObject *object,
|
||||
template = CLUTTER_EFFECT_TEMPLATE (object);
|
||||
priv = template->priv;
|
||||
|
||||
switch (prop_id)
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_TIMELINE:
|
||||
g_value_set_object (value, priv->timeline);
|
||||
@ -185,7 +185,7 @@ clutter_effect_template_get_property (GObject *object,
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
@ -207,7 +207,7 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
|
||||
*
|
||||
* Since: 0.4
|
||||
*/
|
||||
g_object_class_install_property
|
||||
g_object_class_install_property
|
||||
(object_class,
|
||||
PROP_TIMELINE,
|
||||
g_param_spec_object ("timeline",
|
||||
@ -224,7 +224,7 @@ clutter_effect_template_class_init (ClutterEffectTemplateClass *klass)
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
g_object_class_install_property
|
||||
g_object_class_install_property
|
||||
(object_class,
|
||||
PROP_DO_CLONE,
|
||||
g_param_spec_boolean ("clone",
|
||||
@ -272,9 +272,9 @@ clutter_effect_template_set_alpha_func (ClutterEffectTemplate *self,
|
||||
* @template_: A #ClutterEffectTemplate
|
||||
* @setting: A boolean indicating if effects should clone the timeline.
|
||||
*
|
||||
* Sets if effects using this template should make a copy of the
|
||||
* Sets if effects using this template should make a copy of the
|
||||
* templates timeline (default) or reference the effects timeline.
|
||||
*
|
||||
*
|
||||
* Since: 0.6
|
||||
*/
|
||||
void
|
||||
@ -331,7 +331,7 @@ clutter_effect_template_get_timeline_clone (ClutterEffectTemplate *template_)
|
||||
* Since: 0.4
|
||||
*/
|
||||
ClutterEffectTemplate*
|
||||
clutter_effect_template_new (ClutterTimeline *timeline,
|
||||
clutter_effect_template_new (ClutterTimeline *timeline,
|
||||
ClutterAlphaFunc alpha_func)
|
||||
{
|
||||
ClutterEffectTemplate *retval;
|
||||
@ -339,7 +339,7 @@ clutter_effect_template_new (ClutterTimeline *timeline,
|
||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||
g_return_val_if_fail (alpha_func != NULL, NULL);
|
||||
|
||||
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
||||
retval = g_object_new (CLUTTER_TYPE_EFFECT_TEMPLATE,
|
||||
"timeline", timeline,
|
||||
NULL);
|
||||
|
||||
@ -496,7 +496,7 @@ clutter_effect_closure_destroy (ClutterEffectClosure *c)
|
||||
|
||||
static ClutterEffectClosure *
|
||||
clutter_effect_closure_new (ClutterEffectTemplate *template,
|
||||
ClutterActor *actor,
|
||||
ClutterActor *actor,
|
||||
GCallback complete)
|
||||
{
|
||||
ClutterEffectClosure *c;
|
||||
@ -517,7 +517,7 @@ clutter_effect_closure_new (ClutterEffectTemplate *template,
|
||||
c->timeline = priv->timeline;
|
||||
g_object_ref (priv->timeline);
|
||||
}
|
||||
|
||||
|
||||
c->alpha = clutter_alpha_new_full (c->timeline,
|
||||
priv->alpha_func,
|
||||
priv->alpha_data,
|
||||
@ -569,7 +569,7 @@ clutter_effect_fade (ClutterEffectTemplate *template_,
|
||||
guint8 opacity_start;
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
@ -577,13 +577,13 @@ clutter_effect_fade (ClutterEffectTemplate *template_,
|
||||
|
||||
opacity_start = clutter_actor_get_opacity (actor);
|
||||
|
||||
c->behave = clutter_behaviour_opacity_new (c->alpha,
|
||||
opacity_start,
|
||||
c->behave = clutter_behaviour_opacity_new (c->alpha,
|
||||
opacity_start,
|
||||
opacity_end);
|
||||
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ clutter_effect_depth (ClutterEffectTemplate *template_,
|
||||
gint depth_start;
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
@ -624,10 +624,10 @@ clutter_effect_depth (ClutterEffectTemplate *template_,
|
||||
depth_start = clutter_actor_get_depth (actor);
|
||||
|
||||
c->behave = clutter_behaviour_depth_new (c->alpha, depth_start, depth_end);
|
||||
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
|
||||
@ -662,7 +662,7 @@ clutter_effect_move (ClutterEffectTemplate *template_,
|
||||
ClutterKnot knots[2];
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
@ -675,10 +675,10 @@ clutter_effect_move (ClutterEffectTemplate *template_,
|
||||
knots[1].y = y;
|
||||
|
||||
c->behave = clutter_behaviour_path_new (c->alpha, knots, 2);
|
||||
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
/**
|
||||
@ -710,7 +710,7 @@ clutter_effect_path (ClutterEffectTemplate *template_,
|
||||
ClutterEffectClosure *c;
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
@ -720,10 +720,10 @@ clutter_effect_path (ClutterEffectTemplate *template_,
|
||||
clutter_actor_set_position (actor, knots[0].x, knots[0].y);
|
||||
|
||||
c->behave = clutter_behaviour_path_new (c->alpha, knots, n_knots);
|
||||
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
|
||||
@ -733,7 +733,6 @@ clutter_effect_path (ClutterEffectTemplate *template_,
|
||||
* @actor: A #ClutterActor to apply the effect to.
|
||||
* @x_scale_end: Final X axis scale factor to apply to actor
|
||||
* @y_scale_end: Final Y axis scale factor to apply to actor
|
||||
* @gravity: A #ClutterGravity for the scale.
|
||||
* @func: A #ClutterEffectCompleteFunc to call on effect
|
||||
* completion or NULL
|
||||
* @data: Data to pass to supplied #ClutterEffectCompleteFunc
|
||||
@ -751,7 +750,6 @@ clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||
ClutterActor *actor,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end,
|
||||
ClutterGravity gravity,
|
||||
ClutterEffectCompleteFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
@ -759,21 +757,20 @@ clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||
gdouble x_scale_start, y_scale_start;
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
c->completed_data = data;
|
||||
|
||||
clutter_actor_get_scale (actor, &x_scale_start, &y_scale_start);
|
||||
c->behave = clutter_behaviour_scale_new (c->alpha,
|
||||
c->behave = clutter_behaviour_scale_new (c->alpha,
|
||||
x_scale_start, y_scale_start,
|
||||
x_scale_end, y_scale_end,
|
||||
gravity);
|
||||
|
||||
x_scale_end, y_scale_end);
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
|
||||
@ -814,14 +811,14 @@ clutter_effect_rotate (ClutterEffectTemplate *template_,
|
||||
gdouble angle_start;
|
||||
|
||||
c = clutter_effect_closure_new (template_,
|
||||
actor,
|
||||
actor,
|
||||
G_CALLBACK (on_effect_complete));
|
||||
|
||||
c->completed_func = func;
|
||||
c->completed_data = data;
|
||||
|
||||
angle_start = clutter_actor_get_rotation (actor, axis, NULL, NULL, NULL);
|
||||
|
||||
|
||||
c->behave = clutter_behaviour_rotate_new (c->alpha,
|
||||
axis,
|
||||
direction,
|
||||
@ -832,9 +829,9 @@ clutter_effect_rotate (ClutterEffectTemplate *template_,
|
||||
"center-y", center_y,
|
||||
"center-z", center_z,
|
||||
NULL);
|
||||
|
||||
|
||||
clutter_behaviour_apply (c->behave, actor);
|
||||
clutter_timeline_start (c->timeline);
|
||||
|
||||
|
||||
return c->timeline;
|
||||
}
|
||||
|
@ -142,7 +142,6 @@ ClutterTimeline *clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||
ClutterActor *actor,
|
||||
gdouble x_scale_end,
|
||||
gdouble y_scale_end,
|
||||
ClutterGravity gravity,
|
||||
ClutterEffectCompleteFunc func,
|
||||
gpointer data);
|
||||
ClutterTimeline *clutter_effect_rotate (ClutterEffectTemplate *template_,
|
||||
|
@ -19,7 +19,7 @@ typedef struct SuperOH
|
||||
ClutterActor *group;
|
||||
GdkPixbuf *bgpixb;
|
||||
|
||||
} SuperOH;
|
||||
} SuperOH;
|
||||
|
||||
static gint n_hands = NHANDS;
|
||||
|
||||
@ -40,8 +40,8 @@ get_radius (void)
|
||||
}
|
||||
|
||||
/* input handler */
|
||||
static gboolean
|
||||
input_cb (ClutterStage *stage,
|
||||
static gboolean
|
||||
input_cb (ClutterStage *stage,
|
||||
ClutterEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
@ -71,7 +71,7 @@ input_cb (ClutterStage *stage,
|
||||
|
||||
g_print ("*** key press event (key:%c) ***\n",
|
||||
clutter_key_event_symbol (kev));
|
||||
|
||||
|
||||
if (clutter_key_event_symbol (kev) == CLUTTER_q)
|
||||
{
|
||||
clutter_main_quit ();
|
||||
@ -85,8 +85,8 @@ input_cb (ClutterStage *stage,
|
||||
|
||||
/* Timeline handler */
|
||||
static void
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
frame_cb (ClutterTimeline *timeline,
|
||||
gint frame_num,
|
||||
gpointer data)
|
||||
{
|
||||
SuperOH *oh = (SuperOH *)data;
|
||||
@ -178,15 +178,13 @@ main (int argc, char *argv[])
|
||||
/* Set up some behaviours to handle scaling */
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE, NULL, NULL);
|
||||
|
||||
scaler_1 = clutter_behaviour_scale_new (alpha,
|
||||
0.5, 0.5,
|
||||
1.0, 1.0,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
scaler_2 = clutter_behaviour_scale_new (alpha,
|
||||
1.0, 1.0,
|
||||
scaler_1 = clutter_behaviour_scale_new (alpha,
|
||||
0.5, 0.5,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
1.0, 1.0);
|
||||
|
||||
scaler_2 = clutter_behaviour_scale_new (alpha,
|
||||
1.0, 1.0,
|
||||
0.5, 0.5);
|
||||
|
||||
/* create a new group to hold multiple actors in a group */
|
||||
oh->group = clutter_group_new();
|
||||
@ -207,17 +205,21 @@ main (int argc, char *argv[])
|
||||
w = clutter_actor_get_width (oh->hand[0]);
|
||||
h = clutter_actor_get_height (oh->hand[0]);
|
||||
|
||||
x = CLUTTER_STAGE_WIDTH () / 2
|
||||
x = CLUTTER_STAGE_WIDTH () / 2
|
||||
+ radius
|
||||
* cos (i * M_PI / (n_hands / 2))
|
||||
- w / 2;
|
||||
y = CLUTTER_STAGE_HEIGHT () / 2
|
||||
y = CLUTTER_STAGE_HEIGHT () / 2
|
||||
+ radius
|
||||
* sin (i * M_PI / (n_hands / 2))
|
||||
- h / 2;
|
||||
|
||||
clutter_actor_set_position (oh->hand[i], x, y);
|
||||
|
||||
clutter_actor_set_anchor_point_from_gravity (oh->hand[i],
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
|
||||
/* Add to our group group */
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
|
||||
|
||||
@ -240,7 +242,7 @@ main (int argc, char *argv[])
|
||||
|
||||
|
||||
g_signal_connect (stage, "button-press-event",
|
||||
G_CALLBACK (input_cb),
|
||||
G_CALLBACK (input_cb),
|
||||
oh);
|
||||
g_signal_connect (stage, "key-release-event",
|
||||
G_CALLBACK (input_cb),
|
||||
|
@ -69,8 +69,9 @@ main (int argc, char *argv[])
|
||||
clutter_container_add_actor (container, actor);
|
||||
clutter_actor_set_size (actor, 50, 50);
|
||||
clutter_actor_set_position (actor, 50, 280);
|
||||
clutter_effect_scale (tmpl, actor, 2.0, 2.0,
|
||||
CLUTTER_GRAVITY_CENTER, NULL, NULL);
|
||||
clutter_actor_set_anchor_point_from_gravity (actor, CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
clutter_effect_scale (tmpl, actor, 2.0, 2.0, NULL, NULL);
|
||||
clutter_actor_show (actor);
|
||||
|
||||
actor = clutter_rectangle_new_with_color (&rect_color);
|
||||
|
@ -20,12 +20,12 @@ void
|
||||
on_timeline_completed (ClutterTimeline *cluttertimeline,
|
||||
gpointer data)
|
||||
{
|
||||
ClutterBehaviourScale *behave = CLUTTER_BEHAVIOUR_SCALE(data);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (data);
|
||||
|
||||
if (++gindex >= G_N_ELEMENTS (gravities))
|
||||
gindex = 0;
|
||||
|
||||
g_object_set (behave, "scale-gravity", gravities[gindex], NULL);
|
||||
clutter_actor_move_anchor_point_from_gravity (actor, gravities[gindex]);
|
||||
}
|
||||
|
||||
int
|
||||
@ -53,9 +53,9 @@ main (int argc, char *argv[])
|
||||
|
||||
rect_color.alpha = 0xff;
|
||||
rect = clutter_rectangle_new_with_color (&rect_color);
|
||||
clutter_actor_set_anchor_point_from_gravity (rect, CLUTTER_GRAVITY_CENTER);
|
||||
clutter_actor_set_position (rect, 100, 100);
|
||||
clutter_actor_set_size (rect, 100, 100);
|
||||
clutter_actor_set_position (rect, 150, 150);
|
||||
clutter_actor_move_anchor_point_from_gravity (rect, CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP (stage), rect);
|
||||
|
||||
@ -65,15 +65,14 @@ main (int argc, char *argv[])
|
||||
NULL, NULL);
|
||||
|
||||
behave = clutter_behaviour_scale_new (alpha,
|
||||
0.0, 0.0, /* scale start */
|
||||
1.5, 1.5, /* scale end */
|
||||
gravities[gindex]);
|
||||
0.0, 0.0, /* scale start */
|
||||
1.0, 1.0); /* scale end */
|
||||
|
||||
clutter_behaviour_apply (behave, rect);
|
||||
clutter_behaviour_apply (behave, rect);
|
||||
|
||||
clutter_timeline_set_loop (timeline, TRUE);
|
||||
g_signal_connect (timeline, "completed",
|
||||
G_CALLBACK(on_timeline_completed), behave);
|
||||
g_signal_connect (timeline, "completed",
|
||||
G_CALLBACK(on_timeline_completed), rect);
|
||||
clutter_timeline_start (timeline);
|
||||
|
||||
clutter_actor_show_all (stage);
|
||||
|
Loading…
Reference in New Issue
Block a user