Chapter 2. Actors

Table of Contents

1. Introduction
2. Implementing a simple custom actor
2.1. Problem
2.2. Solution
2.3. Discussion
3. Knowing when an actor's position or size changes
3.1. Problem
3.2. Solution
3.3. Discussion
4. Overriding the paint sequence
4.1. Problem
4.2. Solution
4.3. Discussion
5. Making an actor transparent by changing its opacity
5.1. Problem
5.2. Solution
5.3. Discussion
6. Creating an actor with a non-rectangular shape
6.1. Problem
6.2. Solution
6.3. Discussion

An actor's a guy who if you ain't talkin' about him, ain't listening.

Edmon Gween, actor, on his deathbed

1. Introduction

When building a User Interface with Clutter, the visible part of the UI — that is, what is displayed on the screen — is commonly referred to as "the scene graph". Like every graph, a scene graph is composed by nodes.

Every node on the Clutter scene graph is an actor. Every actor has a single relationship with the others: it can be the parent of another actor, or a child of another actor.

Note

The stage is an actor that can have children but cannot have any parent.

Actors have different attributes: a position, a size, a scale factor, a rotation angle on each axis (relative to a specific center on the normal plane for that axis), an opacity factor.

The scene graph is not fixed: it can be changed, not only by adding or removing actors, but also by changing the parent-child relationship: it is possible, for instance, to move an entire section of the scene graph from one parent actor to another.