Clutter (computing)

Clutter (computing)

Infobox Software
name = Clutter



caption =
developer = OpenedHand Ltd
released = 22 June 2006
latest_release_version = 0.8.0
latest_release_date = release date and age|2008|07|10
programming language = C
operating system = Cross-platform
language = English
genre = Graphics library
license = LGPL
website = [http://www.clutter-project.org/ Clutter Project]

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. Licensed under the LGPL, Clutter is free software (and open source).

Programming languages

Clutter uses the C programming language, although its design uses the GObject object system. Bindings are available for these languages:

*C++ (cluttermm)
*Perl (clutter-perl)
*Ruby (rbclutter)
*Python (PyClutter)
*Vala (clutter-vala)
*C# (Clutter#)

Platforms

Clutter is developed on the X Window System, 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.

Design

Clutter is a scene graph 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.

Example

This example will add a label on the stage.

ClutterActor *stage = clutter_stage_get_default ();:This statement will retrieve the default stage, which will contain all the actors on the scene.

ClutterActor *label = clutter_label_new_with_text ("Sans 32px", "Hello, world");clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);:These statement 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.

gint x, y;

x = (clutter_actor_get_width (stage) + clutter_label_get_width (label)) / 2;y = (clutter_actor_get_height (stage) + clutter_label_get_height (label)) / 2;clutter_actor_set_position (label, x, y);:These statements will position the label at the center of the stage, taking into account the stage and the label size.

clutter_actor_show (label);clutter_actor_show (stage);:These statements will show the label and the stage.

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 tweening. 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.

Example

This example will scale the label from its size to a factor of 2 in 2 seconds, using a linear function of time:

ClutterTimeline *timeline = clutter_timeline_new_for_duration (2000); /* milliseconds */ClutterAlpha *alpha = clutter_alpha_new_full (timeline, clutter_ramp_func, NULL, NULL);:These statements will create a "timeline", a clock function which will be used to time the animation; and an "alpha", an object binding the timeline to a function.

ClutterBehaviour *behaviour;

behaviour = clutter_behaviour_scale_new (alpha, 1.0, 1.0, /* scale factor on the X axis */ 2.0, 2.0 /* scale factor on the Y axis */);clutter_behaviour_apply (behaviour, label);:These statements will create a new behaviour and will apply it to the label.

clutter_timeline_start (timeline);:This statement will start the animation.

Interface builder

Clutter can build user interfaces using a specialized JSON 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.

{ "id" : "main-stage", "type" : "ClutterStage", "color" : "white" "width" : 800, "height" : 600, "children" : [ { "id" : "hello-label", "type" : "ClutterLabel", "x" : 400, "y" : 300, "text" : "Hello, world!", "color" : "black" } ] }

Integration libraries

Clutter can be integrated with other libraries and toolkits, for instance:

* GTK+ applications can embed the Clutter stage using a special widget
* Clutter applications can use GStreamer to play videos directly into a Clutter texture actor
* Clutter applications can use Cairo to draw onto a texture

Experimental support is present for using WebKit to render a web page onto a Clutter texture. [ [http://blogs.gnome.org/iain/2008/02/04/never-thought-youd-write-a-browser-cos-html-is-so-passe/ Never thought you’d write a browser, cos HTML is so passé - My Dreams are Bulletproof ] ]

See also

* List of widget toolkits
* Core Animation
* Windows Presentation Foundation

References

External links

* [http://www.clutter-project.org Clutter homepage]
* [http://www.clutter-project.org/blog/ Clutter project blog]

"'


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Clutter — may refer to any of the following: Excessive physical disorder Clutter (organizing), a confusing or disorderly state or collection, and possible symptom of compulsive hoarding A type of light pollution Clutter (radar), unwanted echoes in… …   Wikipedia

  • Missile Approach Warning — A Missile Approach Warning system is part of the avionics package on some military aircraft. A sensor detects attacking missiles. Its automatic warning cues the pilot to make a defensive maneuver and deploy the available countermeasures to… …   Wikipedia

  • Radar — For other uses, see Radar (disambiguation). A long range radar antenna, known as ALTAIR, used to detect and track space objects in conjunction with ABM testing at the Ronald Reagan Test Site on Kwajalein Atoll …   Wikipedia

  • MeeGo — This article is about the mobile operating system. For other uses, see Meego. MeeGo Company / developer …   Wikipedia

  • CAPTCHA — Early CAPTCHAs such as these, generated by the EZ Gimpy program, were used on Yahoo!. However, technology was developed to read this type of CAPTCHA[1] …   Wikipedia

  • Kadir Brady saliency detector — The Kadir Brady saliency detector is designed to detect representative region in images. It performs well in the context of object class recognition. It was invented by http://www.robots.ox.ac.uk/ timork/ Timor Kadir] and [http://www.robots.ox.ac …   Wikipedia

  • Zumwalt class destroyer — Artist rendering of the Zumwalt class destroyer Class overview Name: Zumwalt Builders: General Dynamics …   Wikipedia

  • Human-computer interaction — Human–computer interaction or HCI is the study of interaction between people (users) and computers. It is often regarded as the intersection of computer science, behavioral sciences, design and several other fields of study. Interaction between… …   Wikipedia

  • Human–computer interaction — This article is about the interaction between users and computers. For the direct communication between brain cells and computers, see Brain–computer interface. A mouse is a pointing device that functions by detecting two dimensional motion… …   Wikipedia

  • Neuroinformatics — is a research field concerned with the organization of neuroscience data by the application of computational models and analytical tools. These areas of research are important for the integration and analysis of increasingly large volume, high… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”