2008-01-17 Emmanuele Bassi <ebassi@openedhand.com>
* clutter.symbols: Add new ClutterBehaviourScale setters. * clutter/clutter-behaviour-scale.[ch]: Split the scaling factors on both axis. Add setters for all the behaviour properties. * clutter/clutter-effect.h: * clutter/clutter-effect.c (clutter_effect_scale): Split the final scale factor to match the ClutterBehaviourScale changes. (#709) * tests/test-actors.c: * tests/test-effects.c: * tests/test-rotate.c: * tests/test-scale.c: Update after API change.
This commit is contained in:
parent
e2f72ae557
commit
fe2379a810
16
ChangeLog
16
ChangeLog
@ -1,3 +1,19 @@
|
|||||||
|
2008-01-17 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter.symbols: Add new ClutterBehaviourScale setters.
|
||||||
|
|
||||||
|
* clutter/clutter-behaviour-scale.[ch]: Split the scaling factors
|
||||||
|
on both axis. Add setters for all the behaviour properties.
|
||||||
|
|
||||||
|
* clutter/clutter-effect.h:
|
||||||
|
* clutter/clutter-effect.c (clutter_effect_scale): Split the
|
||||||
|
final scale factor to match the ClutterBehaviourScale changes. (#709)
|
||||||
|
|
||||||
|
* tests/test-actors.c:
|
||||||
|
* tests/test-effects.c:
|
||||||
|
* tests/test-rotate.c:
|
||||||
|
* tests/test-scale.c: Update after API change.
|
||||||
|
|
||||||
2008-01-16 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-01-16 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/cogl/cogl.h: Rename COGLhandleARB to COGLhandle.
|
* clutter/cogl/cogl.h: Rename COGLhandleARB to COGLhandle.
|
||||||
|
@ -173,6 +173,9 @@ clutter_behaviour_scale_get_gravity
|
|||||||
clutter_behaviour_scale_get_type
|
clutter_behaviour_scale_get_type
|
||||||
clutter_behaviour_scale_new
|
clutter_behaviour_scale_new
|
||||||
clutter_behaviour_scale_newx
|
clutter_behaviour_scale_newx
|
||||||
|
clutter_behaviour_scale_set_bounds
|
||||||
|
clutter_behaviour_scale_set_boundsx
|
||||||
|
clutter_behaviour_scale_set_gravity
|
||||||
clutter_behaviour_set_alpha
|
clutter_behaviour_set_alpha
|
||||||
clutter_box_get_color
|
clutter_box_get_color
|
||||||
clutter_box_get_default_padding
|
clutter_box_get_default_padding
|
||||||
|
@ -52,8 +52,8 @@ G_DEFINE_TYPE (ClutterBehaviourScale,
|
|||||||
|
|
||||||
struct _ClutterBehaviourScalePrivate
|
struct _ClutterBehaviourScalePrivate
|
||||||
{
|
{
|
||||||
ClutterFixed scale_start;
|
ClutterFixed scale_start[2];
|
||||||
ClutterFixed scale_end;
|
ClutterFixed scale_end[2];
|
||||||
|
|
||||||
ClutterGravity gravity;
|
ClutterGravity gravity;
|
||||||
};
|
};
|
||||||
@ -67,11 +67,18 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_SCALE_START,
|
PROP_X_SCALE_START,
|
||||||
PROP_SCALE_END,
|
PROP_Y_SCALE_START,
|
||||||
|
PROP_X_SCALE_END,
|
||||||
|
PROP_Y_SCALE_END,
|
||||||
PROP_SCALE_GRAVITY
|
PROP_SCALE_GRAVITY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
ClutterFixed scale_x;
|
||||||
|
ClutterFixed scale_y;
|
||||||
|
} ScaleFrameClosure;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scale_frame_foreach (ClutterBehaviour *behaviour,
|
scale_frame_foreach (ClutterBehaviour *behaviour,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
@ -79,7 +86,7 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
|
|||||||
{
|
{
|
||||||
ClutterBehaviourScalePrivate *priv =
|
ClutterBehaviourScalePrivate *priv =
|
||||||
CLUTTER_BEHAVIOUR_SCALE (behaviour)->priv;
|
CLUTTER_BEHAVIOUR_SCALE (behaviour)->priv;
|
||||||
ClutterFixed scale = GPOINTER_TO_UINT (data);
|
ScaleFrameClosure *closure = data;
|
||||||
ClutterGravity gravity = priv->gravity;
|
ClutterGravity gravity = priv->gravity;
|
||||||
|
|
||||||
/* Don't mess with the actor anchor point of gravity is set to
|
/* Don't mess with the actor anchor point of gravity is set to
|
||||||
@ -88,25 +95,35 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
|
|||||||
if (gravity != CLUTTER_GRAVITY_NONE)
|
if (gravity != CLUTTER_GRAVITY_NONE)
|
||||||
clutter_actor_set_anchor_point_from_gravity (actor, gravity);
|
clutter_actor_set_anchor_point_from_gravity (actor, gravity);
|
||||||
|
|
||||||
clutter_actor_set_scalex (actor, scale, scale);
|
clutter_actor_set_scalex (actor, closure->scale_x, closure->scale_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
|
clutter_behaviour_scale_alpha_notify (ClutterBehaviour *behave,
|
||||||
guint32 alpha_value)
|
guint32 alpha_value)
|
||||||
{
|
{
|
||||||
ClutterFixed scale, factor;
|
|
||||||
ClutterBehaviourScalePrivate *priv;
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
ClutterFixed scale_x, scale_y, factor;
|
||||||
|
ScaleFrameClosure closure = { 0, };
|
||||||
|
|
||||||
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
||||||
|
|
||||||
factor = CLUTTER_INT_TO_FIXED (alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
|
factor = CLUTTER_INT_TO_FIXED (alpha_value) / CLUTTER_ALPHA_MAX_ALPHA;
|
||||||
scale = CLUTTER_FIXED_MUL (factor, (priv->scale_end - priv->scale_start));
|
|
||||||
scale += priv->scale_start;
|
scale_x = CLUTTER_FIXED_MUL (factor,
|
||||||
|
(priv->scale_end[0] - priv->scale_start[0]));
|
||||||
|
scale_x += priv->scale_start[0];
|
||||||
|
|
||||||
|
scale_y = CLUTTER_FIXED_MUL (factor,
|
||||||
|
(priv->scale_end[1] - priv->scale_start[1]));
|
||||||
|
scale_y += priv->scale_start[1];
|
||||||
|
|
||||||
|
closure.scale_x = scale_x;
|
||||||
|
closure.scale_y = scale_y;
|
||||||
|
|
||||||
clutter_behaviour_actors_foreach (behave,
|
clutter_behaviour_actors_foreach (behave,
|
||||||
scale_frame_foreach,
|
scale_frame_foreach,
|
||||||
GUINT_TO_POINTER (scale));
|
&closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -121,11 +138,21 @@ clutter_behaviour_scale_set_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_SCALE_START:
|
case PROP_X_SCALE_START:
|
||||||
priv->scale_start = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
priv->scale_start[0] =
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE_END:
|
case PROP_X_SCALE_END:
|
||||||
priv->scale_end = CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
priv->scale_end[0] =
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||||
|
break;
|
||||||
|
case PROP_Y_SCALE_START:
|
||||||
|
priv->scale_start[1] =
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||||
|
break;
|
||||||
|
case PROP_Y_SCALE_END:
|
||||||
|
priv->scale_end[1] =
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (g_value_get_double (value));
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE_GRAVITY:
|
case PROP_SCALE_GRAVITY:
|
||||||
priv->gravity = g_value_get_enum (value);
|
priv->gravity = g_value_get_enum (value);
|
||||||
@ -148,11 +175,17 @@ clutter_behaviour_scale_get_property (GObject *gobject,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_SCALE_START:
|
case PROP_X_SCALE_START:
|
||||||
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_start));
|
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_start[0]));
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE_END:
|
case PROP_X_SCALE_END:
|
||||||
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_end));
|
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_end[0]));
|
||||||
|
break;
|
||||||
|
case PROP_Y_SCALE_START:
|
||||||
|
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_start[1]));
|
||||||
|
break;
|
||||||
|
case PROP_Y_SCALE_END:
|
||||||
|
g_value_set_double (value, CLUTTER_FIXED_TO_FLOAT (priv->scale_end[1]));
|
||||||
break;
|
break;
|
||||||
case PROP_SCALE_GRAVITY:
|
case PROP_SCALE_GRAVITY:
|
||||||
g_value_set_enum (value, priv->gravity);
|
g_value_set_enum (value, priv->gravity);
|
||||||
@ -173,32 +206,62 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
|
|||||||
gobject_class->get_property = clutter_behaviour_scale_get_property;
|
gobject_class->get_property = clutter_behaviour_scale_get_property;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterBehaviourScale:scale-start:
|
* ClutterBehaviourScale:x-scale-start:
|
||||||
*
|
*
|
||||||
* The initial scaling factor for the actors.
|
* The initial scaling factor on the X axis for the actors.
|
||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_SCALE_START,
|
PROP_X_SCALE_START,
|
||||||
g_param_spec_double ("scale-start",
|
g_param_spec_double ("x-scale-start",
|
||||||
"Start Scale",
|
"X Start Scale",
|
||||||
"Initial scale",
|
"Initial scale on the X axis",
|
||||||
0.0, G_MAXDOUBLE,
|
0.0, G_MAXDOUBLE,
|
||||||
1.0,
|
1.0,
|
||||||
CLUTTER_PARAM_READWRITE));
|
CLUTTER_PARAM_READWRITE));
|
||||||
/**
|
/**
|
||||||
* ClutterBehaviourScale:scale-end:
|
* ClutterBehaviourScale:x-scale-end:
|
||||||
*
|
*
|
||||||
* The final scaling factor for the actors.
|
* The final scaling factor on the X axis for the actors.
|
||||||
*
|
*
|
||||||
* Since: 0.2
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
g_object_class_install_property (gobject_class,
|
g_object_class_install_property (gobject_class,
|
||||||
PROP_SCALE_END,
|
PROP_X_SCALE_END,
|
||||||
g_param_spec_double ("scale-end",
|
g_param_spec_double ("x-scale-end",
|
||||||
"End Scale",
|
"X End Scale",
|
||||||
"Final scale",
|
"Final scale on the X axis",
|
||||||
|
0.0, G_MAXDOUBLE,
|
||||||
|
1.0,
|
||||||
|
CLUTTER_PARAM_READWRITE));
|
||||||
|
/**
|
||||||
|
* ClutterBehaviourScale:y-scale-start:
|
||||||
|
*
|
||||||
|
* The initial scaling factor on the Y axis for the actors.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_Y_SCALE_START,
|
||||||
|
g_param_spec_double ("y-scale-start",
|
||||||
|
"Y Start Scale",
|
||||||
|
"Initial scale on the Y axis",
|
||||||
|
0.0, G_MAXDOUBLE,
|
||||||
|
1.0,
|
||||||
|
CLUTTER_PARAM_READWRITE));
|
||||||
|
/**
|
||||||
|
* ClutterBehaviourScale:y-scale-end:
|
||||||
|
*
|
||||||
|
* The final scaling factor on the Y axis for the actors.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_class,
|
||||||
|
PROP_X_SCALE_END,
|
||||||
|
g_param_spec_double ("y-scale-end",
|
||||||
|
"Y End Scale",
|
||||||
|
"Final scale on the Y axis",
|
||||||
0.0, G_MAXDOUBLE,
|
0.0, G_MAXDOUBLE,
|
||||||
1.0,
|
1.0,
|
||||||
CLUTTER_PARAM_READWRITE));
|
CLUTTER_PARAM_READWRITE));
|
||||||
@ -235,8 +298,10 @@ clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
|||||||
/**
|
/**
|
||||||
* clutter_behaviour_scale_new:
|
* clutter_behaviour_scale_new:
|
||||||
* @alpha: a #ClutterAlpha
|
* @alpha: a #ClutterAlpha
|
||||||
* @scale_start: initial scale factor
|
* @x_scale_start: initial scale factor on the X axis
|
||||||
* @scale_end: final scale factor
|
* @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.
|
* @gravity: a #ClutterGravity for the scale.
|
||||||
*
|
*
|
||||||
* Creates a new #ClutterBehaviourScale instance.
|
* Creates a new #ClutterBehaviourScale instance.
|
||||||
@ -247,23 +312,29 @@ clutter_behaviour_scale_init (ClutterBehaviourScale *self)
|
|||||||
*/
|
*/
|
||||||
ClutterBehaviour *
|
ClutterBehaviour *
|
||||||
clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||||
gdouble scale_start,
|
gdouble x_scale_start,
|
||||||
gdouble scale_end,
|
gdouble y_scale_start,
|
||||||
|
gdouble x_scale_end,
|
||||||
|
gdouble y_scale_end,
|
||||||
ClutterGravity gravity)
|
ClutterGravity gravity)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||||
|
|
||||||
return clutter_behaviour_scale_newx (alpha,
|
return clutter_behaviour_scale_newx (alpha,
|
||||||
CLUTTER_FLOAT_TO_FIXED (scale_start),
|
CLUTTER_FLOAT_TO_FIXED (x_scale_start),
|
||||||
CLUTTER_FLOAT_TO_FIXED (scale_end),
|
CLUTTER_FLOAT_TO_FIXED (y_scale_start),
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (x_scale_end),
|
||||||
|
CLUTTER_FLOAT_TO_FIXED (y_scale_end),
|
||||||
gravity);
|
gravity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_behaviour_scale_newx:
|
* clutter_behaviour_scale_newx:
|
||||||
* @alpha: a #ClutterAlpha
|
* @alpha: a #ClutterAlpha
|
||||||
* @scale_start: initial scale factor
|
* @x_scale_start: initial scale factor on the X axis
|
||||||
* @scale_end: final scale factor
|
* @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.
|
* @gravity: a #ClutterGravity for the scale.
|
||||||
*
|
*
|
||||||
* A fixed point implementation of clutter_behaviour_scale_new()
|
* A fixed point implementation of clutter_behaviour_scale_new()
|
||||||
@ -274,30 +345,67 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
|||||||
*/
|
*/
|
||||||
ClutterBehaviour *
|
ClutterBehaviour *
|
||||||
clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||||
ClutterFixed scale_start,
|
ClutterFixed x_scale_start,
|
||||||
ClutterFixed scale_end,
|
ClutterFixed y_scale_start,
|
||||||
|
ClutterFixed x_scale_end,
|
||||||
|
ClutterFixed y_scale_end,
|
||||||
ClutterGravity gravity)
|
ClutterGravity gravity)
|
||||||
{
|
{
|
||||||
ClutterBehaviourScale *behave;
|
ClutterBehaviourScale *behave;
|
||||||
|
|
||||||
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
g_return_val_if_fail (alpha == NULL || CLUTTER_IS_ALPHA (alpha), NULL);
|
||||||
|
|
||||||
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE,
|
behave = g_object_new (CLUTTER_TYPE_BEHAVIOUR_SCALE, "alpha", alpha, NULL);
|
||||||
"alpha", alpha,
|
|
||||||
NULL);
|
behave->priv->scale_start[0] = x_scale_start;
|
||||||
|
behave->priv->scale_start[1] = y_scale_start;
|
||||||
|
behave->priv->scale_end[0] = x_scale_end;
|
||||||
|
behave->priv->scale_end[1] = y_scale_end;
|
||||||
|
|
||||||
behave->priv->scale_start = scale_start;
|
|
||||||
behave->priv->scale_end = scale_end;
|
|
||||||
behave->priv->gravity = gravity;
|
behave->priv->gravity = gravity;
|
||||||
|
|
||||||
return CLUTTER_BEHAVIOUR (behave);
|
return CLUTTER_BEHAVIOUR (behave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_behaviour_scale_set_bounds:
|
||||||
|
* @scale: a #ClutterBehaviourScale
|
||||||
|
* @x_scale_start: initial scale factor on the X axis
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
* Sets the bounds used by scale behaviour.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||||
|
gdouble x_scale_start,
|
||||||
|
gdouble y_scale_start,
|
||||||
|
gdouble x_scale_end,
|
||||||
|
gdouble y_scale_end)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||||
|
|
||||||
|
clutter_behaviour_scale_set_boundsx (scale,
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_behaviour_scale_get_bounds:
|
* clutter_behaviour_scale_get_bounds:
|
||||||
* @scale: a #ClutterBehaviourScale
|
* @scale: a #ClutterBehaviourScale
|
||||||
* @scale_start: return location for the initial scale factor
|
* @x_scale_start: return location for the initial scale factor on the X
|
||||||
* @scale_end: return location for the final scale factor
|
* axis, or %NULL
|
||||||
|
* @y_scale_start: return location for the initial scale factor on the Y
|
||||||
|
* axis, or %NULL
|
||||||
|
* @x_scale_end: return location for the final scale factor on the X axis,
|
||||||
|
* or %NULL
|
||||||
|
* @y_scale_end: return location for the final scale factor on the Y axis,
|
||||||
|
* or %NULL
|
||||||
*
|
*
|
||||||
* Retrieves the bounds used by scale behaviour.
|
* Retrieves the bounds used by scale behaviour.
|
||||||
*
|
*
|
||||||
@ -305,8 +413,10 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||||
gdouble *scale_start,
|
gdouble *x_scale_start,
|
||||||
gdouble *scale_end)
|
gdouble *y_scale_start,
|
||||||
|
gdouble *x_scale_end,
|
||||||
|
gdouble *y_scale_end)
|
||||||
{
|
{
|
||||||
ClutterBehaviourScalePrivate *priv;
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
@ -314,18 +424,88 @@ clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
|||||||
|
|
||||||
priv = scale->priv;
|
priv = scale->priv;
|
||||||
|
|
||||||
if (scale_start)
|
if (x_scale_start)
|
||||||
*scale_start = CLUTTER_FIXED_TO_DOUBLE (priv->scale_start);
|
*x_scale_start = CLUTTER_FIXED_TO_DOUBLE (priv->scale_start[0]);
|
||||||
|
|
||||||
if (scale_end)
|
if (x_scale_end)
|
||||||
*scale_end = CLUTTER_FIXED_TO_DOUBLE (priv->scale_end);
|
*x_scale_end = CLUTTER_FIXED_TO_DOUBLE (priv->scale_end[0]);
|
||||||
|
|
||||||
|
if (y_scale_start)
|
||||||
|
*y_scale_start = CLUTTER_FIXED_TO_DOUBLE (priv->scale_start[1]);
|
||||||
|
|
||||||
|
if (y_scale_end)
|
||||||
|
*y_scale_end = CLUTTER_FIXED_TO_DOUBLE (priv->scale_end[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_behaviour_scale_set_boundsx:
|
||||||
|
* @scale: a #ClutterBehaviourScale
|
||||||
|
* @x_scale_start: initial scale factor on the X axis
|
||||||
|
* @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
|
||||||
|
*
|
||||||
|
* Fixed point version of clutter_behaviour_scale_set_bounds().
|
||||||
|
*
|
||||||
|
* Sets the bounds used by scale behaviour.
|
||||||
|
*
|
||||||
|
* Since: 0.6
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_behaviour_scale_set_boundsx (ClutterBehaviourScale *scale,
|
||||||
|
ClutterFixed x_scale_start,
|
||||||
|
ClutterFixed y_scale_start,
|
||||||
|
ClutterFixed x_scale_end,
|
||||||
|
ClutterFixed y_scale_end)
|
||||||
|
{
|
||||||
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||||
|
|
||||||
|
priv = scale->priv;
|
||||||
|
|
||||||
|
g_object_freeze_notify (G_OBJECT (scale));
|
||||||
|
|
||||||
|
if (priv->scale_start[0] != x_scale_start)
|
||||||
|
{
|
||||||
|
priv->scale_start[0] = x_scale_start;
|
||||||
|
g_object_notify (G_OBJECT (scale), "x-scale-start");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->scale_start[1] != y_scale_start)
|
||||||
|
{
|
||||||
|
priv->scale_start[1] = y_scale_start;
|
||||||
|
g_object_notify (G_OBJECT (scale), "y-scale-start");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->scale_end[0] != x_scale_end)
|
||||||
|
{
|
||||||
|
priv->scale_end[0] = x_scale_end;
|
||||||
|
g_object_notify (G_OBJECT (scale), "x-scale-end");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->scale_end[1] != y_scale_end)
|
||||||
|
{
|
||||||
|
priv->scale_end[1] = y_scale_end;
|
||||||
|
g_object_notify (G_OBJECT (scale), "y-scale-end");
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_thaw_notify (G_OBJECT (scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_behaviour_scale_get_boundsx:
|
* clutter_behaviour_scale_get_boundsx:
|
||||||
* @scale: a #ClutterBehaviourScale
|
* @scale: a #ClutterBehaviourScale
|
||||||
* @scale_start: return location for the initial scale factor
|
* @x_scale_start: return location for the initial scale factor on the X
|
||||||
* @scale_end: return location for the final scale factor
|
* axis, or %NULL
|
||||||
|
* @y_scale_start: return location for the initial scale factor on the Y
|
||||||
|
* axis, or %NULL
|
||||||
|
* @x_scale_end: return location for the final scale factor on the X axis,
|
||||||
|
* or %NULL
|
||||||
|
* @y_scale_end: return location for the final scale factor on the Y axis,
|
||||||
|
* or %NULL
|
||||||
|
*
|
||||||
|
* Fixed point version of clutter_behaviour_scale_get_bounds().
|
||||||
*
|
*
|
||||||
* Retrieves the bounds used by scale behaviour.
|
* Retrieves the bounds used by scale behaviour.
|
||||||
*
|
*
|
||||||
@ -333,8 +513,10 @@ clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||||
ClutterFixed *scale_start,
|
ClutterFixed *x_scale_start,
|
||||||
ClutterFixed *scale_end)
|
ClutterFixed *y_scale_start,
|
||||||
|
ClutterFixed *x_scale_end,
|
||||||
|
ClutterFixed *y_scale_end)
|
||||||
{
|
{
|
||||||
ClutterBehaviourScalePrivate *priv;
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
@ -342,13 +524,41 @@ clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
|||||||
|
|
||||||
priv = scale->priv;
|
priv = scale->priv;
|
||||||
|
|
||||||
if (scale_start)
|
if (x_scale_start)
|
||||||
*scale_start = priv->scale_start;
|
*x_scale_start = priv->scale_start[0];
|
||||||
|
|
||||||
if (scale_end)
|
if (x_scale_end)
|
||||||
*scale_end = priv->scale_end;
|
*x_scale_end = priv->scale_end[0];
|
||||||
|
|
||||||
|
if (y_scale_start)
|
||||||
|
*y_scale_start = priv->scale_start[1];
|
||||||
|
|
||||||
|
if (y_scale_end)
|
||||||
|
*y_scale_end = priv->scale_end[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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), "gravity");
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* clutter_behaviour_scale_get_gravity:
|
* clutter_behaviour_scale_get_gravity:
|
||||||
* @scale: a #ClutterBehaviourScale
|
* @scale: a #ClutterBehaviourScale
|
||||||
|
@ -77,21 +77,41 @@ struct _ClutterBehaviourScaleClass
|
|||||||
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||||
gdouble scale_start,
|
gdouble x_scale_start,
|
||||||
gdouble scale_end,
|
gdouble y_scale_start,
|
||||||
|
gdouble x_scale_end,
|
||||||
|
gdouble z_scale_end,
|
||||||
ClutterGravity gravity);
|
ClutterGravity gravity);
|
||||||
ClutterBehaviour *clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
ClutterBehaviour *clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||||
ClutterFixed scale_start,
|
ClutterFixed x_scale_start,
|
||||||
ClutterFixed scale_end,
|
ClutterFixed y_scale_start,
|
||||||
|
ClutterFixed x_scale_end,
|
||||||
|
ClutterFixed y_scale_end,
|
||||||
ClutterGravity gravity);
|
ClutterGravity gravity);
|
||||||
|
|
||||||
|
void clutter_behaviour_scale_set_bounds (ClutterBehaviourScale *scale,
|
||||||
|
gdouble x_scale_start,
|
||||||
|
gdouble y_scale_start,
|
||||||
|
gdouble x_scale_end,
|
||||||
|
gdouble y_scale_end);
|
||||||
|
void clutter_behaviour_scale_set_boundsx (ClutterBehaviourScale *scale,
|
||||||
|
ClutterFixed x_scale_start,
|
||||||
|
ClutterFixed y_scale_start,
|
||||||
|
ClutterFixed x_scale_end,
|
||||||
|
ClutterFixed y_scale_end);
|
||||||
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||||
gdouble *scale_start,
|
gdouble *x_scale_start,
|
||||||
gdouble *scale_end);
|
gdouble *y_scale_start,
|
||||||
|
gdouble *x_scale_end,
|
||||||
|
gdouble *y_scale_end);
|
||||||
void clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
void clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||||
ClutterFixed *scale_start,
|
ClutterFixed *x_scale_start,
|
||||||
ClutterFixed *scale_end);
|
ClutterFixed *y_scale_start,
|
||||||
|
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);
|
ClutterGravity clutter_behaviour_scale_get_gravity (ClutterBehaviourScale *scale);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
@ -731,7 +731,8 @@ clutter_effect_path (ClutterEffectTemplate *template_,
|
|||||||
* clutter_effect_scale:
|
* clutter_effect_scale:
|
||||||
* @template_: A #ClutterEffectTemplate
|
* @template_: A #ClutterEffectTemplate
|
||||||
* @actor: A #ClutterActor to apply the effect to.
|
* @actor: A #ClutterActor to apply the effect to.
|
||||||
* @scale_end: Final scale factor to apply to actor
|
* @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.
|
* @gravity: A #ClutterGravity for the scale.
|
||||||
* @func: A #ClutterEffectCompleteFunc to call on effect
|
* @func: A #ClutterEffectCompleteFunc to call on effect
|
||||||
* completion or NULL
|
* completion or NULL
|
||||||
@ -748,13 +749,14 @@ clutter_effect_path (ClutterEffectTemplate *template_,
|
|||||||
ClutterTimeline *
|
ClutterTimeline *
|
||||||
clutter_effect_scale (ClutterEffectTemplate *template_,
|
clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
gdouble scale_end,
|
gdouble x_scale_end,
|
||||||
|
gdouble y_scale_end,
|
||||||
ClutterGravity gravity,
|
ClutterGravity gravity,
|
||||||
ClutterEffectCompleteFunc func,
|
ClutterEffectCompleteFunc func,
|
||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
ClutterEffectClosure *c;
|
ClutterEffectClosure *c;
|
||||||
gdouble scale_start;
|
gdouble x_scale_start, y_scale_start;
|
||||||
|
|
||||||
c = clutter_effect_closure_new (template_,
|
c = clutter_effect_closure_new (template_,
|
||||||
actor,
|
actor,
|
||||||
@ -763,10 +765,10 @@ clutter_effect_scale (ClutterEffectTemplate *template_,
|
|||||||
c->completed_func = func;
|
c->completed_func = func;
|
||||||
c->completed_data = data;
|
c->completed_data = data;
|
||||||
|
|
||||||
clutter_actor_get_scale (actor, &scale_start, NULL);
|
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,
|
||||||
scale_start,
|
x_scale_start, y_scale_start,
|
||||||
scale_end,
|
x_scale_end, y_scale_end,
|
||||||
gravity);
|
gravity);
|
||||||
|
|
||||||
clutter_behaviour_apply (c->behave, actor);
|
clutter_behaviour_apply (c->behave, actor);
|
||||||
|
@ -140,7 +140,8 @@ ClutterTimeline *clutter_effect_path (ClutterEffectTemplate *template_,
|
|||||||
gpointer data);
|
gpointer data);
|
||||||
ClutterTimeline *clutter_effect_scale (ClutterEffectTemplate *template_,
|
ClutterTimeline *clutter_effect_scale (ClutterEffectTemplate *template_,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
gdouble scale_end,
|
gdouble x_scale_end,
|
||||||
|
gdouble y_scale_end,
|
||||||
ClutterGravity gravity,
|
ClutterGravity gravity,
|
||||||
ClutterEffectCompleteFunc func,
|
ClutterEffectCompleteFunc func,
|
||||||
gpointer data);
|
gpointer data);
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2008-01-17 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter-sections.txt: Add the new ClutterBehaviourScale setters.
|
||||||
|
|
||||||
2008-01-14 Emmanuele Bassi <ebassi@openedhand.com>
|
2008-01-14 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter-sections.txt: Add clutter_model_insertv()
|
* clutter-sections.txt: Add clutter_model_insertv()
|
||||||
|
@ -651,8 +651,11 @@ ClutterBehaviourScale
|
|||||||
ClutterBehaviourScaleClass
|
ClutterBehaviourScaleClass
|
||||||
clutter_behaviour_scale_new
|
clutter_behaviour_scale_new
|
||||||
clutter_behaviour_scale_newx
|
clutter_behaviour_scale_newx
|
||||||
|
clutter_behaviour_scale_set_bounds
|
||||||
clutter_behaviour_scale_get_bounds
|
clutter_behaviour_scale_get_bounds
|
||||||
|
clutter_behaviour_scale_set_boundsx
|
||||||
clutter_behaviour_scale_get_boundsx
|
clutter_behaviour_scale_get_boundsx
|
||||||
|
clutter_behaviour_scale_set_gravity
|
||||||
clutter_behaviour_scale_get_gravity
|
clutter_behaviour_scale_get_gravity
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
CLUTTER_BEHAVIOUR_SCALE
|
CLUTTER_BEHAVIOUR_SCALE
|
||||||
|
@ -172,13 +172,13 @@ main (int argc, char *argv[])
|
|||||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE, NULL, NULL);
|
alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE, NULL, NULL);
|
||||||
|
|
||||||
scaler_1 = clutter_behaviour_scale_new (alpha,
|
scaler_1 = clutter_behaviour_scale_new (alpha,
|
||||||
0.5,
|
0.5, 0.5,
|
||||||
1.0,
|
1.0, 1.0,
|
||||||
CLUTTER_GRAVITY_CENTER);
|
CLUTTER_GRAVITY_CENTER);
|
||||||
|
|
||||||
scaler_2 = clutter_behaviour_scale_new (alpha,
|
scaler_2 = clutter_behaviour_scale_new (alpha,
|
||||||
1.0,
|
1.0, 1.0,
|
||||||
0.5,
|
0.5, 0.5,
|
||||||
CLUTTER_GRAVITY_CENTER);
|
CLUTTER_GRAVITY_CENTER);
|
||||||
|
|
||||||
/* create a new group to hold multiple actors in a group */
|
/* create a new group to hold multiple actors in a group */
|
||||||
|
@ -69,7 +69,8 @@ main (int argc, char *argv[])
|
|||||||
clutter_container_add_actor (container, actor);
|
clutter_container_add_actor (container, actor);
|
||||||
clutter_actor_set_size (actor, 50, 50);
|
clutter_actor_set_size (actor, 50, 50);
|
||||||
clutter_actor_set_position (actor, 50, 280);
|
clutter_actor_set_position (actor, 50, 280);
|
||||||
clutter_effect_scale (tmpl, actor, 2.0, CLUTTER_GRAVITY_CENTER, NULL, NULL);
|
clutter_effect_scale (tmpl, actor, 2.0, 2.0,
|
||||||
|
CLUTTER_GRAVITY_CENTER, NULL, NULL);
|
||||||
clutter_actor_show (actor);
|
clutter_actor_show (actor);
|
||||||
|
|
||||||
actor = clutter_rectangle_new_with_color (&rect_color);
|
actor = clutter_rectangle_new_with_color (&rect_color);
|
||||||
|
@ -38,6 +38,7 @@ main (int argc, char *argv[])
|
|||||||
label = clutter_label_new_with_text ("Mono 16", "The Wonder of the Spinning Hand");
|
label = clutter_label_new_with_text ("Mono 16", "The Wonder of the Spinning Hand");
|
||||||
clutter_label_set_alignment (CLUTTER_LABEL (label), PANGO_ALIGN_CENTER);
|
clutter_label_set_alignment (CLUTTER_LABEL (label), PANGO_ALIGN_CENTER);
|
||||||
clutter_actor_set_position (label, 150, 150);
|
clutter_actor_set_position (label, 150, 150);
|
||||||
|
clutter_actor_set_size (label, 500, 100);
|
||||||
clutter_actor_show (label);
|
clutter_actor_show (label);
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
|
||||||
|
|
||||||
|
@ -65,8 +65,8 @@ main (int argc, char *argv[])
|
|||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
behave = clutter_behaviour_scale_new (alpha,
|
behave = clutter_behaviour_scale_new (alpha,
|
||||||
0.0,
|
0.0, 0.0, /* scale start */
|
||||||
1.0,
|
1.0, 1.0, /* scale end */
|
||||||
gravities[gindex]);
|
gravities[gindex]);
|
||||||
|
|
||||||
clutter_behaviour_apply (behave, rect);
|
clutter_behaviour_apply (behave, rect);
|
||||||
|
Loading…
Reference in New Issue
Block a user