作者:empty 页数:114 出版社:empty |
We very much appreciate any reports of inaccuracies or other errors in this document.Contributions are also mostwelcome.Post your suggestions, cn tiques or addenda to the team(mailto.murraycBopenismus.com) .Permission is g ratted to copy.dist n bute and Vor modify this document under the terms of the GNU Free Docume mation License, Versa on 1.2orany later version pab lished by the Free Software Foundation; with no ln variant Sections.m oF rons-Cover Texts, and no Back-Cover Texis.Youmay obtain a copy of the GNU Free Documentation License from the Free So dtw ace Foundation by visiting their We h site or by writing to c FreeSoftware Foundation, In e. 59 Temple Place-Sun te 330, Boston, MA 02111-1307.USA
Chapter 1.Introduction1.1.This book1.2.ClutterThis book assumes a good understanding of C, and howto create C programs.This book attempts to cx plain key Clutter concepts and introduce some of the more commonly used userinterface elements( actors) .For full APl information you should follow the links into the referencedocumentation.This document covers the API in Clutter version 0.8Each chapter contains very simple examples.These are meant to show the use of the API rather thanshow an impressive visual result However, the full example should give some idea of what can beachieved with ClutterThe Clutter platform uses techniques found in the GTK+(http://www.gtkorg) platform, so you willsometimes wish to refer to the GTK+documentation.We would very much like to hear of any problems you have leaming Clut ler with this do cur nent, andwould appreciate input regarding improvements.Please see the Cont but ing section for furtherinformation.
Clutter isaC programming API that allows you to create simple but visually appea ing and involvinguser interfaces.It offers a variety of objects(actors) which can be placed on a canvas(stage) andmanipulated by the application or the user.It is therefore aT retained mode graphics APL Unliketraditional 2DcanvasAPls, Clutter allows these actors to move partly in the Z dimensionThis concepts ipltesthecreationof3D interfaces compared io direct use of OpenGL or other 3Ddrawing APIs.For instance, it restricts the user interaction to the 2D plane facing the user, which isappropriate for today's devices allowing interaction only with a2Dplanesuchasatouchsere en.Inaddition.your application does not need to provide visual context to show the user which obj eets are, forinstance, small rather than farawayIn addition.Clutter provides timeline and behavior abstractions which sip li fy animation by allowingyou to associate actor properties(such as position, rotation.or opacity) with callback functions,including pre-de in ed functions of time such as sinewave s.
Chap re rI.IntroductionClutter uses the popular OpenGL.3DgraphicsAPlonreguar desktop PCs, allowing it access tohardware accelera lion, On handheld devices it can use OpenGL ES, a subset of the OpenGL API aimedat embedded devices.So, where necessary, you may also use OpenGL or OpenGL ES directlyIn the next few chapters you will le arm howto place a et orson the stage, howto set their proper tes, howto change their properties(including their position) overtime by using timelines and behaviours, andhowto do all this in response to user interaction.Clutier packages are probably available from your Linux distribution.For instance, on Ubuntu Linux orDebian you can install the lib clutter-0.8-dev package.After you've installed all of the dependencies, download the Clute r sourcecode, unpack it, and change tothe newly created directory.Clu lter can be built and installed wth the following sequence of commands:
The configure script will check to make sure all of the required dependencies are already installed.Ifyou are missing any dependencies it will exit and display an error.By default, Clutter will be installed under the/usr/local directory.If you want to help develop Clutter or exper ment wth new features, you can also install Clutter fromSVN.Details are available at the Clutter website(http://www.clutter-projectorg0.
2.2.1.DependenciesBefore at temping to install Clutter, you should first install these other packages:
Chapter 2.Installation2.1.Prebuilt Packages2.2.Installing From Source
Chapter 3.Header Files And LinkingChapter 4.The Stage4.1.Stage BasicsTo use the Clutter APEs, you must include the headers for the libraries, and link to their shared i braries.The necessary compiler and inker commands can be obtained from the pkg-contig uit ity like so:pkg-contig clutter-D, 8--ct lagspkg-config clut to r-D.8--libsHowever.if you are using the autotools (automake, autoconf, etc) build system, you will find it moreconvenient to use the PKG_CHECK_MODULES macro in your configure.ac file.For instance:PKG_CHECK MODULE 5(EXAMPLE, clutter-D.8JAC_SUBSTI EXAMPLE_CELA GSIAC_SUBST 4 EXAMPLE LIBS)
You should then use the generated_CFLAGS and_LIBS definitions in your Makefile.am files.Note thalyou may mention other libra ties in the same PKG_CHECK_MODULE 5c all, separated by spaces.Forinstance, some examples in this tutorial require extra Clutter libraries, such as clutter-gtk-0.8,clutter-cairo-0, B or clutter-gst-0.8,Each Clutter application contains atleast one Clutter stage.This stage contains Actors such asrectangles, images.or texi.We will talk more about the actors in the next chapter, but for now let's seehow a stage can be created and how we can respond to user interaction with the stage itself.First make sure that you have called clutter_in it l) to initialize Clutter.You may then gec theapplication's stage with clutter_stage get_default O.This function always returns the sameinstance.with its own window.You could instead use a Gtk Clutter Embed widget inside a morecomplicated GTK+window-see the Stage Widget sectionClutter Stage is derived from the Clutter Actor object so many of that object's functions are usefulfor the stage.For instance, call clutter_actor_B how() to make the stage visibleclutter Stage also implements the Clutter Container interface, allowing it to contain child actorsvia calls lo clutter_container_addO,Call clutter_main O to start a mainloop so that the stage can animate its contents and respond to userinteraction.Reference(http//luter-project.org/does/cluter/0.8/CluterStage.html)
4.1.1.ExampleThe following example shows a clutter stage and handles click son the stage.There are no actors yelso all you will see is a black rectangle.You can create an exe curable from this code like so, being careful to use backticks around the e all topkg-config See also the Header Files And Linking section.gee-wall-g example.c-o example'pkg-config clutter-0.8--cflags--1ibs'
1.Introduction.
2.Installation.
1.1.This book.
1.2.Clutter.
2.1.Prebuilt Packages.
2.2.Installing From Source.
4.1.Stage Basics.
4.2.Stage Widget.
5.1.Actor Basics.
5.2.Transformations.
5.3.Containers.
5.4.Events.
6.1.Using Timelines.
6.2.Example.
6.3.Grouping TimeLines in a Seo re.
6.4.Example.
7.1.Using Effects.
7.2.Example.
8.1.Using Behaviour.
8.2.Example.
A.1.Implementing Simple Actors.
A.2.Example.
A.3.Implementing Container Actors.
A.4.Example.
B.1.The Technique.
B.2.Example.
C.L.The Technique.
C 2.Example.
22.1.Dependencies.
4.1.1.Example.
4.2.1.Example.
5.1.1.Example.
5.2.1.Scaling.
5.2.2.Rotation.
52.3.Clipping.
5.2.4.Movement.
5.2.5.Example.
5.3.1.Example.
5.4.1.Example.
3.Header Files And Linking.
4.The Stage.
5.Actors.
6.Timelines.
7.Effects.
8.Behaviours.
9.Full Example.
A.Implementing Actors.
4-1.St ago.
4-2.Stage Widget.
5-1.Actor.
5-2.Actor.
5-3.Group.y is.
5-4.Actor Events.
6-1.Timeline.
6-2.Sc of e.
7-1.Graphic representation of some al