Clutter (computing)
Encyclopedia
Clutter is an open source
graphics library for creating hardware-accelerated user interfaces. It relies upon OpenGL
(1.4+) or OpenGL ES
(1.1 or 2.0) for rendering, can be compiled on different platforms (X11, Darwin and Win32) and has multiple bindings to other languages (including Mono
, Perl
, Python, Ruby
and Vala
). It also supports media playback using GStreamer
and 2D graphics rendering using Cairo
.
Clutter was created by OpenedHand Ltd
, now part of Intel
. Licensed under the LGPL
v2.1, Clutter is free
and open source
software.
with a design based on the GObject
object system. Bindings are available for these languages:
, using the GLX extension. It is also targeted to embedded environments, either using X or the native frame buffer. As of release 0.6, native support for Mac OS X
has been added. A native Microsoft Windows
backend is supported since the 0.8 release. Windows pre-compiled dll's can be found on or , however, you can build the latest dll for Windows with MinGW and Bash shell for Windows.
based canvas working in retained mode
. Every object on the scene is usually a 2D surface inside a 3D space.
Clutter abstracts the native windowing environment behind a backend, which is also responsible for creating the main container for the scene graph; this top level container is called the stage. Items on the stage are called actors.
Instead of operating on matrices, as does OpenGL
, the Clutter developer changes properties of each actor. Clutter will then notice the changes, and render the scene accordingly.
. Clutter provides a generic base class
for developers to implement custom behaviours, and various simple classes handling simple properties, like opacity, position on the Z axis (depth), position along a path, rotation, etc.
Since Clutter 1.0, it is also possible to create simple, one-off animations using the ClutterAnimation class and the clutter_actor_animate convenience function. The clutter_actor_animate function animates an actor properties between their current state and the specified final state.
The equivalent code using the implicit animations API is:
dialect. The entire scene graph is defined using JSON types and built at run time through the ClutterScript class.
The definition can be saved into a file or as a string, and loaded using:
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
graphics library for creating hardware-accelerated user interfaces. It relies upon OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...
(1.4+) or OpenGL ES
OpenGL ES
OpenGL for Embedded Systems is a subset of the OpenGL 3D graphics application programming interface designed for embedded systems such as mobile phones, PDAs, and video game consoles. OpenGL ES is managed by the not-for-profit technology consortium, the Khronos Group, Inc.- Versions :Several...
(1.1 or 2.0) for rendering, can be compiled on different platforms (X11, Darwin and Win32) and has multiple bindings to other languages (including Mono
Mono (software)
Mono, pronounced , is a free and open source project led by Xamarin to create an Ecma standard compliant .NET-compatible set of tools including, among others, a C# compiler and a Common Language Runtime....
, Perl
Perl
Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
, Python, Ruby
Ruby (programming language)
Ruby is a dynamic, reflective, general-purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was first developed and designed by Yukihiro "Matz" Matsumoto...
and Vala
Vala (programming language)
Vala is a programming language created with the goal of bringing modern language features to C, with no added runtime needs and with little overhead, by targeting the GObject object system. It is being developed by Jürg Billeter and Raffaele Sandrini. The syntax borrows heavily from C#...
). It also supports media playback using GStreamer
GStreamer
GStreamer is a pipeline-based multimedia framework written in the C programming language with the type system based on GObject.GStreamer allows a programmer to create a variety of media-handling components, including simple audio playback, audio and video playback, recording, streaming and editing...
and 2D graphics rendering using Cairo
Cairo (graphics)
cairo is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends...
.
Clutter was created by OpenedHand Ltd
OpenedHand
OpenedHand was an embedded Linux start-up that was acquired by Intel in Q3, 2008. The firm developed a OpenEmbedded distribution called Poky Linux and the Clutter library. The latter is heavily used in the customized UIs of Maemo and Moblin, embedded Linux distributions from Nokia and Intel,...
, now part of Intel
Intel Corporation
Intel Corporation is an American multinational semiconductor chip maker corporation headquartered in Santa Clara, California, United States and the world's largest semiconductor chip maker, based on revenue. It is the inventor of the x86 series of microprocessors, the processors found in most...
. Licensed under the LGPL
GNU Lesser General Public License
The GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License or GPL and permissive licenses such as the BSD licenses and the MIT License...
v2.1, Clutter is free
Free software
Free software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
and open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
software.
Programming languages
Clutter is implemented using the C programming languageC (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
with a design based on the GObject
GObject
The GLib Object System, or GObject, is a free software library providing a portable object system and transparent cross-language interoperability...
object system. Bindings are available for these languages:
- C++C++C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. It is regarded as an intermediate-level language, as it comprises a combination of both high-level and low-level language features. It was developed by Bjarne Stroustrup starting in 1979 at Bell...
(cluttermm) - PerlPerlPerl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular...
(clutter-perl) - Ruby (rbclutter)
- PythonPython (programming language)Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...
(PyClutter) - ValaVala (programming language)Vala is a programming language created with the goal of bringing modern language features to C, with no added runtime needs and with little overhead, by targeting the GObject object system. It is being developed by Jürg Billeter and Raffaele Sandrini. The syntax borrows heavily from C#...
(clutter-vala) - C# (clutter-sharp (aka Clutter#))
- JavaScriptJavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
(Seed and GJS) - HaskellHaskell (programming language)Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...
(clutterhs)
Platforms
Clutter is developed on the X Window SystemX Window System
The X window system is a computer software system and network protocol that provides a basis for graphical user interfaces and rich input device capability for networked computers...
, using the GLX extension. It is also targeted to embedded environments, either using X or the native frame buffer. As of release 0.6, native support for Mac OS X
Mac OS X
Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Since 2002, has been included with all new Macintosh computer systems...
has been added. A native Microsoft Windows
Microsoft Windows
Microsoft Windows is a series of operating systems produced by Microsoft.Microsoft introduced an operating environment named Windows on November 20, 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces . Microsoft Windows came to dominate the world's personal...
backend is supported since the 0.8 release. Windows pre-compiled dll's can be found on or , however, you can build the latest dll for Windows with MinGW and Bash shell for Windows.
Design
Clutter is a scene graphScene graph
A scene graph is a general data structure commonly used by vector-based graphics editing applications and modern computer games. Examples of such programs include Acrobat 3D, Adobe Illustrator, AutoCAD, CorelDRAW, OpenSceneGraph, OpenSG, VRML97, and X3D....
based canvas working in retained mode
Retained mode
In computing, retained mode rendering is a style for application programming interfaces of graphics libraries, in which the libraries retain a complete model of the objects to be rendered.-Overview:...
. Every object on the scene is usually a 2D surface inside a 3D space.
Clutter abstracts the native windowing environment behind a backend, which is also responsible for creating the main container for the scene graph; this top level container is called the stage. Items on the stage are called actors.
Instead of operating on matrices, as does OpenGL
OpenGL
OpenGL is a standard specification defining a cross-language, cross-platform API for writing applications that produce 2D and 3D computer graphics. The interface consists of over 250 different function calls which can be used to draw complex three-dimensional scenes from simple primitives. OpenGL...
, the Clutter developer changes properties of each actor. Clutter will then notice the changes, and render the scene accordingly.
Example
This example will add a label on the stage.- This statement will retrieve the default stage, which will contain all the actors on the scene.
- These statements will create a new label, using the Sans font 32 pixels high, and with the "Hello, world" text, and will place it into the stage.
- These statements will position the label at the center of the stage, taking into account the stage and the label size.
- These statements will show the stage. All actors in Clutter are visible unless explicitly hidden, except for the stage; thus showing the stage will automatically display all of its visible children.
Animation
Clutter allows implicit animations of every item on the canvas using special objects called behaviours: each behaviour can be applied to multiple actors, and multiple behaviours can be composed on the same actor. Behaviours handle animations implicitly: the developer specifies the initial and final states, the time (or number of frames) needed to complete the animation, the function of time to be used (linear, sine wave, exponential, etc.), and the behaviour will take care of the tweeningTweening
Inbetweening or tweening is the process of generating intermediate frames between two images to give the appearance that the first image evolves smoothly into the second image. Inbetweens are the drawings between the key frames which help to create the illusion of motion...
. Clutter provides a generic base class
Class (computer science)
In object-oriented programming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior...
for developers to implement custom behaviours, and various simple classes handling simple properties, like opacity, position on the Z axis (depth), position along a path, rotation, etc.
Since Clutter 1.0, it is also possible to create simple, one-off animations using the ClutterAnimation class and the clutter_actor_animate convenience function. The clutter_actor_animate function animates an actor properties between their current state and the specified final state.
Example
This example will scale the label from its size to a factor of 2 in 2 seconds, using a linear function of time and behaviours:- These statements will create a Timeline with a duration of 2000 milliseconds; an Alpha, binding the Timeline to a linear easing mode; a Behaviour, which will scale any actor to which it is applied between factor 1.0 and factor 2.0 (both horizontally and vertically). Finally, it applies the behaviour to an actor.
The equivalent code using the implicit animations API is:
- This statement will create an implicit ClutterAnimation object, which will animate the provided GObject properties between their current value and the specified final value.
Interface builder
Clutter can build user interfaces using a specialized JSONJSON
JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
dialect. The entire scene graph is defined using JSON types and built at run time through the ClutterScript class.
Example
This definition will create the main window and place a label with the text Hello, world! inside it.The definition can be saved into a file or as a string, and loaded using:
Integration libraries
Clutter can be integrated with other libraries and toolkits, for instance:- GTK+GTK+GTK+ is a cross-platform widget toolkit for creating graphical user interfaces. It is licensed under the terms of the GNU LGPL, allowing both free and proprietary software to use it. It is one of the most popular toolkits for the X Window System, along with Qt.The name GTK+ originates from GTK;...
applications can embed Clutter stages using a special widget. - Clutter applications can embed GTK+ widgets using the 'client-side windows' feature since GTK+ 2.18.
- Clutter applications can use GStreamerGStreamerGStreamer is a pipeline-based multimedia framework written in the C programming language with the type system based on GObject.GStreamer allows a programmer to create a variety of media-handling components, including simple audio playback, audio and video playback, recording, streaming and editing...
to play videos directly into a Clutter texture actor. - Clutter applications can use CairoCairo (graphics)cairo is a software library used to provide a vector graphics-based, device-independent API for software developers. It is designed to provide primitives for 2-dimensional drawing across a number of different backends...
to draw onto a texture.
See also
- List of widget toolkits
- Core AnimationCore AnimationCore Animation is a data visualization API used by Mac OS X 10.5 and later as well as iOS to produce animated user interfaces.-Overview:Core Animation provides a way for developers to produce animated user interfaces via an implicit animation model as well as an "explicit" model...
- Windows Presentation FoundationWindows Presentation FoundationDeveloped by Microsoft, the Windows Presentation Foundation is a computer-software graphical subsystem for rendering user interfaces in Windows-based applications. WPF, previously known as "Avalon", was initially released as part of .NET Framework 3.0. Rather than relying on the older GDI...
- Qt (framework)