mirror of
https://github.com/brl/mutter.git
synced 2025-01-03 08:12:15 +00:00
Add API for getting the scale bounds from a scale behaviour instance.
This commit is contained in:
parent
f741107fcb
commit
f595460932
@ -1,3 +1,8 @@
|
|||||||
|
2007-03-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
|
* clutter/clutter-behaviour-scale.[ch]: Add API for getting
|
||||||
|
the scale bounds and the gravity from a scale behaviour instance.
|
||||||
|
|
||||||
2007-03-26 Emmanuele Bassi <ebassi@openedhand.com>
|
2007-03-26 Emmanuele Bassi <ebassi@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-timeline.c: Fix last commit.
|
* clutter/clutter-timeline.c: Fix last commit.
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* @short_description: A behaviour class interpolating actors size between
|
* @short_description: A behaviour class interpolating actors size between
|
||||||
* two values.
|
* two values.
|
||||||
*
|
*
|
||||||
* #ClutterBehaviourPath interpolates actors size between two values.
|
* A #ClutterBehaviourScale interpolates actors size between two values.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -47,13 +47,6 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:clutter-behaviour-scale
|
|
||||||
* @short_description: Behaviour controlling the scale of a set of actors
|
|
||||||
*
|
|
||||||
* FIXME
|
|
||||||
*/
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (ClutterBehaviourScale,
|
G_DEFINE_TYPE (ClutterBehaviourScale,
|
||||||
clutter_behaviour_scale,
|
clutter_behaviour_scale,
|
||||||
CLUTTER_TYPE_BEHAVIOUR);
|
CLUTTER_TYPE_BEHAVIOUR);
|
||||||
@ -121,7 +114,7 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
|
|||||||
/*
|
/*
|
||||||
* FIXME: This is actually broken for anything other than 0,0
|
* FIXME: This is actually broken for anything other than 0,0
|
||||||
*/
|
*/
|
||||||
clutter_actor_set_position (actor, (w - sw)/2, (h - sh)/2);
|
clutter_actor_set_position (actor, (w - sw) / 2, (h - sh) / 2);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -131,7 +124,7 @@ 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;
|
ClutterFixed scale, factor;
|
||||||
ClutterBehaviourScalePrivate *priv;
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
priv = CLUTTER_BEHAVIOUR_SCALE (behave)->priv;
|
||||||
@ -287,6 +280,8 @@ clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
|||||||
gdouble scale_end,
|
gdouble scale_end,
|
||||||
ClutterGravity gravity)
|
ClutterGravity gravity)
|
||||||
{
|
{
|
||||||
|
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_begin),
|
CLUTTER_FLOAT_TO_FIXED (scale_begin),
|
||||||
CLUTTER_FLOAT_TO_FIXED (scale_end),
|
CLUTTER_FLOAT_TO_FIXED (scale_end),
|
||||||
@ -314,6 +309,8 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
|||||||
{
|
{
|
||||||
ClutterBehaviourScale *behave;
|
ClutterBehaviourScale *behave;
|
||||||
|
|
||||||
|
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,
|
"alpha", alpha,
|
||||||
NULL);
|
NULL);
|
||||||
@ -324,3 +321,77 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
|||||||
|
|
||||||
return CLUTTER_BEHAVIOUR (behave);
|
return CLUTTER_BEHAVIOUR (behave);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_behaviour_scale_get_bounds:
|
||||||
|
* @scale: a #ClutterBehaviourScale
|
||||||
|
* @scale_begin: return location for the initial scale factor
|
||||||
|
* @scale_end: return location for the final scale factor
|
||||||
|
*
|
||||||
|
* Retrieves the bounds used by scale behaviour.
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||||
|
gdouble *scale_begin,
|
||||||
|
gdouble *scale_end)
|
||||||
|
{
|
||||||
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||||
|
|
||||||
|
priv = scale->priv;
|
||||||
|
|
||||||
|
if (scale_begin)
|
||||||
|
*scale_begin = CLUTTER_FIXED_TO_DOUBLE (priv->scale_begin);
|
||||||
|
|
||||||
|
if (scale_end)
|
||||||
|
*scale_end = CLUTTER_FIXED_TO_DOUBLE (priv->scale_end);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_behaviour_scale_get_boundsx:
|
||||||
|
* @scale: a #ClutterBehaviourScale
|
||||||
|
* @scale_begin: return location for the initial scale factor
|
||||||
|
* @scale_end: return location for the final scale factor
|
||||||
|
*
|
||||||
|
* Retrieves the bounds used by scale behaviour.
|
||||||
|
*
|
||||||
|
* Since: 0.4
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||||
|
ClutterFixed *scale_begin,
|
||||||
|
ClutterFixed *scale_end)
|
||||||
|
{
|
||||||
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_BEHAVIOUR_SCALE (scale));
|
||||||
|
|
||||||
|
priv = scale->priv;
|
||||||
|
|
||||||
|
if (scale_begin)
|
||||||
|
*scale_begin = priv->scale_begin;
|
||||||
|
|
||||||
|
if (scale_end)
|
||||||
|
*scale_end = priv->scale_end;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
@ -55,23 +55,8 @@ G_BEGIN_DECLS
|
|||||||
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||||
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
CLUTTER_TYPE_BEHAVIOUR_SCALE, ClutterBehaviourScaleClass))
|
||||||
|
|
||||||
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
|
typedef enum { /*< prefix=CLUTTER_GRAVITY >*/
|
||||||
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
|
CLUTTER_GRAVITY_NONE = 0,
|
||||||
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
|
|
||||||
|
|
||||||
struct _ClutterBehaviourScale
|
|
||||||
{
|
|
||||||
ClutterBehaviour parent;
|
|
||||||
ClutterBehaviourScalePrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ClutterBehaviourScaleClass
|
|
||||||
{
|
|
||||||
ClutterBehaviourClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
CLUTTER_GRAVITY_NONE = 0,
|
|
||||||
CLUTTER_GRAVITY_NORTH,
|
CLUTTER_GRAVITY_NORTH,
|
||||||
CLUTTER_GRAVITY_NORTH_EAST,
|
CLUTTER_GRAVITY_NORTH_EAST,
|
||||||
CLUTTER_GRAVITY_EAST,
|
CLUTTER_GRAVITY_EAST,
|
||||||
@ -83,20 +68,43 @@ typedef enum {
|
|||||||
CLUTTER_GRAVITY_CENTER
|
CLUTTER_GRAVITY_CENTER
|
||||||
} ClutterGravity;
|
} ClutterGravity;
|
||||||
|
|
||||||
|
typedef struct _ClutterBehaviourScale ClutterBehaviourScale;
|
||||||
|
typedef struct _ClutterBehaviourScalePrivate ClutterBehaviourScalePrivate;
|
||||||
|
typedef struct _ClutterBehaviourScaleClass ClutterBehaviourScaleClass;
|
||||||
|
|
||||||
|
struct _ClutterBehaviourScale
|
||||||
|
{
|
||||||
|
ClutterBehaviour parent_instance;
|
||||||
|
|
||||||
|
/*< private >*/
|
||||||
|
ClutterBehaviourScalePrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _ClutterBehaviourScaleClass
|
||||||
|
{
|
||||||
|
ClutterBehaviourClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
GType clutter_behaviour_scale_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
ClutterBehaviour*
|
ClutterBehaviour *clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
||||||
clutter_behaviour_scale_new (ClutterAlpha *alpha,
|
gdouble scale_begin,
|
||||||
gdouble scale_begin,
|
gdouble scale_end,
|
||||||
gdouble scale_end,
|
ClutterGravity gravity);
|
||||||
ClutterGravity gravity);
|
ClutterBehaviour *clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
||||||
|
ClutterFixed scale_begin,
|
||||||
|
ClutterFixed scale_end,
|
||||||
|
ClutterGravity gravity);
|
||||||
|
|
||||||
ClutterBehaviour*
|
void clutter_behaviour_scale_get_bounds (ClutterBehaviourScale *scale,
|
||||||
clutter_behaviour_scale_newx (ClutterAlpha *alpha,
|
gdouble *scale_begin,
|
||||||
ClutterFixed scale_begin,
|
gdouble *scale_end);
|
||||||
ClutterFixed scale_end,
|
void clutter_behaviour_scale_get_boundsx (ClutterBehaviourScale *scale,
|
||||||
ClutterGravity gravity);
|
ClutterFixed *scale_begin,
|
||||||
|
ClutterFixed *scale_end);
|
||||||
|
|
||||||
|
ClutterGravity clutter_behaviour_scale_get_gravity (ClutterBehaviourScale *scale);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif /* __CLUTTER_BEHAVIOUR_SCALE_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user