mutter/doc/reference/clutter
Emmanuele Bassi 37bd35f592 [actor] Allow changing the transformations matrix
Currently, the transformation matrix for an actor is constructed
from scenegraph-related accessors. An actor, though, can call COGL
API to add new transformations inside the paint() implementation,
for instance:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
    cogl_translate (-scroll_x, -scroll_y, 0);
    ...
  }

Unfortunately these transformations will be completely ignored by
the scenegraph machinery; for instance, getting the actor-relative
coordinates from event coordinates is going to break badly because
of this.

In order to make the scenegraph aware of the potential of additional
transformations, we need a ::apply_transform() virtual function. This
vfunc will pass a CoglMatrix which can be used to apply additional
operations:

  static void
  my_foo_apply_transform (ClutterActor *a, CoglMatrix *m)
  {
    CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m);
    ...
    cogl_matrix_translate (m, -scroll_x, -scroll_y, 0);
    ...
  }

The ::paint() implementation will be called with the actor already
using the newly applied transformation matrix, as expected:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
  }

The ::apply_transform() implementations *must* chain up, so that the
various transformations of each class are preserved. The default
implementation inside ClutterActor applies all the transformations
defined by the scenegraph-related accessors.

Actors performing transformations inside the paint() function will
continue to work as previously.
2009-07-01 15:30:21 +01:00
..
actor-box.png Merged clutter-ivan branch into trunk. 2008-04-25 13:37:36 +00:00
building-clutter.xml 2008-06-27 Emmanuele Bassi <ebassi@openedhand.com> 2008-06-27 20:45:33 +00:00
clutter-animation-tutorial.xml [clutter-docs] Update the animation tutorial 2009-01-28 16:47:41 +00:00
clutter-docs.xml.in [docs] Add an initial porting guide 2009-06-25 14:54:16 +01:00
clutter-overview.xml 2008-06-26 Emmanuele Bassi <ebassi@openedhand.com> 2008-06-26 09:02:58 +00:00
clutter-sections.txt [actor] Allow changing the transformations matrix 2009-07-01 15:30:21 +01:00
clutter.types [docs] Add Animation get_type() function 2009-05-14 16:11:47 +01:00
creating-behaviours.xml 2008-06-26 Emmanuele Bassi <ebassi@openedhand.com> 2008-06-26 09:02:58 +00:00
easing-modes.png [docs] Update the easing modes documentation 2009-01-20 18:13:36 +00:00
easing-modes.svg [docs] Update the easing modes documentation 2009-01-20 18:13:36 +00:00
event-flow.dia * clutter/event-flow.png: fixed typo. 2008-06-13 10:37:33 +00:00
event-flow.png * clutter/event-flow.png: fixed typo. 2008-06-13 10:37:33 +00:00
Makefile.am [docs] Add an initial porting guide 2009-06-25 14:54:16 +01:00
migrating-ClutterEffect.xml [docs] Add an initial porting guide 2009-06-25 14:54:16 +01:00
path-alpha-func.png Merged clutter-ivan branch into trunk. 2008-04-25 13:37:36 +00:00
running-clutter.xml [docs] Document envvars and command line switches 2009-02-23 13:44:03 +00:00
subclassing-ClutterActor.xml 2008-11-12 Emmanuele Bassi <ebassi@linux.intel.com> 2008-11-12 13:57:58 +00:00