2007-11-28 Tomas Frydrych <tf@openedhand.com>

* 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.
This commit is contained in:
Tomas Frydrych 2007-11-28 12:23:31 +00:00
parent 04afb1066c
commit 20a9bf142c
6 changed files with 310 additions and 169 deletions

View File

@ -1,3 +1,25 @@
2007-11-28 Tomas Frydrych <tf@openedhand.com>
* 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 <ebassi@openedhand.com> 2007-11-28 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/clutter-effect.[ch]: Add clutter_effect_template_construct() * clutter/clutter-effect.[ch]: Add clutter_effect_template_construct()

66
NEWS
View File

@ -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) 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 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. 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 #390 - clutter_stage_get_actor_at_pos broken on 16bpp displays.
o #398 - inconsistent type for return value of clutter_event_get_state o #398 - inconsistent type for return value of clutter_event_get_state
o #403 - Critical error when removing texture actor 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 GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB and GL_TEXTURE_RECTANGLE_ARB
o #409 - depth mismatch between visual (32) and window (24) o #409 - depth mismatch between visual (32) and window (24)
o #407 - metadata-available signal #ifdef'ed out o #407 - metadata-available signal #ifdef'ed out
o #413 - Clutter compile error with Sun Studio C compiler o #413 - Clutter compile error with Sun Studio C compiler
o #426 - typo in sdl_backend 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 #434 - clutter_color_from_pixel incorrectly interprets alpha value
o #435 - clutter_color_subtract does the opposite of its documentation o #435 - clutter_color_subtract does the opposite of its documentation
o #436 - clutter-behaviour-depth always perform "from deep to shallow" 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; o EGL. There are now 2 experimental EGL backends;
- 'eglx', the former EGL on X11 implementation (now renamed) - 'eglx', the former EGL on X11 implementation (now renamed)
- 'eglnative', a new EGL 'native' backend which supporting non - '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 o Missing redhand.png added to distro tarball (fixing tests that require
it) it)
o Fix picking in ClutterBox o Fix picking in ClutterBox
@ -69,7 +77,7 @@ Clutter 0.3.1 (06/07/2007)
o Many API documentation fixes and improvements. o Many API documentation fixes and improvements.
o ClutterEffect cleanups. o ClutterEffect cleanups.
o ClutterEntry cleanups. o ClutterEntry cleanups.
@ -81,8 +89,8 @@ Clutter 0.3 (29/06/2007)
======================== ========================
* List of changes between 0.2.3 and 0.3 * List of changes between 0.2.3 and 0.3
o Clutter now supports both switchable windowing system and GL backends. o Clutter now supports both switchable windowing system and GL backends.
Window systems supported include GLX, EGL and SDL. Window systems supported include GLX, EGL and SDL.
GL support includes OpenGL 1.2+ and OpenGL ES 1.1. This is 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 provided by a small basic abstraction layer 'cogl.h'. Cogl is not
@ -92,8 +100,8 @@ Clutter 0.3 (29/06/2007)
Notes; Notes;
GLX GLX
--- ---
The GLX backend is built by default and is currently the most The GLX backend is built by default and is currently the most
developed, supported and featured windowing system backend. Only developed, supported and featured windowing system backend. Only
OpenGL is supported via GLX. OpenGL is supported via GLX.
@ -104,16 +112,16 @@ Clutter 0.3 (29/06/2007)
is OpenGL ES via Dogles (very experimental). is OpenGL ES via Dogles (very experimental).
EGL EGL
--- ---
Clutter has experimental support for using EGL. Only Open GL ES Clutter has experimental support for using EGL. Only Open GL ES
is supported by EGL. 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. Open GL ES.
----------- -----------
Clutter now has experimental support for Open GL ES. Clutter now has experimental support for Open GL ES.
Current known issues; Current known issues;
+ Unrealising a ClutterTexture will not move pixel data from video + 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 include `Vincent' and `dgles'. Support for commerical
implementations may require modifications to the configure.ac implementations may require modifications to the configure.ac
script. script.
vincent: http://ogl-es.sourceforge.net/ vincent: http://ogl-es.sourceforge.net/
(Also see: http://svn.o-hand.com/repos/misc/trunk/ogles/ ) (Also see: http://svn.o-hand.com/repos/misc/trunk/ogles/ )
dgles: http://developer.hybrid.fi/dgles/index.html 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. API wrapping around behaviours, alphas and timelines.
o New Behaviours - bspline, ellipsis, rotation. o New Behaviours - bspline, ellipsis, rotation.
o New built in Alpha functions; o New built in Alpha functions;
CLUTTER_ALPHA_SINE_INC CLUTTER_ALPHA_SINE_INC
CLUTTER_ALPHA_SINE_DEC CLUTTER_ALPHA_SINE_DEC
CLUTTER_ALPHA_SINE_HALF CLUTTER_ALPHA_SINE_HALF
CLUTTER_ALPHA_SQUARE CLUTTER_ALPHA_SQUARE
CLUTTER_ALPHA_SMOOTHSTEP_INC CLUTTER_ALPHA_SMOOTHSTEP_INC
CLUTTER_ALPHA_SMOOTHSTEP_DEC CLUTTER_ALPHA_SMOOTHSTEP_DEC
CLUTTER_ALPHA_EXP_INC CLUTTER_ALPHA_EXP_INC
CLUTTER_ALPHA_EXP_DEC CLUTTER_ALPHA_EXP_DEC
o New Actors and interfaces o New Actors and interfaces
+ ClutterLayout, for writing extended layout support in actors + ClutterLayout, for writing extended layout support in actors
+ ClutterContainer, for generic container 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. + Perspective setting - The stages perspective can now be modified.
o New Clutter_actor *project API calls allow for querying of tranformed o New Clutter_actor *project API calls allow for querying of tranformed
actor vertices and points. actor vertices and points.
o New Clutter Feature checks. o New Clutter Feature checks.
o Initial ClutterUnit implementation for device independant positioning. o Initial ClutterUnit implementation for device independant positioning.
* List of Bugs fixed * List of Bugs fixed
o Various issues with very poor performance and Intel drivers. o Various issues with very poor performance and Intel drivers.
o #138 Fix typo in x rotation transform. o #138 Fix typo in x rotation transform.
@ -218,7 +226,7 @@ Clutter 0.2 (18-01-2007)
switches. switches.
o Add Pango GL renderer for Clutter, and use it to render text o Add Pango GL renderer for Clutter, and use it to render text
inside the ClutterLabel actor; this decrease texture memory inside the ClutterLabel actor; this decrease texture memory
usage. usage.
o Redo Clutter Label widget, using the new Pango renderer. o Redo Clutter Label widget, using the new Pango renderer.
o Clutter Textures do not store local pixbuf copy (of texture). o Clutter Textures do not store local pixbuf copy (of texture).
o Redo group and actor scale/sizing API and functionality. o Redo group and actor scale/sizing API and functionality.
@ -244,7 +252,7 @@ Clutter 0.1 (22/06/2006)
* Contains: * Contains:
o Hopefully enough functionality to build things. o Hopefully enough functionality to build things.
o Basic gstreamer 0.10 video playback support. 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. Expect CHANGES in future versions.
o Some simple examples ( also see OPT ). o Some simple examples ( also see OPT ).
o An experimental GTK-Clutter widget. o An experimental GTK-Clutter widget.

View File

@ -32,7 +32,23 @@
* be a #ClutterActor, either by using one of the classes provided by * be a #ClutterActor, either by using one of the classes provided by
* Clutter, or by implementing a new #ClutterActor subclass. * 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:
* <orderedlist>
* <listitem><para>Translation by actor x, y coords,</para></listitem>
* <listitem><para>Scaling by scale_x, scale_y,</para></listitem>
* <listitem><para>Negative translation by anchor point x, y,</para>
* </listitem>
* <listitem><para>Rotation around z axis,</para></listitem>
* <listitem><para>Rotation around y axis,</para></listitem>
* <listitem><para>Rotation around x axis,</para></listitem>
* <listitem><para>Translation by actor depth (z),</para></listitem>
* <listitem><para>Clip stencil is applied (not an operation on the matrix as
* such, but done as part of the transform set up).</para>
* </listitem>
* </orderedlist>
* *
* Notes on clutter actor events: * Notes on clutter actor events:
* <orderedlist> * <orderedlist>
@ -56,9 +72,9 @@
* the event source actor is reached. The emission then enters the bubble * the event source actor is reached. The emission then enters the bubble
* phase, traversing back up the chain via parents until it reaches the * phase, traversing back up the chain via parents until it reaches the
* stage. Any event handler can abort this chain by returning * stage. Any event handler can abort this chain by returning
* %TRUE (meaning "event handled").</para></listitem> * %TRUE (meaning "event handled").</para></listitem>
* <listitem><para>Pointer events will 'pass through' non reactive actors. * <listitem><para>Pointer events will 'pass through' non reactive actors.
* </para></listitem> * </para></listitem>
* </orderedlist> * </orderedlist>
*/ */
@ -158,6 +174,7 @@ struct _ClutterActorPrivate
gchar *name; gchar *name;
ClutterFixed scale_x, scale_y; ClutterFixed scale_x, scale_y;
guint32 id; /* Unique ID */ guint32 id; /* Unique ID */
ClutterUnit anchor_x, anchor_y;
}; };
enum enum
@ -413,7 +430,7 @@ clutter_actor_real_pick (ClutterActor *self,
* mapping pointer events to actors. * mapping pointer events to actors.
* *
* This function should not never be called directly by applications. * This function should not never be called directly by applications.
* *
* Subclasses overiding this method should call * Subclasses overiding this method should call
* #clutter_actor_should_pick_paint to decide if to render there * #clutter_actor_should_pick_paint to decide if to render there
* silhouette but in any case should still recursively call pick for * 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 (); 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) && (G_UNLIKELY(context->pick_mode == CLUTTER_PICK_ALL)
|| CLUTTER_ACTOR_IS_REACTIVE (self))) || CLUTTER_ACTOR_IS_REACTIVE (self)))
return TRUE; return TRUE;
@ -733,8 +750,11 @@ static void
_clutter_actor_apply_modelview_transform (ClutterActor * self) _clutter_actor_apply_modelview_transform (ClutterActor * self)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
ClutterActor *parent;
if (clutter_actor_get_parent (self) != NULL) parent = clutter_actor_get_parent (self);
if (parent != NULL)
{ {
cogl_translate (CLUTTER_UNITS_TO_INT (priv->coords.x1), cogl_translate (CLUTTER_UNITS_TO_INT (priv->coords.x1),
CLUTTER_UNITS_TO_INT (priv->coords.y1), 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); 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) if (priv->rzang)
{ {
cogl_translate (priv->rzx, priv->rzy, 0); 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.green = ((id >> b) & (0xff>>(8-g))) << (8-g);
col.blue = (id & (0xff>>(8-b)))<<(8-b); col.blue = (id & (0xff>>(8-b)))<<(8-b);
col.alpha = 0xff; col.alpha = 0xff;
/* Actor will then paint silhouette of itself in supplied /* Actor will then paint silhouette of itself in supplied
* color. See clutter_stage_get_actor_at_pos() for where * color. See clutter_stage_get_actor_at_pos() for where
* picking is enabled. * picking is enabled.
@ -2393,111 +2420,6 @@ clutter_actor_get_scale (ClutterActor *self,
*scale_y = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_y); *scale_y = CLUTTER_FIXED_TO_FLOAT (self->priv->scale_y);
} }
/**
* 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: * clutter_actor_set_opacity:
* @self: A #ClutterActor * @self: A #ClutterActor
@ -2618,7 +2540,7 @@ clutter_actor_set_depth (ClutterActor *self,
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv; priv = self->priv;
if (priv->z != depth) if (priv->z != depth)
{ {
/* Sets Z value. - FIXME: should invert ?*/ /* Sets Z value. - FIXME: should invert ?*/
@ -3372,6 +3294,182 @@ clutter_actor_get_reactive (ClutterActor *actor)
return CLUTTER_ACTOR_IS_REACTIVE (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 * ClutterGeometry
*/ */

View File

@ -51,14 +51,14 @@ G_BEGIN_DECLS
#define CLUTTER_ACTOR_GET_CLASS(obj) \ #define CLUTTER_ACTOR_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass)) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR, ClutterActorClass))
#define CLUTTER_ACTOR_SET_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_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_REALIZED(e) (((ClutterActor*)(e))->flags & CLUTTER_ACTOR_REALIZED)
#define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \ #define CLUTTER_ACTOR_IS_VISIBLE(e) (CLUTTER_ACTOR_IS_MAPPED (e) && \
CLUTTER_ACTOR_IS_REALIZED (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)) */ /* && CLUTTER_ACTOR_IS_VISIBLE(e)) */
@ -125,13 +125,13 @@ struct _ClutterActor
{ {
/*< private >*/ /*< private >*/
GInitiallyUnowned parent_instance; GInitiallyUnowned parent_instance;
/*< public >*/ /*< public >*/
guint32 flags; guint32 flags;
/*< private >*/ /*< private >*/
guint32 private_flags; guint32 private_flags;
ClutterActorPrivate *priv; ClutterActorPrivate *priv;
}; };
@ -230,7 +230,7 @@ void clutter_actor_hide_all (ClutterActor *sel
void clutter_actor_realize (ClutterActor *self); void clutter_actor_realize (ClutterActor *self);
void clutter_actor_unrealize (ClutterActor *self); void clutter_actor_unrealize (ClutterActor *self);
void clutter_actor_paint (ClutterActor *self); void clutter_actor_paint (ClutterActor *self);
void clutter_actor_pick (ClutterActor *self, void clutter_actor_pick (ClutterActor *self,
const ClutterColor *color); const ClutterColor *color);
void clutter_actor_queue_redraw (ClutterActor *self); void clutter_actor_queue_redraw (ClutterActor *self);
void clutter_actor_destroy (ClutterActor *self); void clutter_actor_destroy (ClutterActor *self);
@ -262,9 +262,9 @@ void clutter_actor_get_abs_position (ClutterActor *sel
gint *y); gint *y);
guint clutter_actor_get_width (ClutterActor *self); guint clutter_actor_get_width (ClutterActor *self);
guint clutter_actor_get_height (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); guint width);
void clutter_actor_set_height (ClutterActor *self, void clutter_actor_set_height (ClutterActor *self,
guint height); guint height);
gint clutter_actor_get_x (ClutterActor *self); gint clutter_actor_get_x (ClutterActor *self);
gint clutter_actor_get_y (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); G_CONST_RETURN gchar *clutter_actor_get_name (ClutterActor *self);
guint32 clutter_actor_get_gid (ClutterActor *self); guint32 clutter_actor_get_gid (ClutterActor *self);
void clutter_actor_set_clip (ClutterActor *self, void clutter_actor_set_clip (ClutterActor *self,
gint xoff, gint xoff,
gint yoff, gint yoff,
gint width, gint width,
gint height); gint height);
void clutter_actor_remove_clip (ClutterActor *self); void clutter_actor_remove_clip (ClutterActor *self);
gboolean clutter_actor_has_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_x,
gdouble *scale_y); 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, void clutter_actor_get_abs_size (ClutterActor *self,
guint *width, guint *width,
guint *height); guint *height);
@ -368,7 +358,7 @@ void clutter_actor_move_by (ClutterActor
void clutter_actor_get_vertices (ClutterActor *self, void clutter_actor_get_vertices (ClutterActor *self,
ClutterVertex verts[4]); ClutterVertex verts[4]);
void clutter_actor_apply_transform_to_point (ClutterActor *self, void clutter_actor_apply_transform_to_point (ClutterActor *self,
ClutterVertex *point, ClutterVertex *point,
ClutterVertex *vertex); ClutterVertex *vertex);
@ -379,6 +369,21 @@ ClutterActor * clutter_get_actor_by_gid (guint32 id);
gboolean clutter_actor_should_pick_paint (ClutterActor *self); 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 G_END_DECLS
#endif /* _HAVE_CLUTTER_ACTOR_H */ #endif /* _HAVE_CLUTTER_ACTOR_H */

View File

@ -82,7 +82,13 @@ scale_frame_foreach (ClutterBehaviour *behaviour,
ClutterFixed scale = GPOINTER_TO_UINT (data); ClutterFixed scale = GPOINTER_TO_UINT (data);
ClutterGravity gravity = priv->gravity; 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 static void
@ -170,7 +176,7 @@ clutter_behaviour_scale_class_init (ClutterBehaviourScaleClass *klass)
* ClutterBehaviourScale:scale-start: * ClutterBehaviourScale:scale-start:
* *
* The initial scaling factor for the actors. * The initial scaling factor for the actors.
* *
* Since: 0.2 * Since: 0.2
*/ */
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
@ -275,8 +281,8 @@ clutter_behaviour_scale_newx (ClutterAlpha *alpha,
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, "alpha", alpha,
NULL); NULL);

View File

@ -31,5 +31,7 @@
#define clutter_actor_get_rxangx clutter_actor_get_rxangx_DEPRECATED_BY_clutter_actor_get_rotationx #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_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_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 */ #endif /* CLUTTER_DEPRECATED_H */