Merge branch 'scale-center'

Bug 1349 - Using the anchor point to set the scale center is messy

The branch adds an extra center point for scaling which can be used
for example to set a scale about the center without affecting the
position of the actor.

The scale center can be specified as a unit offset from the origin or
as a gravity. If specified as a gravity it will be stored as a
fraction of the actor's size so that the position will track when the
actor changes size.

The anchor point and rotation centers have been modified so they can
be set with a gravity in the same way. However, only the Z rotation
exposes a property to set using a gravity because the other two
require a Z coordinate which doesn't make sense to interpret as a
fraction of the actor's width or height.

Conflicts:

	clutter/clutter-actor.c
This commit is contained in:
Neil Roberts
2009-01-28 09:08:19 +00:00
8 changed files with 1607 additions and 437 deletions

File diff suppressed because it is too large Load Diff

View File

@ -390,33 +390,26 @@ void clutter_actor_set_rotation (ClutterActor
gint x,
gint y,
gint z);
void clutter_actor_set_rotationx (ClutterActor *self,
ClutterRotateAxis axis,
ClutterFixed angle,
gint x,
gint y,
gint z);
void clutter_actor_set_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
ClutterUnit x,
ClutterUnit y,
ClutterUnit z);
void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self,
gdouble angle,
ClutterGravity gravity);
gdouble clutter_actor_get_rotation (ClutterActor *self,
ClutterRotateAxis axis,
gint *x,
gint *y,
gint *z);
ClutterFixed clutter_actor_get_rotationx (ClutterActor *self,
ClutterRotateAxis axis,
gint *x,
gint *y,
gint *z);
gdouble clutter_actor_get_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
ClutterUnit *x,
ClutterUnit *y,
ClutterUnit *z);
ClutterGravity clutter_actor_get_z_rotation_gravity (ClutterActor *self);
void clutter_actor_set_opacity (ClutterActor *self,
guint8 opacity);
@ -474,18 +467,33 @@ void clutter_actor_set_depthu (ClutterActor
ClutterUnit depth);
ClutterUnit clutter_actor_get_depthu (ClutterActor *self);
void clutter_actor_set_scalex (ClutterActor *self,
ClutterFixed scale_x,
ClutterFixed scale_y);
void clutter_actor_set_scale (ClutterActor *self,
gdouble scale_x,
gdouble scale_y);
void clutter_actor_get_scalex (ClutterActor *self,
ClutterFixed *scale_x,
ClutterFixed *scale_y);
void clutter_actor_set_scale_full (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
int center_x,
int center_y);
void clutter_actor_set_scale_fullu (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterUnit center_x,
ClutterUnit center_y);
void clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterGravity gravity);
void clutter_actor_get_scale (ClutterActor *self,
gdouble *scale_x,
gdouble *scale_y);
void clutter_actor_get_scale_center (ClutterActor *self,
gint *center_x,
gint *center_y);
void clutter_actor_get_scale_centeru (ClutterActor *self,
ClutterUnit *center_x,
ClutterUnit *center_y);
ClutterGravity clutter_actor_get_scale_gravity (ClutterActor *self);
void clutter_actor_move_by (ClutterActor *self,
gint dx,
@ -526,6 +534,7 @@ void clutter_actor_move_anchor_point (ClutterActor *self,
void clutter_actor_get_anchor_point (ClutterActor *self,
gint *anchor_x,
gint *anchor_y);
ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self);
void clutter_actor_set_anchor_pointu (ClutterActor *self,
ClutterUnit anchor_x,
ClutterUnit anchor_y);

View File

@ -95,11 +95,11 @@ alpha_notify_foreach (ClutterBehaviour *behaviour,
rotate_behaviour = CLUTTER_BEHAVIOUR_ROTATE (behaviour);
priv = rotate_behaviour->priv;
clutter_actor_set_rotationx (actor, priv->axis,
angle,
priv->center_x,
priv->center_y,
priv->center_z);
clutter_actor_set_rotation (actor, priv->axis,
CLUTTER_FIXED_TO_DOUBLE (angle),
priv->center_x,
priv->center_y,
priv->center_z);
}
static inline

View File

@ -85,7 +85,9 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
{
ScaleFrameClosure *closure = data;
clutter_actor_set_scalex (actor, closure->scale_x, closure->scale_y);
clutter_actor_set_scale (actor,
CLUTTER_FIXED_TO_DOUBLE (closure->scale_x),
CLUTTER_FIXED_TO_DOUBLE (closure->scale_y));
}
static void