August 5, 2009
This article was contributed by Nathan Willis
Version 1.0 of the Clutter
graphics library was released on July 29,
sporting a stable application program interface (API) and binary interface
(ABI), an animation framework, and an OpenGL abstraction library that
should prove useful to developers. With Clutter set to take on a more
prominent role in the GNOME 3.x series, the announcement should prove to be
welcome news to application developers.
Clutter is used to build user interfaces, but unlike traditional
toolkits such as GTK+ or Qt, it uses a flexible "scene graph" model with
"actors" and "stages" instead of the customary widgets and containers. The
free-form actor elements can be placed with fixed positioning on the stage
or use managed layout, and they can be easily moved, deformed, and even
animated. Clutter is designed to use OpenGL as a back-end, so applications
can benefit from hardware accelerated rendering. OpenGL for Embedded
Systems (OpenGL ES) is supported, making Clutter a popular choice on
slim-CPU mobile devices such as Nokia's Maemo tablets and Moblin's netbook Linux distribution.
The project was started in 2006 at embedded Linux development firm
Opened Hand, which was
acquired by Intel in late 2008. Clutter has been selected as an official
part of the Maemo GUI stack, beginning with the upcoming 5.0 release, called
"Fremantle." Following Opened Hand's acquisition by Intel, however, more
effort went into integrating Clutter as a core UI library for Moblin, which
prior to April 2009, was an Intel-owned effort. The toolkit is also
growing in popularity on desktop Linux systems, where it is used by GNOME
games, the Mutter window manager, and the GNOME Shell project set to be
featured prominently in GNOME 3.0.
Although Clutter is written in C, bindings are available for a wide variety
of languages, including C++, C#, Python, Ruby, Vala, JavaScript, and Perl.
In addition, applications can embed traditional GTK+ elements, GStreamer video content and Cairo 2-D canvases as Clutter actors.
Clutter is developed primarily for usage under X with the GLX extension,
but can also use Simple DirectMedia Layer (SDL) or the Linux frame buffer
if necessary. Ports to Windows and Mac OS X are also available. Using ClutterScript,
Clutter applications can store and load full or partial scene graphs in
JavaScript Object Notation (JSON) format.
Changes in 1.0
The Clutter API has undergone several important changes since the last
stable series, 0.8, but the development team has declared the 1.0 API
frozen for all subsequent 1.x releases. Apart from stabilizing the API,
Clutter 1.0 includes a new animation framework, unified handling of all
text widgets with Pango, performance
improvements based on better tracking which actors in the scene graph will
be painted, debugging facilities for application developers, and
improvements to the Clutter OpenGL abstraction library COGL. The Clutter
and COGL documentation
also underwent extensive revision, including a migration guide for
developers needing to port their code from Clutter 0.8 to Clutter 1.0.
The Animation API has received the most attention of the changes in 1.0,
being the subject of several conference talks this summer. In prior
versions of Clutter, animation of actors was handled through two separate
features: Behaviors and Effects. Behaviors were to be used when both the
starting and ending states of the actor were known (such as moving from one
predetermined position to another), and Effects could be used at any time,
regardless of the state of the actor. The Effects API proved to be kludgy
and difficult for application developers to use, as well as difficult for
the Clutter developers to extend, so it has been dropped in favor of the
Animation API.
The new API is both simpler and shares base classes, such as Timeline,
with the Behaviors API, which should simplify its adoption. Whereas in
Effects each transformation was a separate function (e.g., rotate, fade,
translate), Animation requires only specifying the desired final state of
the actor with a single function call; the animation itself is performed
implicitly, with all of the intermediate steps interpolated. This
"tweening" behavior is similar to what is possible with JavaScript
animation. The Clutter
1.0 migration guide provides some side-by-side example code
demonstrating the difference between using Effects and Animation.
COGL is also significant; it began as a purely internal layer for
Clutter to abstract away the differences between OpenGL, OpenGL ES 1.1, and
OpenGL ES 2.0, but it has since evolved into a library useful for other
OpenGL-based projects. COGL attempts to make OpenGL usage as fast as
possible by maintaining its own internal store of the scene rather than
sending every update to the GPU separately, caching as much as possible,
and minimizing the number of validations and state changes.
1.x, 2.0, and more
The Clutter team has expressed its desire to further develop COGL into a
more flexible GPU-programming library, providing a modern, object-oriented
API for OpenGL programming. As for Clutter itself, the plan is to adopt a
six-month release cycle, as used by other projects in the GNOME ecosystem.
There will be further 1.x stable releases to improve performance and
efficiency, but the guarantee is that no changes made during the 1.x cycle
will break API compatibility.
GNOME will reportedly ship Clutter with its 2.28 release in September,
but Clutter-based tools like GNOME Shell are not scheduled to arrive until
the 3.0 release six months later. The API stability guarantee is more
likely to please developers with mobile platform projects like Maemo and Moblin, however,
who count on longer product life cycles than those of a typical desktop
Linux distribution.
Independent application developers may have to wait a few more weeks
before they can begin working with Clutter 1.0, though. The dependent
libraries that allow embedding GTK+ widgets, GStreamer content, and Cairo
canvases are a bit behind the core
Clutter release, as are some of the language bindings. Fortunately, the
official packages are built
to be installable in parallel with Clutter 0.8, and with the documentation
in place — including the migration guide — no one has an excuse
to sit idly by in the meantime.
(
Log in to post comments)