From f4029ab77c385a0446d35970bcf43b909c3fed54 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Tue, 26 Jun 2007 11:35:33 +0000 Subject: [PATCH] added fixed version of clutter_actor_rotate_*() functions and accessors for rotation angles --- ChangeLog | 7 +++ clutter/clutter-actor.c | 118 ++++++++++++++++++++++++++++++++++++++-- clutter/clutter-actor.h | 15 +++++ 3 files changed, 135 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index de846143f..efcbb6cb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-06-26 Tomas Frydrych + + * clutter/clutter-actor.h: + * clutter/clutter-actor.c: + Added fixed point version of clutter_actor_rotate_*() functions + and accessors for rotation angles. + 2007-06-25 Matthew Allum * README: diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index fd969653f..860a387b6 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -1990,7 +1990,6 @@ clutter_actor_rotate_z (ClutterActor *self, gint x, gint y) { - /* FIXME: FIXED VERSION */ g_return_if_fail (CLUTTER_IS_ACTOR (self)); self->priv->rzang = CLUTTER_FLOAT_TO_FIXED (angle); @@ -2018,8 +2017,6 @@ clutter_actor_rotate_x (ClutterActor *self, { g_return_if_fail (CLUTTER_IS_ACTOR (self)); - /* FIXME: FIXED API Version */ - self->priv->rxang = CLUTTER_FLOAT_TO_FIXED(angle); self->priv->rxy = y; self->priv->rxz = z; @@ -2045,8 +2042,6 @@ clutter_actor_rotate_y (ClutterActor *self, { g_return_if_fail (CLUTTER_IS_ACTOR (self)); - /* FIXME: FIXED API VERSION */ - self->priv->ryang = CLUTTER_FLOAT_TO_FIXED(angle); self->priv->ryx = x; @@ -2056,6 +2051,119 @@ clutter_actor_rotate_y (ClutterActor *self, clutter_actor_queue_redraw (self); } +/** + * clutter_actor_rotate_zx: + * @self: A #ClutterActor + * @angle: Angle of rotation + * @x: X co-ord to rotate actor around ( relative to actor position ) + * @y: Y co-ord to rotate actor around ( relative to actor position ) + * + * Rotates actor around the Z axis. + */ +void +clutter_actor_rotate_zx (ClutterActor *self, + ClutterFixed angle, + gint x, + gint y) +{ + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + self->priv->rzang = angle; + self->priv->rzx = x; + self->priv->rzy = y; + + if (CLUTTER_ACTOR_IS_VISIBLE (self)) + clutter_actor_queue_redraw (self); +} + +/** + * clutter_actor_rotate_xx: + * @self: A #ClutterActor + * @angle: Angle of rotation + * @y: Y co-ord to rotate actor around ( relative to actor position ) + * @z: Z co-ord to rotate actor around ( relative to actor position ) + * + * Rotates actor around the X axis. + */ +void +clutter_actor_rotate_xx (ClutterActor *self, + ClutterFixed angle, + gint y, + gint z) +{ + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + self->priv->rxang = angle; + self->priv->rxy = y; + self->priv->rxz = z; + + if (CLUTTER_ACTOR_IS_VISIBLE (self)) + clutter_actor_queue_redraw (self); +} + +/** + * clutter_actor_rotate_yx: + * @self: A #ClutterActor + * @angle: Angle of rotation + * @x: X co-ord to rotate actor around ( relative to actor position ) + * @z: Z co-ord to rotate actor around ( relative to actor position ) + * + * Rotates actor around the X axis. + */ +void +clutter_actor_rotate_yx (ClutterActor *self, + ClutterFixed angle, + gint x, + gint z) +{ + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + self->priv->ryang = angle; + self->priv->ryx = x; + self->priv->ryz = z; + + if (CLUTTER_ACTOR_IS_VISIBLE (self)) + clutter_actor_queue_redraw (self); +} + +/** + * clutter_actor_get_rxangx: + * @self: A #ClutterActor + * + * Gets the angle of rotation around x axis in degrees. + */ +ClutterFixed +clutter_actor_get_rxangx (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0); + return self->priv->rxang; +} + +/** + * clutter_actor_get_ryangx: + * @self: A #ClutterActor + * + * Gets the angle of rotation around y axis in degrees. + */ +ClutterFixed +clutter_actor_get_ryangx (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0); + return self->priv->ryang; +} + +/** + * clutter_actor_get_rzangx: + * @self: A #ClutterActor + * + * Gets the angle of rotation around x axis in degrees. + */ +ClutterFixed +clutter_actor_get_rzangx (ClutterActor *self) +{ + g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0); + return self->priv->rzang; +} /** * clutter_actor_set_clip: diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index 72dc293be..f7fc6e04c 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -217,6 +217,21 @@ void clutter_actor_rotate_z (ClutterActor *sel gfloat angle, gint x, gint y); +void clutter_actor_rotate_xx (ClutterActor *self, + ClutterFixed angle, + gint y, + gint z); +void clutter_actor_rotate_yx (ClutterActor *self, + ClutterFixed angle, + gint x, + gint z); +void clutter_actor_rotate_zx (ClutterActor *self, + ClutterFixed angle, + gint x, + gint y); +ClutterFixed clutter_actor_get_rxangx (ClutterActor *self); +ClutterFixed clutter_actor_get_ryangx (ClutterActor *self); +ClutterFixed clutter_actor_get_rzangx (ClutterActor *self); void clutter_actor_set_opacity (ClutterActor *self, guint8 opacity); guint8 clutter_actor_get_opacity (ClutterActor *self);