From 20a9bf142c97951a21fca7f1cc1366be3a1808fe Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 28 Nov 2007 12:23:31 +0000 Subject: [PATCH] 2007-11-28 Tomas Frydrych * clutter/NEWS: Started 0.6.0 section with comment on actor anchor point. * clutter/clutter/clutter-actor.c: * clutter/clutter/clutter-actor.h: * clutter/clutter/clutter-behaviour-scale.c: * clutter/clutter/clutter-deprecated.h: (clutter_actor_set_anchor_point): (clutter_actor_set_anchor_pointu): (clutter_actor_get_anchor_point): (clutter_actor_get_anchor_pointu): (clutter_actor_set_anchor_point_from_gravity): New anchor point API deprecating old gravity scaling, added comments on modelview matrix construction to ClutterActor documentation. (clutter_actor_set_scale_with_gravity): (clutter_actor_set_scale_with_gravityx): Deprecated; use clutter_actor_set_anchor_point_from_gravity() instead. --- ChangeLog | 22 +++ NEWS | 66 ++++---- clutter/clutter-actor.c | 324 +++++++++++++++++++++++++------------- clutter/clutter-actor.h | 51 +++--- clutter/clutter-behaviour-scale.c | 14 +- clutter/clutter-deprecated.h | 2 + 6 files changed, 310 insertions(+), 169 deletions(-) diff --git a/ChangeLog b/ChangeLog index 84f30ec..7295ed6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2007-11-28 Tomas Frydrych + + * clutter/NEWS: + Started 0.6.0 section with comment on actor anchor point. + + * clutter/clutter/clutter-actor.c: + * clutter/clutter/clutter-actor.h: + * clutter/clutter/clutter-behaviour-scale.c: + * clutter/clutter/clutter-deprecated.h: + (clutter_actor_set_anchor_point): + (clutter_actor_set_anchor_pointu): + (clutter_actor_get_anchor_point): + (clutter_actor_get_anchor_pointu): + (clutter_actor_set_anchor_point_from_gravity): + New anchor point API deprecating old gravity scaling, added + comments on modelview matrix construction to ClutterActor + documentation. + + (clutter_actor_set_scale_with_gravity): + (clutter_actor_set_scale_with_gravityx): + Deprecated; use clutter_actor_set_anchor_point_from_gravity() instead. + 2007-11-28 Emmanuele Bassi * clutter/clutter-effect.[ch]: Add clutter_effect_template_construct() diff --git a/NEWS b/NEWS index 13f8518..6288547 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Clutter 0.6.0 (??/??/????) +======================== + + * List of changes between 0.4.0 and 0.6.0 + + o Scaling with gravity functionality was replaced by more generic and + powerful anchor point. + Clutter 0.4.0 (07/08/2007) ======================== @@ -5,7 +13,7 @@ Clutter 0.4.0 (07/08/2007) o Many documentation additions and improvements. - o Display DPI now honours on backends its can be queried. + o Display DPI now honours on backends its can be queried. o Various big endian related fixes. @@ -36,13 +44,13 @@ Clutter 0.4.0 (07/08/2007) o #390 - clutter_stage_get_actor_at_pos broken on 16bpp displays. o #398 - inconsistent type for return value of clutter_event_get_state o #403 - Critical error when removing texture actor - o #404 - Solaris build error with OpenGL, missing + o #404 - Solaris build error with OpenGL, missing GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB and GL_TEXTURE_RECTANGLE_ARB o #409 - depth mismatch between visual (32) and window (24) o #407 - metadata-available signal #ifdef'ed out o #413 - Clutter compile error with Sun Studio C compiler o #426 - typo in sdl_backend - o #414 - ClutterEntry invisible if size not set + o #414 - ClutterEntry invisible if size not set o #434 - clutter_color_from_pixel incorrectly interprets alpha value o #435 - clutter_color_subtract does the opposite of its documentation o #436 - clutter-behaviour-depth always perform "from deep to shallow" @@ -54,12 +62,12 @@ Clutter 0.3.1 (06/07/2007) o EGL. There are now 2 experimental EGL backends; - 'eglx', the former EGL on X11 implementation (now renamed) - 'eglnative', a new EGL 'native' backend which supporting non - X11 EGL implementations (i.e framebuffer). + X11 EGL implementations (i.e framebuffer). - o ClutterGroup now returns correct size when a child is removed. + o ClutterGroup now returns correct size when a child is removed. - o Missing redhand.png added to distro tarball (fixing tests that require - it) + o Missing redhand.png added to distro tarball (fixing tests that require + it) o Fix picking in ClutterBox @@ -69,7 +77,7 @@ Clutter 0.3.1 (06/07/2007) o Many API documentation fixes and improvements. - o ClutterEffect cleanups. + o ClutterEffect cleanups. o ClutterEntry cleanups. @@ -81,8 +89,8 @@ Clutter 0.3 (29/06/2007) ======================== * List of changes between 0.2.3 and 0.3 - o Clutter now supports both switchable windowing system and GL backends. - Window systems supported include GLX, EGL and SDL. + o Clutter now supports both switchable windowing system and GL backends. + Window systems supported include GLX, EGL and SDL. GL support includes OpenGL 1.2+ and OpenGL ES 1.1. This is provided by a small basic abstraction layer 'cogl.h'. Cogl is not @@ -92,8 +100,8 @@ Clutter 0.3 (29/06/2007) Notes; - GLX - --- + GLX + --- The GLX backend is built by default and is currently the most developed, supported and featured windowing system backend. Only OpenGL is supported via GLX. @@ -104,16 +112,16 @@ Clutter 0.3 (29/06/2007) is OpenGL ES via Dogles (very experimental). EGL - --- + --- Clutter has experimental support for using EGL. Only Open GL ES is supported by EGL. - EGL support assumes an EGL implementation running atop X Windows. + EGL support assumes an EGL implementation running atop X Windows. Open GL ES. ----------- - Clutter now has experimental support for Open GL ES. + Clutter now has experimental support for Open GL ES. Current known issues; + Unrealising a ClutterTexture will not move pixel data from video @@ -126,8 +134,8 @@ Clutter 0.3 (29/06/2007) include `Vincent' and `dgles'. Support for commerical implementations may require modifications to the configure.ac script. - - vincent: http://ogl-es.sourceforge.net/ + + vincent: http://ogl-es.sourceforge.net/ (Also see: http://svn.o-hand.com/repos/misc/trunk/ogles/ ) dgles: http://developer.hybrid.fi/dgles/index.html @@ -136,14 +144,14 @@ Clutter 0.3 (29/06/2007) API wrapping around behaviours, alphas and timelines. o New Behaviours - bspline, ellipsis, rotation. o New built in Alpha functions; - CLUTTER_ALPHA_SINE_INC - CLUTTER_ALPHA_SINE_DEC - CLUTTER_ALPHA_SINE_HALF - CLUTTER_ALPHA_SQUARE - CLUTTER_ALPHA_SMOOTHSTEP_INC - CLUTTER_ALPHA_SMOOTHSTEP_DEC - CLUTTER_ALPHA_EXP_INC - CLUTTER_ALPHA_EXP_DEC + CLUTTER_ALPHA_SINE_INC + CLUTTER_ALPHA_SINE_DEC + CLUTTER_ALPHA_SINE_HALF + CLUTTER_ALPHA_SQUARE + CLUTTER_ALPHA_SMOOTHSTEP_INC + CLUTTER_ALPHA_SMOOTHSTEP_DEC + CLUTTER_ALPHA_EXP_INC + CLUTTER_ALPHA_EXP_DEC o New Actors and interfaces + ClutterLayout, for writing extended layout support in actors + ClutterContainer, for generic container actors @@ -157,8 +165,8 @@ Clutter 0.3 (29/06/2007) + Perspective setting - The stages perspective can now be modified. o New Clutter_actor *project API calls allow for querying of tranformed actor vertices and points. - o New Clutter Feature checks. - o Initial ClutterUnit implementation for device independant positioning. + o New Clutter Feature checks. + o Initial ClutterUnit implementation for device independant positioning. * List of Bugs fixed o Various issues with very poor performance and Intel drivers. o #138 Fix typo in x rotation transform. @@ -218,7 +226,7 @@ Clutter 0.2 (18-01-2007) switches. o Add Pango GL renderer for Clutter, and use it to render text inside the ClutterLabel actor; this decrease texture memory - usage. + usage. o Redo Clutter Label widget, using the new Pango renderer. o Clutter Textures do not store local pixbuf copy (of texture). o Redo group and actor scale/sizing API and functionality. @@ -244,7 +252,7 @@ Clutter 0.1 (22/06/2006) * Contains: o Hopefully enough functionality to build things. o Basic gstreamer 0.10 video playback support. - o Fairly stable API, though in no way totally stable. + o Fairly stable API, though in no way totally stable. Expect CHANGES in future versions. o Some simple examples ( also see OPT ). o An experimental GTK-Clutter widget. diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index 39cde93..c787d78 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -32,7 +32,23 @@ * be a #ClutterActor, either by using one of the classes provided by * Clutter, or by implementing a new #ClutterActor subclass. * - * Ordering on/Notes on tranformations. FIXME. + * * Notes on actor transformation matrix + * + * The OpenGL modelview matrix for the actor is constructed from the actor + * settings by the following order of operations: + * + * Translation by actor x, y coords, + * Scaling by scale_x, scale_y, + * Negative translation by anchor point x, y, + * + * Rotation around z axis, + * Rotation around y axis, + * Rotation around x axis, + * Translation by actor depth (z), + * Clip stencil is applied (not an operation on the matrix as + * such, but done as part of the transform set up). + * + * * * Notes on clutter actor events: * @@ -56,9 +72,9 @@ * the event source actor is reached. The emission then enters the bubble * phase, traversing back up the chain via parents until it reaches the * stage. Any event handler can abort this chain by returning - * %TRUE (meaning "event handled"). + * %TRUE (meaning "event handled"). * Pointer events will 'pass through' non reactive actors. - * + * * */ @@ -158,6 +174,7 @@ struct _ClutterActorPrivate gchar *name; ClutterFixed scale_x, scale_y; guint32 id; /* Unique ID */ + ClutterUnit anchor_x, anchor_y; }; enum @@ -413,7 +430,7 @@ clutter_actor_real_pick (ClutterActor *self, * mapping pointer events to actors. * * This function should not never be called directly by applications. - * + * * Subclasses overiding this method should call * #clutter_actor_should_pick_paint to decide if to render there * silhouette but in any case should still recursively call pick for @@ -450,7 +467,7 @@ clutter_actor_should_pick_paint (ClutterActor *self) context = clutter_context_get_default (); - if (CLUTTER_ACTOR_IS_MAPPED (self) + if (CLUTTER_ACTOR_IS_MAPPED (self) && (G_UNLIKELY(context->pick_mode == CLUTTER_PICK_ALL) || CLUTTER_ACTOR_IS_REACTIVE (self))) return TRUE; @@ -733,8 +750,11 @@ static void _clutter_actor_apply_modelview_transform (ClutterActor * self) { ClutterActorPrivate *priv = self->priv; + ClutterActor *parent; + + parent = clutter_actor_get_parent (self); - if (clutter_actor_get_parent (self) != NULL) + if (parent != NULL) { cogl_translate (CLUTTER_UNITS_TO_INT (priv->coords.x1), CLUTTER_UNITS_TO_INT (priv->coords.y1), @@ -753,6 +773,13 @@ _clutter_actor_apply_modelview_transform (ClutterActor * self) cogl_scale (priv->scale_x, priv->scale_y); } + if (parent && (priv->anchor_x || priv->anchor_y)) + { + cogl_translate (CLUTTER_UNITS_TO_INT (-priv->anchor_x), + CLUTTER_UNITS_TO_INT (-priv->anchor_y), + 0); + } + if (priv->rzang) { cogl_translate (priv->rzx, priv->rzy, 0); @@ -852,7 +879,7 @@ clutter_actor_paint (ClutterActor *self) col.green = ((id >> b) & (0xff>>(8-g))) << (8-g); col.blue = (id & (0xff>>(8-b)))<<(8-b); col.alpha = 0xff; - + /* Actor will then paint silhouette of itself in supplied * color. See clutter_stage_get_actor_at_pos() for where * picking is enabled. @@ -2394,111 +2421,6 @@ clutter_actor_get_scale (ClutterActor *self, } /** - * clutter_actor_set_scale_with_gravity: - * @self: A #ClutterActor - * @scale_x: scaling factor for x axis - * @scale_y: scaling factor for y axis - * @gravity: #ClutterGravity to apply to scaling. - * - * Scales the actor by scale_x, scale_y taking into consideration the - * required gravity. - * - * Since: 0.4 - */ -void -clutter_actor_set_scale_with_gravity (ClutterActor *self, - gfloat scale_x, - gfloat scale_y, - ClutterGravity gravity) -{ - clutter_actor_set_scale_with_gravityx (self, - CLUTTER_FLOAT_TO_FIXED (scale_x), - CLUTTER_FLOAT_TO_FIXED (scale_y), - gravity); -} - -/** - * clutter_actor_set_scale_with_gravityx: - * @self: A #ClutterActor - * @scale_x: #ClutterFixed scaling factor for x axis - * @scale_y: #ClutterFixed scaling factor for y axis - * @gravity: #ClutterGravity to apply to scaling. - * - * Scales the actor by scale_x, scale_y taking into consideration the - * required gravity. - * - * Since: 0.4 - */ -void -clutter_actor_set_scale_with_gravityx (ClutterActor *self, - ClutterFixed scale_x, - ClutterFixed scale_y, - ClutterGravity gravity) -{ - ClutterActorBox box; - ClutterFixed sw, sh, w, h, x, y; - ClutterFixed old_scale_x, old_scale_y; - - clutter_actor_get_scalex (self, &old_scale_x, &old_scale_y); - clutter_actor_set_scalex (self, scale_x, scale_y); - - if (gravity == CLUTTER_GRAVITY_NONE || - gravity == CLUTTER_GRAVITY_NORTH_WEST) - return; - - clutter_actor_query_coords (self, &box); - - w = CFX_QMUL (box.x2 - box.x1, old_scale_x); - h = CFX_QMUL (box.y2 - box.y1, old_scale_y); - sw = CFX_QMUL (box.x2 - box.x1, scale_x); - sh = CFX_QMUL (box.y2 - box.y1, scale_y); - - - x = box.x1; - y = box.y1; - - switch (gravity) - { - case CLUTTER_GRAVITY_NORTH: - x = x - ((sw - w) / 2); - break; - case CLUTTER_GRAVITY_NORTH_EAST: - x = x + w - sw; - break; - case CLUTTER_GRAVITY_EAST: - x = x + w - sw; - y = y - ((sh - h) / 2); - break; - case CLUTTER_GRAVITY_SOUTH_EAST: - x = x + w - sw; - y = y + h - sh; - break; - case CLUTTER_GRAVITY_SOUTH: - x = x - ((sw - w) / 2); - y = y + h - sh; - break; - case CLUTTER_GRAVITY_SOUTH_WEST: - y = y + h - sh; - break; - case CLUTTER_GRAVITY_WEST: - y = y - ((sh - h) / 2); - break; - case CLUTTER_GRAVITY_CENTER: - x = x - ((sw - w) / 2); - y = y - ((sh - h) / 2); - default: - break; - } - - box.x2 += (x - box.x1); - box.y2 += (y - box.y1); - box.x1 = x; - box.y1 = y; - - clutter_actor_request_coords (self, &box); -} - -/** * clutter_actor_set_opacity: * @self: A #ClutterActor * @opacity: New opacity value for actor. @@ -2618,7 +2540,7 @@ clutter_actor_set_depth (ClutterActor *self, g_return_if_fail (CLUTTER_IS_ACTOR (self)); priv = self->priv; - + if (priv->z != depth) { /* Sets Z value. - FIXME: should invert ?*/ @@ -3372,6 +3294,182 @@ clutter_actor_get_reactive (ClutterActor *actor) return CLUTTER_ACTOR_IS_REACTIVE (actor); } +/** + * clutter_actor_set_anchor_point: + * @actor: a #ClutterActor + * @anchor_x: X coordinace of the anchor point. + * @anchor_y: Y coordinace of the anchor point. + * + * Sets an anchor point for the @actor. The anchor point is a point in the + * coordianate space of the actor to which the actor position within its + * parent is relative; the default is 0,0, i.e., the top-left corner. + * + * Since: 0.6 + */ +void +clutter_actor_set_anchor_point (ClutterActor *self, + gint anchor_x, gint anchor_y) +{ + ClutterActorPrivate *priv; + + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + priv = self->priv; + + priv->anchor_x = CLUTTER_UNITS_FROM_DEVICE (anchor_x); + priv->anchor_y = CLUTTER_UNITS_FROM_DEVICE (anchor_y); +} + +/** + * clutter_actor_get_anchor_point: + * @actor: a #ClutterActor + * @anchor_x: location for the X coordinace of the anchor point. + * @anchor_y: location for the X coordinace of the anchor point. + * + * Gets the current anchor point of the @actor. + * + * Since: 0.6 + */ +void +clutter_actor_get_anchor_point (ClutterActor *self, + gint *anchor_x, gint *anchor_y) +{ + ClutterActorPrivate *priv; + + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + priv = self->priv; + + if (anchor_x) + *anchor_x = CLUTTER_UNITS_TO_DEVICE (priv->anchor_x); + + if (anchor_y) + *anchor_y = CLUTTER_UNITS_TO_DEVICE (priv->anchor_y); +} + +/** + * clutter_actor_set_anchor_pointu: + * @actor: a #ClutterActor + * @anchor_x: X coordinace of the anchor point, in multiples of #ClutterUnit. + * @anchor_y: Y coordinace of the anchor point, in multiples of #ClutterUnit. + * + * Sets an anchor point for the @actor. The anchor point is a point in the + * coordinate space of the actor to which the actor position within its + * parent is relative; the default is 0,0, i.e., the top-left corner, of the + * actor. + * + * Since: 0.6 + */ +void +clutter_actor_set_anchor_pointu (ClutterActor *self, + ClutterUnit anchor_x, ClutterUnit anchor_y) +{ + ClutterActorPrivate *priv; + + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + priv = self->priv; + + priv->anchor_x = anchor_x; + priv->anchor_y = anchor_y; +} + +/** + * clutter_actor_get_anchor_pointu: + * @actor: a #ClutterActor + * @anchor_x: location for the X coordinace of the anchor point, #ClutterUnit. + * @anchor_y: location for the X coordinace of the anchor point, #ClutterUnit. + * + * Gets the current anchor point of the @actor. + * + * Since: 0.6 + */ +void +clutter_actor_get_anchor_pointu (ClutterActor *self, + ClutterUnit *anchor_x, ClutterUnit *anchor_y) +{ + ClutterActorPrivate *priv; + + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + priv = self->priv; + + if (anchor_x) + *anchor_x = priv->anchor_x; + + if (anchor_y) + *anchor_y = priv->anchor_y; +} + +/** + * clutter_actor_set_anchor_point_from_gravity: + * @actor: a #ClutterActor + * @gravity: #ClutterGravity. + * + * Sets an anchor point the actor based on the given gravity (this is a + * convenience function wrapping #clutter_actor_set_anchor_point). + * + * Since: 0.6 + */ +void +clutter_actor_set_anchor_point_from_gravity (ClutterActor *self, + ClutterGravity gravity) +{ + ClutterActorPrivate *priv; + ClutterActorBox box; + ClutterUnit w, h, x, y; + + g_return_if_fail (CLUTTER_IS_ACTOR (self)); + + priv = self->priv; + + clutter_actor_query_coords (self, &box); + + x = 0; + y = 0; + w = box.x2 - box.x1; + h = box.y2 - box.y1; + + switch (gravity) + { + case CLUTTER_GRAVITY_NORTH: + x = w/2; + break; + case CLUTTER_GRAVITY_SOUTH: + x = w/2; + y = h; + break; + case CLUTTER_GRAVITY_EAST: + x = w; + y = h/2; + break; + case CLUTTER_GRAVITY_NORTH_EAST: + x = w; + break; + case CLUTTER_GRAVITY_SOUTH_EAST: + x = w; + y = h; + break; + case CLUTTER_GRAVITY_SOUTH_WEST: + y = h; + break; + case CLUTTER_GRAVITY_WEST: + y = h/2; + break; + case CLUTTER_GRAVITY_CENTER: + x = w/2; + y = h/2; + break; + case CLUTTER_GRAVITY_NONE: + case CLUTTER_GRAVITY_NORTH_WEST: + default: + break; + } + + priv->anchor_x = x; + priv->anchor_y = y; +} + /* * ClutterGeometry */ diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h index e3a7a06..0df8a14 100644 --- a/clutter/clutter-actor.h +++ b/clutter/clutter-actor.h @@ -51,14 +51,14 @@ G_BEGIN_DECLS #define CLUTTER_ACTOR_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass)) -#define CLUTTER_ACTOR_SET_FLAGS(e,f) (((ClutterActor*)(e))->flags |= (f)) -#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) (((ClutterActor*)(e))->flags &= ~(f)) +#define CLUTTER_ACTOR_SET_FLAGS(e,f) (((ClutterActor*)(e))->flags |= (f)) +#define CLUTTER_ACTOR_UNSET_FLAGS(e,f) (((ClutterActor*)(e))->flags &= ~(f)) -#define CLUTTER_ACTOR_IS_MAPPED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_MAPPED) +#define CLUTTER_ACTOR_IS_MAPPED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_MAPPED) #define CLUTTER_ACTOR_IS_REALIZED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REALIZED) #define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \ CLUTTER_ACTOR_IS_REALIZED (e)) -#define CLUTTER_ACTOR_IS_REACTIVE(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REACTIVE) +#define CLUTTER_ACTOR_IS_REACTIVE(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REACTIVE) /* && CLUTTER_ACTOR_IS_VISIBLE(e)) */ @@ -125,13 +125,13 @@ struct _ClutterActor { /*< private >*/ GInitiallyUnowned parent_instance; - + /*< public >*/ guint32 flags; /*< private >*/ guint32 private_flags; - + ClutterActorPrivate *priv; }; @@ -230,7 +230,7 @@ void clutter_actor_hide_all (ClutterActor *sel void clutter_actor_realize (ClutterActor *self); void clutter_actor_unrealize (ClutterActor *self); void clutter_actor_paint (ClutterActor *self); -void clutter_actor_pick (ClutterActor *self, +void clutter_actor_pick (ClutterActor *self, const ClutterColor *color); void clutter_actor_queue_redraw (ClutterActor *self); void clutter_actor_destroy (ClutterActor *self); @@ -262,9 +262,9 @@ void clutter_actor_get_abs_position (ClutterActor *sel gint *y); guint clutter_actor_get_width (ClutterActor *self); guint clutter_actor_get_height (ClutterActor *self); -void clutter_actor_set_width (ClutterActor *self, +void clutter_actor_set_width (ClutterActor *self, guint width); -void clutter_actor_set_height (ClutterActor *self, +void clutter_actor_set_height (ClutterActor *self, guint height); gint clutter_actor_get_x (ClutterActor *self); gint clutter_actor_get_y (ClutterActor *self); @@ -303,9 +303,9 @@ void clutter_actor_set_name (ClutterActor *sel G_CONST_RETURN gchar *clutter_actor_get_name (ClutterActor *self); guint32 clutter_actor_get_gid (ClutterActor *self); void clutter_actor_set_clip (ClutterActor *self, - gint xoff, - gint yoff, - gint width, + gint xoff, + gint yoff, + gint width, gint height); void clutter_actor_remove_clip (ClutterActor *self); gboolean clutter_actor_has_clip (ClutterActor *self); @@ -345,16 +345,6 @@ void clutter_actor_get_scale (ClutterActor *sel gdouble *scale_x, gdouble *scale_y); -void clutter_actor_set_scale_with_gravityx (ClutterActor *self, - ClutterFixed scale_x, - ClutterFixed scale_y, - ClutterGravity gravity); - -void clutter_actor_set_scale_with_gravity (ClutterActor *self, - gfloat scale_x, - gfloat scale_y, - ClutterGravity gravity); - void clutter_actor_get_abs_size (ClutterActor *self, guint *width, guint *height); @@ -368,7 +358,7 @@ void clutter_actor_move_by (ClutterActor void clutter_actor_get_vertices (ClutterActor *self, ClutterVertex verts[4]); -void clutter_actor_apply_transform_to_point (ClutterActor *self, +void clutter_actor_apply_transform_to_point (ClutterActor *self, ClutterVertex *point, ClutterVertex *vertex); @@ -379,6 +369,21 @@ ClutterActor * clutter_get_actor_by_gid (guint32 id); gboolean clutter_actor_should_pick_paint (ClutterActor *self); +void clutter_actor_set_anchor_point (ClutterActor *self, + gint offset_x, + gint offset_y); +void clutter_actor_get_anchor_point (ClutterActor *self, + gint *offset_x, + gint *offset_y); +void clutter_actor_set_anchor_pointu (ClutterActor *self, + ClutterUnit offset_x, + ClutterUnit offset_y); +void clutter_actor_get_anchor_pointu (ClutterActor *self, + ClutterUnit *offset_x, + ClutterUnit *offset_y); +void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self, + ClutterGravity gravity); + G_END_DECLS #endif /* _HAVE_CLUTTER_ACTOR_H */ diff --git a/clutter/clutter-behaviour-scale.c b/clutter/clutter-behaviour-scale.c index 54759ab..033b506 100644 --- a/clutter/clutter-behaviour-scale.c +++ b/clutter/clutter-behaviour-scale.c @@ -82,7 +82,13 @@ scale_frame_foreach (ClutterBehaviour *behaviour, ClutterFixed scale = GPOINTER_TO_UINT (data); ClutterGravity gravity = priv->gravity; - clutter_actor_set_scale_with_gravityx (actor, scale, scale, 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, scale, scale); } static void @@ -170,7 +176,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass) * ClutterBehaviourScale:scale-start: * * The initial scaling factor for the actors. - * + * * Since: 0.2 */ g_object_class_install_property (gobject_class, @@ -275,8 +281,8 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha, 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, NULL); diff --git a/clutter/clutter-deprecated.h b/clutter/clutter-deprecated.h index 9d339ff..88a800a 100644 --- a/clutter/clutter-deprecated.h +++ b/clutter/clutter-deprecated.h @@ -31,5 +31,7 @@ #define clutter_actor_get_rxangx clutter_actor_get_rxangx_DEPRECATED_BY_clutter_actor_get_rotationx #define clutter_actor_get_ryangx clutter_actor_get_ryangx_DEPRECATED_BY_clutter_actor_get_rotationx #define clutter_actor_get_rzangx clutter_actor_get_rzangx_DEPRECATED_BY_clutter_actor_get_rotationx +#define clutter_actor_set_scale_with_gravity clutter_actor_set_scale_with_gravity_DEPRECATED_BY_clutter_actor_set_anchor_point_from_gravity +#define clutter_actor_set_scale_with_gravityx clutter_actor_set_scale_with_gravity_DEPRECATED_BY_clutter_actor_set_anchor_point_from_gravity #endif /* CLUTTER_DEPRECATED_H */ -- 2.7.4