diff --git a/Makefile.am b/Makefile.am index 5faf106df..11e881093 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,12 +1,12 @@ NULL = -SUBDIRS = build clutter tests doc po +SUBDIRS = build clutter tests po if BUILD_EXAMPLES SUBDIRS += examples endif -DIST_SUBDIRS = clutter tests examples doc po build +DIST_SUBDIRS = clutter tests examples po build # XXX - this is a massive hack to make autoreconf honour the ACLOCAL_FLAGS # that jhbuild sets while still retaining build/autotools as the authoritative @@ -17,7 +17,7 @@ CLEANFILES = $(pcfiles) DISTCLEANFILES = -DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-maintainer-flags --enable-docs +DISTCHECK_CONFIGURE_FLAGS = --enable-maintainer-flags # proxy rules for tests test-report full-report: diff --git a/configure.ac b/configure.ac index f7690b4cc..70788ca01 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,6 @@ m4_define([atk_req_version], [2.5.3]) m4_define([cairo_req_version], [1.14.0]) m4_define([pango_req_version], [1.30]) m4_define([gi_req_version], [1.39.0]) -m4_define([gtk_doc_req_version], [1.20]) m4_define([xcomposite_req_version], [0.4]) m4_define([gdk_req_version], [3.3.18]) m4_define([libinput_req_version], [0.19.0]) @@ -127,7 +126,6 @@ AC_SUBST([ATK_REQ_VERSION], [atk_req_version]) AC_SUBST([CAIRO_REQ_VERSION], [cairo_req_version]) AC_SUBST([PANGO_REQ_VERSION], [pango_req_version]) AC_SUBST([GI_REQ_VERSION], [gi_req_version]) -AC_SUBST([GTK_DOC_REQ_VERSION], [gtk_doc_req_version]) AC_SUBST([XCOMPOSITE_REQ_VERSION], [xcomposite_req_version]) AC_SUBST([GDK_REQ_VERSION], [gdk_req_version]) AC_SUBST([LIBINPUT_REQ_VERSION], [libinput_req_version]) @@ -738,61 +736,6 @@ dnl === GObject-Introspection check =========================================== GOBJECT_INTROSPECTION_CHECK([gi_req_version]) -dnl === GTK Doc check ========================================================= - -GTK_DOC_CHECK([gtk_doc_req_version], [--flavour no-tmpl]) - -# we don't want to build the documentation from a Git clone unless we -# explicitly tell configure to do so; this allows avoiding to recurse into -# the documentation directory when building Clutter inside Poky for a -# target device that doesn't have gtk-doc installed. for reference -# see: http://bugzilla.openedhand.com/show_bug.cgi?id=1047 -# -# we use autogen.sh as it exists only inside the Git clones, and it -# is not packaged into tarballs. -AM_CONDITIONAL([BUILD_GTK_DOC], [test "x$enable_gtk_doc" = "xyes" || test ! -f "autogen.sh"]) - -# prefixes for fixing gtk-doc references -CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`" -GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`" -PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`" -COGL_PREFIX="`$PKG_CONFIG --variable=prefix cogl-1.0`" -ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`" -AC_SUBST(CAIRO_PREFIX) -AC_SUBST(GLIB_PREFIX) -AC_SUBST(PANGO_PREFIX) -AC_SUBST(COGL_PREFIX) -AC_SUBST(ATK_PREFIX) - -dnl === Manual ================================================================ - -AC_ARG_ENABLE([docs], - [AS_HELP_STRING([--enable-docs=@<:@no/yes@:>@], - [Build optional documentation; requires xsltproc and jw.])], - [enable_docs=$enableval], - [enable_docs=no]) - -enable_pdfs=no -AS_IF([test "x$enable_docs" = "xyes"], - [ - AC_PATH_PROG(JW, [jw], [no]) - AS_IF([test "x$JW" = "xno"], - [ - AC_MSG_WARN([jw not found; pdf generation has been disabled]) - ], - [enable_pdfs=yes]) - - AC_PATH_PROG(XSLTPROC, [xsltproc], [no]) - AS_IF([test "x$XSLTPROC" = "xno"], - [ - AC_MSG_ERROR([xsltproc not found]) - ]) - ] -) - -AM_CONDITIONAL(ENABLE_DOCS, [test "x$enable_docs" = "xyes"]) -AM_CONDITIONAL(ENABLE_PDFS, [test "x$enable_pdfs" = "xyes"]) - dnl === I18N ================================================================== AM_GNU_GETTEXT_VERSION([0.17]) @@ -840,14 +783,6 @@ AC_CONFIG_FILES([ examples/Makefile - doc/Makefile - doc/reference/Makefile - doc/reference/clutter-docs.xml - doc/common/Makefile - doc/cookbook/Makefile - doc/cookbook/clutter-cookbook.xml - doc/cookbook/examples/Makefile - po/Makefile.in ]) @@ -873,12 +808,6 @@ echo " Compiler flags: ${CFLAGS} ${MAINTAINER_CFLAGS}" echo " Enable coverage tests: ${use_gcov}" echo " Enable deprecated symbols: ${enable_deprecated}" -# Documentation -echo "" -echo " • Documentation:" -echo " Build API Reference: ${enable_gtk_doc}" -echo " Build Additional Documentation: ${enable_docs} (Generate PDF: ${enable_pdfs})" - # Miscellaneous echo "" echo " • Extra:" diff --git a/doc/AUTHORS.old b/doc/AUTHORS.old deleted file mode 100644 index a72c94892..000000000 --- a/doc/AUTHORS.old +++ /dev/null @@ -1,17 +0,0 @@ -# Do not modify this list; this file is maintained for historical -# reasons. The list of authors can be extracted from the Git commit -# log. See the clutter.doap file for the updated maintainers list. - -Matthew Allum - Primary cat hurding authour. -Emmanuele Bassi - python bindings, gobject/glib mastery. -Iain Holmes - Original GTK Clutter widget. -Jorn Baayen - Original Gstreamer bits. -Tomas Frydrych - Fixed point + behaviour + maths magic. -Neil Patel - ClutterEntry, lots of API stress testing. -Neil Roberts - PangoClutter Renderer, COGL and win32 backend. -Rober Bragg - COGL, timeline mastery. -Ivan Leben - COGL. -Øyvind Kolås - Event handling, Clever magic stuff, Shaders, COGL. -Chris Lord - Many bug fixes. -Havoc Pennington - New layout magic. -Tommi Komulainen - OSX Backend. diff --git a/doc/CODING_STYLE b/doc/CODING_STYLE deleted file mode 100644 index b8682c82b..000000000 --- a/doc/CODING_STYLE +++ /dev/null @@ -1,613 +0,0 @@ -Clutter Coding Style -------------------------------------------------------------------------------- - -This document is intended to be a short description of the preferred -coding style to be used for the Clutter source code. - -Coding style is a matter of consistency, readability and maintainance; -coding style is also completely arbitrary and a matter of taste. This -document will use examples at the very least to provide authoritative -and consistent answers to common questions regarding the coding style, -and will also try to identify the allowed exceptions. - -The examples will show the preferred coding style; the negative examples -will be clearly identified. Please, don't submit code to Clutter that -looks like any of these. - -Part of the rationales for these coding style rules are available either -in the kernel CodingStyle document or in Cairo's CODING_STYLE one. - -When in doubt, check the surrounding code and try to imitate it. - -Clutter provides an Uncrustify configuration file that tries to match -this document. Since automated tools are not a substitute for human eye, -they should not be entirely relied upon - but they can give an initial -layout for contributors. - -+ Line width - -The maximum line width for source files is 80 characters, whenever possible. -Longer lines are usually an indication that you either need a function -or a pre-processor macro. - -+ Indentation - -Each new level is indented 2 or more spaces than the previous level: - - if (condition) - single_statement (); - -This can only be achieved using space characters. It may not be achieved -using tab characters alone, or using a combination of spaces and tabs. - -Do not change the editor's configuration to change the meaning of a -tab character (see below); code using tabs to indent will not be accepted -into Clutter. - -Even if two spaces for each indentation level allows deeper nesting than -8 spaces, Clutter favours self-documenting function names that can take -quite some space. For this reason you should avoid deeply nested code. - -+ Tab characters - -The tab character must always be expanded to spaces. If a literal -tab must be used inside the source, the tab must always be interpreted -according to its traditional meaning: - - Advance to the next column which is a multiple of 8. - [ these two lines should be aligned ] - -+ Braces - -Curly braces should not be used for single statement blocks: - - if (condition) - single_statement (); - else - another_single_statement (arg1); - -In case of multiple statements, curly braces should be put on another -indentation level: - - if (condition) - { - statement_1 (); - statement_2 (); - statement_3 (); - } - -The "no block for single statements" rule has only three exceptions: - - ① if the single statement covers multiple lines, e.g. for functions with - many arguments, and it is followed by else or else if: - - /* valid */ - if (condition) - { - a_single_statement_with_many_arguments (some_lengthy_argument, - another_lengthy_argument, - and_another_one, - plus_one); - } - else - another_single_statement (arg1, arg2); - - ② if the condition is composed of many lines: - - /* valid */ - if (condition1 || - (condition2 && condition3) || - condition4 || - (condition5 && (condition6 || condition7))) - { - a_single_statement (); - } - - ③ Nested if's, in which case the block should be placed on the - outermost if: - - /* valid */ - if (condition) - { - if (another_condition) - single_statement (); - else - another_single_statement (); - } - - /* invalid */ - if (condition) - if (another_condition) - single_statement (); - else if (yet_another_condition) - another_single_statement (); - -In general, new blocks should be placed on a new indentation level, -like: - - int retval = 0; - - statement_1 (); - statement_2 (); - - { - int var1 = 42; - gboolean res = FALSE; - - res = statement_3 (var1); - - retval = res ? -1 : 1; - } - -While curly braces for function definitions should rest on a new line -they should not add an indentation level: - - /* valid */ - static void - my_function (int argument) - { - do_my_things (); - } - - /* invalid */ - static void - my_function (int argument) { - do_my_things (); - } - - /* invalid */ - static void - my_function (int argument) - { - do_my_things (); - } - -Curly braces must not be placed on the same line as a condition: - - /* invalid */ - if (condition) { - statement_1 (); - statement_2 (); - } - -+ Conditions - -Do not check boolean values for equality: - - /* invalid */ - if (condition == TRUE) - do_foo (); - - /* valid */ - if (another_condition) - do_bar (); - -Even if C handles NULL equality like a boolean, be explicit: - - /* valid */ - if (some_pointer == NULL) - do_blah (); - - /* invalid */ - if (some_other_pointer) - do_blurp (); - -In case of conditions split over multiple lines, the logical operators should -always go at the end of the line: - - /* invalid */ - if (condition1 - || condition2 - || condition3) - { - do_foo (); - } - - /* valid */ - if (condition1 && - condition2 && - (condition3 || (condition4 && condition5))) - { - do_blah (); - } - -+ Functions - -Functions should be declared by placing the returned value on a separate -line from the function name: - - void - my_function (void) - { - } - -The arguments list must be broken into a new line for each argument, -with the argument names right aligned, taking into account pointers: - - void - my_function (some_type_t type, - another_type_t *a_pointer, - final_type_t another_type) - { - } - -The alignment also holds when invoking a function without breaking the -80 characters limit: - - align_function_arguments (first_argument, - second_argument, - third_argument); - -To respect the 80 characters limit do not break the function name from -the arguments: - - /* invalid */ - a_very_long_function_name_with_long_parameters - (argument_the_first, argument_the_second); - - /* valid */ - first_a = argument_the_first; - second_a = argument_the_second; - a_very_long_function_name_with_long_parameters (first_a, second_a); - -+ Whitespace - -Always put a space before a parenthesis but never after: - - /* valid */ - if (condition) - do_my_things (); - - /* valid */ - switch (condition) - { - } - - /* invalid */ - if(condition) - do_my_things(); - - /* invalid */ - if ( condition ) - do_my_things ( ); - -A switch() should open a block on a new indentation level, and each case -should start on the same indentation level as the curly braces, with the -case block on a new indentation level: - - /* valid */ - switch (condition) - { - case FOO: - do_foo (); - break; - - case BAR: - do_bar (); - break; - } - - /* invalid */ - switch (condition) { - case FOO: do_foo (); break; - case BAR: do_bar (); break; - } - - /* invalid */ - switch (condition) - { - case FOO: do_foo (); - break; - case BAR: do_bar (); - break; - } - - /* invalid */ - switch (condition) - { - case FOO: - do_foo (); - break; - case BAR: - do_bar (); - break; - } - -It is preferable, though not mandatory, to separate the various cases with -a newline: - - switch (condition) - { - case FOO: - do_foo (); - break; - - case BAR: - do_bar (); - break; - - default: - do_default (); - } - -The 'break' statement for the default: case is not mandatory. - -If a case block needs to declare new variables, the same rules as the -inner blocks (see above) apply; the break statement should be placed -outside of the inner block: - - switch (condition) - { - case FOO: - { - int foo; - - foo = do_foo (); - } - break; - - ... - } - -When declaring a structure type use newlines to separate logical sections -of the structure: - - struct _ClutterActorPrivate - { - /* fixed position */ - ClutterUnit fixed_x; - ClutterUnit fixed_y; - - ClutterRequestMode request_mode; - - /* requisition sizes */ - ClutterUnit request_width_for_height; - ClutterUnit request_min_width; - ClutterUnit request_natural_width; - ClutterUnit request_height_for_width; - ClutterUnit request_min_height; - ClutterUnit request_natural_height; - - ClutterActorBox allocation; - - ... - }; - -Do not eliminate whitespace and newlines just because something would -fit on 80 characters: - - /* invalid */ - if (condition) foo (); else bar (); - -Do eliminate trailing whitespace on any line, preferably as a separate -patch or commit. Never use empty lines at the beginning or at the end of -a file. - -Do enable the default git pre-commit hook that detect trailing -whitespace for you and help you to avoid corrupting Clutter's tree with -it. Do that as follows: - - chmod a+x .git/hooks/pre-commit - -You might also find the git-stripspace utility helpful which acts as a -filter to remove trailing whitespace as well as initial, final, and -duplicate blank lines. - -+ Headers - -Headers are special, for Clutter, in that they don't have to obey the -80 characters limit. The only major rule for headers is that the functions -definition should be vertically aligned in three columns: - - return value function_name (type argument, - type argument, - type argument); - -The maximum width of each column is given by the longest element in the -column: - - void clutter_type_set_property (ClutterType *type, - const gchar *value, - GError **error); - const gchar *clutter_type_get_property (ClutterType *type); - -It is also possible to align the columns to the next tab: - - void clutter_type_set_prop (ClutterType *type, - gfloat value); - gfloat clutter_type_get_prop (ClutterType *type); - gint clutter_type_update_foobar (ClutterType *type); - -Public headers should never be included directly: - - #if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION) - #error "Only can be included directly." - #endif - -Public headers should also have inclusion guards (for internal usage) -and C++ guards: - - #ifndef __CLUTTER_HEADER_H__ - #define __CLUTTER_HEADER_H__ - - #include - - G_BEGIN_DECLS - - ... - - G_END_DECLS - - #endif /* __CLUTTER_HEADER_H__ */ - -+ Includes - -Clutter source files should never include the global clutter.h header, but -instead include the individual headers that are needed. Every file must -include config.h first, then its own header, then other Clutter headers -that it needs, then system and third-party headers that it needs. - - /* valid */ - #include "config.h" - - #include "clutter-foo.h" - - #include "clutter-actor.h" - #include "clutter-container.h" - - ... - - #include - -+ GObject - -GObject classes definition and implementation require some additional -coding style notices. - -Typedef declarations should be placed at the beginning of the file: - - typedef struct _ClutterActor ClutterActor; - typedef struct _ClutterActorPrivate ClutterActorPrivate; - typedef struct _ClutterActorClass ClutterActorClass; - -This includes enumeration types: - - typedef enum { - CLUTTER_REQUEST_WIDTH_FOR_HEIGHT, - CLUTTER_REQUEST_HEIGHT_FOR_WIDTH - } ClutterRequestMode; - -And callback types: - - typedef void (* ClutterCallback) (ClutterActor *actor, - gpointer user_data); - -Instance structures should only contain the parent type and a pointer to a -private data structure, and they should be annotated as "private": - - struct _ClutterRectangle - { - /*< private >*/ - ClutterActor parent_instance; - - ClutterRectanglePrivate *priv; - }; - -All the properties should be stored inside the private data structure, which -is defined inside the source file - or, if needed, inside a private header -file; the private header filename must end with "-private.h" and must not be -installed. - -The private data structure should only be accessed internally using the -pointer inside the instance structure, and never using the -G_TYPE_INSTANCE_GET_PRIVATE() macro or the g_type_instance_get_private() -function. - -Always use the G_DEFINE_TYPE(), G_DEFINE_TYPE_WITH_CODE() macros, or -their abstract variants G_DEFINE_ABSTRACT_TYPE() and -G_DEFINE_ABSTRACT_TYPE_WITH_CODE(). - -Avoid forward declaration for functions: use the G_DEFINE_* macros right -after the private types, variables and macros declarations. - -Interface types should always have the dummy typedef for cast purposes: - - typedef struct _ClutterFoo ClutterFoo; - -The interface structure should have "Iface" postfixed to the dummy typedef: - - typedef struct _ClutterFooIface ClutterFooIface; - -Interfaces must have the following macros: - - - Macro: - Expands to: - • CLUTTER_TYPE_ _get_type - • CLUTTER_ G_TYPE_CHECK_INSTANCE_CAST - • CLUTTER_IS_ G_TYPE_CHECK_INSTANCE_TYPE - • CLUTTER__GET_IFACE G_TYPE_INSTANCE_GET_INTERFACE - -+ Memory allocation - -When dynamically allocating data on the heap either use g_new() or, -if allocating multiple small data structures, g_slice_new(). - -Public structure types should always be returned after being zero-ed, -either explicitly for each member, or by using g_new0() or g_slice_new0(). - -+ Macros - -Try to avoid private macros unless strictly necessary. Remember to #undef -them at the end of a block or a series of functions needing them. - -Inline functions are usually preferable to private macros. - -Public macros should not be used unless they evaluate to a constant. - -+ Public API - -Avoid exporting variables as public API, since this is cumbersome on some -platforms. It is always preferable to add getters and setters instead. - -+ Private API - -Non-exported functions that are needed in more than one source file -should be named "_clutter_...", and declared in a private header file. - -Underscore-prefixed functions are never exported. - -Non-exported functions that are only needed in one source file -should be declared static. - -+ Documentation - -All public APIs must have gtk-doc comments. For functions, these should -be placed in the source file, directly above the function. - - /* valid */ - /** - * clutter_get_flow: - * @actor: a #ClutterActor - * - * Gets the flow of an actor. - * - * Note that flows may be laminar or turbulent... - * - * Return value: (transfer none): the flow of @actor - */ - ClutterFlow * - clutter_get_flow (ClutterActor *actor) - { - ... - } - -Doc comments for macros, function types, class structs, etc should be -placed next to the definitions, typically in headers. - -Section introductions should be placed in the source file they describe, -after the license header: - - /* valid */ - /** - * SECTION:clutter-align-constraint - * @Title: ClutterAlignConstraint - * @Short_Description: A constraint aligning the position of an actor - * - * #ClutterAlignConstraint is a #ClutterConstraint that aligns the position - * of the #ClutterActor to which it is applied to the size of another - * #ClutterActor using an alignment factor - * - * [...] - */ - -To properly document a new function, macro, function type or struct, -it needs to be listed in the clutter-sections.txt file. - -To properly document a new class, it needs to be given its own section -in clutter-sections.txt, needs to be included in clutter-docs.xml, and the -get_type function needs to listed in clutter.types. - -+ Old code - -It is ok to update the style of a code block or function when you -are touching it anyway, but sweeping whitespace changes obscure the -git history and should be avoided. diff --git a/doc/HACKING b/doc/HACKING deleted file mode 100644 index a927f012f..000000000 --- a/doc/HACKING +++ /dev/null @@ -1,95 +0,0 @@ -GENERAL -======= - -General notes and rules on clutter core hacking; - - - Follow the CODING_STYLE document. - - - *Really* follow the CODING_STYLE document. - - - All non static public API funcs should be documented in the source files - via gtk-doc. Structures, enumerations and macros should be documented in - the header files. - - - All non-trivial static and private API should be documented, especially - the eventual lifetime handling of the arguments/return values or locking - of mutexes. - - - Properties should always be in floating point (never fixed point). - The preferred precision is double for angles, and single precision - for size and position -- especially if they have to be passed down - to Cogl. - - - Properties should use pixels whenever is possible. Dimensional and - positional properties can also use ClutterParamSpecUnits to define - the units-based logical values with a unit type. - - - The nick and blurb of properties in public classes should be marked for - translation by using the P_() macro defined in the clutter-private.h - header file. - - - Public entry points must always check their arguments with - g_return_if_fail() or g_return_val_if_fail(). - - - Private entry points should use g_assert() or g_warn_if_fail() to - verify internal state; do not use g_return_if_fail() or - g_return_val_if_fail() as they might be compiled out. - - - If you need to share some state variable across source files use - ClutterContext and a private accessor. - - - Private, non-static functions must begin with an underscore and - be declared inside clutter-private.h. - - - Don't add direct GL calls but add API to Cogl (both GL and GL|ES - versions if possible). - - - Use the CLUTTER_NOTE() macro for debug statements in Clutter, and - the COGL_NOTE() macro for debug statements in Cogl. If necessary, - add a value inside ClutterDebugFlags or CoglDebugFlags to specify - the debug section. - - - New features should also include an exhaustive test unit under - tests/conform and, eventually, a user-interactive test under - tests/interactive. - - - When committing, use the standard git commit message format: - -=== begin example commit === -Short explanation of the commit - -Longer explanation explaining exactly what's changed, whether any -external or private interfaces changed, what bugs were fixed (with bug -tracker reference if applicable) and so forth. Be concise but not too -brief. Don't be afraid of using UTF-8, or even ASCII art. -=== end example commit === - - - Always add a brief description of the commit to the _first_ line of - the commit and terminate by two newlines (it will work without the - second newline, but that is not nice for the interfaces). - - short description - MUST be less than 72 characters - - MANDATORY empty line - long description - Each line MUST be less than 76 characters - - - Do NOT put the commit message on the short description line. One line - commit messages should be avoided, unless they can be *fully* explained - in less than 72 characters (e.g. "Fix typo in - clutter_actor_create_pango_context() docs"). - - - The brief description might optionally have a "tag", i.e. a word or two - followed by a color, detailing what part of the repository the commit - affected, e.g.: - - alpha: Add :mode property - text: Emit ::cursor-event only on changes - - - The tag counts as part of overall character count, so try using - a short word. Optionally, you can also use the "[tag]" form. - - - Build environment fixes should use the "build" tag. - - - Think of the commit message as an email sent to the maintainers explaining - "what" you did and, more importantly, "why" you did it. The "how" is not - important, since "git show" will show the patch inlined with the commit - message. diff --git a/doc/HACKING.backends b/doc/HACKING.backends deleted file mode 100644 index 0c8037060..000000000 --- a/doc/HACKING.backends +++ /dev/null @@ -1,207 +0,0 @@ -IMPLEMENTING BACKENDS -=============================================================================== - -Clutter supports multiple backends for handling windowing systems and -GL/GLES API on different platforms. - -The GL and GLES API are abstracted by the COGL library. The windowing -system is handled by the ClutterBackend implementations inside Clutter -itself. - -Clutter, at the moment, supports only in-tree backends. - -In order to write a new backend for a specific platform you should -create a new sub-directory under clutter/clutter containing: - - /clutter-backend-.h - /clutter-backend-.c - - -- The subclass of the ClutterBackend abstract class. - - /clutter-stage-.h - /clutter-stage-.c - - -- The implementation of the stage window - - /clutter-device-manager-.h - /clutter-device-manager-.c - - -- The implementation of the input device manager - - /clutter-event-.c - - -- Event-specific code (optional) - - /clutter-.h - - -- A header for the backend-specific API that should be installed - by Clutter inside the include directory along with the rest of - the public API headers (optional). - - -Implementing ClutterBackend -------------------------------------------------------------------------------- - -Each backend must implement the - - GType - _clutter_backend_impl_get_type (void); - -function declared inside clutter/clutter-private.h. The implementation -of the function must return the same GType of the backend implementation, -for instance: - - GType - _clutter_backend_impl_get_type (void) - { - return CLUTTER_TYPE_BACKEND_GLX; - } - -The ClutterBackend implementation is a singleton instance, and the -backend must ensure that every time g_object_new() is called the same -pointer is returned (with its reference count increased). The GObject -API reference describes how to use the ::constructor virtual function -to implement a singleton, so you should refer to that. - -The ClutterBackend implementation should hold a single drawing context -for its entire lifetime; stage implementations should be "made current" -when needed. - -When implementing the ClutterBackend subclass these virtual functions -can be overridden: - - ClutterBackend::add_options - -- Use this function to install new, backend-specific GOptionEntry - definitions to the Clutter GOptionGroup. This function is guaranteed - to be called just once. - - ClutterBackend::pre_parse - -- Use this function to check for environment variables or setting - up default values before the command line arguments are parsed. - This function is guaranteed to be called just once. - - ClutterBackend::post_parse - -- Use this function to prepare the backend with the values either - set inside the ::pre_parse virtual function or by the command - line options parsing code. This function is guaranteed to be - called just once. - - ClutterBackend::init_events - -- Use this function to initialize the event handling. This function - is guaranteed to be called just once. - - ClutterBackend::get_features - -- Use this function to retrieve the features detectable at runtime - from the GL or GLES implementation, plus the eventual backend-specific - features. - - ClutterBackend::create_context - -- This function is used to create the drawing context to be used - by Clutter. Clutter will call this function during the initialization - phase. A GL (or GLES) context must always be available after the - initialization, so that Cogl and Clutter can query it for capabilities. - This function might be called multiple times so if a context was - successfully created in a previous call, this function should - short-circuit early and return TRUE - - ClutterBackend::ensure_context - -- This function is used to ensure that the backend drawing context - is made current for passed ClutterStage, using the backend-specific - API. This function is called each time a new stage is going to - be painted. If the Stage is inside its destruction sequence this - function should either fall back the drawing context to a default - drawing surface or should unset the drawing surface from the - drawing context. - - ClutterBackend::create_stage - -- This function is used to create the stage implementation. It will - receive as an argument the ClutterStage instance that is "wrapping" - the actual implementation being created. The backend must create - its stage implementation, initialise it and then return it; in case - of error, the backend must return NULL and set the passed GError. - - ClutterBackend::get_device_manager - -- This function is used to return the ClutterDeviceManager instance - that is going to be returned by clutter_device_manager_get_default() - and that should be used internally by input event translation. - -Implementing the stage -------------------------------------------------------------------------------- - -ClutterStage acts as a wrapper object relaying all the drawing operations -to the actual implementation. The implementation of the stage can be any -GObject subclass, as long as it implements the ClutterStageWindow interface. - -The ClutterStageWindow interface contains a set of virtual functions that -should be overridden by backends that support a windowing system, like -::set_title(), ::set_fullscreen(), ::set_cursor_visible(), etc. - -The stage implementation actor must implement: - - • ClutterStageWindow::get_wrapper() - • ClutterStageWindow::realize() and ::unrealize() - • ClutterStageWindow::show() and ::hide() - • ClutterStageWindow::resize() - • ClutterStageWindow::get_geometry() - • ClutterStageWindow::redraw() - -The ::get_wrapper() implementation should return the pointer to the -ClutterStage actor using the ClutterStageWindow implementation. - -In the ::realize virtual function the stage implementation should: - - - create a new native window handle - - ensure that there is a GL (or GLES) context - - make sure that the native window handle is compatible with - the GL (or GLES) context - -The return value should be TRUE if the stage implementation was successfully -realized, and FALSE otherwise. - -Inside the ::unrealize function the stage implementation should destroy -the native window handle created in ::realize(). - -The ::resize() virtual function implementation should cause an update -of the COGL viewport. - -The ::redraw() virtual function implementation should contain the platform -specific drawing logic, and call _clutter_stage_do_paint() on the ClutterStage -wrapper instance to cause the scene to be painted. - -The stage implementation actor can optionally implement: - - • ClutterStageWindow::get_pending_swaps() - -The get_pending_swaps() implementation should return the number of swap -buffer requests pending completion. This is only relevent for backends -that also support CLUTTER_FEATURE_SWAP_EVENTS. - -If the stage window is supposed to handle events, then it should also implement -the ClutterEventTranslator interface; this interface has a single virtual -function: - - • ClutterEventTranslator::translate_event() - -which gets passed a pointer to the native event data structure, and a pointer -to a newly-allocated, empty ClutterEvent. The EventTranslator implementation -should then decide between three options: - - - translate the native event and return CLUTTER_TRANSLATE_QUEUE to - let Clutter queue it up in the events queue; - - return CLUTTER_TRANSLATE_CONTINUE to let other event translators handle - the event; - - return CLUTTER_TRANSLATE_REMOVE to ignore the event. - -Implementing ClutterDeviceManager -------------------------------------------------------------------------------- - -Backends with input devices should provide a ClutterDeviceManager -implementation to handle addition, removal and input device event translation -through the ClutterEventTranslator interface. - -NOTES -=============================================================================== - -• If the platform is using X11 you should probably subclass ClutterBackendX11 - and ClutterStageX11, which will provide you with a ready to use code - implementation for event handling and window management. diff --git a/doc/Makefile.am b/doc/Makefile.am deleted file mode 100644 index 879d3a57d..000000000 --- a/doc/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -SUBDIRS = - -if BUILD_GTK_DOC -SUBDIRS += reference -endif - -if ENABLE_DOCS -SUBDIRS += common cookbook -endif - -DIST_SUBDIRS = reference common cookbook - -EXTRA_DIST = \ - CODING_STYLE \ - HACKING \ - HACKING.backends diff --git a/doc/RELEASING b/doc/RELEASING deleted file mode 100644 index d753eb811..000000000 --- a/doc/RELEASING +++ /dev/null @@ -1,64 +0,0 @@ -RELEASING -========= - -When making a new release; - - - Verify that you don't have uncommitted and unpublished - changes, i.e. both this: - - $ git status - - and this: - - $ git diff --stat master origin/master - - should be empty. Commit and push before the next step. - - - Clean your work directory: - - $ git clean -xdf - - This ensures that you don't have stale files lying around. - - - Run: - - $ ./autogen.sh --enable-gtk-doc --enable-docs - $ make all - $ make check - - And verify that the code builds from a clean Git snapshot. - - - Update the release documentation: - - - NEWS: new feature details, bugs fixed, acknowledgements - - README: dependencies, any behavioural changes relevant to - developers; - - then commit the changes. - - - Bump clutter_micro_version to the next even number; if this is a stable - release, bump up clutter_interface_version by one as well. Then commit - the changes. - - - Run: - - $ make release-publish - - which will: - - - do sanity checks on the build - - distcheck the release - - tag the repository with the version number - - upload the tarball to the remote server (needs SSH account) - - - Bump clutter_micro_version to the next odd number; if this is a stable - release, bump up clutter_interface_version by one as well. Then commit - the changes. - - - Push the branch and then the tag, e.g.: - - $ git push origin master - $ git push origin 1.2.4 - - - Announce release to the waiting world on the blog and mailing lists. Use - the template printed by `make release-publish`. diff --git a/doc/actor-invariants.txt b/doc/actor-invariants.txt deleted file mode 100644 index 801a9fb6c..000000000 --- a/doc/actor-invariants.txt +++ /dev/null @@ -1,278 +0,0 @@ -ClutterActor Invariants -=============================================================================== - -ClutterActor behaviour has invariants that will be kept with the same API and -ABI guarantees as the whole Clutter library. - -This document refers to the 0.8 release of Clutter. - -Sections: - - i. Flags - a. Public ClutterActor Flags - b. Private ClutterActor Flags - c. Private Pick Modes - ii. Invariants - iii. State changes - iv. Responsibilities of a ClutterActor - a. Adding to a container - b. Removing from a container - c. Initial state - - i. Flags -------------------------------------------------------------------------------- - -This section describes the various flags and enumerations used by -ClutterActor. - - a. Public ClutterActor Flags - -CLUTTER_ACTOR_REALIZED - Means: the actor has GPU resources associated to its paint - cycle. Note however that an actor is allowed to allocate Cogl - resources before being realized because Clutter only ever uses - one rendering context which is always current. An actor is - free to create resources at any time. - - Set by clutter_actor_realize(), unset by - clutter_actor_unrealize(). Generally set implicitly when the - actor becomes MAPPED (see below). - - May only be set if one of the actor's ancestors is a toplevel. - May only be set if all of the actor's ancestors are realized. - - Once realized an actor remains realized until removed from the - toplevel. Hide, reparent will not unrealize; but unparent or - destroy will unrealize since they remove the actor from the - toplevel. - -CLUTTER_ACTOR_MAPPED - Means: the actor will be painted if the stage is mapped. - - On non-toplevels, will be set if all of the following are - true, and unset otherwise: - * the actor's VISIBLE flag is set - * all of the actor's non-toplevel ancestors have the MAPPED - flag set - * the actor has a toplevel ancestor - * the toplevel ancestor's VISIBLE flag is set - * the toplevel ancestor's REALIZED flag is set - - On toplevels, MAPPED is set asynchronously when the window - system notifies Clutter that the toplevel has been made - visible on the screen. - - The MAPPED flag requires that an actor is REALIZED. When - Clutter sets the MAPPED flag, it forces realization; this is - the "normal" way for realization to occur, though explicit - realization with clutter_actor_realize() is permitted. - - Reparent may not change the MAPPED flag if the old and the - new parent are both MAPPED. - -CLUTTER_ACTOR_VISIBLE - Means: the actor's "visible" property was set to true by - the application programmer. - - Set by clutter_actor_show(), unset by clutter_actor_hide(). - - This is an application-controlled property, while MAPPED and - REALIZED are usually managed by Clutter (with the exception - that applications can "realize early" with - clutter_actor_realize()). - - If VISIBLE is unset, the actor (and any children) must - be immediately unmapped, to maintain the invariants for - the MAPPED flag. - -CLUTTER_ACTOR_REACTIVE - Set and unset by clutter_actor_set_reactive() - Means: the actor is now reactive to events. - Notes: - * If parents need to be reactive for child its up to the - parent implementation. In the case of ClutterGroup it - being marked unreactive does not mark all children unreactive. - * Clutter stage is always reactive. - - - b. Private ClutterActor flags - -CLUTTER_ACTOR_IN_DESTRUCTION - Set internally by clutter_actor_destroy(). - Used to avoid uneeded overhead when freeing GPU resources on unrealize - -CLUTTER_ACTOR_IS_TOPLEVEL - Set internally by the initialization of ClutterStage - -CLUTTER_ACTOR_IN_REPARENT [DEPRECATED] - Set internally by clutter_actor_reparent(). This flag - optimizes the reparent process by avoiding the need - to pass through an unrealized state when the actor is - removed from the old parent. - -CLUTTER_ACTOR_IN_PAINT: - Set internally by clutter_actor_paint() - -CLUTTER_ACTOR_IN_RELAYOUT - Set internally by clutter_actor_allocate() - - c. Pick Modes - -CLUTTER_PICK_NONE - No pick operation is performed during the paint - -CLUTTER_PICK_REACTIVE - Only reactive actors will be picked - -CLUTTER_PICK_ALL - All visible actors will be picked - - ii. Invariants -------------------------------------------------------------------------------- - -This section describes the various constraints and invariants on ClutterActor. - -In the following - - A => B means if A is true then B is true - A <=> B means A is true if and only if B is true - (equivalent to A => B && A <= B) - -1) CLUTTER_ACTOR_IN_DESTRUCTION => !CLUTTER_ACTOR_IS_MAPPED (actor) && - !CLUTTER_ACTOR_IS_REALIZED (actor) - - clutter_actor_destroy() will cause an actor to be unparented, - which means the actor must be unmapped and unrealized as - well. - -2) CLUTTER_ACTOR_IS_MAPPED (actor) => CLUTTER_ACTOR_IS_REALIZED (actor) - - when an actor is mapped, it must first be realized. - - This is the most common way an actor becomes realized. - -3) if clutter_actor_add_child (parent, actor): - ((parent_is_not_toplevel && CLUTTER_ACTOR_IS_MAPPED (parent)) || - (parent_is_toplevel && CLUTTER_ACTOR_IS_VISIBLE(parent))) && - CLUTTER_ACTOR_IS_VISIBLE (actor) - => CLUTTER_ACTOR_IS_MAPPED (actor) - - calling clutter_actor_add_child() on an actor and a mapped - parent will map the actor if it has been shown. - -4) if clutter_actor_remove_child (parent, actor): - CLUTTER_ACTOR_IS_MAPPED (actor) <=> CLUTTER_ACTOR_IN_REPARENT - - calling clutter_actor_remove_child() on an actor will unmap and - unrealize the actor since it no longer has a toplevel. - - calling clutter_actor_reparent() on an actor will leave the - actor mapped and realized (if it was before) until it has a - new parent, at which point the invariants implied by the new - parent's state are applied. [DEPRECATED] - -5) CLUTTER_ACTOR_IS_REALIZED(actor) => CLUTTER_ACTOR_IS_REALIZED(parent) - - Actors may only be realized if their parent is realized. - However, they may be unrealized even though their parent - is realized. - - This implies that an actor may not be realized unless - it has a parent, or is a toplevel. - - Since only toplevels can realize without a parent, no actor - can be realized unless it either is a toplevel or has a - toplevel ancestor. - - As long as they are unmapped, actors may be unrealized. This - will force all children of the actor to be unrealized, since - children may not be realized while parents are unrealized. - -6) CLUTTER_ACTOR_IS_MAPPED(actor) <=> - ( ( (CLUTTER_ACTOR_IS_VISIBLE(toplevel_parent) && - CLUTTER_ACTOR_IS_REALIZED(toplevel_parent)) || - CLUTTER_ACTOR_IS_MAPPED(non_toplevel_parent) ) ) && - CLUTTER_ACTOR_IS_VISIBLE(actor) - - Actors _must_ be mapped if and only if they are visible and - their parent is mapped, or they are visible and their - parent is a toplevel that's realized and visible. - - This invariant enables us to track whether an actor will - be painted (whether it's MAPPED) without ever traversing - the actor graph. - - iii. State changes -------------------------------------------------------------------------------- - -clutter_actor_show: - 1. sets VISIBLE - 2. sets MAPPED if invariants are met; mapping in turn sets - REALIZED - -clutter_actor_hide: - 1. sets !VISIBLE - 2. unsets MAPPED if actor was mapped previously - 3. does not affect REALIZED - -clutter_actor_destroy: - 1. sets CLUTTER_ACTOR_IN_DESTRUCTION - 2. unparents the actor, which in turn implies unmap and unrealize - -clutter_actor_realize: - 1. attempts to set REALIZED on all parents, failing if - invariants are not met, e.g. not in a toplevel yet - 2. sets REALIZED on actor if parent was successfully realized - -clutter_actor_unrealize: - 1. sets !VISIBLE which forces !MAPPED - 2. sets !REALIZED - 3. !MAPPED and !REALIZED forces unmap and unrealize of all - children - -clutter_actor_add_child: - 1. sets actor->parent - 2. if actor->show_on_set_parent is TRUE calls clutter_actor_show - 3. sets MAPPED if all prerequisites are now met for map - 4. if !CLUTTER_ACTOR_IN_REPARENT emits ::parent-set with - old_parent set to NULL - -clutter_actor_remove_child: - 1. unsets actor->parent - 2. if !CLUTTER_ACTOR_IN_REPARENT, sets !MAPPED and !REALIZED - since the invariants for those flags are no longer met - 3. if !CLUTTER_ACTOR_IN_REPARENT emits ::parent-set with - old_parent set to the previous parent - -clutter_actor_reparent: [DEPRECATED] - 1. sets CLUTTER_ACTOR_IN_REPARENT - 2. emits ::parent-set with old_parent set to the previous parent - equivalent to: - clutter_actor_unparent - clutter_actor_set_parent - 3. updates state of the actor to match invariants - (may change MAPPED or REALIZED in either direction, - depending on state of the new parent) - - - iv. Responsibilities of a ClutterActor -------------------------------------------------------------------------------- - - a. Adding to a container - -When adding an actor to a container, the container must: - - 1. call clutter_actor_add_child (container, actor) - - b. Removing from a container - -When removing an actor from a container, the container must: - - 1. call clutter_actor_remove_child (container, actor) - - c. Initial state - -When creating an actor, the initial state is: - - 1. !CLUTTER_ACTOR_REALIZED - 2. !CLUTTER_ACTOR_MAPPED diff --git a/doc/common/Makefile.am b/doc/common/Makefile.am deleted file mode 100644 index 59f345cd4..000000000 --- a/doc/common/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -NULL = - -EXTRA_DIST = \ - common.xsl \ - cookbook.xsl \ - devhelp.xsl \ - html.xsl \ - ref-html-style.xsl \ - style.css \ - $(NULL) diff --git a/doc/common/common.xsl b/doc/common/common.xsl deleted file mode 100644 index 606313fff..000000000 --- a/doc/common/common.xsl +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/doc/common/cookbook.xsl b/doc/common/cookbook.xsl deleted file mode 100644 index 755e0d071..000000000 --- a/doc/common/cookbook.xsl +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- -

-
- -
diff --git a/doc/common/devhelp.xsl b/doc/common/devhelp.xsl deleted file mode 100644 index b329a4ce0..000000000 --- a/doc/common/devhelp.xsl +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - book - - - .devhelp - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - , - - - - - diff --git a/doc/common/html.xsl b/doc/common/html.xsl deleted file mode 100644 index d8fea785e..000000000 --- a/doc/common/html.xsl +++ /dev/null @@ -1,285 +0,0 @@ - - - -]> - - - -style.css - - - - - - - - -
- - - - - - - - - - - - - - - - - -
  - -  
- -- - -  
-
- - - - - -
- -
-
- -
- -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
-
-      class 
-      
-      
-        (
-                )
-      
-      :&RE;
-
-      
-    
-
- - - - - - - - , - - - - - - - - - -   - - - - - - , - - - - - - - - - , - - - - - - - - - , - - - - - - - - -      - - - - - - - - -   - - - - - - -   - - - - - - = - - - - - - - void  - - - - - - - - - - - - , - - - - - - - - - - def - - ( - - ) - - - - - - - - - - ( - - ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
- -
diff --git a/doc/common/ref-html-style.xsl b/doc/common/ref-html-style.xsl deleted file mode 100644 index 380e6a6fd..000000000 --- a/doc/common/ref-html-style.xsl +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - <ANCHOR id=" - - " href=" - - - / - - - "> - - - - - - - - - - - - - - - - - - - diff --git a/doc/common/style.css b/doc/common/style.css deleted file mode 100644 index d2484daf2..000000000 --- a/doc/common/style.css +++ /dev/null @@ -1,966 +0,0 @@ -/* - Generic XHTML / DocBook XHTML CSS Stylesheet. - - Browser wrangling and typographic design by - Oyvind Kolas / pippin@gimp.org - - Customised for Poky by - Matthew Allum / mallum@o-hand.com - - Thanks to: - Liam R. E. Quin - William Skaggs - Jakub Steiner - - Structure - --------- - - The stylesheet is divided into the following sections: - - Positioning - Margins, paddings, width, font-size, clearing. - Decorations - Borders, style - Colors - Colors - Graphics - Graphical backgrounds - Nasty IE tweaks - Workarounds needed to make it work in internet explorer, - currently makes the stylesheet non validating, but up until - this point it is validating. - Mozilla extensions - Transparency for footer - Rounded corners on boxes - -*/ - - - /*************** / - / Positioning / -/ ***************/ - -body { - font-family: Verdana, Sans, sans-serif; - - min-width: 640px; - width: 80%; - margin: 0em auto; - padding: 2em 5em 5em 5em; - color: #333; -} - -h1,h2,h3,h4,h5,h6,h7 { - font-family: Arial, Sans; - color:#999999; - clear: both; -} - -h1 { - font-size: 2em; - text-align: left; - padding: 0em 0em 0em 0em; - margin: 2em 0em 0em 0em; -} - -h2.subtitle { - margin: 0.10em 0em 3.0em 0em; - padding: 0em 0em 0em 0em; - font-size: 1.8em; - padding-left: 20%; - font-weight: normal; - font-style: italic; -} - -h2 { - margin: 2em 0em 0.66em 0em; - padding: 0.5em 0em 0em 0em; - font-size: 1.5em; - font-weight: normal; -} - -h3.subtitle { - margin: 0em 0em 1em 0em; - padding: 0em 0em 0em 0em; - font-size: 142.14%; - text-align: right; -} - -h3 { - margin: 1em 0em 0.5em 0em; - padding: 1em 0em 0em 0em; - font-size: 140%; - font-weight: normal; -} - -h4 { - margin: 1em 0em 0.5em 0em; - padding: 1em 0em 0em 0em; - font-size: 120%; - font-weight: normal; -} - -h5 { - margin: 1em 0em 0.5em 0em; - padding: 1em 0em 0em 0em; - font-size: 110.000%; - border-bottom: 1px solid black; -} - -h6 { - margin: 1em 0em 0em 0em; - padding: 1em 0em 0em 0em; - font-size: 80%; - font-weight: normal; -} - -.authorgroup { - background-color: transparent; - background-repeat: no-repeat; - padding-top: 256px; -/* background-image: url("images/clutter-logo.png"); */ - background-position: right top; - float: right; - margin-top: -256px; - padding-right: 50px; - margin-left: 50px; - text-align: right; - width: 200px; -} - -h3.author { - margin: 0em 0me 0em 0em; - padding: 0em 0em 0em 0em; - font-weight: normal; - font-size: 100%; - clear: both; -} - -.author tt.email { - font-size: 66%; -} - -.titlepage hr { - width: 0em; - clear: both; -} - -.revhistory { - padding-top: 2em; - clear: both; -} - -.toc, -.list-of-tables, -.list-of-examples, -.list-of-figures { - padding: 1.33em 0em 2.5em 0em; -} - -.toc p, -.list-of-tables p, -.list-of-figures p, -.list-of-examples p { - padding: 0em 0em 0em 0em; - padding: 0em 0em 0.3em; - margin: 1.5em 0em 0em 0em; -} - -.toc p b, -.list-of-tables p b, -.list-of-figures p b, -.list-of-examples p b{ - font-size: 100.0%; - font-weight: bold; -} - -.toc dl, -.list-of-tables dl, -.list-of-figures dl, -.list-of-examples dl { - margin: 0em 0em 0.5em 0em; - padding: 0em 0em 0em 0em; -} - -.toc dt { - margin: 0em 0em 0em 0em; - padding: 0em 0em 0em 0em; -} - -.toc dd { - margin: 0em 0em 0em 2.6em; - padding: 0em 0em 0em 0em; -} - -div.glossary dl, -div.variablelist dl { -} - -.glossary dl dt, -.variablelist dl dt, -.variablelist dl dt span.term { - font-weight: normal; - width: 20em; - text-align: right; -} - -.variablelist dl dt { - margin-top: 0.5em; -} - -.glossary dl dd, -.variablelist dl dd { - margin-top: -1em; - margin-left: 25.5em; -} - -.glossary dd p, -.variablelist dd p { - margin-top: 0em; - margin-bottom: 1em; -} - - -div.calloutlist table td { - padding: 0em 0em 0em 0em; - margin: 0em 0em 0em 0em; -} - -div.calloutlist table td p { - margin-top: 0em; - margin-bottom: 1em; -} - -div p.copyright { - text-align: left; -} - -div.legalnotice p.legalnotice-title { - margin-bottom: 0em; - font-size: 80%; -} - -p { - line-height: 1.5em; - margin-top: 0em; - -} - -dl { - padding-top: 0em; -} - -hr { - border: solid 1px; -} - - -.mediaobject, -.mediaobjectco { - text-align: center; -} - -img { - border: none; -} - -ul { - padding: 0em 0em 0em 1.5em; -} - -ul li { - padding: 0em 0em 0em 0em; -} - -ul li p { - text-align: left; -} - -table { - width :100%; -} - -th { - padding: 0.25em; - text-align: left; - font-weight: normal; - vertical-align: top; -} - -td { - padding: 0.25em; - vertical-align: top; -} - -p a[id] { - margin: 0px; - padding: 0px; - display: inline; - background-image: none; -} - -a { - text-decoration: underline; - color: #444; -} - -pre { - overflow: auto; -} - -a:hover { - text-decoration: underline; - /*font-weight: bold;*/ -} - - -div.informalfigure, -div.informalexample, -div.informaltable, -div.figure, -div.table, -div.example { - margin: 1em 0em; - padding: 1em; - page-break-inside: avoid; - background-color: #3ab1cc; -} - - -div.informalfigure p.title b, -div.informalexample p.title b, -div.informaltable p.title b, -div.figure p.title b, -div.example p.title b, -div.table p.title b{ - padding-top: 0em; - margin-top: 0em; - font-size: 100%; - font-weight: normal; -} - -.mediaobject .caption, -.mediaobject .caption p { - text-align: center; - font-size: 80%; - padding-top: 0.5em; - padding-bottom: 0.5em; -} - -.epigraph { - padding-left: 55%; - margin-bottom: 1em; - color: #666; - font-size: 80%; -} - -.epigraph p { - text-align: left; -} - -.epigraph .quote { - font-style: italic; -} -.epigraph .attribution { - font-style: normal; - text-align: right; -} - -span.application { - font-style: italic; -} - -span.property, span.type { - font-family: monospace; -} - -.programlisting { - font-family: monospace; - font-size: 80%; - white-space: pre; - margin: 1.33em 0em; - padding: 1.33em; -} - -.tip, -.warning, -.caution, -.note { - margin-top: 1em; - margin-bottom: 1em; - -} - -/* force full width of table within div */ -.tip table, -.warning table, -.caution table, -.note table { - border: none; - width: 100%; -} - - -.tip table th, -.warning table th, -.caution table th, -.note table th { - padding: 0.8em 0.0em 0.0em 0.0em; - margin : 0em 0em 0em 0em; -} - -.tip p, -.warning p, -.caution p, -.note p { - margin-top: 0.5em; - margin-bottom: 0.5em; - padding-right: 1em; - text-align: left; -} - -.acronym { - text-transform: uppercase; -} - -b.keycap, -.keycap { - padding: 0.09em 0.3em; - margin: 0em; -} - -.itemizedlist li { - clear: none; -} - -.filename { - font-size: medium; - font-family: Courier, monospace; -} - - -div.navheader, div.heading{ - position: absolute; - left: 0em; - top: 0em; - width: 100%; - background-color: #cdf; - width: 100%; -} - -div.navfooter, div.footing{ - position: fixed; - left: 0em; - bottom: 0em; - background-color: #eee; - width: 100%; -} - - -div.navheader td, -div.navfooter td { - font-size: 66%; -} - -div.navheader table th { - /*font-family: Georgia, Times, serif;*/ - /*font-size: x-large;*/ - font-size: 80%; -} - -div.navheader table { - border-left: 0em; - border-right: 0em; - border-top: 0em; - width: 100%; -} - -div.navfooter table { - border-left: 0em; - border-right: 0em; - border-bottom: 0em; - width: 100%; -} - -div.navheader table td a, -div.navfooter table td a { - color: #777; - text-decoration: none; -} - -/* normal text in the footer */ -div.navfooter table td { - color: black; -} - -div.navheader table td a:visited, -div.navfooter table td a:visited { - color: #444; -} - - -/* links in header and footer */ -div.navheader table td a:hover, -div.navfooter table td a:hover { - text-decoration: underline; - background-color: transparent; - color: #33a; -} - -div.navheader hr, -div.navfooter hr { - display: none; -} - - -.qandaset tr.question td p { - margin: 0em 0em 1em 0em; - padding: 0em 0em 0em 0em; -} - -.qandaset tr.answer td p { - margin: 0em 0em 1em 0em; - padding: 0em 0em 0em 0em; -} -.answer td { - padding-bottom: 1.5em; -} - -.emphasis { - font-weight: bold; -} - -pre.programlisting .emphasis { - font-weight: normal !important; -} - - /************* / - / decorations / -/ *************/ - -.titlepage { -} - -.part .title { -} - -.subtitle { - border: none; -} - -/* -h1 { - border: none; -} - -h2 { - border-top: solid 0.2em; - border-bottom: solid 0.06em; -} - -h3 { - border-top: 0em; - border-bottom: solid 0.06em; -} - -h4 { - border: 0em; - border-bottom: solid 0.06em; -} - -h5 { - border: 0em; -} -*/ - -.programlisting { - border: solid 1px; -} - -div.figure, -div.table, -div.informalfigure, -div.informaltable, -div.informalexample, -div.example { - border: 1px solid; -} - - - -.tip, -.warning, -.caution, -.note { - border: 1px solid; -} - -.tip table th, -.warning table th, -.caution table th, -.note table th { - border-bottom: 1px solid; -} - -.question td { - border-top: 1px solid black; -} - -.answer { -} - - -b.keycap, -.keycap { - border: 1px solid; -} - - -div.navheader, div.heading{ - border-bottom: 1px solid; -} - - -div.navfooter, div.footing{ - border-top: 1px solid; -} - - /********* / - / colors / -/ *********/ - -body { - color: #333; - background: white; -} - -a { - background: transparent; -} - -a:hover { - background-color: #dedede; -} - - -h1, -h2, -h3, -h4, -h5, -h6, -h7, -h8 { - background-color: transparent; -} - -hr { - border-color: #aaa; -} - - -.tip, .warning, .caution, .note { - border-color: #aaa; -} - - -.tip table th, -.warning table th, -.caution table th, -.note table th { - border-bottom-color: #aaa; -} - - -.warning { - background-color: #fea; -} - -.caution { - background-color: #fea; -} - -.tip { - background-color: #eff; -} - -.note { - background-color: #8bd12e; -} - -.glossary dl dt, -.variablelist dl dt, -.variablelist dl dt span.term { - color: #044; -} - -div.figure, -div.table, -div.example, -div.informalfigure, -div.informaltable, -div.informalexample { - border-color: #aaa; -} - -pre.programlisting { - color: black; - background-color: #fff; - border-color: #aaa; - border-width: 2px; -} - -.guimenu, -.guilabel, -.guimenuitem { - background-color: #eee; -} - - -b.keycap, -.keycap { - background-color: #eee; - border-color: #999; -} - - -div.navheader { - border-color: black; -} - - -div.navfooter { - border-color: black; -} - - - /*********** / - / graphics / -/ ***********/ - -/* -body { - background-image: url("images/body_bg.jpg"); - background-attachment: fixed; -} - -.navheader, -.note, -.tip { - background-image: url("images/note_bg.jpg"); - background-attachment: fixed; -} - -.warning, -.caution { - background-image: url("images/warning_bg.jpg"); - background-attachment: fixed; -} - -.figure, -.informalfigure, -.example, -.informalexample, -.table, -.informaltable { - background-image: url("images/figure_bg.jpg"); - background-attachment: fixed; -} - -*/ -h1, -h2, -h3, -h4, -h5, -h6, -h7{ -} - -div.preface .titlepage .title, -div.colophon .title, -div.chapter .titlepage .title { - background-image: url("images/title-bg.png"); - background-position: bottom; - background-repeat: repeat-x; -} - -div.section div.section .titlepage .title, -div.sect2 .titlepage .title { - background: none; -} - - -h1.title { - background-color: transparent; - background-image: url("images/clutter-logo.png"); - background-repeat: no-repeat; - height: 128px; - text-indent: 400px; - overflow:hidden; - margin: 2em 1em 2em 0em; - text-align: right; -} - -h2.subtitle { - background-color: transparent; - text-indent: -9000px; - overflow:hidden; - width: 0px; - display: none; -} - - /*************************************** / - / pippin.gimp.org specific alterations / -/ ***************************************/ - -/* -div.heading, div.navheader { - color: #777; - font-size: 80%; - padding: 0; - margin: 0; - text-align: left; - position: absolute; - top: 0px; - left: 0px; - width: 100%; - height: 50px; - background: url('/gfx/heading_bg.png') transparent; - background-repeat: repeat-x; - background-attachment: fixed; - border: none; -} - -div.heading a { - color: #444; -} - -div.footing, div.navfooter { - border: none; - color: #ddd; - font-size: 80%; - text-align:right; - - width: 100%; - padding-top: 10px; - position: absolute; - bottom: 0px; - left: 0px; - - background: url('/gfx/footing_bg.png') transparent; -} -*/ - - - - /****************** / - / nasty ie tweaks / -/ ******************/ - -/* -div.heading, div.navheader { - width:expression(document.body.clientWidth + "px"); -} - -div.footing, div.navfooter { - width:expression(document.body.clientWidth + "px"); - margin-left:expression("-5em"); -} -body { - padding:expression("4em 5em 0em 5em"); -} -*/ - - /**************************************** / - / mozilla vendor specific css extensions / -/ ****************************************/ -/* -div.navfooter, div.footing{ - -moz-opacity: 0.8em; -} - -div.figure, -div.table, -div.informalfigure, -div.informaltable, -div.informalexample, -div.example, -.tip, -.warning, -.caution, -.note { - -moz-border-radius: 0.5em; -} - -b.keycap, -.keycap { - -moz-border-radius: 0.3em; -} -*/ - -table tr td table tr td { - display: none; -} - - -hr { - display: none; -} - -table { - border: 0em; -} - - .photo { - float: right; - margin-left: 1.5em; - margin-bottom: 1.5em; - margin-top: 0em; - max-width: 17em; - border: 1px solid gray; - padding: 3px; - background: white; -} - .seperator { - padding-top: 2em; - clear: both; - } - - #validators { - margin-top: 5em; - text-align: right; - color: #777; - } - @media print { - body { - font-size: 8pt; - } - .noprint { - display: none; - } - } - - -.tip, -.note { - background: #91ae35; - color: #fff; - padding: 20px; - margin: 20px; -} - -.tip h3, -.note h3 { - padding: 0em; - margin: 0em; - font-size: 2em; - font-weight: bold; - color: #fff; -} - -.tip a, -.note a { - color: #fff; - text-decoration: underline; -} diff --git a/doc/cookbook/Makefile.am b/doc/cookbook/Makefile.am deleted file mode 100644 index 0f2aff53e..000000000 --- a/doc/cookbook/Makefile.am +++ /dev/null @@ -1,185 +0,0 @@ -SUBDIRS = examples - -NULL = - -HTML_DIR = $(datadir)/gtk-doc/html -TARGET_DIR = $(HTML_DIR)/clutter-cookbook - -XML_FILES = \ - $(top_srcdir)/doc/cookbook/actors.xml \ - $(top_srcdir)/doc/cookbook/animations.xml \ - $(top_srcdir)/doc/cookbook/events.xml \ - $(top_srcdir)/doc/cookbook/introduction.xml \ - $(top_srcdir)/doc/cookbook/text.xml \ - $(top_srcdir)/doc/cookbook/textures.xml \ - $(top_srcdir)/doc/cookbook/layouts.xml \ - $(top_srcdir)/doc/cookbook/script.xml \ - $(top_srcdir)/doc/cookbook/effects.xml \ - $(NULL) - -XSLTOPTS = \ - --stringparam html.stylesheet style.css \ - --stringparam chapter.autolabel 1 \ - --stringparam appendix.autolabel 1 \ - --stringparam section.autolabel 1 \ - --stringparam gtkdoc.bookname "clutter-cookbook" \ - --stringparam gtkdoc.version @CLUTTER_API_VERSION@ \ - --stringparam callout.graphics 0 \ - --path $(top_srcdir)/doc/common \ - --path $(top_srcdir)/doc/cookbook \ - --xinclude - -XSL_BASE_URI = http://docbook.sourceforge.net/release/xsl/current -XSL_XHTML_URI = $(XSL_BASE_URI)/xhtml/docbook.xsl - -HTML_FILES = $(top_builddir)/doc/cookbook/html/*.html -CSS_FILES = $(top_builddir)/doc/cookbook/html/*.css -IMAGE_FILES = \ - $(srcdir)/images/clutter-logo.png \ - $(srcdir)/images/effects-basic.png \ - $(srcdir)/images/effects-basic-background.png \ - $(srcdir)/images/effects-built-in.png \ - $(srcdir)/images/effects-custom-deform.png \ - $(srcdir)/images/effects-custom-deform-back-material.png \ - $(srcdir)/images/textures-reflection.png \ - $(srcdir)/images/actors-opacity.png \ - $(srcdir)/images/actors-opacity-container-affects-opacity.png \ - $(srcdir)/images/text-shadow.png \ - $(srcdir)/images/textures-sub-texture.png \ - $(srcdir)/images/layouts-stacking-diff-actor-sizes.png \ - $(srcdir)/images/events-pointer-motion-stacking.png \ - $(srcdir)/images/layouts-bind-constraint-stage.png \ - $(NULL) - -VIDEO_FILES = \ - $(srcdir)/videos/animations-fading-out.ogv \ - $(srcdir)/videos/animations-fading-in-then-out.ogv \ - $(srcdir)/videos/animations-path.ogv \ - $(srcdir)/videos/animations-rotating-x-minus-45.ogv \ - $(srcdir)/videos/animations-rotating-y-45.ogv \ - $(srcdir)/videos/animations-rotating-z-90.ogv \ - $(srcdir)/videos/animations-rotating-x-minus-180-with-y-minus-96.ogv \ - $(srcdir)/videos/animations-rotating-x-minus-180-with-z-minus-96.ogv \ - $(srcdir)/videos/animations-rotating-x-centered.ogv \ - $(srcdir)/videos/animations-rotating-y-centered.ogv \ - $(srcdir)/videos/animations-rotating-z-centered.ogv \ - $(srcdir)/videos/animations-rotating-container-reverses-direction.ogv \ - $(srcdir)/videos/effects-custom-deform.ogv \ - $(srcdir)/videos/textures-split-go.ogv \ - $(srcdir)/videos/events-mouse-scroll.ogv \ - $(srcdir)/videos/textures-crossfade-two-textures.ogv \ - $(srcdir)/videos/animations-complex.ogv \ - $(srcdir)/videos/animations-reuse.ogv \ - $(srcdir)/videos/animations-moving-anchors.ogv \ - $(srcdir)/videos/animations-moving-depth.ogv \ - $(srcdir)/videos/animations-looping.ogv \ - $(NULL) - -EXTRA_DIST = \ - clutter-cookbook.xml.in \ - recipe-template.xml \ - $(IMAGE_FILES) \ - $(XML_FILES) \ - $(VIDEO_FILES) - -CLEANFILES = \ - pdf-build.stamp \ - html-build.stamp \ - clutter-cookbook.html - -pdf-build.stamp: clutter-cookbook.xml $(XML_FILES) - SP_ENCODING=XML SP_CHARSET_FIXED=YES \ - $(JW) -b pdf $(top_builddir)/doc/cookbook/clutter-cookbook.xml \ - && mv -f clutter-cookbook.pdf clutter-cookbook-@CLUTTER_API_VERSION@.pdf \ - && echo timestamp > $(@F) - -html-build.stamp: clutter-cookbook.xml $(XML_FILES) - if [ ! -d html ] ; then mkdir html ; fi && \ - if [ ! -d html/images ] ; then mkdir html/images ; fi && \ - if [ ! -d html/videos ] ; then mkdir html/videos ; fi && \ - if [ ! -d html/examples ] ; then mkdir html/examples ; fi && \ - $(XSLTPROC) $(XSLTOPTS) -o clutter-cookbook.html $(XSL_XHTML_URI) $(top_builddir)/doc/cookbook/clutter-cookbook.xml && \ - $(XSLTPROC) $(XSLTOPTS) -o html/ cookbook.xsl $(top_builddir)/doc/cookbook/clutter-cookbook.xml && \ - cp $(top_srcdir)/doc/common/style.css html/ && \ - if [[ "$(VIDEO_FILES)" != "" ]] ; then \ - for file in `ls $(VIDEO_FILES)`; do \ - cp $$file html/videos/ ; \ - done \ - fi && \ - cp $(top_srcdir)/doc/cookbook/images/* html/images/ && \ - cp $(top_srcdir)/doc/cookbook/examples/*.c html/examples/ && \ - echo timestamp > $(@F) - -if ENABLE_PDFS -#pdf_target = pdf-build.stamp -pdf_target = -else -pdf_target = -endif - -if ENABLE_DOCS -all-local: html-build.stamp $(pdf_target) -else -all-local: -endif - -clean-local: - @rm -rf html ; \ - rm -f *.pdf ; \ - rm -f *.stamp - -dist-hook: - mkdir $(distdir)/html - cp -r ./html/* $(distdir)/html - -uninstall-local: - @rm -rf $(DESTDIR)$(TARGET_DIR) - @rm -f $(DESTDIR)$(TARGET_DIR)/clutter-cookbook.devhelp - -install-data-local: - installfiles=`echo $(top_builddir)/doc/cookbook/html/*`; \ - if test "$$installfiles" = '$(top_builddir)/doc/cookbook/html/*'; \ - then echo '-- Nothing to install' ; \ - else \ - $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR) ; \ - for file in `ls $(HTML_FILES) $(CSS_FILES)`; do \ - if [ -f $$file ]; then \ - basefile=`echo $$file | sed -e 's,^.*/,,'`; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(TARGET_DIR)/$$basefile; \ - fi \ - done; \ - fi; \ - if [ -d $(top_srcdir)/doc/cookbook/images ]; \ - then \ - $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/images ; \ - for file in `ls $(IMAGE_FILES)`; do \ - if [ -f $$file ]; \ - then \ - basefile=`echo $$file | sed -e 's,^.*/,,'`; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(TARGET_DIR)/images/$$basefile; \ - fi \ - done; \ - fi; \ - if [ -d $(top_srcdir)/doc/cookbook/videos ]; \ - then \ - $(mkinstalldirs) $(DESTDIR)$(TARGET_DIR)/videos ; \ - for file in `ls $(VIDEO_FILES)`; do \ - if [ -f $$file ]; \ - then \ - basefile=`echo $$file | sed -e 's,^.*/,,'`; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(TARGET_DIR)/videos/$$basefile; \ - fi \ - done; \ - fi; \ - $(INSTALL_DATA) $(top_builddir)/doc/cookbook/html/clutter-cookbook.devhelp $(DESTDIR)$(TARGET_DIR)/clutter-cookbook.devhelp - -.PHONY : doc - -COOKBOOK_BASE_PATH = /home/clutter/web/docs.clutter-project.org/docs/clutter-cookbook -COOKBOOK_VERSION = $(CLUTTER_API_VERSION) -COOKBOOK_PATH = $(COOKBOOK_BASE_PATH)/$(COOKBOOK_VERSION) - -publish: html-build.stamp - $(QUIET_CP)scp -r html/* clutter@clutter-project.org:$(COOKBOOK_PATH) - -.PHONY : publish diff --git a/doc/cookbook/actors.xml b/doc/cookbook/actors.xml deleted file mode 100644 index eab25008b..000000000 --- a/doc/cookbook/actors.xml +++ /dev/null @@ -1,1145 +0,0 @@ - - - - Actors - - - Edmon Gween, actor, on his deathbed - An actor's a guy who if you ain't talkin' about him, ain't - listening. - - -
- 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. - - 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. - -
- -
- Implementing a simple custom actor - -
- Problem - - You want to implement your own ClutterActor; - for example, a very simple button widget. But you want to base it - on existing Clutter primitives (rectangles, text) to minimise - the work required. -
- -
- Solution - - Implement a custom actor composed from a ClutterBox - packed with other ClutterActors. The custom actor - provides a facade over these internal actors, simplifying - access to their properties and behavior. - - In this recipe, we subclass ClutterActor using this - approach to create a very simple button widget, CbButton. - It is not a complete button implementation: see - - MxButton for a more comprehensive example - (and the basis for this recipe). But this recipe does cover the most - important parts of a ClutterActor implementation, - as well some useful GObject-related code. - - - As Clutter is a GObject-based library, it relies - heavily on GObject concepts and idioms. If you are unfamiliar with - GObject, please read - the GObject - Reference Manual before proceeding. - - - The code for this solution is structured like standard GObject - C library code: - - - - The header file cb-button.h - declares the class' public API (function prototypes, macros, - structs). - - - The code file cb-button.c - contains the class implementation. - - - - One more example file, actors-composite-main.c, - shows how to use CbButton in an application. - - Each of these files is described in more detail below. - - - In a more realistic context, CbButton would - have some build infrastructure (for example, autotooling) - so it could be compiled, installed, and reused in a variety of - applications. However, for the purposes of cookbook examples, - these issues are ignored here. - - If you are planning on building - your own widgets using Clutter as part of an application, or - to create your own library, the - Mx toolkit - provides an excellent example of how to autotool your project. - - - - <filename>cb-button.h</filename>: header file - - This defines the public API for the class, including - GObject type macros, class and object structures, and - function prototypes. - - - -a code sample should be here... but isn't - - - - - - <filename>cb-button.c</filename>: <type>ClutterActor</type> - and GObject implementation - - This is the main C code file which implements both - the GObject and Clutter elements of CbButton. - The example below is liberally commented, and also gives some samples - of annotations to generate - gtk-docs for the - widget. The - discussion - section comments more specifically about the Clutter-specific - parts of it. - - - -a code sample should be here... but isn't - - - - - - <filename>actors-composite-main.c</filename>: trivial - application demonstrating usage of <type>CbButton</type> - - Note how any of the ClutterActor - functions (like clutter_actor_set_size() - and clutter_actor_add_constraint()) can - be applied to instances of our ClutterActor - implementation. - - - -a code sample should be here... but isn't - - - - -
- -
- Discussion - - The actor implemented here is based on - simple composition: bundling several actors together and wrapping - their behavior and properties. In the example here, we make use of a - ClutterLayoutManager to handle positioning of - the ClutterText; we change the background color of - the button by changing the color of the - ClutterBox; and we use a ClutterClickAction - to simplify implementation of a click signal. - - You may find that this approach is appropriate if you need - to implement a simple rectangular actor. However, it puts some - constraints on the outline of the actor, making it harder to - use a custom outline: for example, a rectangle with rounded corners - or a shape which can't be approximated by a rectangle. Such cases - require both pick() and paint() - implementations using Cogl (or similar): see - this recipe - for more details. - - The composition approach may also be inappropriate where - you need to do a lot of custom animation and drawing; and it is - likely to be inappropriate for implementing a container - actor. See the notes on implementing a new actor in the Clutter - reference manual for more details of what may be required - in these cases. - -
- Implementing <type>ClutterActor</type> virtual functions - - While most of the CbButton implementation - revolves around GObject, there are some elements of it - specific to Clutter. Due to the simplicity of - the CbButton actor, the implementation of - these functions is fairly trivial, as explained below: - - - - - - - Object destruction: - <function>cb_button_destroy()</function> - - ClutterActor subclasses based - on composition should implement the destroy() - virtual function. This is called on an actor when its - container is destroyed to clean up the resources - allocated to the actor; it also emits a - destroy signal which other code can - hook onto. - - - In the case of CbButton, the - destroy() implementation calls - clutter_actor_destroy() on the child - ClutterBox, then sets that child to - NULL. Finally, it checks for a - destroy() implementation on the parent - class, then calls it if one exists. - - - - - - - Size requisition: - <function>cb_button_get_preferred_height()</function> - and <function>cb_button_get_preferred_width()</function> - - During the size requisition phase, Clutter asks each - actor the minimum size it should be to remain useful, - and the maximum size it would be if unconstrained. This is done - by calling the get_preferred_height() - and get_preferred_width() functions - on each actor in turn. - - - If an actor will only ever be explictly sized - (via clutter_actor_set_size(), - clutter_actor_set_height() and/or - clutter_actor_set_width()), - there is no need to implement the get_preferred_*() - functions. (Some actors like ClutterRectangle - work this way and require explicit sizing.) - - However, if an actor's size should be negotiated during - the size requisition phase, you can implement these functions, - using the size of the child actors as a basis for the - preferred height and width. In the case of - CbButton, a preferred height and width can be - computed; these are based on the height and width of - the child ClutterBox, plus 20 pixels on each - axis. Because the size of the box is itself dependent on - the size of the ClutterText inside it, the net - result is that the CbButton preferred size - is the size of the text actor inside it, plus 20 pixels on each - axis. - - - - - - - Allocation: - <function>cb_button_allocate()</function> - - The requests gathered during size requisition - are then negotiated by Clutter, each actor - receiving some allocation of the available space. At the - end of this process, each actor is allocated a - box, representing the space available - to it on the stage. - - - An actor implementation is responsible for distributing - space from its allocation box to its children as it sees - fit. In the case of CbButton, there is only a single - ClutterBox actor which needs allocation; - cb_button_allocate() therefore - allocates all of the button's space to its child - ClutterBox. - - - - - - - Painting and picking: - <function>cb_button_paint()</function> - - Clutter works its way through the actors on the - stage, following the actor hierarchy (top level - actors directly inside the stage first); - clutter_actor_paint() - is called on each actor. This, in turn, calls the actor's - paint() implementation. If the actor - is a container, it may iterate over its children, - calling paint() on each; the children - may call paint() on their children...; - and so on, until the leaves of the actor hierarchy are - reached. - - - As our actor consists of a single ClutterBox - child, its paint() implementation simply - has to retrieve the reference to that ClutterBox - (from its private structure) and call - clutter_actor_paint() - on it. Painting of the ClutterBox's child - (the ClutterText) is handled by the - ClutterBox. - - In cases where an actor is non-rectangular, you also - need to implement a pick() function. - (This is used to determine which actor was the recipient of - an event occurring within the stage.) However, because - the actor in this recipe is a simple rectangle, there is no - need to implement pick(). - - - - - -
- -
- -
- -
- Knowing when an actor's position or size changes - -
- Problem - - You want to know when the position or the size, or - both, of an actor change, for instance to update an unrelated - actor or some internal state. -
- -
- Solution - - You can use the notify signal, - detailed with the coordinate or the dimension you want - to know has changed: - - - -g_signal_connect (actor, "notify::x", - G_CALLBACK (on_x_changed), - NULL); -g_signal_connect (actor, "notify::height", - G_CALLBACK (on_height_changed), - NULL); -g_signal_connect (actor, "notify::depth", - G_CALLBACK (on_depth_changed), - NULL); - - - - If you want to know if any of the coordinates or dimensions of - an actor have been changed, except for depth, you can use the - allocation-changed signal: - - - -g_signal_connect (actor, "allocation-changed", - G_CALLBACK (on_allocation_changed), - NULL); - - - - The signature for the handler of the "notify" signal is: - - - -void -on_notify (GObject *gobject, - GParamSpec *pspec, - gpointer user_data); - - - - While the signature for the handler of the "allocation-changed" - signal is: - - - -void -on_allocation_changed (ClutterActor *actor, - const ClutterActorBox *allocation, - ClutterAllocationFlags flags, - gpointer user_data); - - - -
- -
- Discussion - - Any change the position and size of an actor will cause a - change in the allocation of the actor itself. This will update the - values of the x, y, - width and height - properties as well. - - The first technique allows a greater deal of granularity, - allowing you to know what exactly changed. Inside the callback - for the signal you can query the value of the property: - - - -void -on_x_changed (GObject *gobject, - GParamSpec *pspec, - gpointer user_data) -{ - gint x_value = 0; - - /* Round the X coordinate to the nearest pixel */ - x_value = floorf (clutter_actor_get_x (CLUTTER_ACTOR (gobject))) + 0.5; - - g_print ("The new X coordinate is '%d' pixels\n", x_value); -} - - - - The second technique is more indicated if you want to - get notification that any of the positional or dimensional - attributes changed, except for the depth: - - - -void -on_allocation_changed (ClutterActor *actor, - const ClutterActorBox *allocation, - ClutterAllocationFlags flags, - gpointer user_data) -{ - g_print ("The bounding box is now: (%.2f, %.2f) (%.2f x %.2f)\n", - clutter_actor_box_get_x (allocation), - clutter_actor_box_get_y (allocation), - clutter_actor_box_get_width (allocation), - clutter_actor_box_get_height (allocation)); -} - - - - All actors will update these properties when their size - or position change. - - Note that the stage, on the other hand, will not notify on - position changes, so it is not possible to use the - x and y - properties to know that the platform-specific window embedding the - stage has been moved — if the platform supports a windowing - system. In order to achieve that you will have to use backend-specific - API to extract the surface used by the stage and then platform-specific - API to retrieve its coordinates. - -
- -
- -
- Overriding the paint sequence - -
- Problem - - You want to override the way an actor paints itself - without creating a subclass. -
- -
- Solution - - You can use the paint signal to - invoke a callback that will be executed before the actor's - paint implementation: - - - -g_signal_connect (actor, "paint", G_CALLBACK (on_paint), NULL); - - - - You can paint something after the actor's paint implementation - by using the g_signal_connect_after() function - instead of g_signal_connect(): - - - -g_signal_connect_after (actor, "paint", G_CALLBACK (on_paint_after), NULL); - - - - The signature for the handler of the "paint" signal is: - - - -void on_paint (ClutterActor *actor, gpointer user_data); - - - -
- -
- Discussion - - The paint cycle in Clutter works its way recursively from the - stage through every child. - - Whenever an Actor is going to be painted it will be positioned in - a new frame of reference according to the list of transformations - (scaling, rotation and additional translations). After that, the "paint" - signal will be emitted. - - The "paint" signal is defined as run-last, - that is the signal handlers connected to it using - g_signal_connetc() will be called first; then the - default handler defined by the Actor's sub-class will be called; - finally, all the signal handlers connected to the signal using - g_signal_connect_after() will be called. - - This allows pre- and post-default paint handlers, and it also - allows completely overriding the way an Actor draws itself by default; - for instance: - - - -void -on_paint (ClutterActor *actor) -{ - do_my_paint (actor); - - g_signal_stop_emission_by_name (actor, "paint"); -} - - - - The code above will prevent the default paint implementation of - the actor from running. -
- -
- -
- Making an actor transparent by changing its opacity - -
- Problem - - You want an actor to be transparent so that other - actors are visible through it. -
- -
- Solution - - Change the actor's opacity so that - it is partially (or even fully) transparent: - - - -/* 25% transparency */ -clutter_actor_set_opacity (actor, 191); - -/* 50% transparency */ -clutter_actor_set_opacity (actor, 122); - -/* completely transparent */ -clutter_actor_set_opacity (actor, 0); - - - - Any actor covered or overlapped by the transparent actor - should be visible through it; the Discussion section gives - some examples of how visible you can expect the covered or - overlapped actor to be. - -
- -
- Discussion - - Opacity is a property of every ClutterActor. - It is a float on a scale from 0 (invisible) to 255 (completely - opaque). Actors with 0 < opacity < 255 will - have a varying amount of solidity on the stage, so other actors - may be visible through them. - - For example, below are 4 yellow rectangles overlapping - a white rectangle on a blue stage: - - - - - - - - The effect of different opacities levels on - an actor's appearance - - - - - The rectangles have the following opacities: - - - - top-left: 255 (0% transparency) - - - top-right: 191 (25% transparency) - - - bottom-right: 122 (50% transparency) - - - bottom-left: 61 (75% transparency) - - - - Notice how both the stage and the white rectangle are - visible through the yellow rectangles. - - As opacity is a property of every actor, it can - be animated like any other GObject property, using any of - the approaches in the animation API. - - The following sections cover some other considerations - when working with actor opacity. - -
- Container and color opacity - - If a container has its opacity set, any children of the - container have their opacity combined with their parent's opacity. - For example, if a parent has an opacity of 122 - (50% transparent) and the child also has an opacity of - 122, the child's effective - opacity is 25% (opacity = 61, and it is - 75% transparent). - - To demonstrate the visual effect of this, here are - three rectangles with the same color but different opacity settings, - inside parents which also have different opacity settings: - - - - - - - - How a container's opacity affects the opacity of - its children - - - - - - - The left-hand rectangle has opacity = 255 - and is in a ClutterGroup with - opacity = 255. This means it is fully opaque. - - - The middle rectangle has opacity = 255 - and is in a ClutterGroup with - opacity = 122. Notice that the parent opacity - makes the rectangle appear darker, as the stage colour is showing - through from behind. - - - The right-hand rectangle has opacity = 122 - and is in a ClutterGroup with - opacity = 122. Notice that the rectangle appears - to be even darker, as the stage colour is showing - through both the rectangle and its parent. - - - - Similarly, ClutterColor also contains an - alpha property which governs the transparency - of the color. Where an actor can have a color set (e.g. - ClutterRectangle) the alpha value of the color also - affects the transparency of the actor, for example: - - - - - - - -
- -
- Depth and depth order - - Each actor has two more aspects which affect its - apparent opacity: - - - - An actor's depth can have an - effect if the stage has fog (a depth cueing effect) turned on. - As an actor's depth increases, the actor apparently "recedes" from - view and gradually blends into the colour of the stage. This - produces an effect similar to making the actor transparent. - See the ClutterStage documentation for - more details about fog. - - Depth also needs to be considered if you want - one actor to be visible through another: the actor you want - to see through a transparent actor must be "deeper" than (or at - the same depth as) the transparent actor. - - - The depth order governs how - actors within a ClutterContainer implementation - are placed with respect to each other. - - - Depth ordering is not the same thing as depth: depth - ordering records relationships between actors at the same - depth. - - - If you have two overlapping actors actorA and - actorB in a container, and you want actorA - (opaque) to be visible through actorB (transparent), - you should ensure that actorB is "above" actorA - in the depth ordering. You could do this as follows: - - - -/* -* raise actorB so it is above actorA in the depth order; -* NB actorA and actorB both need to be in the same container -* for this to work -*/ -clutter_actor_raise (actorB, actorA); - - - - clutter_actor_set_child_above_sibling(), - clutter_actor_set_child_below_sibling() and related - ClutterActor functions set - depth ordering on actors. - - - -
- -
- -
- -
- Creating an actor with a non-rectangular shape - -
- Problem - - You want to create a ClutterActor subclass, - but don't want it to be rectangular; for example, you want a - star-shaped actor. -
- -
- Solution - - Use Cogl primitives to draw the actor. - - Below is an example of the pick and paint implementations for a - star-shaped StarActor class (an extension of - ClutterActor). - - Like ClutterRectangle, it has a private - struct internally, which contains a ClutterColor - denoting the color it should be painted. This is used to set the Cogl - source color. - - - -priv->color; - - clutter_actor_get_allocation_box (actor, &allocation); - clutter_actor_box_get_size (&allocation, &width, &height); - - tmp_alpha = clutter_actor_get_paint_opacity (actor) - * color.alpha - / 255; - - cogl_path_new (); - - cogl_set_source_color4ub (color.red, - color.green, - color.blue, - tmp_alpha); - - /* create and store a path describing a star */ - cogl_path_move_to (width * 0.5, 0); - cogl_path_line_to (width, height * 0.75); - cogl_path_line_to (0, height * 0.75); - cogl_path_move_to (width * 0.5, height); - cogl_path_line_to (0, height * 0.25); - cogl_path_line_to (width, height * 0.25); - cogl_path_line_to (width * 0.5, height); - - cogl_path_fill (); -} - -static void -star_actor_pick (ClutterActor *actor, - const ClutterColor *pick_color) -{ - if (!clutter_actor_should_pick_paint (actor)) - return; - - ClutterActorBox allocation = { 0, }; - gfloat width, height; - - clutter_actor_get_allocation_box (actor, &allocation); - clutter_actor_box_get_size (&allocation, &width, &height); - - cogl_path_new (); - - cogl_set_source_color4ub (pick_color->red, - pick_color->green, - pick_color->blue, - pick_color->alpha); - - /* create and store a path describing a star */ - cogl_path_move_to (width * 0.5, 0); - cogl_path_line_to (width, height * 0.75); - cogl_path_line_to (0, height * 0.75); - cogl_path_move_to (width * 0.5, height); - cogl_path_line_to (0, height * 0.25); - cogl_path_line_to (width, height * 0.25); - cogl_path_line_to (width * 0.5, height); - - cogl_path_fill (); -} -]]> - - - - If you need more information about how to implement your own - ClutterActor, see the Clutter reference - manual. - - Note that the code in these two functions is virtually identical: - the Discussion section suggests how to remove this redundancy. -
- -
- Discussion - - The above is one approach to creating a non-rectangular - actor. But it's also possible to get a similar effect by - subclassing an existing actor (like ClutterRectangle) - and giving it a non-rectangular appearance. You could do this by - making the underlying rectangle transparent and then drawing on - top of it (e.g. using Cairo or Cogl). - - However, if you then made such an actor reactive, events - like mouse button presses would be triggered from anywhere on - the underlying rectangle. This is true even if the visible part - of the actor only partially fills the rectangle (underneath, it's - still a rectangle). - - The advantage of using Cogl paths is that the reactive area - of the actor is defined by the Cogl path. So if you have a - star-shaped actor, only clicks (or other events) directly on the - star will have any effect on it. - -
- Cogl path coordinates - - In the example shown, cogl_path_move_to() - and cogl_path_line_to() are used. These - take absolute x and y coordinates as - arguments, relative to the GL 'modelview' transform matrix; in - the case of an actor's paint implementation, - relative to the bounding box for the actor. So if an actor has - width and height of 50 pixels, and you used - cogl_move_to (25, 25) in its - paint implementation, the "pen" - moves to the centre of the actor, regardless of where the actor - is positioned on the stage. Similarly, using - cogl_path_line_to() creates a line segment - from the current pen position to the absolute coordinates - (x, y) specified. - - The Cogl API also provides various "rel" variants of the path - functions (e.g. cogl_path_rel_line_to()), which - create path segments relative to the current pen position (i.e. - pen_x + x, pen_y + y). - - It's important to note that the path isn't drawn until you - call cogl_path_stroke() (to draw the path segments) - or cogl_path_fill() (to fill the area enclosed by - the path). The path is cleared once it's been drawn. - Using the *_preserve variants of these functions draws - the path and retains it (so it could be drawn again). - -
- -
- Other Cogl primitives - - Note that the Cogl primitives API provides other types of path - segment beyond straight lines that we didn't use here, including: - - - - Bezier curves (cogl_path_curve_to()) - - - Arcs (cogl_path_arc()) - - - Polygons (cogl_path_polygon()) - - - Rectangles (cogl_path_rectangle()) - - - Rectangles with rounded corners - (cogl_path_round_rectangle()) - - - Ellipses (cogl_path_ellipse()) - - - - One important drawback of using Cogl path primitives is that - they will not produce high quality results; more specifically, - Cogl does not draw anti-aliased primitives. It is recommended to use - the Cairo API to draw during the paint sequence, and the Cogl API - to draw during the pick sequence. - - If you need more flexibility than is available in the Cogl path - API, you can make direct use of the CoglVertexBuffer - API instead. This is a lower-level API, but could potentially - be used to draw more complex shapes. -
- -
- Using <type>ClutterPath</type> to store the path - - The disadvantage of the code above is that the paths are stored in two - places: once for pick, and once for - paint. It would make sense to store the - path in one place and reference it from both of these functions to - prevent duplication. - - Clutter provides a ClutterPath API for storing - generic path descriptions. It can be used to describe paths - which translate to Cogl or Cairo paths, and can also be used to - describe animation paths. - - We can use a ClutterPath instance stored - inside the actor to define the path for pick and - paint; then, inside those functions, we - translate the ClutterPath into Cogl path function calls - (NB ClutterPath is effectively a declarative method - for defining a path, while the Cogl path API is imperative). - - First we add a path member to the private - struct for the StarActor class (using standard - GObject mechanisms). The init implementation for - StarActor creates an empty path: - - - -static void -star_actor_init (StarActor *self) -{ - self->priv = STAR_ACTOR_GET_PRIVATE (self); - - self->priv->path = clutter_path_new (); - - clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); -} - - - - One consideration is that the path coordinates need to - fit inside the actor's bounding box. So as the actor's allocation - changes, path also needs to change. We can do this - by implementing allocate for the - StarActor class: - - - -priv->path; - gfloat width, height; - - clutter_actor_box_get_size (box, &width, &height); - - /* create and store a path describing a star */ - clutter_path_clear (path); - - clutter_path_add_move_to (path, width * 0.5, 0); - clutter_path_add_line_to (path, width, height * 0.75); - clutter_path_add_line_to (path, 0, height * 0.75); - clutter_path_add_move_to (path, width * 0.5, height); - clutter_path_add_line_to (path, 0, height * 0.25); - clutter_path_add_line_to (path, width, height * 0.25); - clutter_path_add_line_to (path, width * 0.5, height); - - CLUTTER_ACTOR_CLASS (star_actor_parent_class)->allocate (actor, box, flags); -} -]]> - - - - This clears then adds segments to the - ClutterPath stored with the - StarActor instance. The positioning and - lengths of the segments are relative to the size of the actor when - its allocation changes. - - The pick and paint - functions now reference the ClutterPath (only the - pick is shown below); and - to turn the path into drawing operations, we implement a - star_actor_convert_clutter_path_node() function - which takes a ClutterPathNode and converts it - into its Cogl equivalent: - - - -type) - { - case CLUTTER_PATH_MOVE_TO: - knot = node->points[0]; - cogl_path_move_to (knot.x, knot.y); - break; - case CLUTTER_PATH_LINE_TO: - knot = node->points[0]; - cogl_path_line_to (knot.x, knot.y); - break; - default: - break; - } -} - -static void -star_actor_pick (ClutterActor *actor, - const ClutterColor *pick_color) -{ - if (!clutter_actor_should_pick_paint (actor)) - return; - - ClutterActorBox allocation = { 0, }; - gfloat width, height; - ClutterPath *path = STAR_ACTOR (actor)->priv->path; - - clutter_actor_get_allocation_box (actor, &allocation); - clutter_actor_box_get_size (&allocation, &width, &height); - - cogl_path_new (); - - cogl_set_source_color4ub (pick_color->red, - pick_color->green, - pick_color->blue, - pick_color->alpha); - - clutter_path_foreach (path, star_actor_convert_clutter_path_node, NULL); - - cogl_path_fill (); -} -]]> - - - - - The conversion function only covers - ClutterPathNode types encountered in this - actor. - - - Instead of converting to Cogl path operations, another alternative - would be to use the clutter_path_to_cairo_path() - function to write directly from the ClutterPath - onto a Cairo context. - -
-
- -
- -
diff --git a/doc/cookbook/animations.xml b/doc/cookbook/animations.xml deleted file mode 100644 index 8f7e7494d..000000000 --- a/doc/cookbook/animations.xml +++ /dev/null @@ -1,3327 +0,0 @@ - - - - Animations - - - Walt Disney - Animation can explain whatever the mind of man can conceive. - - -
- Introduction - - Clutter actors have a variety of properties - (position, size, rotation in 3D space, scale, opacity) which govern - their visual appearance in the UI. They may also have - constraints on how they are aligned - and/or positioned relative to each other. - - The Clutter animation API provides a means of changing - properties and constraints as a function of time: moving, scaling, - rotating, changing opacity and colour, modifying postional - constraints, etc. - - Clutter also makes it possible to animate non-visual - properties if desired. - -
- High level overview - - Here are the main concepts behind animation in Clutter: - - - - An animation changes one or more - properties of one or more actors over time: their rotation in - a particular dimension (x, y, - z), scale, size, opacity etc. - - - An animation has an associated timeline. - Think of this as analogous to the "thing" you're controlling when - you watch a video on the internet: it's what you control with - the play/pause button and what is measured by the bar - showing how far through the video you are. As with the - controls on a video player, you can play/pause/skip a Clutter - timeline; you can also rewind it, loop it, and play it - backwards. - - If a timeline is reversed, the progress along the - timeline is still measured the same way as it is in the forward - direction: so if you start from the end of the timeline and run - it backwards for 75% of its length, the progress is reported - as 0.25 (i.e. 25% of the way from the start of the - timeline). - - - - The duration of a timeline - (e.g. 500 milliseconds, 1 second, 10 seconds) specifies how - long its animation will last. The timeline can be inspected - to find out how much of it has elapsed, either as a value in - milliseconds or as a fraction (between 0 and 1) of the total - length of the timeline. - - - An animation is divided into frames. - The number of frames which make up the animation isn't - constant: it depends on various factors, like how powerful - your machine is, the state of the drivers for your hardware, - and the load on he system. So you won't always get the same - number of frames in an animation of a particular duration. - - - The change to a property in an animation occurs over - the course of the timeline: the start value of the property - heads toward some target value. When it reaches the end of - the timeline, the property should have reached the target - value. - - - Exactly how the property changes over the course of the - timeline is governed by an alpha. This - is the trickiest idea to explain, so it has its own section - below. - - -
- -
- Alphas - - An alpha is generated for each frame of the animation. - The alpha varies between -1.0 and 2.0, and changes during the - course of the animation's timeline; ideally, the value should - start at 0.0 and reach 1.0 by the end of the timeline. - - The alpha for any given frame of the animation is determined - by an alpha function. Usually, the alpha - function will return a value based on progress along the timeline. - However, the alpha function doesn't have to respect or pay - attention to the timeline: it can be entirely random if desired. - - To work out the value of a property at a given frame - somewhere along the timeline for a given alpha: - - - - Determine the difference between the start value and - the target end value for the property. - - - Multiply the difference by the alpha for the current - frame. - - - Add the result to the start value. - - - - The shape of the plot of the alpha function over time is - called its easing mode. Clutter provides - various modes ranging from CLUTTER_LINEAR - (the alpha value is equal to progress along the timeline), - to modes based on various polynomial and exponential functions, - to modes providing elastic and bounce shapes. See the - ClutterAlpha documentation for examples of the shapes produced - by these functions. There is also a good interactive demo - of the modes on - Robert Penner's site. - - - Most of the time, you can use the built-in Clutter easing - modes to get the kind of animation effect you want. However, - in some cases you may want to provide your own alpha function. - Here's an example (based on the quintic ease in mode from - clutter-alpha.c): - - - - - - - - An alpha function just has to have a specified method - signature and return a gdouble value when called. - As stated above, you'd typically base the return value on the - timeline progress; the function above shows how you get the - timeline associated with the alpha, so you can apply the alpha - function to it. -
- -
- Clutter's animation API - - All of the animation approaches in Clutter use the same - basic underpinnings (as explained above), but the API provides - varying levels of abstraction and/or ease of use on top of those - underpinnings. - - - - Implicit animations (created using - clutter_actor_animate() and related - functions) are useful where you want to apply - a simple or one-off animation to an actor. They enable you - to animate one or more properties using a single easing mode; - however, you only specify the target values for the properties - you're animating, not the start values. - - - ClutterAnimator provides support - for declarative animations (defined using ClutterScript). - You can animate multiple actors with this approach, and - have more control over the easing modes used during an - animation: while implicit animations only allow a single - easing mode for all properties, ClutterAnimator - supports multiple easing modes for - each property; key frames - are used to indicate where in the animation each easing mode - should be applied. - - - ClutterState enables you to describe - states: property values across one or - more actors, plus the easing modes used to transition to - those values. It can also be combined with ClutterAnimator - for finer grained definition of transitions if desired. - States are particularly useful if you need actors to - animate between a known set of positions/sizes/opacities etc. - during their lifecycles (e.g. animating a list of items in - a menu, or for animations in a picture viewer where you - click on thumbnails to display a full view of a photograph). - - - - The recipes in this section show when and where it is - appropriate to use each of these approaches. - -
- -
- -
- Inverting Animations - -
- Problem - - You want to have an animation exactly mirroring another one - that you just played. -
- -
- Solution - - Reverse the direction of the ClutterTimeline - associated with the animation. - - For example, here's how to invert an implicit - animation which moves an actor along the x - axis. The direction of the animation is inverted when the - movement along the x axis is completed; it is - also inverted if the mouse button is pressed on the actor. - - First, set up the animation: - - - - - - - - Next, add a function for inverting the timeline: - - - - - - - - Then add a function which calls _invert_timeline - when the animation completes. More importantly, the callback should - stop emission of the "completed" signal by the animation. This - prevents the ClutterAnimation underlying the implicit - animation from being unreferenced; which in turn allows it to be - inverted: - - - - - - - - Finally, the click callback function uses the same - _invert_timeline function if the animation - is playing; but if the animation is stopped, it will - start it instead: - - - - - - - -
- -
- Discussion - - If you are using ClutterAnimator rather than - implicit animations, clutter_animator_get_timeline() - enables you to get the underlying timeline; you could then use - the techniques shown above to invert it. - - ClutterState enables a different approach - to "inverting" an animation: rather than having a single animation - which you invert, you would define two or more - keys for an actor (or set of actors) and - transition between them. - - For the example above, you would define two keys: - one for the actor's initial position; and a second for the actor - at x = 300.0. You would also define the - transition between them: 2000 milliseconds with a - CLUTTER_EASE_IN_OUT_CUBIC easing mode. - - With the states defined, you would then use - clutter_state_set_state() inside callbacks to - animate the actor between the two x positions. - Behind the scenes, ClutterState would handle the - animations and timelines for you. - -
- -
- -
- Fading an actor out of or into view - -
- Problem - - You want to animate an actor so that it fades out of or into - view. -
- -
- Solution - - Animate the actor's opacity property. - - You can do this using any of the approaches provided - by the animation API. Here's how to fade out an actor (until it's - completely transparent) using implicit animations: - - - - - - - - Here's an example of a rectangle fading out using this - animation: - - - - - - - Video showing an actor fading out using implicit - animations - - - - CLUTTER_EASE_OUT_CUBIC is one of the - Clutter easing modes; see - the introduction - for more details about what these are and how to choose one. - - Here's an example of the transitions you could use to - fade an actor in and out using ClutterState: - - - - - - - - You would then trigger an animated state change as events - occur in the application (e.g. mouse button clicks): - - - - - - - - Here's an example of this animation fading in then out again: - - - - - - - Video showing an actor fading in then out using - ClutterState - - - - - ClutterState is most useful where you - need to animate an actor backwards and forwards between multiple - states (e.g. fade an actor in and out of view). Where you just - want to fade an actor in or out once, - clutter_actor_animate() is adequate. - - -
- -
- Discussion - - Reducing an actor's transparency to zero does not make it - inactive: the actor will still be reactive even if it's not - visible (responding to key events, mouse clicks etc.). - To make it really "disappear", you could use - clutter_actor_hide() once you'd made the actor - fully transparent. - -
- -
- -
- Rotating an actor - -
- Problem - - You want to animate rotation of an actor. Some example cases - where you might want to do this: - - - - To rotate an image so it's the right way up for - viewing. - - - To make actors more or less prominent, rotating them - towards or away from the view point. - - - To turn an actor "around" and display different UI - elements "behind" it. - - -
- -
- Solution - - Animate one of the rotation-angle-(x|y|z) - properties of the actor. - - The most "obvious" (and probably most commonly used) rotation is - in the z axis (parallel - to the 2D surface of the UI). The other rotation axes - (x and y) - are less obvious, as they rotate the actor in the depth dimension, - "away from" or "towards" the view point. - - Examples of each type of rotation are given below. While the - examples use implicit - animations, it is also possible to use - ClutterAnimator and ClutterState to animate - rotations: see the - full example at the end of this recipe for some - ClutterState code. - - - I've added an inaccurate (but hopefully useful) metaphor to - each rotation axis ("wheel", "letter box", "door"), to make it - easier to remember the effect you get from animating in that axis - (and when the rotation center is inside the actor). - - - Rotating on the z axis ("wheel") - - - - - - - - The above code animating a texture: - - - - - - - Video showing an actor rotating to 90 degrees on the - z axis - - - - By default, the center of the rotation is derived from - the anchor point of the actor; unless you've changed the anchor - point, the default is the top-left corner of the actor. See the - Discussion section below for more about setting the rotation center. - - - An animated rotation moves an actor to - the specified rotation angle; it does not - increment or decrement the actor's current rotation angle by - the amount specified. - - - Rotating on the x axis - ("letter box") - - - - - - - - The above code animating a texture: - - - - - - - Video showing an actor rotating to -45 degrees on the - x axis - - - - Notice how the texture rotates away from the view point, - and also how perspective effects are applied (as the actor is rotating - "into" the depth dimension). - - Rotating on the y axis - ("door") - - - - - - - - The above code animating a texture: - - - - - - - Video showing an actor rotating to 45 degrees on the - y axis - - - - Again, the rotation is into the depth dimension, so - you get perspective effects. - -
- -
- Discussion - - It can sometimes be difficult to predict exactly - how a particular rotation animation will appear when applied. - Often the only way to find out is to experiment. However, - the sections below outline some of the most common factors which - affect animated rotations, with the aim of minimising the - experimentation you need to do. - -
- Setting the rotation center for an animation - - The examples in the previous section used the default - center of rotation for each axis. However, it is possible to - change the rotation center for an axis, in turn changing - the appearance of the animation. - - - Rotation center coordinates are relative to the - actor's coordinates, not to the coordinates of the actor's - container or the stage. - - -
- Setting a rotation center inside an actor - - You can set the center for rotation on the x or y axes - like this: - - - - - - - - Because z axis rotations are more common, Clutter - provides some convenience functions to set the rotation - center for this axis: - - - - - - - - CLUTTER_GRAVITY_CENTER makes the - center of the actor the rotation center for - the z axis. See the ClutterGravity enumeration for - acceptable values for this parameter. - - - Setting the rotation center for the z axis using gravity - is recommended, as Clutter will automatically recompute the - rotation center if the actor's size changes. For the x and y - axes, you have to do this computation yourself if you - want an actor's center of rotation to stay in the same place - if it is resized. - - - Rotation on the x axis around an actor's center: - - - - - - - Video showing an actor rotating around its center - on the x axis - - - - Rotation on the y axis around an actor's center: - - - - - - - Video showing an actor rotating around its center - on the y axis - - - - Rotation on the z axis around an actor's center: - - - - - - - Video showing an actor rotating around its center - on the z axis - - - -
- -
- Setting the rotation center outside an actor - - Rather than rotating the actor around a point inside - itself, the rotation center can be moved to a position - outside the actor. (In the case of the z axis, - any rotation center setting is outside the actor as its depth - is 0.) When animated, the actor will describe an arc around the - rotation center, as if it's swinging from an invisible thread. - - The same code as shown above can be used to set the - rotation center: just set the rotation center coordinates to - negative numbers (outside the actor). However, you can't use the - gravity functions if the rotation center falls outside an actor. - - For example, here's a rotation to -180 degrees in the x - axis, with the y rotation center set to -96 (the same as the height - of the actor): - - - - - - - Video showing an actor rotating to -180 degrees on - the x axis with y rotation center set to -96 - - - - Similarly, moving the z rotation center (for a rotation - in the x or y axis) will cause the actor to swing "into" or "out - of" the UI. Its final apparent size may be different, as it could - reach a different depth in the UI by the end of the - animation. - - For example, here's a rotation to -180 in the x axis, - with the z rotation center set to -96 (the same as the height - of the actor): - - - - - - - Video showing an actor rotating to -180 degrees on - the x axis with z rotation center set to -96 - - - - The apparent final size of the actor is reduced, as it - has rotated away from the view point. - -
- -
- -
- Direction of rotation - - The apparent direction of an animated rotation depends on - two things: - - - - Whether the angle of rotation is positive or negative. - - - The rotation of the container(s) the actor is inside. - - - - In the case of the sign of the rotation, here's what - happens for each axis and rotation angle sign (positive or - negative). - - - - - Axis - Sign of rotation angle - Effect on actor - - - - - z - + - - Clockwise spin about the x,y center of - rotation. - - - - z - - - - Anti-clockwise spin about the x,y - center of rotation. - - - - x - + - - The top swings away from the view point and the - bottom swings towards it. If y rotation center == 0, - the top is fixed; if y rotation center == the actor's - height, the bottom is fixed. - - - - x - - - - The bottom swings away from the view point and the - top swings towards it. If y rotation center == 0, - the top is fixed; if y rotation center == the actor's - height, the bottom is fixed. - - - - y - + - - The right-hand side swings away from the view point and - the left-hand side swings towards it. When x rotation - center == 0, the left-hand side if fixed; when x - rotation center == the actor's width, the right-hand - side is fixed. - - - - y - - - - The right-hand side swings towards the view point and - the left-hand side swings away from it. When x rotation - center == 0, the left-hand side if fixed; when x - rotation center == the actor's width, the right-hand - side is fixed. - - - - - - If an actor's container is rotated, this may affect the - appearance of rotation animations applied to the actor. In - particular, if an actor's container has been rotated - by 180 degrees in one axis, the direction of that actor's - rotation may appear reversed. - - For example, the video below shows an actor being animated - to 90 degrees on the z axis, then back to 0 degrees; - the actor's container is then rotated by 180 degrees in the y - axis; then the same rotation 90 degree rotation is applied - to the actor again. Note that the first time the animation - is applied, the rotation is clockwise; but the second time (as - the actor is effectively "reversed"), it is anti-clockwise. - - - - - - - Video showing how an actor's apparent rotation is - affected by the rotation of its parent - - - -
- -
- Apparent vs. actual rotation - - There is a difference between an actor's apparent - rotation (how much an actor appears to be rotating, from the - perspective of someone looking at the UI) and its - actual rotation (how much that actor is - really rotating). - - For example, if you rotate an actor and its container - simultaneously, each by 90 degrees in the same direction, the - actor will appear to have rotated by 180 degrees by the end - of the animation. However, calling the - clutter_actor_get_rotation() function - for that axis on the actor still returns a rotation of 90 - degrees. -
- -
- Orientation of rotation axes - - The rotation axes remain fixed in the same place on - the actor regardless of its rotation, even though from the viewer's - perspective they may appear to move. - - For example, when rotation in the z axis is 0 degrees, - the actor's x axis is horizontal (across the UI) from both the - actor's and the viewer's perspective. However, if you rotate the - actor by 90 degrees in the z axis, the x axis is now vertical from - the viewer's perspective, but still horizontal - across the actor from the actor's - perspective. -
- -
- -
- Full example - - - Rotating an actor around x, y, and z axes using - <type>ClutterState</type> - - - a code sample should be here... but isn't - - - -
- -
- -
- Creating complex animations with - <type>ClutterAnimator</type> - -
- Problem - - You want to create a complex animation involving one or more - actors. The animation will consist of a sequence of transitions - over multiple properties on each actor. - - An example might be moving several actors between points, - with different types of movement for each part of the path, while - transforming each actor (e.g. scaling or rotating it). - -
- -
- Solution - - Use a ClutterAnimator to define the animation. - - Because there are many complex animations you - could implement, the example below does - this: - - - - - - - Video showing a complex animation of an actor - using ClutterAnimator - - - - Although this uses a single actor, the animation is complex - enough to make it difficult to implement with implicit animations - or ClutterState (see - the Discussion - section for reasons why). - - Here is a JSON definition of the stage, actors, and - the ClutterAnimator for this - animation: - - - JSON definition of a complex animation using - <type>ClutterAnimator</type> - - - a code sample should be here... but isn't - - - - - - The core to understanding this example is understanding - how to define keys for a ClutterAnimator. As - this is an involved topic, further explanation - is given in the - Discussion section. - - - The program for loading this JSON definition from a file - is as follows: - - - Simple program for loading a JSON script; - any key press starts the animation - - - a code sample should be here... but isn't - - - - - - It is also possible to use the ClutterAnimator - C API to define keys for an animation, but this will - typically be much more verbose than the JSON equivalent. - - One other advantage of JSON is that it is much simpler - to tweak and test an animation, as you don't have to recompile - the application each time you edit it (you just load - the new JSON file). - - -
- -
- Discussion - - You can think of ClutterAnimator - as a way to give directions to actors. For example, - you could give a real (human) actor a direction like "move - downstage; when you get there, stop and - rotate 90 degrees to your right". In code, - this might equate to a transition in the x - and y properties of the actor, followed by a - rotation in one axis. - - - ClutterAnimator can give - "directions" to any type of GObject, but we concentrate - on animating ClutterActors in this section. - - - Each direction like this has an implicit - timeline, spanning the length of time the direction should - take to fulfil (you set the length of the timeline through - the duration property of the - ClutterAnimator). But within that timeline, you may - change the proportion of time spent on each action: "move - downstage quickly, then slowly rotate 90 degrees - to your right". The direction is the same, but we've - specified how much of the timeline should be devoted to each - action. - - In ClutterAnimator, this concept is - captured by key frames. A - key frame represents a point somewhere along the timeline, - with one or more target property values for one or more actors. - A ClutterAnimator manages the transitions - between property values for each object, ensuring that - the target values are reached when the associated key frame - is reached. - - To change the amount of time a transition - should take, you change the percentage of the timeline - between key frames. Using our real stage directions as an - example, you might define the key frames like this: - - - - 0.2 (after 20% of the timeline): - arrive downstage - - - 1.0 (by the end of the timeline): - achieve a 90 degree rotation to the right - - - - See - this - section for more details about keys and key frames. - - Finally, a direction might be further refined with - a description of the kind of movement to use: - rather than saying "move downstage quickly, then - slowly rotate 90 degrees to your right" a director could say: - "start off slowly, but build up to a run; - run downstage quickly; then stop and start rotating - slowly to your right, gradually speeding up, turn a little more, then slow - down gradually; you should end up rotated 90 degrees to your right" - (this granularity of description is closer to what you might - see in dance notation like - Laban; - though of course you can't animate human opacity, scale, dimensions - etc...). - - ClutterAnimator gives you this level of - granularity. Each transition to a property value between - key frames can have a separate easing mode: - for example, starting off slowly and building to a constant - speed equates to an "ease in" mode; starting slowly, speeding - up, maintaining a constant speed, then gradually slowing down - equates to "ease in and ease out". - - To summarise: creating a complex animation means deciding: - - - - Which properties need to change on which actors? - - - What target value should each property transition to? - - - How quickly (by which key frame) should the property - reach the target value? - - - What "shape" (easing mode) should the change to - the target value follow? - - - -
- Understanding keys and key frames - - A ClutterAnimator maintains a list of - properties objects, each being a unique pair - of object (an object to be animated) + - name (name of the property - to be animated on that object). - - Each properties object in turn has a - list of keys, with each key having three elements: - - - - The key frame, expressed as a fraction - (between 0.0 and 1.0) of the duration of the animation. At this - point, the named property should reach a target value. - - - The easing mode to use to transition - the property to that value. - - - The target value the property - should transition to. - - - - For example: - - - -{ - "object" : "rectangle", - "name" : "x", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 0.1, "easeInCubic", 150.0 ], - [ 0.8, "linear", 150.0 ], - [ 1.0, "easeInCubic", 0.0 ] - ] -} - - - - defines a sequence of transitions for the x - property (position on the x axis) of the rectangle - object, as follows: - - - - [ 0.0, "linear", 0.0 ]: - At the start of the animation, x should be - 0.0; linear is used as the easing mode, as there - is no transition here. - - - - [ 0.1, "easeInCubic", 150.0 ]: - By 10% of the way through the animation, - x should reach a value of 150.0. - This moves the rectangle horizontally across the stage. - - The easeInCubic easing mode means that - the transition to the new value starts slow and speeds up. - This makes the movement look more "natural". - - - - [ 0.8, "linear", 150.0 ]: - From 10% of the way through the animation to 80% - of the way through, the x value remains at - 150.0. This makes the rectangle stay still - on the x axis throughout this period. - - It's important to specify interim key frames if - in a later key frame you intend to change the value again - (as is done for the x value here). Otherwise - you can get premature transitions to a value over longer - periods than you intended. By specifying the interim - key frames where the value remains constant, you ensure - that it doesn't change before you want it to. - - - - [ 1.0, "easeInCubic", 0.0 ]: - From 80% of the way through the animation to the end, - the x value should transition back to - 0.0. This moves the actor back to its - starting position on the x axis. Again, an easeInCubic - easing mode is used to make the transition appear more natural. - - - - There are two more properties you can set for each - object/property pair: - - - - Set ease-in to true to - animate to the target value at the first key frame. If - ease-in is false, the animation will - "jump" to the target value instead (if the target value is - different from the current value). - - - - Set interpolation to either - "linear" (the default) or "cubic". - This sets how ClutterAnimator transitions between - key frames; in effect, it further modulates any easing modes - set on individual keys: if set to "cubic", you - get a slightly more natural and gentle transition between - key frames than you do if set to "linear". - - - -
- -
- Why <type>ClutterAnimator</type>? - - Why use ClutterAnimator and not the other - Clutter animation - approaches for complex animations? - - - - Implicit animations can animate - properties on a single actor; however, you can only specify a - single transition for each property. Also, it's not possible - to describe complex movement along a path in a single implicit - animation: you would have to chain several animations together - to do that. - - To animate multiple actors, you'd also need multiple - implicit animations, one for each actor. These animations would - also need to be synchronized (for example, by sharing a - single timeline). - - So it would be possible, but more difficult than - an implementation using ClutterAnimator. - - - - ClutterState can - be used for complex animations: each state can describe - transitions for multiple actors and multiple properties. - However, to make continuous movement (as in the example), - you would need to write a state for each movement between a - pair of points; then add a callback so that when each state - is reached, the animation moves onto the next state. This - adds some code (a handler for the completed - signal emitted by the ClutterState to set - the next state). This could work OK for a few states, - but doesn't scale as well as ClutterAnimator - if you have many transitions. - - - ClutterState and - ClutterAnimator are not mutually exclusive. If - you generally need to transition between several known states - (e.g. hiding/revealing menus which stay in the same place, - moving between two UI layouts), but want to create a - complex animation between states, you can use - ClutterAnimators to define the transitions: see - the documentation for - clutter_state_set_animator() for - details. - - - - - - ClutterAnimator is a good fit for complex - animations, and probably the best fit for the most complex: - it is the simplest way to encode a sequence of transitions - for a list of object/property pairs which can be treated - as a single animation. This is largely because - ClutterAnimator is effectively managing the - chaining together of the individual transitions into a whole. - - One other feature of ClutterAnimator which - isn't demonstrated here is how it enables transitions to overlap. - For example, let's say you wanted an actor - to move along a complex path (e.g. described by five pairs of - x,y coordinates); but during that movement, you - wanted the actor to continuously transition to a scale of - 4.0 on both the x and y axes. - - To achieve this with ClutterState, you would - need to set up five transitions (one to move to each pair of - x,y coordinates); plus a callback to chain the state transitions - together; and within each transition, you'd have to figure out a - percentage of the scaling to apply, so that the actor - was at a scale of 4.0 on reaching the final state. - - With ClutterAnimator, you can treat the - movement between the coordinates and the scaling separately - within the same animation, but overlap their key frames. This - makes coding overlapping animations of different properties - much more straightforward. See - this JSON - definition for an example of how to do this. - -
- -
- -
- Full example - - - Running multiple transition sequences with - different key frames in parallel using - <type>ClutterAnimator</type> - - - This JSON file can be loaded with the same code - as used for this - example, by passing the JSON file name on the command line: - - - $ ./animations-complex animations-complex-overlapping.json - - - - - - a code sample should be here... but isn't - - - -
- -
- -
- Reusing a complex animation on different actors - -
- Problem - - You want to apply the same complex animation to several - different actors. - -
- -
- Solution - - Instead of animating each actor separately, create a - rig: an empty container with an associated - animation, which will be animated in lieu of - animating the actor directly. Do this as follows: - - - - Initialise the stage and actors, including those - to be animated. - - - Define a ClutterContainer and a - ClutterAnimator animation to animate it. - - - When you need to animate an actor: - - - - Create an instance of the rig and its animator. - - - Reparent the actor to the rig. - - - Run the rig's animation. - - - - - - For this solution, we're using - JSON to define the - animation and the user interface elements. For more - details about this approach, see - the chapter - on ClutterScript. - - Here's an extract of the JSON definition for the stage and - one of five rectangles placed at its left edge (the full definition - is in the - appendix): - - - - - - - - The key point to note is how a signal handler is defined - for the button-press-event, so that the - foo_button_pressed_cb() function will trigger - the animation when a (mouse) button is pressed on each rectangle. - - The second JSON definition includes the rig - (an empty ClutterGroup) and a - ClutterAnimator to animate it. The animation moves the - container across the stage and scales it to twice its original - size. (This is the same - code as in the appendix): - - - - - a code sample should be here... but isn't - - - - - The remaining parts of the application code load - the user interface definition, setting up the stage and rectangles; - and define the callback. The full code is - in the appendix, - but below is the most important part, the callback function: - - - - - - - - The code creates a new rig and associated animation - at the point when the rectangle is clicked. It then positions the - rig at the same coordinates as the rectangle, reparents - the rectangle to the rig, and starts the rig's animation. - - - The signal handler has to be declared non-static and - you must use -export-dynamic as an option to the - compiler, otherwise the function isn't visible to - ClutterScript (as outlined - in this recipe). - - - This is what the animation looks like: - - - - - - - Video of a simple reusable animation - - - -
- -
- Discussion - - The above solution reparents an actor to be animated - into a rig (an empty placeholder). The rig is a container - which acts as a temporary parent for the actor we - really want to animate. By animating the rig, - it appears as though the actor inside it is being animated (but - see - these caveats). This means the same animation can be - easily applied to different actors: create an - instance of the rig, reparent an actor to it, then - run the rig's animation. This is simpler than creating - a separate animation for each actor individually, or - reusing a single ClutterAnimator on different - actors (see - this - section). - - Using JSON enhances the animation's reusability (it's even - potentially reusable in another application), makes the code - simpler (an animation can be loaded directly from the script), - and makes refactoring easier (the animation can be modified - without recompiling the application code). However, it also puts - some minor limitations on the animation's reusability; namely, you - can only set absolute property values in a JSON animation - definition. This makes JSON less useful in cases where - you need to animate properties relative to their starting - values: for example, "move 50 pixels along the x axis" or - "rotate by 10 degrees more on the z axis". (This type of animation - is probably less portable anyway.) In such cases, the programmable - API may be a better option: see the ClutterAnimator - documentation for examples. - -
- One animation vs. many - - In the sample code, a new instance of the rig and its - animation are created for each actor. One side effect of this - is that all of the actors can animate simultaneously with the - "same" animation. If you don't want this behaviour, but still - want to use a rig approach, you could create a single instance - of the rig and its animation. Then, you could reparent each actor - to it in turn. - - To ensure that the rig only animates one actor (or group - of actors) at a time, you could track whether the rig is - currently animating (e.g. by examining the animation's - timeline with clutter_animator_get_timeline()). - Then, if the animation is running, prevent any other actor - from being reparented to the rig. - - Note that you would also need to "reset" the rig each time the - animation completed (move it back to the right start values for - its properties), ready to animate the next actor. -
- -
- Caveats about animating a rig instead of an actor - - There are a few issues to be aware of in cases - where you animate a rig with contained actors, rather than - animating the actor directly: - - - - Animating a rig doesn't always - produce the same visual effect as animating an actor directly. - For example, compare the following cases: - - - - You rotate an actor by 180 degrees in the - y axis, then by 90 degrees in the - z axis. The actor appears to rotate in - a clockwise direction. - - - You rotate the parent container of an actor - by 180 degrees in the y axis; then rotate - the actor by 90 degrees in the z axis. - The actor appears to rotate in an - anti-clockwise direction. By - rotating the container, the "back" of the - actor faces the view point, so the actor's movement - appears reversed. See - this - recipe for more details. - - - - There may be other situations where you get similar - discrepancies. - - - - Animating a rig doesn't change an actor's properties, - but animating the actor does. - - When you animate a container rather than the actor - directly, the reported properties of the actor may not - reflect its visual appearance. For example, if you apply - a scale animation to a container, the final scale of - actors inside it (as returned by - clutter_actor_get_scale()) will not - reflect the scaling applied to their container; whereas - directly animating the actors would cause their scale - properties to change. - - - - Reparenting an actor to a rig can cause the actor - to "jump" to the rig's position, unless you align the - actor to the rig first. - - Note that in the sample code, the position of the actor - (x, y coordinates) is copied to - the rig before the reparenting happens. The actor is then - reparented to the rig, and positioned in the rig's - top-left corner. So the actor appears to be in the same - position, but is now actually inside a rig at the actor's old - position. - - Why bother to do this? Because the rig has a default - position of 0,0 (top-left of its - container, the stage). If you reparent the actor to the rig, - without first copying the actor's position to the rig, the - actor appears to "jump" to the rig's position. - - -
- -
- -
- Full example - - - The three separate code examples in this section - constitute a single application which implements the above - solution. - - - - <type>ClutterScript</type> JSON defining several - rectangles with signal handlers - - - a code sample should be here... but isn't - - - - - - <type>ClutterScript</type> JSON describing a "rig" - and a <type>ClutterAnimator</type> animation - - - a code sample should be here... but isn't - - - - - - Loading <type>ClutterScript</type> from JSON files - in response to events in a user interface - - - a code sample should be here... but isn't - - - - -
- -
- -
- Moving actors - -
- Problem - - You want to animate the movement of one or more actors. - For example: - - - - To move user interface elements in response to user input - (e.g. keyboard control of a character in a game). - - - To move a group of actors "off stage" to make way - for another group of actors (e.g. paging through - thumbnails in a photo viewer). - - - To move an actor to a different position in the - interface (e.g. moving an icon for a trashed file into - a wastebin). - - - -
- -
- Solutions - - Animate the actors movement on one or more axes - (x, y, - z/depth) using one or more of the approaches - available in the Clutter API (implicit animations, - ClutterState, ClutterAnimator). - -
- Solution 1: Implicit animations - - This works well for simple movement of a single actor to - a single set of coordinates. Here is an example of how to animate - movement of a ClutterActor actor - to position 100.0 on x axis: - - - -clutter_actor_animate (actor, CLUTTER_LINEAR, 500, - "x", 100.0, - NULL); - - - - See this - example which demonstrates movement in each axis, - in response to (mouse) button presses. - -
- -
- Solution 2: <type>ClutterState</type> - - This suits simple, repeated movement of one or more actors - between sets of coordinates. Here is an example of how to - create two states for a ClutterState instance to - move two actors, actor1 and - actor2: - - - -ClutterState *transitions = clutter_state_new (); - -/* all state transitions take 250ms */ -clutter_state_set_duration (transitions, NULL, NULL, 250); - -/* create a state called move-down which moves both actors to y = 200.0 */ -clutter_state_set (transitions, NULL, "move-down", - actor1, "y", CLUTTER_EASE_OUT_CUBIC, 200.0, - actor2, "y", CLUTTER_EASE_OUT_CUBIC, 200.0, - NULL); - -/* create a state called move-up which moves both actors to y = 0.0 */ -clutter_state_set (transitions, NULL, "move-up", - actor1, "y", CLUTTER_EASE_OUT_CUBIC, 0.0, - actor2, "y", CLUTTER_EASE_OUT_CUBIC, 0.0, - NULL); - -/* move the actors by setting the state */ -clutter_state_set (transitions, "move-down"); - - - - This full - example shows how to move and simultaneously - scale two actors. When a button is pressed on one actor, it is - moved and scaled to occupy the right-hand side of the stage; - the other actor is simultaneously moved back to the left-hand - side of the stage and scaled down. - -
- -
- Solution 3: <type>ClutterAnimator</type> - - This is a good way to implement complex movement of - one or more actors between sets of coordinates. - - - -ClutterAnimator *animator = clutter_animator_new (); - -/* the animation takes 500ms */ -clutter_animator_set_duration (animator, 500); - -/* at the start of the animation, actor should be at 0.0,0.0; - * half-way through, at 100.0,100.0; - * by the end, actor should be at 150.0,200.0; - * note that you can set different easing modes for each - * part of the animation and for each property at each key - */ -clutter_animator_set (animator, - - /* keys for the start of the animation */ - actor, "x", CLUTTER_LINEAR, 0.0, 0.0, - actor, "y", CLUTTER_LINEAR, 0.0, 0.0, - - /* keys for half-way through the animation */ - actor, "x", CLUTTER_EASE_OUT_CUBIC, 0.5, 100.0, - actor, "y", CLUTTER_EASE_IN_CUBIC, 0.5, 100.0, - - /* keys for the end of the animation */ - actor, "x", CLUTTER_EASE_OUT_EXPO, 1.0, 150.0, - actor, "y", CLUTTER_EASE_OUT_CUBIC, 1.0, 200.0, - - NULL); - -/* run the animation */ -clutter_animator_start (animator); - - - - The full - example demonstrates how ClutterAnimator - can be used to programmatically animate multiple actors: in this - case, to simultaneously move three actors to random positions - along the x axis. Synchronising the - movement of three actors simultaneously using implicit - animations would be possible but awkward; - ClutterState might be another option, - but it wasn't really designed for this case: there are no persistent - states to transition between, as the actor positions are - generated on each key press. - - - If you want to apply the same movement to a group of - actors, rather than different movements for each actor, - it's often better to put the actors into a container - of some kind and move that instead of moving the actors - individually. - - -
- -
- -
- Discussion - -
- Movement can take an actor "outside" its container - - Actor movement in the x and - y axes is relative to the actor's parent - container. There is nothing to stop you animating an actor - until it falls outside the bounds of its container. This - could result in the actor moving "off" the interface; though it's - worth remembering that the actor is not unparented or destroyed - if this happens. - - To ensure that an actor remains visible, its position - should remain within the visible area of the container. In practice, - this means either anywhere in the container, if no clip area - has been set; or within the container's clip area, if set. - -
- -
- Anchor points can affect movement - - An actor's anchor point is defined as an x,y - coordinate relative to the top-left of the actor. The default - anchor point for an actor is in its top-left - corner. However, it is possible to set this to some other - coordinate, relative to the actor's top-left corner, - using the clutter_anchor_set_anchor_point() - function. - - For example: - - - -/* set the actor's size to 100px x 100px */ -clutter_actor_set_size (actor, 100, 100); - -/* set an anchor point half-way along the top of the actor */ -clutter_actor_set_anchor_point (actor, 50.0, 0.0); - - - - - In GL terms, the anchor point of an actor is the equivalent - of applying an additional transformation of -x, -y to - the actor's modelview. If the anchor point is 0, 0, - i.e. the top-left corner, then the transformation will leave the - actor in the same place. - It is important to note that the anchor point will affect the - position in which an actor is painted, but will not change the - position or size that its parent allocated for it. - Finally, the anchor point will affect the other transformations - that can be applied to an actor: scaling and rotating. - - - A positive anchor point within the width/height bounds of the - actor is inside the actor. An anchor point outside these bounds - is outside the actor. You can also set a negative - x or y value for - the anchor point, which will again place the point outside - the actor's bounds. - - This is important with respect to moving an actor, because - you are actually moving the anchor point and "dragging" the - actor along with it. - - For example: you have an actor with width 50px, and you - set its anchor-x property to 25.0. - If you move that actor on the x axis, you are - effectively moving a point half-way across the top of the - actor along the x axis (which in turn moves the - actor). - - Similarly, you could set the same actor's - anchor-x to -25.0. If you then - moved the actor along the x axis, you would - effectively be moving the point 25px left of the top of the actor - along that axis. - - The video below demonstrates the effect on movement of shifting - the anchor point on the x axis. The - red rectangle has anchor-x - set to 25.0; the green rectangle has - anchor-x set to 0.0 (the default); the - blue rectangle has anchor-x - set to -25.0. - - - - - - - Video showing the effect of anchor point on movement - - - - A ClutterAnimator is - used to move each of the rectangles to x = 225.0. - Although the three rectangles move to the same position on the - x axis, it's actually the anchor points - which are at the same position. These all align on the - x axis with the left-hand edge of the green - rectangle. - -
- -
- Actors can move in the <varname>z</varname> axis - - The examples so far have shown how to move actors in - the x and y axes; but it - is also possible to move actors in the z - axis (i.e. move them closer or further away from the view point). - This lets you move actors under/over each other. - - To move an actor in the z axis, animate - its depth property. Animating to a negative - depth moves the actor away from the view point; animating to a - positive depth moves the actor towards the view point. - - Changing the depth of an actor also causes perspective - effects: the actor gets smaller and converges on the center - of the stage as it gets further from the view point, and - gets larger and diverges from the center of the stage as it gets - closer. This results in an apparent (but not actual) change in - the x,y position and scale of the actor. - - - Animating the depth of an actor is slightly different - from animating its x and y coordinates, as depth is relative - to the whole stage, not just the parent container of the - actor. This means that perspective effects are with - respect to the whole stage: so as an actor's depth - moves below 0.0, it converges on the center - of the stage, and may even apparently move outside its - container (if the container stays at the same depth). - - - The video below demonstrates the effect of animating - the depth of four actors to a value of -15000.0. - Note how the actors converge on the center of the stage, - as well as appearing to change position and scale; also note - that they appear to move outside the bounds of their parent containers - (the four yellow ClutterBoxes). - - - - - - - Video showing perspective effects when animating - actor depth - - - -
- -
- Movement is affected by constraints - - An actor can have its x,y position constrained by - the position of other actors through ClutterBindConstraints. - This can affect movement in two ways: - - - - If an actor has its x and/or - y properties - bound or aligned to another actor's, you can't animate - those properties. - - In effect this means that the bound actor can't be - moved on a bound axis directly, but can only be moved by - animating the constraint's properties. - - - - If you move an actor which has other actors bound to - it, the bound actors will also move. For example, if - the actor has several other actors whose x - properties are bound to its x property, - moving the actor on the x axis will also - move the bound actors on that axis. - - Similarly, if some actor is the source for - alignment constraints on other actors, moving the source - will cause those other actors to move, so that they remain in - alignment with it. - - - - For example, consider two actors bound by constraints - as follows: - - - -/* the source actor for the constraint */ -ClutterActor *source; - -/* the actor bound by the constraint */ -ClutterActor *target; - -/* a constraint to be added to target */ -ClutterConstraint *constraint; - -/* ...initialize actors etc... */ - -/* create a constraint for binding the x position of some actor to the - * x position of source - */ -constraint = clutter_bind_constraint_new (source, CLUTTER_BIND_X, 0.0); - -/* add the constraint to target with a name */ -clutter_actor_add_constraint_with_name (target, "bind-x", constraint); - - - - Animating source on the x - axis also animates target on the same axis: - - - -clutter_actor_animate (source, CLUTTER_LINEAR, 500, - "x", 250.0, - NULL); - - - - ...while this has no effect, as it would violate - constraint (it's best not to animate - target's x property - directly): - - - -clutter_actor_animate (target, CLUTTER_LINEAR, 500, - "x", 250.0, - NULL); - - - - But the constraint's properties can be animated, to change - how source and target - are bound; which in turn moves target: - - - -clutter_actor_animate (target, CLUTTER_LINEAR, 500, - "@constraints.bind-x.offset", 250.0, - NULL); - - - - Note the @constraints.<constraint name>.<constraint property> - syntax (which is why we needed to use - clutter_actor_add_constraint_with_name(), - so that the constraint can be accessed through the actor). - We are still animating target, but really - we're indirectly animating a property of one of its constraints. - - Another alternative would be to directly animate - the constraint's properties through ClutterState - or ClutterAnimator, rather than using - pseudo-properties on the actor animation: - - - -ClutterAnimator *animator = clutter_animator_new (); -clutter_animator_set_duration (animator, 500); - -clutter_animator_set (animator, - constraint, "offset", CLUTTER_LINEAR, 0.0, 0.0, - constraint, "offset", CLUTTER_LINEAR, 1.0, 250.0, - NULL); - -clutter_animator_start (animator); - - - - This could be useful if you need to animate - multiple constraints between multiple values simultaneously. - -
- -
- -
- Full examples - - - Simple movement using implicit animations - - - a code sample should be here... but isn't - - - - - - Using <type>ClutterState</type> to repeatedly move - (and scale) two actors - - - a code sample should be here... but isn't - - - - - - Using <type>ClutterAnimator</type> to randomly move - three actors along the <varname>x</varname> axis - - - a code sample should be here... but isn't - - - - -
- -
- -
- Looping an animation - -
- Problem - - You want to loop an animation so it plays multiple times. -
- -
- Solutions - - Each animation - approach can be used to create a looping animation, as - described in the following sections. - - The animation implemented in each case is a simple repeated - movement of a rectangle from the right (x = 150.0) - to the left (x = 50.0) of the stage, and back again, - looped; like this (just a few iterations): - - - - - - - Video showing simple looped movement of an actor - - - -
- Solution 1: looping an implicit animation - - Implicit animations, started using - clutter_actor_animate(), can be looped via - their associated ClutterTimeline. - - Create a ClutterTimeline which is - set to loop: - - - -ClutterTimeline *timeline = clutter_timeline_new (1000); -clutter_timeline_set_repeat_count (timeline, -1); - - - - Use this timeline when starting an implicit animation on an - actor; in this case, to animate the actor's x - coordinate from its initial value to 50.0: - - - -/* assume actor is a ClutterActor instance */ - -/* actor's initial x value is 150.0 */ -clutter_actor_set_x (actor, 150.0); - -/* animate the actor (starting the timeline is implicit) */ -clutter_actor_animate_with_timeline (actor, - CLUTTER_LINEAR, - timeline, - "x", 50.0, - NULL); - - - - One further technique is to repeatedly reverse the timeline's - direction to create a "closed loop" animation (one which returns - to its origin at the end of each iteration). See - this - section for details. - - The full - code example shows how to run an implicit animation on - a loop. -
- -
- Solution 2: looping with <type>ClutterAnimator</type> - - A ClutterAnimator animation can also be looped - via its ClutterTimeline. However, as - ClutterAnimator enables more complex animations, - you don't have to manually invert the timeline at the - end of each iteration. Instead, you can animate - an actor's properties back to their initial values - at the end of each iteration of the loop. - - Creating the timeline and setting it to loop is the same - as for implicit animations: - - - -ClutterTimeline *timeline = clutter_timeline_new (2000); -clutter_timeline_set_repeat_count (timeline, -1); - - - - Note that the timeline is twice the length of the one for - the implicit animation: this is because, unlike the implicit - animation, the movement from right to left and back again - is a single animation. By contrast, in the - implicit animation, the timeline runs forward, for the right to - left movement; and then backwards, for the left to right - movement. So rather than a 1000ms timeline running twice (once - forward, once backward for the implicit animation), - we have a 2000ms timeline running once (for - ClutterAnimator). - - Next, create a ClutterAnimator which animates - the actor from right to left, then left to right: - - - -/* assume actor is a ClutterActor instance */ -ClutterAnimator *animator = clutter_animator_new (); - -/* use the looping timeline as the timeline for the animator */ -clutter_animator_set_timeline (animator, timeline); - -/* set positions for the actor at various points through the animation: - * at progress 0.0, x = 150.0 (right of the stage) - * at progress 0.5, x = 50.0 (left of the stage) - * at progress 1.0, x = 150.0 again (back to the right) - */ -clutter_animator_set (animator, - actor, "x", CLUTTER_LINEAR, 0.0, 150.0, - actor, "x", CLUTTER_LINEAR, 0.5, 50.0, - actor, "x", CLUTTER_LINEAR, 1.0, 150.0, - NULL); - - - - Finally, start the animation: - - - -clutter_animator_start (animator); - - - - See the full - example for more details. -
- -
- Solution 3: looping with <type>ClutterState</type> - - You can loop ClutterState animations by - creating a cycle of states which - "swallows - its own tail": i.e. goes from a start state, through - intermediate state(s), back to the start state, then again - through the intermediate states(s), back to the start state, - etc., ad infinitum. - - For the animation we're implementing, there are two states - the actor transitions between: - - - - The actor's x value - is 150.0 (the start/end state, on the right - of the stage). - - - The actor's x value is - 50.0 (the intermediate state, on the left - of the stage). - - - - Here is how to add those states to a - ClutterState instance: - - - -ClutterState *transitions = clutter_state_new (); - -/* the duration for a transition from any state to any other is 1 second */ -clutter_state_set_duration (transitions, NULL, NULL, 1000); - -clutter_state_set (transitions, NULL, "right", - actor, "x", CLUTTER_LINEAR, 150.0, - NULL); - -clutter_state_set (transitions, NULL, "left", - actor, "x", CLUTTER_LINEAR, 50.0, - NULL); - - - - You also need a handler to move the ClutterState - to its next state, called each time a state transition - is completed: - - - -/* handler to move the ClutterState to its next state */ -static void -next_state (ClutterState *transitions, - gpointer user_data) -{ - const gchar *state = clutter_state_get_state (transitions); - - if (g_strcmp0 (state, "right") == 0) - clutter_state_set_state (transitions, "left"); - else - clutter_state_set_state (transitions, "right"); -} - - - - Then connect the ClutterState's - completed signal to the handler, so that each time - a state is reached, the transition to the next state begins: - - - -/* connect the ClutterState completed signal to the handler */ -g_signal_connect (transitions, - "completed", - G_CALLBACK (next_state), - NULL); - - - - Finally, put the ClutterState into the start - state to begin the animation: - - - -clutter_state_warp_to_state (transitions, "right"); - - - - See the full - example for more details. -
- -
- -
- Discussion - - We use two different approaches to looping in the solutions: - - - - Setting the ClutterTimeline to loop - (via clutter_timeline_set_repeat_count()). This - is the best approach where the timeline is explicit (for - ClutterAnimator and implicit animations). - - - Cycling through states in a ClutterState. In - this case, the timeline is implicit and we don't need to - manually control it: the loop is a consequence of cycling - repeatedly through a series of states. - - - - The following sections cover some other aspects of looping - animations. - -
- Looping a fixed number of times - - ClutterTimeline doesn't have any built-in - functionality to support looping a certain number of times. But - it is reasonably easy to count the number of iterations completed and - stop the animation when some limit is reached. - - For example, you could use a static counter to keep track - of the iteration count: - - - -static guint counter = 0; - - - - Implement the looping behaviour as in the above solutions, - but use a callback function to set/reset the counter each time - the timeline completes. For example, for the - ClutterAnimator solution, you would connect the - completed signal of the timeline - to a callback function: - - - -g_signal_connect (timeline, - "completed", - G_CALLBACK (timeline_completed_cb), - NULL); - - - - And implement a callback function which resets the counter and - stops the timeline if more than two iterations have been counted: - - - -static void -timeline_completed_cb (ClutterTimeline *timeline, - gpointer user_data) -{ - counter++; - - if (counter > 2) - { - counter = 0; - clutter_timeline_stop (timeline); - } -} - - - - Note that it's simple to count iterations and - control the timeline using ClutterAnimator or - ClutterState, as the whole animation (right to left - and back) is a discrete unit. Doing the same with implicit - animations is possible (one forward + one backward run along the - timeline is one iteration). But you will be really stretching the - implicit animation API beyond its intended use cases. -
- -
- Creating a "closed loop" with an implicit animation - - When using implicit animations, at the end of the timeline - (before the next iteration of the loop), an actor's properties - "jump" back to their initial values (as they were when the timeline - started). For example, in the - earlier - solution, the actor's initial x value was - 150.0; so the default behaviour on each iteration - of the loop would be to animate the actor to x = 50.0 - then jump it immediately back to x = 150.0, before - continuing the loop. - - To prevent this happening, you can create a "closed" loop: - animate the actor's properties away from their initial values, then - back again. - - This could be done manually, by creating two separate - animations, one the inverse of the other, and chaining them together. - - However, a simpler solution is to run forward through the timeline - once, and have the timeline invert itself when its end is reached. - The animation then continues, but in reverse. Once the backward iteration - completes, the timeline sets itself to run forward again, etc. - - To make a timeline reverse its direction each time it - completes, use the clutter_timeline_set_auto_reverse() - function: - - - -clutter_timeline_set_auto_reverse (timeline, TRUE); - - - - This is the approach used in - the example, - which results in a smooth, repeated right to left, - left to right motion. - - See this - recipe for more details about inverting a timeline. -
- -
- -
- Full examples - - - Looping an implicit animation - - - a code sample should be here... but isn't - - - - - - Looping with <type>ClutterAnimator</type> - - - a code sample should be here... but isn't - - - - - - Looping with <type>ClutterState</type> - - - a code sample should be here... but isn't - - - - -
- -
- -
- Animated scaling - -
- Problem - - You want to animate scaling of an actor. Example use - cases: - - - - To animate zooming in/out of a texture in an - image viewer application. - - - To add an animated "bounce" effect (quick scale up - followed by scale down) to a UI element - to indicate it has received focus. - - -
- -
- Solution - - Animate the actor's scale-x and - scale-y properties to change the scaling on - the x and y axes - respectively. - - For example, to animate an actor to twice its current scale - with implicit animations: - - - - - - - - Alternatively, ClutterAnimator or - ClutterState can be used to animate an actor's scale - properties. See this - example which uses ClutterState to animate - scaling. -
- -
- Discussion - - Scaling an actor is done through its scale-x - and scale-y properties, each of which takes - a double value. A value of less than - 1.0 for an axis scales an actor down on that axis, - reducing its apparent size; values greater than 1.0 - scale an actor up, increasing its apparent size. - - Why "apparent" size? Because scaling applies a transform - to an actor which changes how it appears on the - stage, without changing its "real" size. Similarly, scaling an - actor may transform its position: it could appear to move to a - different position within its container, - although it is "really" at its original position. Run - the - example to see how size and position are - transformed by scaling. - - It can be useful to know an actor's - transformed position and size after scaling: - for example, if you were implementing a reflowing layout manager - which used scaling as part of its allocation algorithm. - Here's an example of how to get these properties for an - actor: - - - - - - - - Note that you can scale an actor on both axes by the same - amount (uniform scaling), or by a different amount on each axis - (differential scaling). - - Use clutter_actor_is_scaled() to determine - whether scaling has been applied to an actor: this function returns - FALSE if both scale-x and - scale-y are 1.0; otherwise, it - returns TRUE. - -
- Scaling vs. resizing - - Scaling changes the apparent size - of an actor, while leaving its real size unchanged. By contrast, - resizing changes the real size of the actor, - by modifying its width and - height properties. - - Resizing and scaling produce the same visual - effect, as both make an actor appear to be larger or - smaller. Therefore, for most purposes, they are interchangeable - if you just want to change an actor's apparent size. - - So why would you scale an actor rather than resize it? - - - - If you've scaled an actor, you can easily reset it - to its original size, by setting its - scale back to 1.0 on both axes. By contrast, - to reset a resized actor to its original size, - you would have to track the original size manually: the - actor doesn't make its original size accessible. - - - - Scaling can easily change the apparent size - of multiple actors inside a container. For example, say you - wanted to shrink multiple actors inside a container - to half their original size. There are two ways you - could do this: - - - - The hard way would be to resize - each actor individually. You couldn't just resize the container, - as resizing a container doesn't resize its children: usually - they will be clipped so that they are either partially or - wholly hidden. - - - - The easy way would be to set the container's scale - to half its initial value: the actors - in the container would retain their original sizes, but would - appear at half size. - - - - - -
- -
- Scaling, layouts and containers - - It is possible to scale actors inside containers. For - example, if you were using a ClutterBox - which has a ClutterBoxLayout layout manager, - you could scale the children of that layout. - - However, you should remain aware that layout managers - don't take account of the scale of their children, only their - size. So if you scale up an actor inside a layout manager, - it may overlap other actors in the layout: the size allocated - by the layout manager doesn't increase as an actor's scale - increases. - - Similarly, scaling an actor down doesn't reduce the space - it will be allocated by a layout. -
- -
- Setting the scale center - - An actor's scale center is the point around which - scaling occurs: when you scale the actor, it will "shrink" - into (if scale < 1.0) or "expand" out of (if scale > 1.0) - its scale center. - - You can change an actor's scale center using - either gravity (a named position on the actor; for example, the - middle of the top edge of the actor is - CLUTTER_GRAVITY_NORTH); or - x,y coordinates relative to the actor's anchor point (by default, - the anchor point for an actor is at 0,0). - - Setting scale gravity has the same consequences as - setting both the scale-center-x and - scale-center-y properties for an actor. - For example, CLUTTER_GRAVITY_NORTH_EAST - sets the scale center to <width of the actor>, 0, - relative to the actor's anchor point (defaults to the top-right - corner of the actor). However, the advantage of scale - gravities is that they change with the actor: so if the - actor is resized, you don't have to manually reset the scale - center. This means that CLUTTER_GRAVITY_NORTH_EAST - will always represent the top-right corner of the actor, - regardless of how it is scaled or resized. The same is true - of each of the other scale gravities. - - If you're animating an actor's scale but want a different - scale center, set it before the animation begins. One way to - do this is to leave the actor's scale unchanged, but with - a different scale center: - - - - - - - - Another approach is to set scale center properties - via GObject, which doesn't require you to figure out the - actor's scale first: - - - - - - - - Once the scale center is set, you can animate the - scaling as per usual. - - It is even possible to animate the - scale-center-* properties, which can - produce interesting, though slightly - unpredictable, effects. It's usually better to change the - scale center before the animation starts. - - The - example cycles through the available scale gravities, - showing the effect on the animation of each of the scale - centers. - - The second - example shows how to combine scaling in and out on a - texture, in response to mouse button presses. In this case, - the scale gravity remains at CLUTTER_GRAVITY_NORTH_WEST - (i.e. at the anchor point of the actor). However, the anchor - point is moved to the coordinates of each double click on button 1 - (usually the left mouse button) or button 3 (usually the right - mouse button); which in turn automatically moves the scale center - before the texture is scaled. As a result, the texture - "expands" or "contracts" around the clicked point, - while the point remains still. - - - One final caveat about scale centers: if an actor is - already scaled, the scale center coordinates are relative to - the real size of the actor, rather than - its transformed size. This can result in - a "jumping" effect if you change the scale center on - a scaled actor. - - For example, you might set the scale gravity of an actor - to CLUTTER_GRAVITY_WEST, then - scale the actor to 0.5 on both axes. Later, you - change the actor's scale gravity to - CLUTTER_GRAVITY_EAST. The effect of this - is to "jump" the actor to the right, so its right-hand edge - is aligned with where it was at scale 1.0. - - If this isn't desirable, you can just retain the scale - center on a scaled actor, and only change it when the actor - is unscaled. - -
- -
- -
- Full examples - - - Animated scaling of an actor using each of the - scale gravities. Press any key to start the animation. - - - a code sample should be here... but isn't - - - - - - Animated scaling (up and down) of a texture in response - to button presses. Call with the path to an image as the - first argument. - - - a code sample should be here... but isn't - - - -
- -
- -
- Animating an actor along a curved path - -
- Problem - - You want to animate an actor along a curved path: for - example, to move an actor in a circle or spiral. -
- -
- Solution - - Create a ClutterPath to describe the - path the actor should move along; then create a - ClutterPathConstraint based on that path: - - - -ClutterPath *path; -ClutterConstraint *constraint; - -/* create the path */ -path = clutter_path_new (); - -/* first node is at 30,60 */ -clutter_path_add_move_to (path, 30, 60); - -/* add a curve to the top-right of the stage, with control - * points relative to the start point at 30,60 - */ -clutter_path_add_rel_curve_to (path, - 120, 180, - 180, 120, - 240, 0); - -/* create a constraint based on the path */ -constraint = clutter_path_constraint_new (path, 0.0); - - - - - For more on the types of curve and line segment available, - see the ClutterPath API documentation. - - - Next, add the constraint to an actor; in this case, the - actor is a red rectangle: - - - -ClutterActor *rectangle; -ClutterActor *stage = clutter_stage_new (); - -/* ...set size stage, color, etc... */ - -const ClutterColor *red_color = clutter_color_new (255, 0, 0, 255); - -rectangle = clutter_rectangle_new_with_color (red_color); -clutter_actor_set_size (rectangle, 60, 60); - -/* add the constraint to the rectangle; note that this - * puts the rectangle at the start of the path, i.e. at position 30,60; - * we also give the constraint a name, so we can use it from an implicit - * animation - */ -clutter_actor_add_constraint_with_name (rectangle, "path", constraint); - -/* add the rectangle to the stage */ -clutter_actor_add_child (stage, rectangle); - - - - Note how the constraint has to be assigned a name (here, "path") - to make it accessible via implicit animations. - - Finally, animate the constraint's offset - property; which in turn moves the actor along the path: - - - -ClutterTimeline *timeline; - -/* create a timeline with 1000 milliseconds duration, which loops - * indefinitely and reverses its direction each time it completes - */ -timeline = clutter_timeline_new (1000); -clutter_timeline_set_repeat_count (timeline, -1); -clutter_timeline_set_auto_reverse (timeline, TRUE); - -/* animate the offset property on the constraint from 0.0 to 1.0; - * note the syntax used to refer to the constraints metadata for the - * rectangle actor: - * - * "@constraints.<constraint name>.<property>" - */ -clutter_actor_animate_with_timeline (rectangle, CLUTTER_LINEAR, timeline, - "@constraints.path.offset", 1.0, - NULL); - -/* ...show the stage, run the mainloop, free memory on exit... */ - - - - The full - example shows how these fragments fit together. - The animation produced by this example looks - like this: - - - - - - - Video showing animation of an actor along a curved - path using ClutterPathConstraint - - - - The second full - example animates an actor around a simulated circle - using a more complex ClutterPath. - -
- -
- Discussion - - Animating an actor using ClutterPathConstraint - is the recommended way to animate actors along curved paths. It - replaces the older ClutterBehaviourPath. - - A ClutterPathConstraint constrains an - actor's x and y properties - to a position along such a ClutterPath: a path through - 2D space. The ClutterPath itself is composed of nodes - (x,y positions in 2D space), connected by straight lines or (cubic) - Bézier - curves. - - - ClutterPath doesn't have to be used in animations: - it can also be used in drawing (see the - non-rectangular actor - recipe). - - - The actor's position along the path is determined by the constraint's - offset property, which has a - value between 0.0 and 1.0. When the offset is 0.0, the actor - is at the beginning of the path; when the actor is at 1.0, the - actor is at the end of the path. Between 0.0 and 1.0, the actor - is some fraction of the way along the path. - - If you immediately set the offset for the - constraint (e.g. to 0.5), the actor is instantly placed - at that position along the path: for offset = 0.5, - at the halfway point. - - By contrast, to animate an actor along a path, you - animate the offset property of a - ClutterPathConstraint. The actor's position - along the path is dependent on the progress of the animation: - when the animation starts, the actor is at the beginning of the path; - by the end of the animation, it will have reached its end. - - If you animate the constraint using a linear easing mode, - the progress of the animation matches progress along the path: at - half-way through the animation, the actor will be half-way along - the path. - - However, if you are using a non-linear easing mode - (e.g. a quintic or cubic mode), the offset along the path and - progress through the animation may differ. This is because the - offset along the path is computed from the alpha value at that - point in the animation; this in turn depends on the alpha function - applied by the animation. (See the - animations introduction - for more details about alphas.) - - One way to think about this is to imagine the actor - making a journey along the path. The alpha function governs the - actor's speed, including how it speeds up and slows down - during its journey. The actor's speed may be constant - (as in a linear easing mode). Alternatively, the actor's speed - may not be constant: it might start out fast then slow down - (ease out); or start slow and speed up (ease in); or start and - end fast, but slow down in the middle (ease in and ease out); or - some other more complex arrangement (as in the bounce and elastic - easing modes). So where the actor is on the path at a particular - time doesn't directly relate to how long it's been travelling: - the position is determined both by how long it's been travelling, - and changes in its speed throughout the journey. - -
- Other ways to animate along a path - - ClutterPathConstraint is the only - decent way of animating along curves in a predictable - and manageable fashion. It can also be used to animate along - paths composed of straight lines, though this isn't essential: you - can do straight line animations directly with ClutterAnimator, - ClutterState or implicit animations. But if - you need to animate between more than a half a dozen sets of - points joined by straight lines, ClutterPathConstraint - makes sense then too. - - It is also possible to animate actors over very simple, non-Bézier - curves without using ClutterPathConstraint. This - can be done by animating the actor's position properties using - a non-linear easing mode (see the ClutterAlpha - documentation for available modes, or write your own custom - alpha function). This - example shows how to animate two actors on - curved paths around each other without - ClutterPathConstraint. - - However, it is difficult to precisely calculate paths - with this approach. It is also only practical where you have a - very simple curve: if you want to chain together several curved - motions (as in the circle - example), this quickly becomes unwieldy. - - - - If you want physics-based animation, look at - clutter-box2d. - - - -
- -
- -
- Full examples - - - Using a <type>ClutterPathConstraint</type> with - implicit animations to move an actor along a curved path - - - a code sample should be here... but isn't - - - - - - Using a <type>ClutterPathConstraint</type> with - <type>ClutterAnimator</type> to animate an actor on - a simulated circular path - - - a code sample should be here... but isn't - - - - - - Animating actors on curved paths using easing modes - - - a code sample should be here... but isn't - - - - -
- -
- -
diff --git a/doc/cookbook/clutter-cookbook.xml.in b/doc/cookbook/clutter-cookbook.xml.in deleted file mode 100644 index d360683e2..000000000 --- a/doc/cookbook/clutter-cookbook.xml.in +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - -]> - - - - - - Emmanuele - Bassi -
&ebassi_mail;
-
- - Elliot - Smith -
&elliot_mail;
-
-
- - 2009, 2010, 2011 - Intel Corporation - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the Creative - Commons Attribution-Non-Commercial-Share Alike 2.0 UK: England & - Wales as published by Creative Commons. - - The Clutter Cookbook - for Clutter &apiversion; -
- - - - - - - - - - - - - Contributing to this document - - This document is written in - Docbook XML. The source files - for this document are located in the subdirectory - doc/cookbook inside the Clutter source directory. - - To maintain some degree of consistency, try to stick to the - following broad guidelines about how to write Docbook for this - cookbook: - - - - If adding a new recipe, use the - recipe-template.xml XML file as a basis. - You can find it in the <clutter source>/doc/cookbook/ - directory. - - - Try to indent your XML sensibly using 2 spaces per level - (we're not too strict, but some indentation helps reading - the source). - - - Stick to a column width of around 80 characters. - - - Use the <filename> element for file - and directory names. - - - Use the <property> element for property names - (e.g. GObject properties). - - - Use the <type> element for GObject class - names. - - - Use the <constant> element for C defines. - - - Use the <keycap> element for keys, where - you are referring to what's actually printed on the key, e.g. - Shift. If you're referring to the key some - other way (e.g. "the Control key"), don't use - <keycap>. - - - Use the <function> element for functions; - the style adopted is to give the function name followed by - empty brackets, e.g. clutter_actor_set_size(). - - - - Use the <note> element for asides which might - otherwise interrupt the flow of the recipe. - - - To include a video in a recipe, do the following: - - - Make the video as short as is practical, and only include - the relevant Clutter window(s). - - - - Use Ogg Theora for the encoding. - - - - Put the file into the - <clutter source>/doc/cookbook/videos - directory. The name should be in the format - <section>-<recipe>-<identifier>.ogv. - For example: animations-fading-fade-out.ogv. - - - - Add the name of the file to the - in the cookbook's Makefile.am, e.g. - - - - - - - - This ensures it gets included in the distribution and - installation. - - - - Use an <inlinemediaobject> to include it in the - Docbook recipe file. It should look something like this: - - - - - - - - - Video showing an actor fading in then out using - ClutterState - - -]]> - - - - The <alt> tag provides the text which - is presented as a link to the file for users whose browser - doesn't support HTML 5 embedded video. - - - - - To include a full code sample in a recipe (which can - be compiled into a runnable binary), do the following: - - - - Create a C code file in the - <clutter source>/doc/cookbook/examples - directory. It should be a standalone C application (with - a main() etc.). The filename should be - in the format - <section>-<recipe>.c; you - can add an optional identifier to the end if you have more - than one example for a recipe. - - If you want to load image files into the application - (e.g. to demonstrate something with a texture), you can use - the TESTS_DATA_DIR variable in your C - code to reuse images in the Clutter tests - directory; this will be replaced with - <clutter source>/tests/data - during the build. For example: - - - - - - - - - - Edit Makefile.am - in the cookbook/examples directory - so that the build recognises the new code; e.g. if - your C source file were called - fooing-barring.c you would do: - - - - - - - - - Note the second line is a new one to tell the - build where the source file is for your example. - - - - - Add a section at the end of your recipe which - XIncludes the sample code, e.g.: - - - - - Full example - - - Fooing with a bar - - - a code sample should be here... but isn't - - - - -]]> - - - - - - - - - - -
diff --git a/doc/cookbook/effects.xml b/doc/cookbook/effects.xml deleted file mode 100644 index 79b5566e3..000000000 --- a/doc/cookbook/effects.xml +++ /dev/null @@ -1,1299 +0,0 @@ - - - - Effects - - - Roger Zelazny, from Prince of Chaos - - Don't wake me for the end of the world unless it has very - good special effects - - -
- Introduction - - Effects modify an actor's appearance, such - as how it is positioned, colored and textured. - - The Clutter API for effects contains several - abstract classes you can subclass to create your own effects. - It also contains several built-in effects you can use to - modify the visual appearance of actors in a variety of ways. - - The recipes in this section of the cookbook cover how to create - your own effects as well as how to apply Clutter's effects. - -
- Creating effects using the abstract effect classes - - - One of the original design goals of Clutter was to abstract - the complexity of GL. However, the effects API partially circumvents - these abstractions, to give you finer-grained access to the - graphics pipeline. Therefore, if you want to write your own effects, - some understanding of Cogl, OpenGL, and general graphics programming - is essential. - - - Each abstract effect class is tailored to modifying different - aspects of an actor, as explained below: - - - - - - <type>ClutterEffect</type> - If you're just using the Clutter and Cogl APIs to - decorate an actor, this is simplest type of effect to - implement. - - - Subclassing ClutterEffect enables you to - "wrap" how an actor is painted, by injecting some code before - and/or after the actor's own paint() - implementation. - - - This is the preferred way to modify how an actor is - painted, short of creating your own actor subclass. - - - Subclasses of - ClutterEffect: - - - - - - <type>ClutterOffscreenEffect</type> - - Use this class as a basis if you need GL textures - for your effect. - - - GL textures are required for effects which need - an offscreen framebuffer. The offscreen framebuffer is - used to store a modified rendering of an actor (e.g. - with its colors altered or with deformed geometry). - This buffer is then redirected to a texture in the - stage window. - - An example is ClutterBlurEffect, - which uses a GLSL fragment shader to blur an - actor's appearance in an offscreen framebuffer. - - Subclasses of - ClutterOffscreenEffect: - - - - - - - <type>ClutterDeformEffect</type> - - Use this base class if you want to modify - an actor's geometry, at the level of individual - vertices. - - - ClutterDeformEffect removes the - complexity of dealing with vertex-based deformations - at the OpenGL level, instead enabling you to easily plug - a deformation callback into the graphics pipeline. - - If you are writing your own deform effects, - a good example to work from is - ClutterPageTurnEffect. - - There is also a - recipe which - explains how to implement a simple custom deform - effect (a page fold). - - - - - - <type>ClutterShaderEffect</type> - - Use this if you want to apply custom - GLSL vertex or fragment shaders to your actors. - - - Writing ClutterShaderEffects gives - you very fine-grained control over the GL pipeline. - However, this makes them the most complex - effects to implement. - - - If you want to write your own GLSL shaders, the - GLSL - specification is a good starting point. - - - - - - - - - - - - - - -
- -
- Using the built-in effects - - Clutter comes with a number of built-in effects - which can easily be applied to your actors. This section - explains how to do this. - - First, create an actor. For this - example, we use a texture loaded with an image: - - - -/* filename could be set from command line or constant */ -gchar *filename; - -/* create a texture */ -ClutterActor *texture = clutter_texture_new (); - -/* ...set texture size, keep aspect ratio etc... */ - -/* NB ignoring missing file errors here for brevity */ -clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - filename, - NULL); - -/* ...add texture to the stage... */ - - - - Next, create an instance of an effect; here, we're - creating a ClutterColorizeEffect with a pink tint: - - - -ClutterColor *pink = clutter_color_new (230, 187, 210, 255); -ClutterEffect *effect = clutter_colorize_effect_new (pink); - - - - Finally, apply the effect to the actor: - - - -clutter_actor_add_effect (texture, effect); - - - - The result in this case is an image colorized with - a pink tint, like this: - - - - - - - - Applying a ClutterColorizeEffect - to a texture loaded with an image (drawing by - Madeleine Smith) - - - - - The same set of steps applies for any of the built-in - Clutter effects. Your own custom effects classes should also - behave in a similar way: constructors should return - ClutterEffect instances so your effect can - be added to an actor through the standard API. - - One further thing worth mentioning is that because an - effect is a GObject, any properties you expose for your effect - can be animated via implicit animations, - ClutterAnimator or ClutterState. For - example, the ClutterPageTurnEffect can be animated - by manipulating its period property. An example - of how to do this for your own effect is given in the - custom deform effect - recipe. - - The full code for the ClutterColorizeEffect - example is below. - - - Applying a <type>ClutterColorizeEffect</type> to - a texture loaded with an image - - - a code sample should be here... but isn't - - - - -
- -
- -
- Changing an actor's paint sequence using - <type>ClutterEffect</type> - -
- Problem - - You want to paint on top of or under an actor in a generic - way, without editing the actor's paint() - implementation. Example use cases are: - - - - Adding a border on top of an actor. - - - Drawing a background for an actor. - - - - A quick way to achieve the same thing (though not - readily portable between actors) is to connect a callback - before or after an actor's paint signal. - See this recipe for - more details. However, using a ClutterEffect - implementation, as explained in this recipe, is the preferred - approach. -
- -
- Solution - - Create a subclass of the ClutterEffect abstract - class; then implement the pre_paint() and/or - post_paint() virtual functions. When the - effect is applied to an actor, these functions will paint - before and after the actor's own paint() - implementation. - - - For this solution, we implement a simple - CbBackgroundEffect which draws a gray rectangle - under an actor. The full source is in - this - section. To keep it simple, the effect has no properties - and isn't configurable (the background is always gray); see the - border - effect for a more detailed implementation with GObject - trimmings. - - - First, create a ClutterEffect subclass. This - requires the trappings of a GObject class; in particular, - it needs a private struct to hold the effect's state. This - should include any CoglMaterials, - CoglColors or other private member variables - you intend to use to draw the effect. - - In the case of the background effect, we have a background - CoglMaterial and a CoglColor for that - material: - - - -struct _CbBackgroundEffectPrivate -{ - CoglMaterial *background; - CoglColor *color; -}; - - - - In the init() function for objects of - your class, create any Cogl resources which you need to draw the - effect. In the case of the background effect, - we need to create the CoglMaterial and - CoglColor for the private struct: - - - -priv = CB_BACKGROUND_EFFECT_GET_PRIVATE (self); - - /* create the background material */ - priv->background = cogl_material_new (); - - /* gray color for filling the background material */ - priv->color = cogl_color_new (); - cogl_color_init_from_4ub (priv->color, 122, 122, 122, 255); - - /* set the color on the material; NB this isn't configurable - * for this effect, and is always gray - */ - cogl_material_set_color (priv->background, priv->color); -} -]]> - - - - Optionally, you can create GObject properties for - the class, if you want a configurable effect: see - this - section for details. - - The dispose() function for your effect - should clean up any Cogl resources: - - - -priv; - - if (priv->background != COGL_INVALID_HANDLE) - { - cogl_handle_unref (priv->background); - priv->background = COGL_INVALID_HANDLE; - } - - if (priv->color != NULL) - { - cogl_color_free (priv->color); - priv->color = NULL; - } - - G_OBJECT_CLASS (cb_background_effect_parent_class)->dispose (gobject); -} -]]> - - - - Now, the important part: implement pre_paint() - and/or post_paint(), using Cogl to draw on the - material(s) set up for the effect. - - For the background effect, we implement pre_paint(), - to draw a gray rectangle under the actor: - - - -priv; - - /* get the associated actor's dimensions */ - actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self)); - clutter_actor_get_size (actor, &width, &height); - - /* draw a Cogl rectangle in the background using the default color */ - cogl_set_source (priv->background); - - /* the rectangle has the same dimensions as the actor */ - cogl_rectangle (0, 0, width, height); - - return TRUE; -} -]]> - - - - Now, in the init() function for the - effect class, assign your implementations to the - virtual methods of the ClutterEffect abstract class: - - - -pre_paint = cb_background_effect_pre_paint; - gobject_class->dispose = cb_background_effect_dispose; - - g_type_class_add_private (klass, sizeof (CbBackgroundEffectPrivate)); -} -]]> - - - - If you intend to make your effect reusable, provide - a public constructor (as is done for the example effects in this - recipe): - - - -ClutterEffect * -cb_background_effect_new () -{ - return g_object_new (CB_TYPE_BACKGROUND_EFFECT, - NULL); -} - - - - The effect is now ready to be used. The application code - for applying your effect to an actor is the same as for any - other effect: - - - -ClutterActor *texture; -ClutterEffect *background_effect; - -/* ...initialize texture, load image file etc... */ - -/* create a gray background effect */ -background_effect = cb_background_effect_new (); - -/* apply the effect to the actor */ -clutter_actor_add_effect (texture, background_effect); - - - - Below is an example of applying this effect to a texture loaded - with an image; the image has a transparent background, so the - background is visible through it. The screenshot is from - the example - application: - - - - - - - - Applying CbBackgroundEffect - to a texture loaded with an image that has a transparent - background - - - - -
- -
- Discussion - - A basic ClutterEffect is particularly useful for - amending the appearance of an actor on the fly: for example, - to highlight an actor in response to a button presses. This - could be done by creating a custom widget - whose appearance could be toggled. But what if you wanted to make - an arbitrary actor's appearance "togglable"? A generic effect - in the style of the border effect in this recipe can be applied - to any actor, and easily toggled by enabling/disabling the - effect. - - ClutterEffect works best where - you want to overlay or underlay the actor with Cogl paths or - primitives, without changing the actor's geometry. If you want - to do complicated geometry transformations, or other subtle - manipulations of an actor's appearance, it is better to use - a ClutterEffect subclass like - ClutterOffscreenEffect, ClutterDeformEffect, - or ClutterShaderEffect. - - In a similar vein, when a ClutterEffect is - applied to an actor, the effect shouldn't paint outside the actor's - allocation. However, if the effect provides a - get_paint_volume() implementation which - returns a volume larger than the actor's allocation, the effect - can paint anywhere within that volume. Though - in most cases, creating a custom paint volume is only going to be - useful for offscreen effects, where you are changing the - actor's geometry. - -
- Effect properties - - If your effect has GObject properties, you should - ensure that an actor associated with the effect is queued - for a redraw when those properties change. (You only need to - do this for properties which change the effect's appearance; - but this is likely to include most of an effect's properties.) - - In most cases, you're likely define standard GObject - properties for the class; for example, - CbBorderEffect - defines a width property like this: - - - - - - - - It also defines a standard GObject - set_property() function for - width: - - - - - - - - Note that this calls - cb_border_effect_set_width(), which is - also exposed in the public API. This is where the - width member variable is actually set in - the private struct; and also where the redraw for the actor - associated with the effect should be queued: - - - -width = width; - - /* the property has been updated, so queue a redraw of the actor (if set) */ - cb_border_effect_update (self); -} -]]> - - - - Any other property setters which affect the associated - actor's appearance (i.e. color in the case of - CbBorderEffect) should also call the update - function after setting the property. - - - If your effect exposes GObject properties in this way, - it can also be animated with the Clutter animation API as usual. - For example, you could animate the border effect in this recipe - so that the border gradually becomes thinner or thicker. - - -
- -
- -
- Full example - - The example application applies two effects to a - group of ClutterTextures: - - - - A CbBackgroundEffect which draws a gray - background under each actor. The effect is implemented in - a header - file and a C - code file. - - - A CbBorderEffect which draws a - red border on top of an actor; this is toggled by clicking - on the actor. The effect is implemented in - a header - file and a C - code file. - - - - The application - creates textures from the file paths specified - on the command line then applies both of these effects to - each texture. In the case of the CbBorderEffect, - a 5 pixel red border is applied; this is also disabled by default, - and enabled when a texture is clicked. - - Here is an example of the output when the application is loaded - with four images: - - - - - - - - Applying CbBackgroundEffect - and a togglable CbBorderEffect - to a several textures - - - - -
- <type>CbBackgroundEffect</type> - - - <filename>cb-background-effect.h</filename> (header file) - - - a code sample should be here... but isn't - - - - - - <filename>cb-background-effect.c</filename> (code file) - - - a code sample should be here... but isn't - - - -
- -
- <type>CbBorderEffect</type> - - This is a more sophisticated effect with configurable - border color and width. - - - <filename>cb-border-effect.h</filename> (header file) - - - a code sample should be here... but isn't - - - - - - <filename>cb-border-effect.c</filename> (code file) - - - a code sample should be here... but isn't - - - -
- -
- Application - - - Application which applies <type>CbBorderEffect</type> - and <type>CbBackgroundEffect</type> to a group of - <type>ClutterTextures</type>. - - - a code sample should be here... but isn't - - - -
- -
- -
- -
- Creating and animating a custom <type>ClutterDeformEffect</type> - -
- Problem - - You want to deform an actor's geometry: for example, - to make it appear stretched, twisted or folded. - - This recipe demonstrates how to do this with a simple page - fold effect, which folds one half of the actor over its other half. -
- -
- Solution - - Subclass ClutterDeformEffect and - implement a deform_vertex() function - to modify the actor's vertices. - - The signature for deform_vertex() - is: - - - -void -deform_vertex (ClutterDeformEffect *effect, - gfloat width, - gfloat height, - CoglTextureVertex *vertex); - - - - The width and height - are the width and height of the target material, stored in - the offscreen buffer. Usually the target material's size will - match the actor's transformed size; however, if the effect - implements create_texture(), the target - material's size may differ from the actor's transformed size. - - The vertex contains the position - and color of a vertex, to be deformed by your effect. - Your deform_vertex() - function should modify the member variables of this - CoglTextureVertex in place. Usually, this will - mean modifying the x, y - and y member variables of the vertex, - which describe its position in 3D space. - - The example function below, taken from - the - full example, applies a transformation to vertices falling - in the "right-hand" half of the actor (i.e. vertices with an - x value greater than or equal to half the - width of the actor). - - - -static void -cb_page_fold_effect_deform_vertex (ClutterDeformEffect *effect, - gfloat width, - gfloat height, - CoglTextureVertex *vertex) -{ - CbPageFoldEffectPrivate *priv = CB_PAGE_FOLD_EFFECT (effect)->priv; - - /* the rotation angle is modified by the percentage progress of the fold, - * as represented by the period variable - */ - gfloat radians = (priv->angle * priv->period) / (180.0f / G_PI); - - /* rotate from the center of the actor on the y axis */ - gfloat adjusted_x = vertex->x - (width / 2); - - /* only rotate vertices to the right of the middle of the actor */ - if (adjusted_x >= 0.0) - { - vertex->x = (vertex->z * sin (radians)) - + (adjusted_x * cos (radians)) - + width / 2; - - /* NB add 1 to z to prevent "z fighting"; otherwise, when fully-folded - * the image has "stripes" where vertices from the folded part - * of the actor interfere with vertices from the unfolded part - */ - vertex->z = (vertex->z * cos (radians)) - + (adjusted_x * sin (radians)) - + 1; - } - - /* adjust depth of all vertices so they fit inside the actor while folding; - * this has the effect of making the image smaller within the texture, - * but does produce a cleaner fold animation - */ - vertex->z -= width / 2; -} - - - - Note that this effect has two properties set in its - constructor or through setters: - - - - angle, representing the angle of - the full fold; for the actor to fully fold in half, this - would be set to 180.0 - - - - period, representing the percentage - of the fold to apply - - - - As well as rotating the vertex, the - deform_vertex() function also shifts - the z coordinate "up" by 1 - (towards the viewpoint) for vertices on the right-hand side of the - actor. This is so that the "folded over" vertices - are above vertices on the left-hand side. Without this small - shift, the vertices interfere with each other, which can cause striping - artefacts. - - All vertices are also shifted "down", - so that the the folding part of the actor remains within the texture. - Otherwise the part which is folding may be clipped to the allocation of - the actor. - - This effect can now be applied to an actor, using the - approach - outlined - in the introduction. The result looks like this when - period is set to 0.25 and angle - to 180.0 (i.e. the page is folded by 45 degrees): - - - - - - - - Applying a custom ClutterDeformEffect - to a texture loaded with an image - - - - - Because the effect is a GObject which exposes its - properties, it can easily be animated, as described in - the - discussion section. - -
- -
- Discussion - - A deform effect processes an actor as follows: - - - - - The actor is divided into a series of - triangular tiles. The number of - horizontal and vertical tiles is configurable; - more tiles implies more vertices. See - this - section for more details about tiles. - - - - The position of each vertex of each - tile is then modified (or not) by the - deform_vertex() function. In this - function, you can change the vertex's position - (x, y, - z coordinates). You can also - modify the color at the vertex if desired. - - The resulting deformed vertices are stored - in an offscreen buffer. - - - - Once the deformation has been applied to - all vertices, the content of the offscreen buffer - is painted at the onscreen position of the actor. - - - - - You may find it useful to visualise this process by imagining - your actor's surface as a net, composed of triangles. (Something - like a fishing net, not a mathematical one.) At each corner of - each triangle is a marble; and between each pair of corners - is an infinitely flexible length of elastic. Moving a marble - doesn't change the position of its neighbours; it just stretches - or relaxes the elastic. - - In this analogy, the marbles are the vertices; and the - surfaces between the marbles, bordered by triangles of - elastic, are the tiles. More triangles (tiles) means more - marbles (vertices). - - When you create a ClutterDeformEffect, - think of it as specifying movements of marbles in the net. - Changing the position of a vertex corresponds to moving a marble - up/down (-/+ y position), left/right - (-/+ x position) or away/towards - you (-/+ z position) (ignoring color for the - moment). - - Now imagine that you are asked to fold the whole net of - marbles; but you can't just grab the edge of the net and pull - it over: you can only move one marble at a time. However, once moved, - each marble magically stays where you put it in 3D space. - - To do this, you could project where each marble would be if - you could fold the whole sheet in one go; then move the - marbles one by one to their projected positions. Even though - you'd be moving the marbles one at a time, it would eventually - look as though you'd folded the whole net with a single movement. - - When you write a ClutterDeformEffect, you have - to accomplish a similar feat: change the shape of an actor - by individually modifying the positions of points on its surface. In - most cases, your deform_vertex() implementation - can take advantage of an existing geometric transformation - method to achieve this. (For example, the page fold in this recipe - is based on equations from p.412 of Computer - Graphics (C Version), 2nd Edition by Hearn and - Baker, 1996.) - -
- Customising the back material - - When you set up a deform effect, you - can optionally specify a material to use for the "back" of - any actor it is applied to. - - If you think of an actor as a sheet of paper with a - picture on it, specifying a back is similar to turning the - sheet of paper over (rotating it around the - y axis) and drawing another picture on - the other side. If you then folded or twisted the paper, - you would be able to see parts of the pictures on both the - front and back of the paper. - - Similarly, during deformation of an actor, if any - vertices of the actor are deformed such that the actor's surface - is folded or twisted over itself, parts of its back - become visible. If you set a back material, you will see parts - of that where the surface is folded over. If you don't set a back - material, you will instead see mirror images of parts of the actor's - front: as if the actor was flexible stained glass, rather than paper. - You can see this if you watch the animation in - this - section. - - The back material should be an instance of - CoglMaterial. You can either create this via - the Cogl API directly; or indirectly through the Clutter API - (for example, by getting the material from a - ClutterTexture). The code below gives an example - of how to do the latter: - - - - - - - - See the ClutterDeformEffect API reference - for more details about back materials. - - Here's a screenshot of the - example - with the addition of a back material, folded at an angle - of 60 degrees: - - - - - - - - Applying a custom ClutterDeformEffect - to a texture loaded with an image - - - - -
- -
- Animating a custom deform effect - - Clutter's animation API can animate any GObject which - exposes its properties. In the case of the page fold effect, - we can expose the period property using - standard GObject property installation: - - - -/* GObject class init */ -static void -cb_page_fold_effect_class_init (CbPageFoldEffectClass *klass) -{ - GParamSpec *pspec; - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - /* ...other class setup code... */ - - /* expose the period as a GObject property */ - pspec = g_param_spec_double ("period", - "Period", - "The period of the page fold", - 0.0, 1.0, - 0.0, - G_PARAM_READWRITE); - obj_props[PROP_PERIOD] = pspec; - g_object_class_install_property (gobject_class, PROP_PERIOD, pspec); - - /* ...install other properties... */ -} - - - - We also add a get_property() - implementation, as well as a setter (see - the full - GObject implementation for details). - - Then set up an animation for the property; in this case, - using a ClutterState: - - - -ClutterEffect *effect = cb_page_fold_effect_new (180.0, 0.0); - -ClutterState *transitions = clutter_state_new (); -clutter_state_set_duration (transitions, NULL, NULL, 500); - -clutter_state_set (transitions, NULL, "unfolded", - effect, "period", CLUTTER_LINEAR, 0.0, - NULL); - -clutter_state_set (transitions, NULL, "folded", - effect, "period", CLUTTER_LINEAR, 1.0, - NULL); - - - - To start the animation, warp the ClutterState - into its "unfolded" state, then set it to - "folded": - - - -/* this changes state instantaneously */ -clutter_state_warp_to_state (transitions, "unfolded"); - -/* this starts an animation to the state */ -clutter_state_set_state (transitions, "folded"); - - - - Note that the - full code - sample is slightly more complex, as it triggers state - changes when a mouse button is pressed on the texture. There is - also a third "partially folded" state (used to create - the screenshot for the - previous - section). - - Here's what the resulting animation looks like: - - - - - - - Video showing animation of a custom deform effect - on a texture - - - -
- -
- Tiles - - A ClutterDeformEffect divides the actor - being deformed into a number of tiles: the larger the number - of tiles, the larger the number of vertices to be manipulated - by the effect. Increasing the number of tiles increases the number of - vertex computations required, which can slow down animations; - at the same time, finer-grained tiles can make an effect appear - smoother, particularly when animated. - - Most of the time, the default number - of tiles in the x and y - axes should suffice. You can get the current number of - tiles associated with an effect with: - - - - - - - - However, if an effect produces jerky or fragmented output, - you want to tweak the number of tiles. Use the - clutter_deform_effect_set_n_tiles() function - to do this: - - - -/* 64 tiles in both axes */ -guint x_tiles = 64; -guint y_tiles = 64; - -clutter_deform_effect_set_n_tiles (CLUTTER_DEFORM_EFFECT (effect), - x_tiles, - y_tiles); - - - -
- -
- -
- Full example - - This example consists of three files: - - - - A header - file for the CbPageFoldEffect GObject. - - - The - code file implementing CbPageFoldEffect. - - - A short - sample application which applies a CbPageFoldEffect - instance to an actor and animates the fold when the actor is - clicked. - - - - As Clutter effect subclasses are written using GObject, - you might find this recipe - (which goes into GObject in more detail) a useful introduction. - - - <filename>cb-page-fold-effect.h</filename> (header file) - - - a code sample should be here... but isn't - - - - - - <filename>cb-page-fold-effect.c</filename> (code file) - - - a code sample should be here... but isn't - - - - - - Application which uses <type>CbPageFoldEffect</type> - to do animated folding of a <type>ClutterTexture</type> - - - a code sample should be here... but isn't - - - - -
- -
- -
diff --git a/doc/cookbook/events.xml b/doc/cookbook/events.xml deleted file mode 100644 index 44d60ad6b..000000000 --- a/doc/cookbook/events.xml +++ /dev/null @@ -1,1424 +0,0 @@ - - - - Events - - - The Tenth Doctor (David Tennant) - Crossing into established events is strictly forbidden. Except for - cheap tricks. - - -
- Introduction - Once you have set up a scene on the stage, in order to respond - to user interaction you will have to handle events coming from the - underlying platform. - - Events are relayed to actors by Clutter in form of - signals; signals are a facility provided by the - GObject framework to call functions depending on a unique name. A signal - can be thought as a message that an object instance broadcasts to various - listener functions. - - There are various events that Clutter will handle: mostly, they - deal with input devices, like a mouse pointer or a keyboard; but they can - also come from the windowing system, like the - delete-event signal that is emitted when the user - closes the window of the stage. - - Each event has a particular source, that is - the actor that received the event. The event handling sequence is divided - in two phases: - - - the capture phase, which consists - in an emission of the captured-event signal - starting from the stage to, following the parent-child relationship, - the source of the event; - the bubble phase, which consists - in an emission of the event signal starting from - the source of the event to, following the parent-child - relationship, the stage. - - - At any point during the event emission sequence a handler of either - the captured-event or the event signals can stop it, by returning a boolean - value of true, which means that the event has been - handled. If an event hasn't been handled, a boolean value of - false should be returned instead. - - Clutter provides two useful macros to avoid remembering which - boolean value should be used in an event signal handler: - CLUTTER_EVENT_PROPAGATE, equivalent to FALSE; and CLUTTER_EVENT_STOP, - equivalent to TRUE. -
- -
- Handling key events - -
- Problem - You want to respond to key presses on an actor. -
- -
- Solutions - - There are two possible solutions: - - - - Solution 1: Connect a callback to the - actor; inside the callback, manually analyse which key and - modifier(s) were pressed and react accordingly. - - - Solution 2: Use an actor's - ClutterBindingPool to declaratively assign - actions to specific key and modifier combinations. - - - - Each solution is covered below. - -
- Solution 1 - - Connect the key-press-event - signal for an actor to a callback; then examine the event - in the callback to determine which key and modifiers were - pressed. - - First, connect an actor's - key-press-event signal to a callback: - - - -g_signal_connect (actor, "key-press-event", G_CALLBACK (_key_press_cb), NULL); - - - - Then, in the callback, check which key was pressed and which - modifiers were down at the same time. For example, this callback - checks for a press on the up arrow key and whether - the Shift and/or Ctrl - key were down: - - - - - - - - - Clutter provides a range of key value definitions - (like CLUTTER_KEY_Up, used above). These are - generated from the list in the - X.Org source code - (replace "XK" with "CLUTTER_KEY" in the definitions there to get the - Clutter equivalents; alternatively, look at the - clutter-keysyms.h header file for the - list). - - CLUTTER_SHIFT_MASK, - CLUTTER_CONTROL_MASK and other modifiers are - defined in the ClutterModifierType enum. - - -
- -
- Solution 2 - - Assign actions to an actor's ClutterBindingPool. - A binding pool stores mappings from a key press (either a single key - or a key plus modifiers) to actions; an action is simply a callback - function with a specific signature. - - While this approach is trickier to implement, it is more - flexible and removes the drudgery of writing branching code to - handle different key presses. See the - Discussion - section for more details. - - To use this approach with an actor which will receive key press - events, first get that actor's binding pool. In the example below, - we're using the binding pool for the default - ClutterStage: - - - -ClutterBindingPool *binding_pool; -GObjectClass *stage_class; - -stage_class = CLUTTER_STAGE_GET_CLASS (stage); -binding_pool = clutter_binding_pool_get_for_class (stage_class); - - - - Next, install actions into the binding pool. For example, to - install an action bound to the up arrow key, which calls the - _move_up() function when that key is pressed, - you would do: - - - -clutter_binding_pool_install_action (binding_pool, - "move-up", /* identifier */ - CLUTTER_KEY_Up, /* up arrow pressed */ - 0, /* no modifiers pressed */ - G_CALLBACK (_move_up), - NULL, /* no user data passed */ - NULL); - - - - Another example, binding up arrow + - Shift + Ctrl to an action - which calls _move_up_shift_control() when - activated: - - - -clutter_binding_pool_install_action (binding_pool, - "move-up-shift-control", - CLUTTER_KEY_Up, - CLUTTER_SHIFT_MASK + CLUTTER_CONTROL_MASK, - G_CALLBACK (_move_up_shift_control), - NULL, - NULL); - - - - The function called when an action is activated looks - like this (for _move_up()): - - - -static void -_move_up (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - g_debug ("Up pressed"); -} - - - - Then bind the key-press-event signal - for the actor (in our case, the stage) to a callback: - - - -g_signal_connect (stage, - "key-press-event", - G_CALLBACK (_key_press_cb), - NULL); - - - - Finally, inside the callback, pass control to the actor's - binding pool rather than dissecting the key press event - yourself: - - - -static gboolean -_key_press_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterBindingPool *pool; - - pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (actor)); - - return clutter_binding_pool_activate (pool, - clutter_event_get_key_symbol (event), - clutter_event_get_state (event), - G_OBJECT (actor)); -} - - - - Now, when a key + modifiers that have been bound to an action - are pressed on the actor, the appropriate action is activated. - -
-
- -
- Discussion - -
- Pros and cons of Solution 1 and Solution 2 - - Solution 1 is the simplest (in terms of the amount of code you - have to write for simple cases), but could quickly turn into a mess if - you need many conditions or want to capture many key combinations. - Also, if multiple actors need to respond to key press events, you'll - need similar event dissection code in each callback. - - Solution 2 is more complicated to implement, but scales better - if you have many different key combinations on multiple actors. - The binding pool protects you from the minutiae of detecting which - keys were pressed, leaving you to concentrate on the - triggered actions instead. This could simplify your control - logic. - - In addition, Solution 2 lets you write a single callback to - handle all key press events for all actors. This callback could then - use clutter_binding_pool_find() - (as in the example code) to determine which binding pool to - activate (depending on which actor received the key press - event). - - Finally, a binding pool allows you to block and unblock actions. - This means you can make the response to a key press event conditional - on application state. For example, let's say you wanted the up arrow - key to move an actor, but only when the actor is at the bottom - of the stage. To implement this, you could disable the up arrow key - action in the binding pool initially; then, once the actor reaches the - bottom of the stage, enable the up arrow key action again. While this - is possible with Solution 1, you would have to implement more of the - state management code yourself. -
- -
- Other useful things to know about key press events - - - - A ClutterKeyEvent contains only a - single key value, plus possibly one - or more modifier keys (like Shift, - Ctrl, Alt etc.). - There are no functions in the Clutter API which return - events for tracking near-simultaneous presses on multiple - keys. - - - - By default, the stage receives all key events. - To make another actor receive key events, use - clutter_stage_set_key_focus(): - - - -/* - * stage is a ClutterStage instance; - * actor is the ClutterActor instance which should receive key events - */ -clutter_stage_set_key_focus (stage, actor); - - - - - -
- -
- -
- -
- Detecting mouse scrolling on an actor - -
- Problem - - You want to detect when the mouse is scrolled on an - actor (e.g. the pointer is over an actor when a mouse - wheel is scrolled). -
- -
- Solution - - Connect a callback handler to the scroll-event - signal of an actor. - - First, ensure that the actor is reactive (i.e. will - respond to events): - - - - - - - - Next, create a callback handler to examine the scroll - event and respond to it: - - - - - - - - Finally, connect the callback handler to the - scroll-event signal of the actor: - - - - - - - -
- -
- Discussion - - A standard mouse wheel will only return up and - down movements; but in cases where the mouse has left and - right scrolling (e.g. a trackball mouse or trackpad), left and - right scroll events may also be emitted. - -
- Creating a scrolling viewport for an actor - - While the simple outline above explains the basics - of how to connect to scroll events, it doesn't do much to - help with really implementing scrolling - over an actor. That's what we'll do in this section. - - - The full code for the example we'll walk through here is - available in this later - section. - - - Scrolling over an actor actually requires coordination - between two components: - - - - - Scrollable actor - An actor which is too large to fit on the stage - or inside the area of the UI assigned to it (otherwise - there's no need to scroll over it...). - - - - - Viewport - This displays a cropped view of part of the scrollable - actor, revealing different parts of it as scroll events - occur. - - - - - Here are the steps required to set up the two actors: - - - - Create the scrollable actor; it should be larger - than the viewport. This example uses a ClutterTexture, - but any ClutterActor will work: - - -/* get image file path, set up stage etc. */ - -ClutterActor *texture; -texture = clutter_texture_new (); -clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), - TRUE); - -/* - * set the texture's height so it's as tall as the stage - * (STAGE_HEIGHT is define'd at the top of the file) - */ -clutter_actor_set_request_mode (texture, CLUTTER_REQUEST_WIDTH_FOR_HEIGHT); -clutter_actor_set_height (texture, STAGE_HEIGHT); - -/* - * load the image file; - * see this recipe for more about loading images into textures - */ -clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - image_file_path, - NULL); - - - - - - - Create the viewport. The simplest way to do - this is with a ClutterGroup: - - - - - - - - The key here is calling - clutter_actor_set_clip_to_allocation (viewport, TRUE). - This configures the viewport group so - that any of its children are clipped: i.e. only parts of - its children which fit inside its allocation are visible. This - in turn requires setting an explicit size on the group, - rather than allowing it to size itself to fit its - children (the latter is the default). - - - - - Put the scrollable actor into the viewport; and - the viewport into its container (in this case, - the default stage): - - - -clutter_actor_add_child (viewport, texture); - -clutter_actor_add_child (stage, viewport); - - - - - - - Create a callback handler for scroll-event - signals emitted by the viewport: - - - - - - - - The approach taken here is to move the scrollable - actor up, relative to the viewport. Initially, the - scrollable will have a y coordinate value - of 0.0 (aligned to the top of the viewport). - Scrolling up decrements the - y coordinate (down to a minumum of - viewport_height - scrollable_height). This moves - the top of the scrollable actor "outside" the clip area of the - viewport; simultaneously, more of the bottom part of the - scrollable moves into the clip area, becoming visible. - - Scrolling down increments the y coordinate - (but only up to a maximum value of 0.0). - - To see how this works in practice, look at - the code - sample. There, the height of the scrollable actor is - set to 300 and the height of the viewport to - 150. This means that the y - coordinate value for the scrollable actor will vary between - -150.0: 150 (the viewport's height) - - 300 (the scrollable actor's height), making - its base visible and clipping its top; and - 0.0, where its top is visible and its base - clipped. - - - - Connect the callback handler to the signal; note - that we pass the scrollable actor (the texture) to the callback, - as we're moving the texture relative to the viewport to - create the scrolling effect: - - - -g_signal_connect (viewport, - "scroll-event", - G_CALLBACK (_scroll_event_cb), - texture); - - - - - - - Here's a video of the result: - - - - - - - Video showing a scrollable actor - - - -
-
- -
- Full example - - - Mouse scrolling over a <type>ClutterActor</type> - - - a code sample should be here... but isn't - - - -
- -
- -
- Detecting pointer movements on an actor - -
- Problem - - You want to be able to tell when the pointer (e.g. associated - with a mouse or touches on a screen) enters, leaves, or moves over - an actor. - - Example use cases include: - - - - Adding a tooltip or hover effect to an actor when - a pointer moves onto it. - - - Tracing the path of the pointer over an actor (e.g. - in a drawing application). - - - -
- -
- Solution - - Connect to the pointer motion signals emitted by the actor. - -
- Responding to crossing events - - To detect the pointer crossing the boundary of an actor - (entering or leaving), connect to the enter-event - and/or leave-event signals. For example: - - - -ClutterActor *actor = clutter_texture_new (); - -/* ...set size, color, image etc., depending on the actor... */ - -/* make the actor reactive: see Discussion for more details */ -clutter_actor_set_reactive (actor, TRUE); - -/* connect to the signals */ -g_signal_connect (actor, - "enter-event", - G_CALLBACK (_pointer_enter_cb), - NULL); - -g_signal_connect (actor, - "leave-event", - G_CALLBACK (_pointer_leave_cb), - NULL); - - - - The signature for callbacks connected to each of these - signals is: - - - -gboolean -_on_crossing (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) - - - - In the callback, you can examine the event to get the - coordinates where the pointer entered or left the actor. For - example, _pointer_enter_cb() could - follow this template: - - - - - - - - See the - code example in the appendix for an example of how - you can implement a hover effect on a "button" (rectangle - with text overlay) using this approach. - -
- -
- Responding to motion events - - Motion events occur when a pointer moves over an actor; - the actor emits a motion-event signal when this - happens. To respond to motion events, connect to this signal: - - - -/* set up the actor, make reactive etc., as above */ - -/* connect to motion-event signal */ -g_signal_connect (actor, - "motion-event", - G_CALLBACK (_pointer_motion_cb), - transitions); - - - - The signature of the callback is the same as for - the enter-event/leave-event signals, so you can use - code - similar to the above to handle it. However, the - type of the event is a ClutterMotionEvent - (rather than a ClutterCrossingEvent). - -
- -
- -
- Discussion - - A few more useful things to know about pointer motion - events: - - - - - Each crossing event is accompanied by a motion event at - the same coordinates. - - - - Before an actor will emit signals for pointer events, - it needs to be made reactive with: - - - -clutter_actor_set_reactive (actor, TRUE); - - - - - - A pointer event structure includes other data. Some - examples: - - - -/* keys and mouse buttons pressed down when the pointer moved */ -ClutterModifierType modifiers = clutter_event_get_state (event); - -/* time (since the epoch) when the event occurred */ -guint32 event_time = clutter_event_get_time (event); - -/* actor where the event originated */ -ClutterActor *actor = clutter_event_get_actor (event); - -/* stage where the event originated */ -ClutterStage *stage = clutter_event_get_stage (event); - - - - There's no need to cast the event to use these - functions: they will work on any ClutterEvent. - - - - The coordinates of an event (as returned by - clutter_event_get_coords()) are relative - to the stage where they originated, rather than the actor. Unless - the actor is the same size as the stage, you'll typically want - the actor-relative coordinates instead. To get those, use - clutter_actor_transform_stage_point(). - - - - - The simple - scribble application gives a more - thorough example of how to integrate pointer events into a - Clutter application (in this case, for drawing on a - ClutterTexture). - - The effect of actor depth on pointer motion events is - worth slightly deeper discussion, and is covered next. - -
- Pointer events on actors at different depths - - If you have actors stacked on top of each other, the - reactive actor nearest the "top" is the one - which emits the signal (when the pointer crosses into or moves - over it). "Top" here means either at the top of - the depth ordering (if all actors are at the same depth) - or the closest to the view point (if actors have different - depths in the z axis). - - Here's an example of three rectangles overlapping each - other: - - - - - - - - Pointer events in actors with different depth ordering - - - - - The rectangles are all at the same point on the - z axis but stacked (different positions in the depth - order). They have the following properties: - - - - The red rectangle is lowest down - the depth ordering and reactive. Pointer motion signals are - emitted by this actor when the pointer crosses or moves on the - area of the rectangle not overlapped by the - green rectangle. - - - The green rectangle is in the - middle of the depth ordering and reactive. This actor emits - events over its whole surface, even though it is overlapped - by the blue rectangle (as the blue rectangle is not - reactive). - Even if the blue rectangle were fully opaque, a pointer - crossing into or moving on the green rectangle's area (even if - obscured by the blue rectangle) would still cause a signal - to be emitted. - - - The blue rectangle is at the top - of the depth ordering and not reactive. - This actor doesn't emit any pointer motion signals and doesn't - block events from occurring on any other actor. - - - - See the - sample code in the appendix for more details. - -
- -
- -
- Full examples - - - Simple button with a hover animation (change in opacity - as the pointer enters and leaves it) - - - a code sample should be here... but isn't - - - - - - Detecting pointer motion on a <type>ClutterRectangle</type> - - - a code sample should be here... but isn't - - - - - - How actors influence pointer events on each other - - - a code sample should be here... but isn't - - - - - - Scribbling on a <type>ClutterTexture</type> in response - to pointer events - - - a code sample should be here... but isn't - - - - -
- -
- -
- Making an actor respond to button events - -
- Problem - - You want an actor to respond to button events. These might - be buttons on an input device like a mouse; - or input events caused by other means, like touches on a screen. - - Some examples of where this is useful: - - - - For implementing button widgets which respond to - button clicks. - - - To make actor selections by mouse click (e.g. - as part of a drawing application). - - - To recognise a button press followed by pointer - motion and button release (e.g. to implement drag - and drop or kinetic animations). - - - -
- -
- Solution - - Connect a handler to the button-press-event - and/or button-release-event signals of an - actor. - - - The button-press-event is emitted - when a button is pressed (not necessarily released) on a reactive - actor; the button-release-event when a - button is released on a reactive actor (even if the button was - pressed down somewhere else). - - - First, ensure the actor is reactive: - - - -clutter_actor_set_reactive (actor, TRUE); - - - - Next, create a function to handle the signal(s) you are - interested in. The function signature is the same for both the - press and release signals: - - - -gboolean -callback_function (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data); - - - - You can use a single function as the - callback for both signals (or write a different one for each signal). - Here's an example function which can be used as a callback - for both press and release signals, as it simply pulls data - out of the event and displays it: - - - -/* event is a ClutterButtonEvent - * for both the press and the release signal; it contains - * data about where the event occurred - */ -static gboolean -button_event_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat x, y; - gchar *event_type; - guint button_pressed; - ClutterModifierType state; - gchar *ctrl_pressed; - guint32 click_count; - - /* where the pointer was (relative to the stage) - * when the button event occurred; use - * clutter_actor_transform_stage_point() - * to transform to actor-relative coordinates - */ - clutter_event_get_coords (event, &x, &y); - - /* check whether it was a press or release event */ - event_type = "released"; - if (clutter_event_type (event) == CLUTTER_BUTTON_PRESS) - event_type = "pressed"; - - /* which button triggered the event */ - button_pressed = clutter_event_get_button (event); - - /* keys down when the event occurred; - * this is a bit mask composed of the bits for each key held down - * when the button was pressed or released; see the - * ClutterModifierType enum in the Clutter API docs - * for a list of the available modifiers - */ - state = clutter_event_get_state (event); - - ctrl_pressed = "ctrl not pressed"; - if (state & CLUTTER_CONTROL_MASK) - ctrl_pressed = "ctrl pressed"; - - /* click count */ - click_count = clutter_event_get_click_count (event); - - g_debug ("button %d was %s at %.0f,%.0f; %s; click count %d", - button_pressed, - event_type, - x, - y, - ctrl_pressed, - click_count); - - return CLUTTER_EVENT_STOP; -} - - - - Finally, connect the signals to the function(s): - - - -/* connect the press event */ -g_signal_connect (actor, - "button-press-event", - G_CALLBACK (button_event_cb), - NULL); - -/* connect the release event */ -g_signal_connect (actor, - "button-release-event", - G_CALLBACK (button_event_cb), - NULL); - - - - Pressing or releasing a button on the actor will now - trigger a call to the button_event_cb() - function. See the full - example for more details. - -
- -
- Discussion - - Properties of the ClutterButtonEvent - emitted by both signals should be examined using the - clutter_event_* functions (rather than struct - members directly), as in the example above. While most of these - functions are self-explanatory, a couple require more explanation: - see the sections below. - - Also covered below is an alternative approach to handling a - button press followed by a release on a single actor: by adding - a ClutterClickAction to an actor. See - this section - for details. - - Finally, a longer - example is included, showing how to make use of button press, - button release and pointer events in a simple drawing application. - -
- Click count - - The click count records the number of times a press/release - pair occurred in sequence. You can retrieve it via the - clutter_event_get_click_count() function. - - - A press/release pair is effectively a click, so this term - will be used from now on throughout this section, - to make the explanation simpler. However, the click count has - nothing to do with ClutterClickActions, described - later. - - - - For clicks to be considered part of the same sequence (for - the purposes of counting), all the clicks after the first one - must occur within the global double_click_distance - (pixels) of the first click; and the time between click - n and click n+1 must be <= - the global double_click_time (milliseconds). - - The clicks do not have to occur on - the same actor: providing they occur within the double click - distance and time, they are counted as part of the same click - sequence. Also note that the clicks don't even have to happen - on a reactive actor: providing they happen somewhere on the - stage, they will still increment the click count. - - The default double click time and distance are - stored in the ClutterSettings associated - with an application. You can get/set their values like this: - - - -gint double_click_distance; -gint double_click_time; - -ClutterSettings *settings = clutter_settings_get_default (); - -/* get double click settings */ -g_object_get (settings, - "double-click-distance", &double_click_distance, - "double-click-time", &double_click_time, - NULL); - -/* set */ -g_object_set (settings, - "double-click-distance", 50, - "double-click-time", 1000, - NULL); - - - -
- -
- Button numbering - - clutter_event_get_button() returns - an integer representing the pressed or released button. - - In the case of a standard scroll mouse, the numbers - returned are reliable across different hardware models: - - - - 1 = left mouse button in a right-handed configuration, - or the right mouse button in a left-handed configuration - - - 2 = scroll wheel button - - - 3 = right mouse button in a right-handed configuration, - or the left mouse button in a left-handed configuration - - - - Clutter provides symbolic names for the three buttons - above: CLUTTER_BUTTON_PRIMARY, CLUTTER_BUTTON_MIDDLE, and - CLUTTER_BUTTON_SECONDARY. - - For mice with more buttons, or other types of - input devices, the mappings may not be so - straightforward: you may have to experiment to see - which button returns which value. - -
- -
- <type>ClutterClickAction</type> - - ClutterActions add flexible event handling - to ClutterActors. They recognise and abstract - common sequences of low-level events into a single, more easily - managed high-level event. In the case of a - ClutterClickAction, the abstraction is over - a press followed by a release on a single actor. This is - achieved by "synthesising" the press and release signals on - the actor: in other words, the action captures those - two signals when emitted by a single actor; and, once captured, the - action emits a single clicked signal - instead of the two signals being - emitted by the actor. - - The pointer can move off the actor between the press and - release, but the press and release must both occur on the same - actor, with no intervening presses or releases on other - actors. In addition, there are no maximum distance or time - constraints on the press and release. - - If a press occurs and you want to force it to be released - (e.g. to break a pointer grab after a certain length of - time has elapsed), use - clutter_click_action_release(). - - On the down side, the clicked signal - doesn't present the same detailed ClutterButtonEvent - to the handler. So, for example, you can't get a click count from a - ClutterClickAction (though you could count - the clicks yourself, of course); and you don't have access - to the coordinates where the press or release occurred. - - To add a click action to a ClutterActor: - - - -ClutterAction *action = clutter_click_action_new (); -clutter_actor_add_action (actor, action); - - - - - An actor must still be set to reactive so that its - signals can be routed to a click action. - - - Create a handler function (note the function - signature is different from the one for the press or - releas signal handler): - - - -void -clicked_cb (ClutterClickAction *action, - ClutterActor *actor, - gpointer user_data) -{ - /* display the number of the clicked button (equivalent - * to the number returned by clutter_event_get_button()) - */ - g_debug ("Button %d clicked", clutter_click_action_get_button (action)); -} - - - - Connect the signal to the handler: - - - -g_signal_connect (action, - "clicked", - G_CALLBACK (clicked_cb), - NULL); - - - - The example - code gives a bit more detail about how to use click - actions. - -
- -
- -
- Full examples - - - Examining properties of a <type>ClutterButtonEvent</type> - - - a code sample should be here... but isn't - - - - - - Using <type>ClutterClickAction</type> to capture - button events on an actor - - - a code sample should be here... but isn't - - - - - - Using button and pointer events for drawing - This code was inspired by - ClutterSmith - - - - a code sample should be here... but isn't - - - - -
- -
- -
diff --git a/doc/cookbook/examples/Makefile.am b/doc/cookbook/examples/Makefile.am deleted file mode 100644 index 80118527f..000000000 --- a/doc/cookbook/examples/Makefile.am +++ /dev/null @@ -1,140 +0,0 @@ -NULL = - -EXTRA_DIST = - -noinst_PROGRAMS = -examples_DATA = - -examplesdir = $(datadir)/clutter-1.0/cookbook/examples - -all_examples = \ - actors-composite-main \ - animations-complex \ - animations-looping-animator \ - animations-looping-implicit \ - animations-looping-state \ - animations-moving-animator \ - animations-moving-implicit \ - animations-moving-state \ - animations-path \ - animations-path-circle \ - animations-path-easing \ - animations-reuse \ - animations-rotating \ - animations-scaling \ - animations-scaling-zoom \ - effects-basic \ - effects-built-in \ - effects-custom-deform \ - text-shadow \ - textures-reflection \ - textures-split-go \ - textures-sub-texture \ - layouts-bind-constraint-allocation \ - layouts-bind-constraint-overlay \ - layouts-bind-constraint-stage \ - layouts-box \ - layouts-box-menu \ - layouts-box-property-effects \ - layouts-stacking \ - layouts-stacking-diff-sized-actors \ - events-mouse-scroll \ - events-pointer-motion \ - events-pointer-motion-crossing \ - events-pointer-motion-stacked \ - events-pointer-motion-scribbler \ - textures-crossfade \ - textures-crossfade-cogl \ - textures-crossfade-slideshow \ - script-ui \ - script-signals \ - script-states \ - events-buttons \ - events-buttons-click \ - events-buttons-lasso \ - $(NULL) - -LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(LIBM) - -AM_CFLAGS = $(CLUTTER_CFLAGS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/ \ - -I$(top_builddir)/ \ - -I$(top_srcdir)/clutter \ - -I$(top_builddir)/clutter \ - -DG_DISABLE_SINGLE_INCLUDES \ - -DCOGL_DISABLE_DEPRECATION_WARNINGS \ - -DCLUTTER_DISABLE_DEPRECATION_WARNINGS \ - $(NULL) - -AM_LDFLAGS = $(CLUTTER_LIBS) -export-dynamic - -actors_composite_main_SOURCES = cb-button.c cb-button.h actors-composite-main.c -animations_complex_SOURCES = animations-complex.c -animations_looping_animator_SOURCES = animations-looping-animator.c -animations_looping_implicit_SOURCES = animations-looping-implicit.c -animations_looping_state_SOURCES = animations-looping-state.c -animations_moving_animator_SOURCES = animations-moving-animator.c -animations_moving_implicit_SOURCES = animations-moving-implicit.c -animations_moving_state_SOURCES = animations-moving-state.c -animations_path_SOURCES = animations-path.c -animations_path_circle_SOURCES = animations-path-circle.c -animations_path_easing_SOURCES = animations-path-easing.c -animations_reuse_SOURCES = animations-reuse.c -animations_rotating_SOURCES = animations-rotating.c -animations_scaling_SOURCES = animations-scaling.c -animations_scaling_zoom_SOURCES = animations-scaling-zoom.c -effects_basic_SOURCES = cb-border-effect.c \ - cb-border-effect.h \ - cb-background-effect.c \ - cb-background-effect.h \ - effects-basic.c -effects_built_in_SOURCES = effects-built-in.c -effects_custom_deform_SOURCES = cb-page-fold-effect.c cb-page-fold-effect.h effects-custom-deform.c -text_shadow_SOURCES = text-shadow.c -textures_reflection_SOURCES = textures-reflection.c -textures_split_go_SOURCES = textures-split-go.c -textures_sub_texture_SOURCES = textures-sub-texture.c -layouts_bind_constraint_allocation_SOURCES = layouts-bind-constraint-allocation.c -layouts_bind_constraint_overlay_SOURCES = layouts-bind-constraint-overlay.c -layouts_bind_constraint_stage_SOURCES = layouts-bind-constraint-stage.c -layouts_box_SOURCES = layouts-box.c -layouts_box_menu_SOURCES = layouts-box-menu.c -layouts_box_property_effects_SOURCES = layouts-box-property-effects.c -layouts_stacking_SOURCES = layouts-stacking.c -layouts_stacking_diff_sized_actors_SOURCES = layouts-stacking-diff-sized-actors.c -events_mouse_scroll_SOURCES = events-mouse-scroll.c -events_pointer_motion_SOURCES = events-pointer-motion.c -events_pointer_motion_crossing_SOURCES = events-pointer-motion-crossing.c -events_pointer_motion_stacked_SOURCES = events-pointer-motion-stacked.c -events_pointer_motion_scribbler_SOURCES = events-pointer-motion-scribbler.c -textures_crossfade_SOURCES = textures-crossfade.c -textures_crossfade_cogl_SOURCES = textures-crossfade-cogl.c -textures_crossfade_slideshow_SOURCES = textures-crossfade-slideshow.c -script_ui_SOURCES = script-ui.c -script_signals_SOURCES = script-signals.c -script_states_SOURCES = script-states.c -events_buttons_SOURCES = events-buttons.c -events_buttons_click_SOURCES = events-buttons-click.c -events_buttons_lasso_SOURCES = events-buttons-lasso.c - -ui_data = \ - $(srcdir)/animations-complex.json \ - $(srcdir)/animations-complex-overlapping.json \ - $(srcdir)/animations-reuse-animation.json \ - $(srcdir)/animations-reuse-ui.json \ - $(srcdir)/script-signals.json \ - $(srcdir)/script-states.json \ - $(srcdir)/script-ui.json \ - $(NULL) - -img_data = \ - $(srcdir)/redhand.png \ - $(srcdir)/smiley.png \ - $(NULL) - -EXTRA_DIST += $(ui_data) $(img_data) - -examples_DATA += $(ui_data) $(img_data) $(srcdir)/*.c $(srcdir)/*.h -noinst_PROGRAMS += $(all_examples) diff --git a/doc/cookbook/examples/actors-composite-main.c b/doc/cookbook/examples/actors-composite-main.c deleted file mode 100644 index bcbe9358a..000000000 --- a/doc/cookbook/examples/actors-composite-main.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include "cb-button.h" - -/* colors */ -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor white_color = { 0xff, 0xff, 0xff, 0xff }; -static const ClutterColor yellow_color = { 0x88, 0x88, 0x00, 0xff }; - -/* click handler */ -static void -clicked (CbButton *button, - gpointer data) -{ - const gchar *current_text; - - g_debug ("Clicked"); - - current_text = cb_button_get_text (button); - - if (g_strcmp0 (current_text, "hello") == 0) - cb_button_set_text (button, "world"); - else - cb_button_set_text (button, "hello"); -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *button; - ClutterConstraint *align_x_constraint; - ClutterConstraint *align_y_constraint; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - button = cb_button_new (); - cb_button_set_text (CB_BUTTON (button), "hello"); - - /* the following is equivalent to the two lines above: - * - * button = g_object_new (CB_TYPE_BUTTON, - * "text", "winkle", - * NULL); - * - * because we defined a set_property function, which can accept - * a PROP_TEXT parameter, GObject can create a button and set one - * or more properties with a single call to g_object_new() - */ - - /* note that the size of the button is left to Clutter's size requisition */ - cb_button_set_text_color (CB_BUTTON (button), &white_color); - cb_button_set_background_color (CB_BUTTON (button), &yellow_color); - g_signal_connect (button, "clicked", G_CALLBACK (clicked), NULL); - - align_x_constraint = clutter_align_constraint_new (stage, - CLUTTER_ALIGN_X_AXIS, - 0.5); - - align_y_constraint = clutter_align_constraint_new (stage, - CLUTTER_ALIGN_Y_AXIS, - 0.5); - - clutter_actor_add_constraint (button, align_x_constraint); - clutter_actor_add_constraint (button, align_y_constraint); - - clutter_actor_add_child (stage, button); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-complex-overlapping.json b/doc/cookbook/examples/animations-complex-overlapping.json deleted file mode 100644 index cae2a96ac..000000000 --- a/doc/cookbook/examples/animations-complex-overlapping.json +++ /dev/null @@ -1,80 +0,0 @@ -[ - { - "type" : "ClutterStage", - "id" : "stage", - "width" : 550, - "height" : 350, - "color" : "#333355ff", - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" }, - { "name" : "key-press-event", "handler" : "foo_key_pressed_cb" } - ], - - "children" : [ - { - "type" : "ClutterRectangle", - "id" : "rectangle", - "color" : "red", - "width" : 50, - "height" : 50, - "x" : 0, - "y" : 0, - "scale-gravity" : "center" - } - ] - }, - - { - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 4000, - - "properties" : [ - { - "object" : "rectangle", - "name" : "x", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 0.1, "easeInCubic", 50.0 ], - [ 0.2, "easeInCubic", 200.0 ], - [ 0.4, "easeInCubic", 75.0 ], - [ 0.5, "easeOutCubic", 300.0 ], - [ 1.0, "easeInCubic", 400.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "y", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 0.1, "easeInCubic", 50.0 ], - [ 0.2, "easeInCubic", 200.0 ], - [ 0.4, "easeInCubic", 75.0 ], - [ 0.5, "easeOutCubic", 150.0 ], - [ 1.0, "easeInCubic", 200.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "scale-x", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 1.0 ], - [ 1.0, "linear", 4.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "scale-y", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 1.0 ], - [ 1.0, "linear", 4.0 ] - ] - } - ] - } -] diff --git a/doc/cookbook/examples/animations-complex.c b/doc/cookbook/examples/animations-complex.c deleted file mode 100644 index b7b15a68d..000000000 --- a/doc/cookbook/examples/animations-complex.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include - -#define UI_FILE "animations-complex.json" - -/* - * start the animation when a key is pressed; - * see the signals recipe in the Script chapter for more details - */ -gboolean -foo_key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterScript *script = CLUTTER_SCRIPT (user_data); - - ClutterAnimator *animator; - clutter_script_get_objects (script, - "animator", &animator, - NULL); - - if (clutter_timeline_is_playing (clutter_animator_get_timeline (animator))) - return FALSE; - - clutter_animator_start (animator); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - gchar *filename = UI_FILE; - - ClutterScript *script; - ClutterActor *stage; - - GError *error = NULL; - - if (argc > 1) - filename = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - script = clutter_script_new (); - clutter_script_load_from_file (script, filename, &error); - - if (error != NULL) - { - g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - /* connect signal handlers as defined in the script */ - clutter_script_connect_signals (script, script); - - clutter_script_get_objects (script, - "stage", &stage, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (script); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-complex.json b/doc/cookbook/examples/animations-complex.json deleted file mode 100644 index 39636f899..000000000 --- a/doc/cookbook/examples/animations-complex.json +++ /dev/null @@ -1,80 +0,0 @@ -[ - { - "type" : "ClutterStage", - "id" : "stage", - "width" : 400, - "height" : 400, - "color" : "#333355ff", - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" }, - { "name" : "key-press-event", "handler" : "foo_key_pressed_cb" } - ], - - "children" : [ - { - "type" : "ClutterRectangle", - "id" : "rectangle", - "color" : "red", - "width" : 100, - "height" : 100, - "x" : 0, - "y" : 0, - "scale-gravity" : "center" - } - ] - }, - - { - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 3000, - - "properties" : [ - { - "object" : "rectangle", - "name" : "x", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 0.1, "easeInCubic", 150.0 ], - [ 0.8, "linear", 150.0 ], - [ 1.0, "easeInCubic", 0.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "y", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 0.1, "easeInCubic", 150.0 ], - [ 0.8, "linear", 150.0 ], - [ 1.0, "easeInCubic", 300.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "scale-x", - "ease-in" : true, - "keys" : [ - [ 0.1, "linear", 1.0 ], - [ 0.3, "easeOutBounce", 2.0 ], - [ 0.8, "linear", 2.0 ], - [ 1.0, "linear", 1.0 ] - ] - }, - { - "object" : "rectangle", - "name" : "scale-y", - "ease-in" : true, - "keys" : [ - [ 0.1, "linear", 1.0 ], - [ 0.3, "easeOutBounce", 2.0 ], - [ 0.8, "linear", 2.0 ], - [ 1.0, "linear", 1.0 ] - ] - } - ] - } -] diff --git a/doc/cookbook/examples/animations-looping-animator.c b/doc/cookbook/examples/animations-looping-animator.c deleted file mode 100644 index 96280bcb5..000000000 --- a/doc/cookbook/examples/animations-looping-animator.c +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterTimeline *timeline = CLUTTER_TIMELINE (user_data); - - if (!clutter_timeline_is_playing (timeline)) - clutter_timeline_start (timeline); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *actor; - ClutterTimeline *timeline; - ClutterAnimator *animator; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 300, 200); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - actor = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (actor, 100, 100); - clutter_actor_set_position (actor, 150, 50); - - timeline = clutter_timeline_new (2000); - clutter_timeline_set_repeat_count (timeline, -1); - - animator = clutter_animator_new (); - clutter_animator_set_timeline (animator, timeline); - - clutter_animator_set (animator, - actor, "x", CLUTTER_LINEAR, 0.0, 150.0, - actor, "x", CLUTTER_LINEAR, 0.5, 50.0, - actor, "x", CLUTTER_LINEAR, 1.0, 150.0, - NULL); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - timeline); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (animator); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-looping-implicit.c b/doc/cookbook/examples/animations-looping-implicit.c deleted file mode 100644 index c72fe8047..000000000 --- a/doc/cookbook/examples/animations-looping-implicit.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; - -typedef struct -{ - ClutterActor *actor; - ClutterTimeline *timeline; -} State; - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *state = (State *) user_data; - - /* only start animating if actor isn't animating already */ - if (clutter_actor_get_animation (state->actor) == NULL) - clutter_actor_animate_with_timeline (state->actor, - CLUTTER_LINEAR, - state->timeline, - "x", 50.0, - NULL); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - State *state = g_new0 (State, 1); - - ClutterActor *stage; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 300, 200); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - state->actor = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (state->actor, 100, 100); - clutter_actor_set_position (state->actor, 150, 50); - - state->timeline = clutter_timeline_new (1000); - clutter_timeline_set_repeat_count (state->timeline, -1); - clutter_timeline_set_auto_reverse (state->timeline, TRUE); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - state); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), state->actor); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (state->timeline); - g_free (state); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-looping-state.c b/doc/cookbook/examples/animations-looping-state.c deleted file mode 100644 index 43edb59cd..000000000 --- a/doc/cookbook/examples/animations-looping-state.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; - -static void -next_state (ClutterState *transitions, - gpointer user_data) -{ - const gchar *state = clutter_state_get_state (transitions); - - if (g_strcmp0 (state, "right") == 0) - clutter_state_set_state (transitions, "left"); - else - clutter_state_set_state (transitions, "right"); -} - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - - if (!clutter_timeline_is_playing (clutter_state_get_timeline (transitions))) - next_state (transitions, NULL); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *actor; - ClutterState *transitions; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 300, 200); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - actor = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_position (actor, 150, 50); - clutter_actor_set_size (actor, 100, 100); - - transitions = clutter_state_new (); - clutter_state_set_duration (transitions, NULL, NULL, 1000); - - clutter_state_set (transitions, NULL, "right", - actor, "x", CLUTTER_LINEAR, 150.0, - NULL); - - clutter_state_set (transitions, NULL, "left", - actor, "x", CLUTTER_LINEAR, 50.0, - NULL); - - clutter_state_warp_to_state (transitions, "right"); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - transitions); - - g_signal_connect (transitions, - "completed", - G_CALLBACK (next_state), - NULL); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), actor); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (transitions); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-moving-animator.c b/doc/cookbook/examples/animations-moving-animator.c deleted file mode 100644 index 091e37e8c..000000000 --- a/doc/cookbook/examples/animations-moving-animator.c +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include - -typedef struct -{ - ClutterActor *stage; - ClutterActor *group; - ClutterAnimator *animator; -} State; - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green_color = { 0x00, 0xff, 0x00, 0xff }; -static const ClutterColor blue_color = { 0x00, 0x00, 0xff, 0xff }; - -/* add keys to the animator such that the actor is moved - * to a random x position - */ -static void -add_keys_for_actor (ClutterActor *actor, - ClutterAnimator *animator) -{ - gfloat x, end_x; - - x = clutter_actor_get_x (actor); - - end_x = 50.0; - if (x == 50.0) - end_x = 225.0 + (100.0 * rand () / (RAND_MAX + 1.0)); - - clutter_animator_set (animator, - actor, "x", CLUTTER_LINEAR, 0.0, x, - actor, "x", CLUTTER_EASE_OUT_CUBIC, 1.0, end_x, - NULL); -} - -static gboolean -move_actors (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *state = user_data; - ClutterActor *child; - - /* do nothing if the animator is already running */ - if (clutter_timeline_is_playing (clutter_animator_get_timeline (state->animator))) - return TRUE; - - /* remove all keys from the animator */ - clutter_animator_remove_key (state->animator, NULL, NULL, -1); - - /* add keys for all actors in the group */ - for (child = clutter_actor_get_first_child (state->group); - child != NULL; - child = clutter_actor_get_next_sibling (child)) - { - add_keys_for_actor (child, state->animator); - } - - /* start the animation */ - clutter_animator_start (state->animator); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *red; - ClutterActor *green; - ClutterActor *blue; - - State *state = g_new0 (State, 1); - - /* seed random number generator */ - srand ((unsigned int) time (NULL)); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - state->animator = clutter_animator_new (); - clutter_animator_set_duration (state->animator, 500); - - state->stage = clutter_stage_new (); - clutter_actor_set_size (state->stage, 400, 350); - clutter_stage_set_color (CLUTTER_STAGE (state->stage), &stage_color); - g_signal_connect (state->stage, - "destroy", - G_CALLBACK (clutter_main_quit), - NULL); - - state->group = clutter_actor_new (); - clutter_actor_add_child (state->stage, state->group); - - red = clutter_actor_new (); - clutter_actor_set_background_color (red, &red_color); - clutter_actor_set_size (red, 50, 50); - clutter_actor_set_position (red, 50, 50); - clutter_actor_add_child (state->group, red); - - green = clutter_actor_new (); - clutter_actor_set_background_color (green, &green_color); - clutter_actor_set_size (green, 50, 50); - clutter_actor_set_position (green, 50, 150); - clutter_actor_add_child (state->group, green); - - blue = clutter_actor_new (); - clutter_actor_set_background_color (blue, &blue_color); - clutter_actor_set_size (blue, 50, 50); - clutter_actor_set_position (blue, 50, 250); - clutter_actor_add_child (state->group, blue); - - g_signal_connect (state->stage, - "key-press-event", - G_CALLBACK (move_actors), - state); - - clutter_actor_show (state->stage); - - clutter_main (); - - g_object_unref (state->animator); - g_free (state); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-moving-implicit.c b/doc/cookbook/examples/animations-moving-implicit.c deleted file mode 100644 index 460320f14..000000000 --- a/doc/cookbook/examples/animations-moving-implicit.c +++ /dev/null @@ -1,96 +0,0 @@ -#include -#include - -typedef struct -{ - gchar *axis; - gfloat target; -} AnimationSpec; - -static gboolean -button_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - AnimationSpec *animation_spec = user_data; - ClutterTransition *transition; - - if (clutter_actor_get_transition (actor, animation_spec->axis) != NULL) - return TRUE; - - clutter_actor_save_easing_state (actor); - clutter_actor_set_easing_duration (actor, 500); - - g_object_set (actor, animation_spec->axis, animation_spec->target, NULL); - transition = clutter_actor_get_transition (actor, animation_spec->axis); - clutter_timeline_set_auto_reverse (CLUTTER_TIMELINE (transition), TRUE); - clutter_timeline_set_repeat_count (CLUTTER_TIMELINE (transition), 1); - - clutter_actor_restore_easing_state (actor); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *rectangle1; - ClutterActor *rectangle2; - ClutterActor *rectangle3; - - AnimationSpec x_move = { "x", 50.0 }; - AnimationSpec y_move = { "y", 400.0 }; - AnimationSpec z_move = { "depth", -1000.0 }; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 500, 500); - clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Aluminium2); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - rectangle1 = clutter_actor_new (); - clutter_actor_set_background_color (rectangle1, CLUTTER_COLOR_ScarletRed); - clutter_actor_set_reactive (rectangle1, TRUE); - clutter_actor_set_size (rectangle1, 50, 50); - clutter_actor_set_position (rectangle1, 400, 400); - clutter_actor_add_child (stage, rectangle1); - - rectangle2 = clutter_actor_new (); - clutter_actor_set_background_color (rectangle2, CLUTTER_COLOR_Chameleon); - clutter_actor_set_reactive (rectangle2, TRUE); - clutter_actor_set_size (rectangle2, 50, 50); - clutter_actor_set_position (rectangle2, 50, 50); - clutter_actor_add_child (stage, rectangle2); - - rectangle3 = clutter_actor_new (); - clutter_actor_set_background_color (rectangle3, CLUTTER_COLOR_SkyBlue); - clutter_actor_set_reactive (rectangle3, TRUE); - clutter_actor_set_size (rectangle3, 50, 50); - clutter_actor_set_position (rectangle3, 225, 225); - clutter_actor_add_child (stage, rectangle3); - - g_signal_connect (rectangle1, - "button-press-event", - G_CALLBACK (button_pressed_cb), - &x_move); - - g_signal_connect (rectangle2, - "button-press-event", - G_CALLBACK (button_pressed_cb), - &y_move); - - g_signal_connect (rectangle3, - "button-press-event", - G_CALLBACK (button_pressed_cb), - &z_move); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-moving-state.c b/doc/cookbook/examples/animations-moving-state.c deleted file mode 100644 index 12086165b..000000000 --- a/doc/cookbook/examples/animations-moving-state.c +++ /dev/null @@ -1,99 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green_color = { 0x00, 0xff, 0x00, 0xff }; - -static gboolean -button_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - - /* set the state to the one with a name matching the actor's name */ - clutter_state_set_state (transitions, clutter_actor_get_name (actor)); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *red; - ClutterActor *green; - ClutterState *transitions; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 650, 500); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* actor names choose the next ClutterState to transition to */ - red = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_reactive (red, TRUE); - clutter_actor_set_name (red, "red"); - clutter_actor_set_size (red, 100, 100); - clutter_actor_set_position (red, 50, 50); - - green = clutter_rectangle_new_with_color (&green_color); - clutter_actor_set_reactive (green, TRUE); - clutter_actor_set_name (green, "green"); - clutter_actor_set_size (green, 100, 100); - clutter_actor_set_position (green, 50, 350); - - transitions = clutter_state_new (); - clutter_state_set_duration (transitions, NULL, NULL, 250); - - /* state names match actor names */ - clutter_state_set (transitions, NULL, "red", - red, "x", CLUTTER_EASE_OUT_CUBIC, 200.0, - red, "y", CLUTTER_EASE_OUT_CUBIC, 50.0, - red, "scale-x", CLUTTER_EASE_OUT_CUBIC, 4.0, - red, "scale-y", CLUTTER_EASE_OUT_CUBIC, 4.0, - green, "x", CLUTTER_EASE_OUT_CUBIC, 50.0, - green, "y", CLUTTER_EASE_OUT_CUBIC, 350.0, - green, "scale-x", CLUTTER_EASE_OUT_CUBIC, 1.0, - green, "scale-y", CLUTTER_EASE_OUT_CUBIC, 1.0, - NULL); - - clutter_state_set (transitions, NULL, "green", - green, "x", CLUTTER_EASE_OUT_CUBIC, 200.0, - green, "y", CLUTTER_EASE_OUT_CUBIC, 50.0, - green, "scale-x", CLUTTER_EASE_OUT_CUBIC, 4.0, - green, "scale-y", CLUTTER_EASE_OUT_CUBIC, 4.0, - red, "x", CLUTTER_EASE_OUT_CUBIC, 50.0, - red, "y", CLUTTER_EASE_OUT_CUBIC, 50.0, - red, "scale-x", CLUTTER_EASE_OUT_CUBIC, 1.0, - red, "scale-y", CLUTTER_EASE_OUT_CUBIC, 1.0, - NULL); - - g_signal_connect (red, - "button-press-event", - G_CALLBACK (button_pressed_cb), - transitions); - - g_signal_connect (green, - "button-press-event", - G_CALLBACK (button_pressed_cb), - transitions); - - clutter_container_add (CLUTTER_CONTAINER (stage), - red, - green, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (transitions); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-path-circle.c b/doc/cookbook/examples/animations-path-circle.c deleted file mode 100644 index ca7f28271..000000000 --- a/doc/cookbook/examples/animations-path-circle.c +++ /dev/null @@ -1,129 +0,0 @@ -#include -#include - -#define STAGE_SIDE 400.0 - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; - -/* Build a "circular" path out of 4 Bezier curves - * - * code modified from - * http://git.clutter-project.org/dax/tree/dax/dax-traverser-clutter.c#n328 - * - * see http://www.whizkidtech.redprince.net/bezier/circle/ - * for further explanation - */ -static ClutterPath * -build_circular_path (gfloat cx, - gfloat cy, - gfloat r) -{ - ClutterPath *path; - static gfloat kappa = 4 * (G_SQRT2 - 1) / 3; - - path = clutter_path_new (); - - clutter_path_add_move_to (path, cx + r, cy); - clutter_path_add_curve_to (path, - cx + r, cy + r * kappa, - cx + r * kappa, cy + r, - cx, cy + r); - clutter_path_add_curve_to (path, - cx - r * kappa, cy + r, - cx - r, cy + r * kappa, - cx - r, cy); - clutter_path_add_curve_to (path, - cx - r, cy - r * kappa, - cx - r * kappa, cy - r, - cx, cy - r); - clutter_path_add_curve_to (path, - cx + r * kappa, cy - r, - cx + r, cy - r * kappa, - cx + r, cy); - clutter_path_add_close (path); - - return path; -} - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterTimeline *timeline = CLUTTER_TIMELINE (user_data); - - if (!clutter_timeline_is_playing (timeline)) - clutter_timeline_start (timeline); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterPath *path; - ClutterConstraint *constraint; - ClutterAnimator *animator; - ClutterTimeline *timeline; - ClutterActor *stage; - ClutterActor *rectangle; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - rectangle = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (rectangle, STAGE_SIDE / 8, STAGE_SIDE / 8); - clutter_actor_set_position (rectangle, - STAGE_SIDE / 2, - STAGE_SIDE / 2); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), - rectangle); - - /* set up a path and make a constraint with it */ - path = build_circular_path (STAGE_SIDE / 2, - STAGE_SIDE / 2, - STAGE_SIDE / 4); - constraint = clutter_path_constraint_new (path, 0.0); - - /* apply the constraint to the rectangle; note that there - * is no need to name the constraint, as we will be animating - * the constraint's offset property directly using ClutterAnimator - */ - clutter_actor_add_constraint (rectangle, constraint); - - /* animation to animate the path offset */ - animator = clutter_animator_new (); - clutter_animator_set_duration (animator, 5000); - - /* use ClutterAnimator to animate the constraint directly */ - clutter_animator_set (animator, - constraint, "offset", CLUTTER_LINEAR, 0.0, 0.0, - constraint, "offset", CLUTTER_LINEAR, 1.0, 1.0, - NULL); - - timeline = clutter_animator_get_timeline (animator); - clutter_timeline_set_repeat_count (timeline, -1); - clutter_timeline_set_auto_reverse (timeline, TRUE); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - timeline); - - clutter_actor_show (stage); - - clutter_main (); - - /* clean up */ - g_object_unref (animator); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-path-easing.c b/doc/cookbook/examples/animations-path-easing.c deleted file mode 100644 index fc119fc08..000000000 --- a/doc/cookbook/examples/animations-path-easing.c +++ /dev/null @@ -1,105 +0,0 @@ -#include -#include - -typedef struct { - ClutterActor *red; - ClutterActor *green; - ClutterTimeline *timeline; -} State; - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green_color = { 0x00, 0xff, 0x00, 0xff }; - -static void -reverse_timeline (ClutterTimeline *timeline) -{ - ClutterTimelineDirection dir = clutter_timeline_get_direction (timeline); - - if (dir == CLUTTER_TIMELINE_FORWARD) - dir = CLUTTER_TIMELINE_BACKWARD; - else - dir = CLUTTER_TIMELINE_FORWARD; - - clutter_timeline_set_direction (timeline, dir); -} - -/* a key press either starts the timeline or reverses it */ -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *state = (State *) user_data; - - if (clutter_timeline_is_playing (state->timeline)) - reverse_timeline (state->timeline); - else - clutter_timeline_start (state->timeline); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - State *state = g_new0 (State, 1); - - ClutterActor *stage; - ClutterAnimator *animator; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - state->red = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (state->red, 100, 100); - clutter_actor_set_position (state->red, 300, 300); - - state->green = clutter_rectangle_new_with_color (&green_color); - clutter_actor_set_size (state->green, 100, 100); - clutter_actor_set_position (state->green, 0, 0); - - animator = clutter_animator_new (); - clutter_animator_set_duration (animator, 1000); - - clutter_animator_set (animator, - state->red, "x", CLUTTER_LINEAR, 0.0, 300.0, - state->red, "y", CLUTTER_LINEAR, 0.0, 300.0, - state->red, "x", CLUTTER_LINEAR, 1.0, 0.0, - state->red, "y", CLUTTER_EASE_IN_QUINT, 1.0, 0.0, - NULL); - - clutter_animator_set (animator, - state->green, "x", CLUTTER_LINEAR, 0.0, 0.0, - state->green, "y", CLUTTER_LINEAR, 0.0, 0.0, - state->green, "x", CLUTTER_LINEAR, 1.0, 300.0, - state->green, "y", CLUTTER_EASE_IN_QUINT, 1.0, 300.0, - NULL); - - state->timeline = clutter_animator_get_timeline (animator); - - clutter_timeline_set_auto_reverse (state->timeline, TRUE); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - state); - - clutter_container_add (CLUTTER_CONTAINER (stage), state->red, state->green, NULL); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (animator); - - g_free (state); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-path.c b/doc/cookbook/examples/animations-path.c deleted file mode 100644 index f6e60f119..000000000 --- a/doc/cookbook/examples/animations-path.c +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterPath *path; - ClutterConstraint *constraint; - ClutterActor *rectangle; - ClutterTimeline *timeline; - - const ClutterColor *stage_color = clutter_color_new (51, 51, 85, 255); - const ClutterColor *red_color = clutter_color_new (255, 0, 0, 255); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 360, 300); - clutter_stage_set_color (CLUTTER_STAGE (stage), stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* create the path */ - path = clutter_path_new (); - clutter_path_add_move_to (path, 30, 60); - - /* add a curve round to the top-right of the stage */ - clutter_path_add_rel_curve_to (path, - 120, 180, - 180, 120, - 240, 0); - - /* create a constraint based on the path */ - constraint = clutter_path_constraint_new (path, 0.0); - - /* put a rectangle at the start of the path */ - rectangle = clutter_rectangle_new_with_color (red_color); - clutter_actor_set_size (rectangle, 60, 60); - - /* add the constraint to the rectangle */ - clutter_actor_add_constraint_with_name (rectangle, "path", constraint); - - /* add the rectangle to the stage */ - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle); - - /* set up the timeline */ - timeline = clutter_timeline_new (1000); - clutter_timeline_set_repeat_count (timeline, -1); - clutter_timeline_set_auto_reverse (timeline, TRUE); - - clutter_actor_animate_with_timeline (rectangle, CLUTTER_LINEAR, timeline, - "@constraints.path.offset", 1.0, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-reuse-animation.json b/doc/cookbook/examples/animations-reuse-animation.json deleted file mode 100644 index 5f16e1ee9..000000000 --- a/doc/cookbook/examples/animations-reuse-animation.json +++ /dev/null @@ -1,42 +0,0 @@ -[ - { - "type" : "ClutterGroup", - "id" : "rig" - }, - - { - "type" : "ClutterAnimator", - "id" : "animator", - "duration" : 2000, - - "properties" : [ - { - "object" : "rig", - "name" : "x", - "ease-in" : true, - "keys" : [ - [ 0.0, "linear", 0.0 ], - [ 1.0, "easeOutCubic", 150.0 ] - ] - }, - { - "object" : "rig", - "name" : "scale-x", - "ease-in" : true, - "keys" : [ - [ 0.5, "linear", 1.0 ], - [ 1.0, "easeOutBack", 2.0 ] - ] - }, - { - "object" : "rig", - "name" : "scale-y", - "ease-in" : true, - "keys" : [ - [ 0.5, "linear", 1.0 ], - [ 1.0, "easeOutBack", 2.0 ] - ] - } - ] - } -] diff --git a/doc/cookbook/examples/animations-reuse-ui.json b/doc/cookbook/examples/animations-reuse-ui.json deleted file mode 100644 index 99f50c616..000000000 --- a/doc/cookbook/examples/animations-reuse-ui.json +++ /dev/null @@ -1,80 +0,0 @@ -[ - { - "type" : "ClutterStage", - "id" : "stage", - "width" : 300, - "height" : 200, - "color" : "#333355ff", - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" } - ], - - "children" : [ - { - "type" : "ClutterRectangle", - "id" : "rect1", - "color" : "white", - "width" : 50, - "height" : 50, - "y" : 50, - "reactive" : true, - "signals" : [ - { "name" : "button-press-event", "handler" : "foo_button_pressed_cb" } - ] - }, - - { - "type" : "ClutterRectangle", - "id" : "rect2", - "color" : "blue", - "width" : 50, - "height" : 50, - "y" : 50, - "reactive" : true, - "signals" : [ - { "name" : "button-press-event", "handler" : "foo_button_pressed_cb" } - ] - }, - - { - "type" : "ClutterRectangle", - "id" : "rect3", - "color" : "green", - "width" : 50, - "height" : 50, - "y" : 50, - "reactive" : true, - "signals" : [ - { "name" : "button-press-event", "handler" : "foo_button_pressed_cb" } - ] - }, - - { - "type" : "ClutterRectangle", - "id" : "rect4", - "color" : "red", - "width" : 50, - "height" : 50, - "y" : 50, - "reactive" : true, - "signals" : [ - { "name" : "button-press-event", "handler" : "foo_button_pressed_cb" } - ] - }, - - { - "type" : "ClutterRectangle", - "id" : "rect5", - "color" : "grey", - "width" : 50, - "height" : 50, - "y" : 50, - "reactive" : true, - "signals" : [ - { "name" : "button-press-event", "handler" : "foo_button_pressed_cb" } - ] - } - ] - } -] diff --git a/doc/cookbook/examples/animations-reuse.c b/doc/cookbook/examples/animations-reuse.c deleted file mode 100644 index d5125e0c6..000000000 --- a/doc/cookbook/examples/animations-reuse.c +++ /dev/null @@ -1,100 +0,0 @@ -#include -#include - -#define UI_FILE "animations-reuse-ui.json" -#define ANIMATION_FILE "animations-reuse-animation.json" - -static gboolean -load_script_from_file (ClutterScript *script, - gchar *filename) -{ - GError *error = NULL; - - clutter_script_load_from_file (script, filename, &error); - - if (error != NULL) - { - g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - return TRUE; -} - -gboolean -foo_button_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterScript *ui = CLUTTER_SCRIPT (user_data); - ClutterStage *stage = CLUTTER_STAGE (clutter_script_get_object (ui, "stage")); - - ClutterScript *script; - ClutterActor *rig; - ClutterAnimator *animator; - - /* load the rig and its animator from a JSON file */ - script = clutter_script_new (); - - /* use a function defined statically in this source file to load the JSON */ - load_script_from_file (script, ANIMATION_FILE); - - clutter_script_get_objects (script, - "rig", &rig, - "animator", &animator, - NULL); - - /* remove the button press handler from the rectangle */ - g_signal_handlers_disconnect_by_func (actor, - G_CALLBACK (foo_button_pressed_cb), - NULL); - - /* add a callback to clean up the script when the rig is destroyed */ - g_object_set_data_full (G_OBJECT (rig), "script", script, g_object_unref); - - /* add the rig to the stage */ - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rig); - - /* place the rig at the same coordinates on the stage as the rectangle */ - clutter_actor_set_position (rig, - clutter_actor_get_x (actor), - clutter_actor_get_y (actor)); - - /* put the rectangle into the top-left corner of the rig */ - clutter_actor_reparent (actor, rig); - - clutter_actor_set_position (actor, 0, 0); - - /* animate the rig */ - clutter_animator_start (animator); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - ClutterScript *script; - ClutterActor *stage; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - script = clutter_script_new (); - load_script_from_file (script, UI_FILE); - - clutter_script_connect_signals (script, script); - - clutter_script_get_objects (script, - "stage", &stage, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (script); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-rotating.c b/doc/cookbook/examples/animations-rotating.c deleted file mode 100644 index 4c2d39f43..000000000 --- a/doc/cookbook/examples/animations-rotating.c +++ /dev/null @@ -1,137 +0,0 @@ -#include - -#define ROTATION_ANGLE 75.0 -#define DURATION 2000 - -static void -_set_next_state (ClutterState *transitions, - gpointer user_data) -{ - const gchar *current = clutter_state_get_state (transitions); - gchar *next_state = "start"; - - if (g_strcmp0 (current, "start") == 0) - next_state = "x-cw"; - else if (g_strcmp0 (current, "x-cw") == 0) - next_state = "x-ccw"; - else if (g_strcmp0 (current, "x-ccw") == 0) - next_state = "x-after"; - else if (g_strcmp0 (current, "x-after") == 0) - next_state = "y-cw"; - else if (g_strcmp0 (current, "y-cw") == 0) - next_state = "y-ccw"; - else if (g_strcmp0 (current, "y-ccw") == 0) - next_state = "y-after"; - else if (g_strcmp0 (current, "y-after") == 0) - next_state = "z-cw"; - else if (g_strcmp0 (current, "z-cw") == 0) - next_state = "z-ccw"; - - clutter_state_set_state (transitions, next_state); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - ClutterState *transitions; - GError *error = NULL; - gfloat texture_width, texture_height; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_actor_add_constraint (texture, - clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (texture, - clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - clutter_texture_set_sync_size (CLUTTER_TEXTURE (texture), TRUE); - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - "redhand.png", - &error); - - if (error != NULL) - { - g_error ("Problem loading image into texture - %s", error->message); - g_error_free (error); - return 1; - } - - clutter_actor_get_size (texture, &texture_width, &texture_height); - clutter_actor_set_size (stage, texture_width * 2, texture_height * 2); - - /* set all centres of rotation to the centre of the texture */ - clutter_actor_set_rotation (texture, - CLUTTER_X_AXIS, - 0.0, - texture_width * 0.5, - texture_height * 0.5, - 0.0); - clutter_actor_set_rotation (texture, - CLUTTER_Y_AXIS, - 0.0, - texture_width * 0.5, - texture_height * 0.5, - 0.0); - clutter_actor_set_z_rotation_from_gravity (texture, 0.0, CLUTTER_GRAVITY_CENTER); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - - /* set up the animations */ - transitions = clutter_state_new (); - - clutter_state_set (transitions, NULL, "start", - texture, "rotation-angle-x", CLUTTER_LINEAR, 0.0, - texture, "rotation-angle-y", CLUTTER_LINEAR, 0.0, - texture, "rotation-angle-z", CLUTTER_LINEAR, 0.0, - NULL); - clutter_state_set (transitions, NULL, "x-cw", - texture, "rotation-angle-x", CLUTTER_LINEAR, ROTATION_ANGLE, - NULL); - clutter_state_set (transitions, NULL, "x-ccw", - texture, "rotation-angle-x", CLUTTER_LINEAR, -ROTATION_ANGLE, - NULL); - clutter_state_set (transitions, NULL, "x-after", - texture, "rotation-angle-x", CLUTTER_LINEAR, 0.0, - NULL); - clutter_state_set (transitions, NULL, "y-cw", - texture, "rotation-angle-y", CLUTTER_LINEAR, ROTATION_ANGLE, - NULL); - clutter_state_set (transitions, NULL, "y-ccw", - texture, "rotation-angle-y", CLUTTER_LINEAR, -ROTATION_ANGLE, - NULL); - clutter_state_set (transitions, NULL, "y-after", - texture, "rotation-angle-y", CLUTTER_LINEAR, 0.0, - NULL); - clutter_state_set (transitions, NULL, "z-cw", - texture, "rotation-angle-z", CLUTTER_LINEAR, ROTATION_ANGLE, - NULL); - clutter_state_set (transitions, NULL, "z-ccw", - texture, "rotation-angle-z", CLUTTER_LINEAR, -ROTATION_ANGLE, - NULL); - clutter_state_set_duration (transitions, NULL, NULL, DURATION); - clutter_state_set_duration (transitions, "start", NULL, DURATION * 0.5); - clutter_state_set_duration (transitions, NULL, "start", DURATION * 0.5); - clutter_state_set_duration (transitions, NULL, "x-after", DURATION * 0.5); - clutter_state_set_duration (transitions, NULL, "y-after", DURATION * 0.5); - - clutter_state_warp_to_state (transitions, "start"); - - g_signal_connect (transitions, - "completed", - G_CALLBACK (_set_next_state), - NULL); - - clutter_state_set_state (transitions, "x-cw"); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/animations-scaling-zoom.c b/doc/cookbook/examples/animations-scaling-zoom.c deleted file mode 100644 index 79c899ed5..000000000 --- a/doc/cookbook/examples/animations-scaling-zoom.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Load an image into a texture, which can then be zoomed in/out - * (double click on button 1, double click on button 3 respectively); - * also resets the texture to the stage center when a key is pressed - * (better would be to prevent drags taking the actor off-stage, - * but the implementation is much more complicated) - */ -#include -#include - -#define STAGE_SIDE 400.0 - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; - -/* on key press, center the actor on the stage; - * useful if you drag it off-stage accidentally - */ -static gboolean -key_press_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat width, height; - - clutter_actor_get_size (actor, &width, &height); - - clutter_actor_set_anchor_point (actor, width / 2, height / 2); - - clutter_actor_set_position (actor, - STAGE_SIDE / 2, - STAGE_SIDE / 2); - - return TRUE; -} - -/* on double click, zoom in on the clicked point; - * also keeps scale in the range 0.1 to 20 - */ -static gboolean -clicked_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gdouble scale; - gfloat click_x, click_y; - gfloat click_target_x, click_target_y; - guint32 button; - - /* don't do anything unless there was a double click */ - if (clutter_event_get_click_count (event) < 2) - return TRUE; - - /* work out new scale */ - button = clutter_event_get_button (event); - - clutter_actor_get_scale (actor, &scale, NULL); - - if (button == CLUTTER_BUTTON_PRIMARY) - scale *= 1.2; - else if (button == CLUTTER_BUTTON_SECONDARY) - scale /= 1.2; - - /* don't do anything if scale is outside bounds */ - if (scale < 0.1 || scale > 20.0) - return TRUE; - - /* get the location of the click on the scaled actor */ - clutter_event_get_coords (event, &click_x, &click_y); - clutter_actor_transform_stage_point (actor, - click_x, click_y, - &click_target_x, &click_target_y); - - /* anchor the actor on the clicked point on its surface */ - clutter_actor_set_anchor_point (actor, click_target_x, click_target_y); - - /* set the actor's position to the click coords: it won't move, - * because the anchor point is already there; but - * the scale will now be centered on these coords (as the - * scale center defaults to the anchor point); so the anchor point - * on the actor won't move from under the pointer - */ - clutter_actor_set_position (actor, click_x, click_y); - - clutter_actor_animate (actor, CLUTTER_LINEAR, 500, - "scale-x", scale, - "scale-y", scale, - NULL); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - gchar *image_path; - GError *error = NULL; - - if (argc < 2) - { - g_print ("Usage: %s \n", argv[0]); - exit (EXIT_FAILURE); - } - - image_path = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_actor_set_reactive (texture, TRUE); - clutter_actor_set_width (texture, STAGE_SIDE); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); - - clutter_actor_add_action (texture, clutter_drag_action_new ()); - - g_object_set (G_OBJECT (texture), - "scale-gravity", CLUTTER_GRAVITY_NORTH_WEST, - NULL); - - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), image_path, &error); - - if (error != NULL) - { - g_warning ("Error loading %s\n%s", image_path, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - clutter_actor_set_y (texture, (STAGE_SIDE - clutter_actor_get_height (texture)) * 0.5); - - g_signal_connect (texture, - "button-release-event", - G_CALLBACK (clicked_cb), - NULL); - - g_signal_connect_swapped (stage, - "key-press-event", - G_CALLBACK (key_press_cb), - texture); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/animations-scaling.c b/doc/cookbook/examples/animations-scaling.c deleted file mode 100644 index 8fd5946e1..000000000 --- a/doc/cookbook/examples/animations-scaling.c +++ /dev/null @@ -1,184 +0,0 @@ -#include -#include - -typedef struct -{ - ClutterState *transitions; - ClutterActor *actor; - ClutterActor *props_display; - guint scale_gravity; - gboolean transitions_running; -} State; - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor yellow_color = { 0xff, 0xff, 0x00, 0xff }; - -static void -show_scale_properties_cb (ClutterActor *actor, - gpointer user_data) -{ - State *state = (State *) user_data; - - gfloat transformed_x, transformed_y; - gfloat transformed_width, transformed_height; - gfloat scale_center_x, scale_center_y; - - gchar *message; - - clutter_actor_get_transformed_position (state->actor, - &transformed_x, - &transformed_y); - - clutter_actor_get_transformed_size (state->actor, - &transformed_width, - &transformed_height); - - g_object_get (G_OBJECT (actor), - "scale-center-x", &scale_center_x, - "scale-center-y", &scale_center_y, - NULL); - - /* draw cross on the scale center */ - cogl_set_source_color4ub (255, 255, 0, 255); - - cogl_path_move_to (scale_center_x, scale_center_y); - cogl_path_rel_line_to (10, 10); - cogl_path_rel_line_to (-20, -20); - cogl_path_move_to (scale_center_x, scale_center_y); - cogl_path_rel_line_to (10, -10); - cogl_path_rel_line_to (-20, 20); - - cogl_path_stroke (); - - /* show actor properties */ - message = g_strdup_printf ("Scale center: %.0f, %.0f\n" - "Transformed position: %.2f, %.2f\n" - "Transformed size: %.2f, %.2f", - scale_center_x, scale_center_y, - transformed_x, transformed_y, - transformed_width, transformed_height); - - clutter_text_set_text (CLUTTER_TEXT (state->props_display), message); - - g_free (message); -} - -static void -next_transition_cb (ClutterState *transitions, - gpointer user_data) -{ - State *state = (State *) user_data; - - if (clutter_actor_is_scaled (state->actor)) - clutter_state_set_state (state->transitions, "not-scaled"); - else if (state->scale_gravity > 9) - { - /* gravity is at center, so reset ready for next key press */ - state->scale_gravity = CLUTTER_GRAVITY_NORTH; - - state->transitions_running = FALSE; - } - else - { - g_object_set (G_OBJECT (state->actor), - "scale-gravity", state->scale_gravity, - NULL); - - state->scale_gravity++; - - clutter_state_set_state (state->transitions, "scaled-down"); - } -} - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *state = (State *) user_data; - - if (!state->transitions_running) - { - state->transitions_running = TRUE; - next_transition_cb (NULL, state); - } - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - State *state = g_new0 (State, 1); - ClutterActor *stage; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 350, 350); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - state->scale_gravity = CLUTTER_GRAVITY_NORTH; - state->transitions_running = FALSE; - - state->props_display = clutter_text_new (); - clutter_actor_set_size (state->props_display, 340, 80); - clutter_actor_set_position (state->props_display, 5, 280); - clutter_text_set_color (CLUTTER_TEXT (state->props_display), &yellow_color); - - state->actor = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (state->actor, 200, 200); - clutter_actor_set_position (state->actor, 75, 50); - - g_object_set (G_OBJECT (state->actor), - "scale-gravity", state->scale_gravity, - NULL); - - state->transitions = clutter_state_new (); - clutter_state_set_duration (state->transitions, NULL, NULL, 400); - - clutter_state_set (state->transitions, NULL, "not-scaled", - state->actor, "scale-x", CLUTTER_LINEAR, 1.0, - state->actor, "scale-y", CLUTTER_LINEAR, 1.0, - NULL); - - clutter_state_set (state->transitions, NULL, "scaled-down", - state->actor, "scale-x", CLUTTER_LINEAR, 0.25, - state->actor, "scale-y", CLUTTER_LINEAR, 0.25, - NULL); - - clutter_state_warp_to_state (state->transitions, "not-scaled"); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - state); - - g_signal_connect (state->transitions, - "completed", - G_CALLBACK (next_transition_cb), - state); - - g_signal_connect_after (state->actor, - "paint", - G_CALLBACK (show_scale_properties_cb), - state); - - clutter_container_add (CLUTTER_CONTAINER (stage), - state->actor, - state->props_display, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (state->transitions); - g_free (state); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/cb-background-effect.c b/doc/cookbook/examples/cb-background-effect.c deleted file mode 100644 index 44a42b8f7..000000000 --- a/doc/cookbook/examples/cb-background-effect.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "cb-background-effect.h" - -G_DEFINE_TYPE (CbBackgroundEffect, cb_background_effect, CLUTTER_TYPE_EFFECT); - -#define CB_BACKGROUND_EFFECT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CB_TYPE_BACKGROUND_EFFECT, \ - CbBackgroundEffectPrivate)) - -struct _CbBackgroundEffectPrivate -{ - CoglMaterial *background; - CoglColor *color; -}; - -/* ClutterEffect implementation */ - -/* note that if pre_paint() returns FALSE - * any post_paint() defined for the effect will not be called - */ -static gboolean -cb_background_effect_pre_paint (ClutterEffect *self) -{ - ClutterActor *actor; - gfloat width; - gfloat height; - CbBackgroundEffectPrivate *priv; - - priv = CB_BACKGROUND_EFFECT (self)->priv; - - /* get the associated actor's dimensions */ - actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self)); - clutter_actor_get_size (actor, &width, &height); - - /* draw a grey Cogl rectangle in the background */ - cogl_set_source (priv->background); - - cogl_rectangle (0, 0, width, height); - - return TRUE; -} - -/* GObject implementation */ -static void -cb_background_effect_dispose (GObject *gobject) -{ - CbBackgroundEffectPrivate *priv = CB_BACKGROUND_EFFECT (gobject)->priv; - - if (priv->background != COGL_INVALID_HANDLE) - { - cogl_handle_unref (priv->background); - priv->background = COGL_INVALID_HANDLE; - } - - if (priv->color != NULL) - { - cogl_color_free (priv->color); - priv->color = NULL; - } - - G_OBJECT_CLASS (cb_background_effect_parent_class)->dispose (gobject); -} - -static void -cb_background_effect_class_init (CbBackgroundEffectClass *klass) -{ - ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - effect_class->pre_paint = cb_background_effect_pre_paint; - gobject_class->dispose = cb_background_effect_dispose; - - g_type_class_add_private (klass, sizeof (CbBackgroundEffectPrivate)); -} - -static void -cb_background_effect_init (CbBackgroundEffect *self) -{ - CbBackgroundEffectPrivate *priv; - - priv = self->priv = CB_BACKGROUND_EFFECT_GET_PRIVATE (self); - - priv->background = cogl_material_new (); - - /* grey color for filling the background material */ - priv->color = cogl_color_new (); - cogl_color_init_from_4ub (priv->color, 122, 122, 122, 255); - - cogl_material_set_color (priv->background, priv->color); -} - -/* public API */ - -/** - * cb_background_effect_new: - * - * Creates a new #ClutterEffect which adds a grey background - * when applied to a rectangular actor. - */ -ClutterEffect * -cb_background_effect_new () -{ - return g_object_new (CB_TYPE_BACKGROUND_EFFECT, - NULL); -} diff --git a/doc/cookbook/examples/cb-background-effect.h b/doc/cookbook/examples/cb-background-effect.h deleted file mode 100644 index b2ce987e3..000000000 --- a/doc/cookbook/examples/cb-background-effect.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef __CB_BACKGROUND_EFFECT_H__ -#define __CB_BACKGROUND_EFFECT_H__ - -#include - -GType cb_background_effect_get_type (void); - -#define CB_TYPE_BACKGROUND_EFFECT (cb_background_effect_get_type ()) -#define CB_BACKGROUND_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CB_TYPE_BACKGROUND_EFFECT, \ - CbBackgroundEffect)) -#define CB_IS_BACKGROUND_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CB_TYPE_BACKGROUND_EFFECT)) -#define CB_BACKGROUND_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CB_TYPE_BACKGROUND_EFFECT, \ - CbBackgroundEffectClass)) -#define CB_IS_BACKGROUND_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CB_TYPE_BACKGROUND_EFFECT)) -#define CB_BACKGROUND_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CB_TYPE_BACKGROUND_EFFECT, \ - CbBackgroundEffectClass)) - -typedef struct _CbBackgroundEffectPrivate CbBackgroundEffectPrivate; -typedef struct _CbBackgroundEffect CbBackgroundEffect; -typedef struct _CbBackgroundEffectClass CbBackgroundEffectClass; - -/* object */ -struct _CbBackgroundEffect -{ - ClutterEffect parent_instance; - CbBackgroundEffectPrivate *priv; -}; - -/* class */ -struct _CbBackgroundEffectClass -{ - ClutterEffectClass parent_class; -}; - -ClutterEffect *cb_background_effect_new (); - -#endif /* __CB_BACKGROUND_EFFECT_H__ */ diff --git a/doc/cookbook/examples/cb-border-effect.c b/doc/cookbook/examples/cb-border-effect.c deleted file mode 100644 index 3de316d44..000000000 --- a/doc/cookbook/examples/cb-border-effect.c +++ /dev/null @@ -1,311 +0,0 @@ -#include "cb-border-effect.h" - -G_DEFINE_TYPE (CbBorderEffect, cb_border_effect, CLUTTER_TYPE_EFFECT); - -#define CB_BORDER_EFFECT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CB_TYPE_BORDER_EFFECT, \ - CbBorderEffectPrivate)) - -static const ClutterColor grey = { 0xaa, 0xaa, 0xaa, 0xff }; - -struct _CbBorderEffectPrivate -{ - CoglMaterial *border; - ClutterColor color; - gfloat width; -}; - -enum { - PROP_0, - - PROP_COLOR, - PROP_WIDTH, - - PROP_LAST -}; - -static GParamSpec *obj_props[PROP_LAST]; - -/* ClutterEffect implementation */ -static void -cb_border_effect_post_paint (ClutterEffect *self) -{ - ClutterActor *actor; - gfloat width; - gfloat height; - CbBorderEffectPrivate *priv; - - priv = CB_BORDER_EFFECT (self)->priv; - - /* get the associated actor's dimensions */ - actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self)); - clutter_actor_get_size (actor, &width, &height); - - /* draw Cogl rectangles on top */ - cogl_set_source (priv->border); - cogl_path_new (); - - /* left rectangle */ - cogl_path_rectangle (0, 0, priv->width, height); - - /* top rectangle */ - cogl_path_rectangle (priv->width, 0, width, priv->width); - - /* right rectangle */ - cogl_path_rectangle (width - priv->width, priv->width, width, height); - - /* bottom rectangle */ - cogl_path_rectangle (priv->width, - height - priv->width, - width - priv->width, - height); - - cogl_path_fill (); -} - -/* GObject implementation */ -static void -cb_border_effect_dispose (GObject *gobject) -{ - CbBorderEffectPrivate *priv = CB_BORDER_EFFECT (gobject)->priv; - - if (priv->border != COGL_INVALID_HANDLE) - { - cogl_handle_unref (priv->border); - priv->border = COGL_INVALID_HANDLE; - } - - G_OBJECT_CLASS (cb_border_effect_parent_class)->dispose (gobject); -} - -static void -cb_border_effect_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - CbBorderEffect *effect = CB_BORDER_EFFECT (gobject); - - switch (prop_id) - { - case PROP_COLOR: - cb_border_effect_set_color (effect, clutter_value_get_color (value)); - break; - - case PROP_WIDTH: - cb_border_effect_set_width (effect, g_value_get_float (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -cb_border_effect_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - CbBorderEffectPrivate *priv = CB_BORDER_EFFECT (gobject)->priv; - - switch (prop_id) - { - case PROP_COLOR: - g_value_set_object (value, &(priv->color)); - break; - - case PROP_WIDTH: - g_value_set_float (value, priv->width); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -/* GObject class and instance init */ -static void -cb_border_effect_class_init (CbBorderEffectClass *klass) -{ - ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - - effect_class->post_paint = cb_border_effect_post_paint; - - gobject_class->set_property = cb_border_effect_set_property; - gobject_class->get_property = cb_border_effect_get_property; - gobject_class->dispose = cb_border_effect_dispose; - - g_type_class_add_private (klass, sizeof (CbBorderEffectPrivate)); - - /** - * CbBorderEffect:width: - * - * The width of the border - */ - pspec = g_param_spec_float ("width", - "Width", - "The width of the border (in pixels)", - 1.0, 100.0, - 10.0, - G_PARAM_READWRITE); - obj_props[PROP_WIDTH] = pspec; - g_object_class_install_property (gobject_class, PROP_WIDTH, pspec); - - /** - * CbBorderEffect:color: - * - * The color of the border - */ - pspec = clutter_param_spec_color ("color", - "Color", - "The border color", - &grey, - G_PARAM_READWRITE); - obj_props[PROP_COLOR] = pspec; - g_object_class_install_property (gobject_class, PROP_COLOR, pspec); -} - -static void -cb_border_effect_init (CbBorderEffect *self) -{ - CbBorderEffectPrivate *priv; - - priv = self->priv = CB_BORDER_EFFECT_GET_PRIVATE (self); - - priv->border = cogl_material_new (); - - priv->color = grey; -} - -/* called each time a property is set on the effect */ -static void -cb_border_effect_update (CbBorderEffect *self) -{ - ClutterActor *actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self)); - - if (actor != NULL) - clutter_actor_queue_redraw (actor); -} - -/* public API */ - -/** - * cb_border_effect_new: - * @width: width of the border applied by the effect - * @color: a #ClutterColor - * - * Creates a new #ClutterEffect with the given @width - * and of the given @color. - */ -ClutterEffect * -cb_border_effect_new (gfloat width, - const ClutterColor *color) -{ - return g_object_new (CB_TYPE_BORDER_EFFECT, - "width", width, - "color", color, - NULL); -} - -/** - * cb_border_effect_set_color: - * @self: a #CbBorderEffect - * @color: a #ClutterColor - * - * Sets the color of the border provided by the effect @self. - */ -void -cb_border_effect_set_color (CbBorderEffect *self, - const ClutterColor *color) -{ - CbBorderEffectPrivate *priv; - - g_return_if_fail (CB_IS_BORDER_EFFECT (self)); - g_return_if_fail (color != NULL); - - priv = CB_BORDER_EFFECT_GET_PRIVATE (self); - - priv->color.red = color->red; - priv->color.green = color->green; - priv->color.blue = color->blue; - priv->color.alpha = color->alpha; - - cogl_material_set_color4ub (priv->border, - color->red, - color->green, - color->blue, - color->alpha); - - cb_border_effect_update (self); -} - -/** - * cb_border_effect_get_color: - * @self: a #CbBorderEffect - * @color: return location for a #ClutterColor - * - * Retrieves the color of the border applied by the effect @self. - */ -void -cb_border_effect_get_color (CbBorderEffect *self, - ClutterColor *color) -{ - CbBorderEffectPrivate *priv; - - g_return_if_fail (CB_IS_BORDER_EFFECT (self)); - - priv = CB_BORDER_EFFECT_GET_PRIVATE (self); - - color->red = priv->color.red; - color->green = priv->color.green; - color->blue = priv->color.blue; - color->alpha = priv->color.alpha; -} - -/** - * cb_border_effect_set_width: - * @self: a #CbBorderEffect - * @width: the width of the border - * - * Sets the width (in pixels) of the border applied by the effect @self. - */ -void -cb_border_effect_set_width (CbBorderEffect *self, - gfloat width) -{ - CbBorderEffectPrivate *priv; - - g_return_if_fail (CB_IS_BORDER_EFFECT (self)); - - priv = CB_BORDER_EFFECT_GET_PRIVATE (self); - - priv->width = width; - - cb_border_effect_update (self); -} - -/** - * cb_border_effect_get_width: - * @self: a #CbBorderEffect - * - * Gets the width (in pixels) of the border applied by the effect @self. - * - * Return value: the border's width, or 0.0 if @self is not - * a #CbBorderEffect - */ -gfloat -cb_border_effect_get_width (CbBorderEffect *self) -{ - CbBorderEffectPrivate *priv; - - g_return_val_if_fail (CB_IS_BORDER_EFFECT (self), 0.0); - - priv = CB_BORDER_EFFECT_GET_PRIVATE (self); - - return priv->width; -} diff --git a/doc/cookbook/examples/cb-border-effect.h b/doc/cookbook/examples/cb-border-effect.h deleted file mode 100644 index c4c6a3675..000000000 --- a/doc/cookbook/examples/cb-border-effect.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __CB_BORDER_EFFECT_H__ -#define __CB_BORDER_EFFECT_H__ - -#include - -GType cb_border_effect_get_type (void); - -#define CB_TYPE_BORDER_EFFECT (cb_border_effect_get_type ()) -#define CB_BORDER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CB_TYPE_BORDER_EFFECT, \ - CbBorderEffect)) -#define CB_IS_BORDER_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CB_TYPE_BORDER_EFFECT)) -#define CB_BORDER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CB_TYPE_BORDER_EFFECT, \ - CbBorderEffectClass)) -#define CB_IS_BORDER_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CB_TYPE_BORDER_EFFECT)) -#define CB_BORDER_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CB_TYPE_BORDER_EFFECT, \ - CbBorderEffectClass)) - -typedef struct _CbBorderEffectPrivate CbBorderEffectPrivate; -typedef struct _CbBorderEffect CbBorderEffect; -typedef struct _CbBorderEffectClass CbBorderEffectClass; - -/* object */ -struct _CbBorderEffect -{ - ClutterEffect parent_instance; - CbBorderEffectPrivate *priv; -}; - -/* class */ -struct _CbBorderEffectClass -{ - ClutterEffectClass parent_class; -}; - -ClutterEffect *cb_border_effect_new (gfloat width, - const ClutterColor *color); - -void cb_border_effect_set_color (CbBorderEffect *self, - const ClutterColor *color); - -void cb_border_effect_get_color (CbBorderEffect *self, - ClutterColor *color); - -void cb_border_effect_set_width (CbBorderEffect *self, - gfloat width); - -gfloat cb_border_effect_get_width (CbBorderEffect *self); - -#endif /* __CB_BORDER_EFFECT_H__ */ diff --git a/doc/cookbook/examples/cb-button.c b/doc/cookbook/examples/cb-button.c deleted file mode 100644 index 2abbf7fc8..000000000 --- a/doc/cookbook/examples/cb-button.c +++ /dev/null @@ -1,450 +0,0 @@ -#include "cb-button.h" - -/** - * SECTION:cb-button - * @short_description: Button widget - * - * A button widget with support for a text label and background color. - */ - -/* convenience macro for GType implementations; see: - * http://library.gnome.org/devel/gobject/2.27/gobject-Type-Information.html#G-DEFINE-TYPE:CAPS - */ -G_DEFINE_TYPE (CbButton, cb_button, CLUTTER_TYPE_ACTOR); - -/* macro for accessing the object's private structure */ -#define CB_BUTTON_GET_PRIVATE(obj) \ - (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CB_TYPE_BUTTON, CbButtonPrivate)) - -/* private structure - should only be accessed through the public API; - * this is used to store member variables whose properties - * need to be accessible from the implementation; for example, if we - * intend to create wrapper functions which modify properties on the - * actors composing an object, we should keep a reference to the actors - * here - * - * this is also the place where other state variables go: - * for example, you might record the current state of the button - * (toggled on or off) or a background image - */ -struct _CbButtonPrivate -{ - ClutterActor *child; - ClutterActor *label; - ClutterAction *click_action; - gchar *text; -}; - -/* enumerates property identifiers for this class; - * note that property identifiers should be non-zero integers, - * so we add an unused PROP_0 to occupy the 0 position in the enum - */ -enum { - PROP_0, - PROP_TEXT -}; - -/* enumerates signal identifiers for this class; - * LAST_SIGNAL is not used as a signal identifier, but is instead - * used to delineate the size of the cache array for signals (see below) - */ -enum { - CLICKED, - LAST_SIGNAL -}; - -/* cache array for signals */ -static guint cb_button_signals[LAST_SIGNAL] = { 0, }; - -/* from http://mail.gnome.org/archives/gtk-devel-list/2004-July/msg00158.html: - * - * "The finalize method finishes releasing the remaining - * resources just before the object itself will be freed from memory, and - * therefore it will only be called once. The two step process helps break - * cyclic references. Both dispose and finalize must chain up to their - * parent objects by calling their parent's respective methods *after* they - * have disposed or finalized their own members." - */ -static void -cb_button_finalize (GObject *gobject) -{ - CbButtonPrivate *priv = CB_BUTTON (gobject)->priv; - - g_free (priv->text); - - /* call the parent class' finalize() method */ - G_OBJECT_CLASS (cb_button_parent_class)->finalize (gobject); -} - -/* enables objects to be uniformly treated as GObjects; - * also exposes properties so they become scriptable, e.g. - * through ClutterScript - */ -static void -cb_button_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - CbButton *button = CB_BUTTON (gobject); - - switch (prop_id) - { - case PROP_TEXT: - cb_button_set_text (button, g_value_get_string (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -/* enables objects to be uniformly treated as GObjects */ -static void -cb_button_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - CbButtonPrivate *priv = CB_BUTTON (gobject)->priv; - - switch (prop_id) - { - case PROP_TEXT: - g_value_set_string (value, priv->text); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -/* ClutterActor implementation - * - * we only implement destroy(), get_preferred_height(), get_preferred_width(), - * allocate(), and paint(), as this is the minimum we can get away with - */ - -/* composite actors should implement destroy(), and inside their - * implementation destroy any actors they are composed from; - * in this case, we just destroy the child ClutterBox - */ -static void -cb_button_destroy (ClutterActor *self) -{ - CbButtonPrivate *priv = CB_BUTTON (self)->priv; - - /* we just destroy the child, and let the child - * deal with destroying _its_ children; note that we have a guard - * here in case the child has already been destroyed - */ - if (priv->child) - { - clutter_actor_destroy (priv->child); - priv->child = NULL; - } - - /* chain up to destroy() on the parent ClutterActorClass; - * note that we check the parent class has a destroy() implementation - * before calling it - */ - if (CLUTTER_ACTOR_CLASS (cb_button_parent_class)->destroy) - CLUTTER_ACTOR_CLASS (cb_button_parent_class)->destroy (self); -} - -/* get_preferred_height and get_preferred_width defer to the - * internal ClutterBox, adding 20px padding on each axis; - * min_*_p is the minimum height or width the actor should occupy - * to be useful; natural_*_p is the height or width the actor - * would occupy if not constrained - * - * note that if we required explicit sizing for CbButtons - * (i.e. a developer must set their height and width), - * we wouldn't need to implement these functions - */ -static void -cb_button_get_preferred_height (ClutterActor *self, - gfloat for_width, - gfloat *min_height_p, - gfloat *natural_height_p) -{ - CbButtonPrivate *priv = CB_BUTTON (self)->priv; - - clutter_actor_get_preferred_height (priv->child, - for_width, - min_height_p, - natural_height_p); - - *min_height_p += 20.0; - *natural_height_p += 20.0; -} - -static void -cb_button_get_preferred_width (ClutterActor *self, - gfloat for_height, - gfloat *min_width_p, - gfloat *natural_width_p) -{ - CbButtonPrivate *priv = CB_BUTTON (self)->priv; - - clutter_actor_get_preferred_width (priv->child, - for_height, - min_width_p, - natural_width_p); - - *min_width_p += 20.0; - *natural_width_p += 20.0; -} - -/* use the actor's allocation for the ClutterBox */ -static void -cb_button_allocate (ClutterActor *actor, - const ClutterActorBox *box, - ClutterAllocationFlags flags) -{ - CbButtonPrivate *priv = CB_BUTTON (actor)->priv; - ClutterActorBox child_box = { 0, }; - - /* set the allocation for the whole button */ - CLUTTER_ACTOR_CLASS (cb_button_parent_class)->allocate (actor, box, flags); - - /* make the child (the ClutterBox) fill the parent; - * note that this allocation box is relative to the - * coordinates of the whole button actor, so we can't just - * use the box passed into this function; instead, it - * is adjusted to span the whole of the actor, from its - * top-left corner (0,0) to its bottom-right corner - * (width,height) - */ - child_box.x1 = 0.0; - child_box.y1 = 0.0; - child_box.x2 = clutter_actor_box_get_width (box); - child_box.y2 = clutter_actor_box_get_height (box); - - clutter_actor_allocate (priv->child, &child_box, flags); -} - -/* paint function implementation: just calls paint() on the ClutterBox */ -static void -cb_button_paint (ClutterActor *actor) -{ - CbButtonPrivate *priv = CB_BUTTON (actor)->priv; - - clutter_actor_paint (priv->child); -} - -/* proxy ClickAction signals so they become signals from the actor */ -static void -cb_button_clicked (ClutterClickAction *action, - ClutterActor *actor, - gpointer user_data) -{ - /* emit signal via the cache array */ - g_signal_emit (actor, cb_button_signals[CLICKED], 0); -} - -/* GObject class and instance initialization functions; note that - * these have been placed after the Clutter implementation, as - * they refer to the static function implementations above - */ - -/* class init: attach functions to superclasses, define properties - * and signals - */ -static void -cb_button_class_init (CbButtonClass *klass) -{ - ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - - gobject_class->finalize = cb_button_finalize; - gobject_class->set_property = cb_button_set_property; - gobject_class->get_property = cb_button_get_property; - - actor_class->destroy = cb_button_destroy; - actor_class->get_preferred_height = cb_button_get_preferred_height; - actor_class->get_preferred_width = cb_button_get_preferred_width; - actor_class->allocate = cb_button_allocate; - actor_class->paint = cb_button_paint; - - g_type_class_add_private (klass, sizeof (CbButtonPrivate)); - - /** - * CbButton:text: - * - * The text shown on the #CbButton - */ - pspec = g_param_spec_string ("text", - "Text", - "Text of the button", - NULL, - G_PARAM_READWRITE); - g_object_class_install_property (gobject_class, PROP_TEXT, pspec); - - /** - * CbButton::clicked: - * @button: the #CbButton that emitted the signal - * - * The ::clicked signal is emitted when the internal #ClutterClickAction - * associated with a #CbButton emits its own ::clicked signal - */ - cb_button_signals[CLICKED] = - g_signal_new ("clicked", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (CbButtonClass, clicked), - NULL, - NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, - 0); -} - -/* object init: create a private structure and pack - * composed ClutterActors into it - */ -static void -cb_button_init (CbButton *self) -{ - CbButtonPrivate *priv; - ClutterLayoutManager *layout; - - priv = self->priv = CB_BUTTON_GET_PRIVATE (self); - - clutter_actor_set_reactive (CLUTTER_ACTOR (self), TRUE); - - /* the only child of this actor is a ClutterBox with a - * ClutterBinLayout: painting and allocation of the actor basically - * involves painting and allocating this child box - */ - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); - - priv->child = clutter_actor_new (); - clutter_actor_set_layout_manager (priv->child, layout); - - /* set the parent of the ClutterBox to this instance */ - clutter_actor_add_child (CLUTTER_ACTOR (self), priv->child); - - /* add text label to the button; see the ClutterText API docs - * for more information about available properties - */ - priv->label = g_object_new (CLUTTER_TYPE_TEXT, - "line-alignment", PANGO_ALIGN_CENTER, - "ellipsize", PANGO_ELLIPSIZE_END, - NULL); - - clutter_actor_add_child (priv->child, priv->label); - - /* add a ClutterClickAction on this actor, so we can proxy its - * "clicked" signal into a signal from this actor - */ - priv->click_action = clutter_click_action_new (); - clutter_actor_add_action (CLUTTER_ACTOR (self), priv->click_action); - - g_signal_connect (priv->click_action, - "clicked", - G_CALLBACK (cb_button_clicked), - NULL); -} - -/* public API */ -/* examples of public API functions which wrap functions - * on internal actors - */ - -/** - * cb_button_set_text: - * @self: a #CbButton - * @text: the text to display on the button - * - * Set the text on the button - */ -void -cb_button_set_text (CbButton *self, - const gchar *text) -{ - CbButtonPrivate *priv; - - /* public API should check its arguments; - * see also g_return_val_if_fail for functions which - * return a value - */ - g_return_if_fail (CB_IS_BUTTON (self)); - - priv = self->priv; - - g_free (priv->text); - - if (text) - priv->text = g_strdup (text); - else - priv->text = g_strdup (""); - - /* call a function on the ClutterText inside the layout */ - clutter_text_set_text (CLUTTER_TEXT (priv->label), priv->text); -} - -/** - * cb_button_set_background_color: - * @self: a #CbButton - * @color: the #ClutterColor to use for the button's background - * - * Set the color of the button's background - */ -void -cb_button_set_background_color (CbButton *self, - const ClutterColor *color) -{ - g_return_if_fail (CB_IS_BUTTON (self)); - - clutter_actor_set_background_color (self->priv->child, color); -} - -/** - * cb_button_set_text_color: - * @self: a #CbButton - * @color: the #ClutterColor to use as the color for the button text - * - * Set the color of the text on the button - */ -void -cb_button_set_text_color (CbButton *self, - const ClutterColor *color) -{ - g_return_if_fail (CB_IS_BUTTON (self)); - - clutter_text_set_color (CLUTTER_TEXT (self->priv->label), color); -} - -/** - * cb_button_get_text: - * @self: a #CbButton - * - * Get the text displayed on the button - * - * Returns: the button's text. This must not be freed by the application. - */ -const gchar * -cb_button_get_text (CbButton *self) -{ - g_return_val_if_fail (CB_IS_BUTTON (self), NULL); - - return self->priv->text; -} - -/** - * cb_button_new: - * - * Creates a new #CbButton instance - * - * Returns: a new #CbButton - */ -ClutterActor * -cb_button_new (void) -{ - return g_object_new (CB_TYPE_BUTTON, NULL); -} diff --git a/doc/cookbook/examples/cb-button.h b/doc/cookbook/examples/cb-button.h deleted file mode 100644 index 756526d4c..000000000 --- a/doc/cookbook/examples/cb-button.h +++ /dev/null @@ -1,84 +0,0 @@ -/* inclusion guard */ -#ifndef __CB_BUTTON_H__ -#define __CB_BUTTON_H__ - -/* include any dependencies */ -#include - -/* GObject implementation */ - -/* declare this function signature to remove compilation errors with -Wall; - * the cb_button_get_type() function is actually added via the - * G_DEFINE_TYPE macro in the .c file - */ -GType cb_button_get_type (void); - -/* GObject type macros */ -/* returns the class type identifier (GType) for CbButton */ -#define CB_TYPE_BUTTON (cb_button_get_type ()) - -/* cast obj to a CbButton object structure*/ -#define CB_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CB_TYPE_BUTTON, CbButton)) - -/* check whether obj is a CbButton */ -#define CB_IS_BUTTON(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CB_TYPE_BUTTON)) - -/* cast klass to CbButtonClass class structure */ -#define CB_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CB_TYPE_BUTTON, CbButtonClass)) - -/* check whether klass is a member of the CbButtonClass */ -#define CB_IS_BUTTON_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CB_TYPE_BUTTON)) - -/* get the CbButtonClass structure for a CbButton obj */ -#define CB_BUTTON_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CB_TYPE_BUTTON, CbButtonClass)) - -/* - * Private instance fields; see - * http://www.gotw.ca/gotw/024.htm for the rationale - */ -typedef struct _CbButtonPrivate CbButtonPrivate; -typedef struct _CbButton CbButton; -typedef struct _CbButtonClass CbButtonClass; - -/* object structure */ -struct _CbButton -{ - /**/ - ClutterActor parent_instance; - - /* structure containing private members */ - /**/ - CbButtonPrivate *priv; -}; - -/* class structure */ -struct _CbButtonClass -{ - /* signals */ - void (* clicked)(CbButton *button); - - /**/ - ClutterActorClass parent_class; -}; - -/* public API */ - -/* constructor - note this returns a ClutterActor instance */ -ClutterActor *cb_button_new (void); - -/* getter */ -const gchar *cb_button_get_text (CbButton *self); - -/* setters - these are wrappers round functions - * which change properties of the internal actors - */ -void cb_button_set_text (CbButton *self, - const gchar *text); - -void cb_button_set_background_color (CbButton *self, - const ClutterColor *color); - -void cb_button_set_text_color (CbButton *self, - const ClutterColor *color); - -#endif /* __CB_BUTTON_H__ */ diff --git a/doc/cookbook/examples/cb-page-fold-effect.c b/doc/cookbook/examples/cb-page-fold-effect.c deleted file mode 100644 index 272703503..000000000 --- a/doc/cookbook/examples/cb-page-fold-effect.c +++ /dev/null @@ -1,250 +0,0 @@ -#include -#include "cb-page-fold-effect.h" - -G_DEFINE_TYPE (CbPageFoldEffect, cb_page_fold_effect, CLUTTER_TYPE_DEFORM_EFFECT); - -#define CB_PAGE_FOLD_EFFECT_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), \ - CB_TYPE_PAGE_FOLD_EFFECT, \ - CbPageFoldEffectPrivate)) - -struct _CbPageFoldEffectPrivate -{ - gdouble angle; - gdouble period; -}; - -enum { - PROP_0, - - PROP_PERIOD, - PROP_ANGLE, - - PROP_LAST -}; - -static GParamSpec *obj_props[PROP_LAST]; - -/* ClutterDeformEffect implementation */ -static void -cb_page_fold_effect_deform_vertex (ClutterDeformEffect *effect, - gfloat width, - gfloat height, - CoglTextureVertex *vertex) -{ - CbPageFoldEffectPrivate *priv = CB_PAGE_FOLD_EFFECT (effect)->priv; - - gfloat radians = (priv->angle * priv->period) / (180.0f / G_PI); - - /* rotate from the center of the actor on the y axis */ - gfloat adjusted_x = vertex->x - (width / 2); - - /* only rotate vertices to the right of the middle of the actor */ - if (adjusted_x >= 0.0) - { - vertex->x = (vertex->z * sin (radians)) - + (adjusted_x * cos (radians)) - + width / 2; - - /* NB add 1 to z to prevent "z fighting"; otherwise, when fully-folded - * the image has "stripes" where vertices from the folded part - * of the actor interfere with vertices from the unfolded part - */ - vertex->z = (vertex->z * cos (radians)) - + (adjusted_x * sin (radians)) - + 1; - } - - /* adjust depth of all vertices so they fit inside the actor while folding; - * this has the effect of making the image smaller within the texture, - * but does produce a cleaner fold animation - */ - vertex->z -= width / 2; -} - -/* GObject implementation */ -static void -cb_page_fold_effect_set_property (GObject *gobject, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - CbPageFoldEffect *effect = CB_PAGE_FOLD_EFFECT (gobject); - - switch (prop_id) - { - case PROP_PERIOD: - cb_page_fold_effect_set_period (effect, g_value_get_double (value)); - break; - - case PROP_ANGLE: - cb_page_fold_effect_set_angle (effect, g_value_get_double (value)); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -static void -cb_page_fold_effect_get_property (GObject *gobject, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - CbPageFoldEffectPrivate *priv = CB_PAGE_FOLD_EFFECT (gobject)->priv; - - switch (prop_id) - { - case PROP_PERIOD: - g_value_set_double (value, priv->period); - break; - - case PROP_ANGLE: - g_value_set_double (value, priv->angle); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); - break; - } -} - -/* GObject class and instance init */ -static void -cb_page_fold_effect_class_init (CbPageFoldEffectClass *klass) -{ - GParamSpec *pspec; - ClutterDeformEffectClass *effect_class = CLUTTER_DEFORM_EFFECT_CLASS (klass); - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - - effect_class->deform_vertex = cb_page_fold_effect_deform_vertex; - - gobject_class->set_property = cb_page_fold_effect_set_property; - gobject_class->get_property = cb_page_fold_effect_get_property; - - g_type_class_add_private (klass, sizeof (CbPageFoldEffectPrivate)); - - /** - * CbPageFoldEffect:period: - * - * The period of the page fold, between 0.0 (no fold) and - * 1.0 (fully folded) - */ - pspec = g_param_spec_double ("period", - "Period", - "The period of the page fold", - 0.0, 1.0, - 0.0, - G_PARAM_READWRITE); - obj_props[PROP_PERIOD] = pspec; - g_object_class_install_property (gobject_class, PROP_PERIOD, pspec); - - /** - * CbPageFoldEffect:angle: - * - * The angle of the page fold, in degrees, between 0.0 and 180.0 - */ - pspec = g_param_spec_double ("angle", - "Angle", - "The angle of the page fold, in degrees", - 0.0, 180.0, - 0.0, - G_PARAM_READWRITE); - obj_props[PROP_ANGLE] = pspec; - g_object_class_install_property (gobject_class, PROP_ANGLE, pspec); -} - -static void -cb_page_fold_effect_init (CbPageFoldEffect *self) -{ - CbPageFoldEffectPrivate *priv; - - priv = self->priv = CB_PAGE_FOLD_EFFECT_GET_PRIVATE (self); - - priv->period = 0.0; - priv->angle = 0.0; -} - -/* public API */ -ClutterEffect * -cb_page_fold_effect_new (gdouble angle, - gdouble period) -{ - return g_object_new (CB_TYPE_PAGE_FOLD_EFFECT, - "angle", angle, - "period", period, - NULL); -} - -/** - * cb_page_fold_effect_set_period: - * @effect: a #CbPageFoldEffect - * @period: the period of the page fold, between 0.0 and 1.0 - * - * Sets the period of the page fold, between 0.0 (no fold) - * and 1.0 (fully folded) - */ -void -cb_page_fold_effect_set_period (CbPageFoldEffect *effect, - gdouble period) -{ - g_return_if_fail (CB_IS_PAGE_FOLD_EFFECT (effect)); - g_return_if_fail (period >= 0.0 && period <= 1.0); - - effect->priv->period = period; - - clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect)); -} - -/** - * cb_page_fold_effect_get_period: - * @effect: a #CbPageFoldEffect - * - * Retrieves the value set using cb_page_fold_effect_get_period() - * - * Return value: the period of the page fold - */ -gdouble -cb_page_fold_effect_get_period (CbPageFoldEffect *effect) -{ - g_return_val_if_fail (CB_IS_PAGE_FOLD_EFFECT (effect), 0.0); - - return effect->priv->period; -} - -/** - * cb_page_fold_effect_set_angle: - * @effect: #CbPageFoldEffect - * @angle: the angle of the page fold, in degrees - * - * Sets the angle of the page fold, in degrees; must be a value between - * 0.0 and 180.0 - */ -void -cb_page_fold_effect_set_angle (CbPageFoldEffect *effect, - gdouble angle) -{ - g_return_if_fail (CB_IS_PAGE_FOLD_EFFECT (effect)); - g_return_if_fail (angle >= 0.0 && angle <= 180.0); - - effect->priv->angle = angle; - - clutter_deform_effect_invalidate (CLUTTER_DEFORM_EFFECT (effect)); -} - -/** - * cb_page_fold_effect_get_angle: - * @effect: a #CbPageFoldEffect: - * - * Retrieves the angle of the page fold, in degrees - * - * Return value: the angle of the page fold - */ -gdouble -cb_page_fold_effect_get_angle (CbPageFoldEffect *effect) -{ - g_return_val_if_fail (CB_IS_PAGE_FOLD_EFFECT (effect), 0.0); - - return effect->priv->angle; -} diff --git a/doc/cookbook/examples/cb-page-fold-effect.h b/doc/cookbook/examples/cb-page-fold-effect.h deleted file mode 100644 index 1fcb8d746..000000000 --- a/doc/cookbook/examples/cb-page-fold-effect.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef __CB_PAGE_FOLD_EFFECT_H__ -#define __CB_PAGE_FOLD_EFFECT_H__ - -#include - -GType cb_page_fold_effect_get_type (void); - -#define CB_TYPE_PAGE_FOLD_EFFECT (cb_page_fold_effect_get_type ()) -#define CB_PAGE_FOLD_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ - CB_TYPE_PAGE_FOLD_EFFECT, \ - CbPageFoldEffect)) -#define CB_IS_PAGE_FOLD_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ - CB_TYPE_PAGE_FOLD_EFFECT)) -#define CB_PAGE_FOLD_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \ - CB_TYPE_PAGE_FOLD_EFFECT, \ - CbPageFoldEffectClass)) -#define CB_IS_PAGE_FOLD_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \ - CB_TYPE_PAGE_FOLD_EFFECT)) -#define CB_PAGE_FOLD_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ - CB_TYPE_PAGE_FOLD_EFFECT, \ - CbPageFoldEffectClass)) - -typedef struct _CbPageFoldEffectPrivate CbPageFoldEffectPrivate; -typedef struct _CbPageFoldEffect CbPageFoldEffect; -typedef struct _CbPageFoldEffectClass CbPageFoldEffectClass; - -/* object */ -struct _CbPageFoldEffect -{ - ClutterDeformEffect parent_instance; - CbPageFoldEffectPrivate *priv; -}; - -/* class */ -struct _CbPageFoldEffectClass -{ - ClutterDeformEffectClass parent_class; -}; - -ClutterEffect *cb_page_fold_effect_new (gdouble angle, - gdouble period); -void cb_page_fold_effect_set_angle (CbPageFoldEffect *effect, - gdouble angle); -void cb_page_fold_effect_set_period (CbPageFoldEffect *effect, - gdouble period); -gdouble cb_page_fold_effect_get_period (CbPageFoldEffect *effect); -gdouble cb_page_fold_effect_get_angle (CbPageFoldEffect *effect); - -#endif /* __CB_PAGE_FOLD_EFFECT_H__ */ diff --git a/doc/cookbook/examples/effects-basic.c b/doc/cookbook/examples/effects-basic.c deleted file mode 100644 index 151a24496..000000000 --- a/doc/cookbook/examples/effects-basic.c +++ /dev/null @@ -1,118 +0,0 @@ -#include -#include - -#include "cb-border-effect.h" -#include "cb-background-effect.h" - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; - -static gboolean -toggle_highlight (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterActorMeta *meta = CLUTTER_ACTOR_META (user_data); - - gboolean effect_enabled = clutter_actor_meta_get_enabled (meta); - - clutter_actor_meta_set_enabled (meta, !effect_enabled); - - return CLUTTER_EVENT_STOP; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *box; - ClutterLayoutManager *layout_manager; - ClutterActor *texture; - ClutterEffect *background_effect; - ClutterEffect *border_effect; - ClutterConstraint *width_constraint; - gchar *filename; - guint i; - GError *error = NULL; - - if (argc < 2) - { - g_print ("Usage: %s \n", argv[0]); - return EXIT_FAILURE; - } - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return EXIT_FAILURE; - - stage = clutter_stage_new (); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); - clutter_actor_set_size (stage, 600, 400); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - layout_manager = clutter_flow_layout_new (CLUTTER_FLOW_HORIZONTAL); - clutter_flow_layout_set_column_spacing (CLUTTER_FLOW_LAYOUT (layout_manager), - 10); - clutter_flow_layout_set_row_spacing (CLUTTER_FLOW_LAYOUT (layout_manager), - 10); - - box = clutter_actor_new (); - clutter_actor_set_layout_manager (box, layout_manager); - width_constraint = clutter_bind_constraint_new (stage, - CLUTTER_BIND_WIDTH, - 0.0); - clutter_actor_add_constraint (box, width_constraint); - - /* loop through the files specified on the command line, adding - * each one into the box - */ - for (i = 1; i < argc; i++) - { - filename = argv[i]; - - texture = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); - clutter_actor_set_width (texture, 150); - clutter_actor_set_reactive (texture, TRUE); - - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - filename, - &error); - - if (error != NULL) - g_warning ("Error loading file %s:\n%s", - filename, - error->message); - - /* create a grey background effect */ - background_effect = cb_background_effect_new (); - - /* apply the effect to the actor */ - clutter_actor_add_effect (texture, background_effect); - - /* create a 5 pixel red border effect */ - border_effect = cb_border_effect_new (5.0, &red_color); - - /* apply the effect to the actor, but disabled */ - clutter_actor_add_effect (texture, border_effect); - clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (border_effect), - FALSE); - - /* on mouse click, toggle the "enabled" property of the border effect */ - g_signal_connect (texture, - "button-press-event", - G_CALLBACK (toggle_highlight), - border_effect); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), texture); - } - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/effects-built-in.c b/doc/cookbook/examples/effects-built-in.c deleted file mode 100644 index f2c3c463b..000000000 --- a/doc/cookbook/examples/effects-built-in.c +++ /dev/null @@ -1,59 +0,0 @@ -#include - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - ClutterConstraint *constraint_x; - ClutterConstraint *constraint_y; - ClutterColor *pink; - ClutterEffect *effect; - gchar *filename; - - if (argc < 2) - { - g_print ("Usage: %s \n", argv[0]); - return 1; - } - - filename = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); - clutter_actor_set_width (texture, 300); - - /* NB ignoring missing file errors here for brevity */ - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - filename, - NULL); - - /* align the texture on the x and y axes */ - constraint_x = clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5); - constraint_y = clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5); - clutter_actor_add_constraint (texture, constraint_x); - clutter_actor_add_constraint (texture, constraint_y); - - /* create a colorize effect with pink tint */ - pink = clutter_color_new (230, 187, 210, 255); - effect = clutter_colorize_effect_new (pink); - - /* apply the effect to the texture */ - clutter_actor_add_effect (texture, effect); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/effects-custom-deform.c b/doc/cookbook/examples/effects-custom-deform.c deleted file mode 100644 index 74ed2133c..000000000 --- a/doc/cookbook/examples/effects-custom-deform.c +++ /dev/null @@ -1,120 +0,0 @@ -/* Example of using a custom CbPageFoldEffect to do - * an animated fold of a texture containing an image - * - * Pass the full path to the image on the command line; - * click on the texture to trigger the folding animation - */ -#include -#include - -#include "cb-page-fold-effect.h" - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; - -static gboolean -button_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - - if (g_strcmp0 (clutter_state_get_state (transitions), "folded") == 0) - clutter_state_set_state (transitions, "unfolded"); - else - clutter_state_set_state (transitions, "folded"); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - ClutterEffect *effect; - ClutterState *transitions; - GError *error = NULL; - - gchar *filename; - - if (argc < 2) - { - g_print ("Usage: %s \n", argv[0]); - return EXIT_FAILURE; - } - - filename = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 300); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); - clutter_actor_set_width (texture, 400); - clutter_actor_set_reactive (texture, TRUE); - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - filename, - &error); - - if (error != NULL) - { - g_critical ("Error loading texture from file %s; error was:\n%s", - filename, - error->message); - return EXIT_FAILURE; - } - - /* create the page fold effect instance with destination fold angle - * of 180 degrees and starting period of 0 (no folding) - */ - effect = cb_page_fold_effect_new (180.0, 0.0); - - /* add the effect to the texture actor */ - clutter_actor_add_effect (texture, effect); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - - /* animation for the period property of the effect, - * to animate its value between 0.0 and 1.0 and back - */ - transitions = clutter_state_new (); - clutter_state_set_duration (transitions, NULL, NULL, 500); - - clutter_state_set_duration (transitions, - "partially-folded", - "folded", - 375); - - clutter_state_set (transitions, NULL, "folded", - effect, "period", CLUTTER_LINEAR, 1.0, - NULL); - - clutter_state_set (transitions, NULL, "partially-folded", - effect, "period", CLUTTER_LINEAR, 0.25, - NULL); - - clutter_state_set (transitions, NULL, "unfolded", - effect, "period", CLUTTER_LINEAR, 0.0, - NULL); - - clutter_state_warp_to_state (transitions, "partially-folded"); - - g_signal_connect (texture, - "button-press-event", - G_CALLBACK (button_pressed_cb), - transitions); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (transitions); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/events-buttons-click.c b/doc/cookbook/examples/events-buttons-click.c deleted file mode 100644 index 07479d4e1..000000000 --- a/doc/cookbook/examples/events-buttons-click.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; - -void -clicked_cb (ClutterClickAction *action, - ClutterActor *actor, - gpointer user_data) -{ - g_print ("Pointer button %d clicked on actor %s\n", - clutter_click_action_get_button (action), - clutter_actor_get_name (actor)); -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterAction *action1; - ClutterAction *action2; - ClutterActor *actor1; - ClutterActor *actor2; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - actor1 = clutter_actor_new (); - clutter_actor_set_name (actor1, "Red Button"); - clutter_actor_set_background_color (actor1, CLUTTER_COLOR_Red); - clutter_actor_set_size (actor1, 100, 100); - clutter_actor_set_reactive (actor1, TRUE); - clutter_actor_set_position (actor1, 50, 150); - clutter_actor_add_child (stage, actor1); - - actor2 = clutter_actor_new (); - clutter_actor_set_name (actor2, "Blue Button"); - clutter_actor_set_background_color (actor2, CLUTTER_COLOR_Blue); - clutter_actor_set_size (actor2, 100, 100); - clutter_actor_set_position (actor2, 250, 150); - clutter_actor_set_reactive (actor2, TRUE); - clutter_actor_add_child (stage, actor2); - - action1 = clutter_click_action_new (); - clutter_actor_add_action (actor1, action1); - - action2 = clutter_click_action_new (); - clutter_actor_add_action (actor2, action2); - - g_signal_connect (action1, - "clicked", - G_CALLBACK (clicked_cb), - NULL); - - g_signal_connect (action2, - "clicked", - G_CALLBACK (clicked_cb), - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/events-buttons-lasso.c b/doc/cookbook/examples/events-buttons-lasso.c deleted file mode 100644 index 16d37c6ac..000000000 --- a/doc/cookbook/examples/events-buttons-lasso.c +++ /dev/null @@ -1,155 +0,0 @@ -/* Simple rectangle drawing using button and pointer events; - * click, drag and release a mouse button to draw a rectangle - */ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor lasso_color = { 0xaa, 0xaa, 0xaa, 0x33 }; - -typedef struct -{ - ClutterActor *actor; - gfloat x; - gfloat y; -} Lasso; - -static guint -random_color_component () -{ - return (guint) (155 + (100.0 * rand () / (RAND_MAX + 1.0))); -} - -static gboolean -button_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - Lasso *lasso = (Lasso *) user_data; - - /* start drawing the lasso actor */ - lasso->actor = clutter_rectangle_new_with_color (&lasso_color); - - /* store lasso's start coordinates */ - clutter_event_get_coords (event, &(lasso->x), &(lasso->y)); - - clutter_container_add_actor (CLUTTER_CONTAINER (actor), lasso->actor); - - return TRUE; -} - -static gboolean -button_released_cb (ClutterActor *stage, - ClutterEvent *event, - gpointer user_data) -{ - Lasso *lasso = (Lasso *) user_data; - ClutterActor *rectangle; - ClutterColor *random_color; - gfloat x; - gfloat y; - gfloat width; - gfloat height; - - if (lasso->actor == NULL) - return TRUE; - - /* create a new rectangle */ - random_color = clutter_color_new (random_color_component (), - random_color_component (), - random_color_component (), - random_color_component ()); - rectangle = clutter_rectangle_new_with_color (random_color); - - /* set the rectangle to the same size and shape as the lasso */ - clutter_actor_get_position (lasso->actor, &x, &y); - clutter_actor_get_size (lasso->actor, &width, &height); - - clutter_actor_set_position (rectangle, x, y); - clutter_actor_set_size (rectangle, width, height); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle); - - /* clear up the lasso actor */ - clutter_actor_destroy (lasso->actor); - lasso->actor = NULL; - - clutter_actor_queue_redraw (stage); - - return TRUE; - -} - -static gboolean -pointer_motion_cb (ClutterActor *stage, - ClutterEvent *event, - gpointer user_data) -{ - gfloat pointer_x; - gfloat pointer_y; - gfloat new_x; - gfloat new_y; - gfloat width; - gfloat height; - - Lasso *lasso = (Lasso *) user_data; - - if (lasso->actor == NULL) - return TRUE; - - /* redraw the lasso actor */ - clutter_event_get_coords (event, &pointer_x, &pointer_y); - - new_x = MIN (pointer_x, lasso->x); - new_y = MIN (pointer_y, lasso->y); - width = MAX (pointer_x, lasso->x) - new_x; - height = MAX (pointer_y, lasso->y) - new_y; - - clutter_actor_set_position (lasso->actor, new_x, new_y); - clutter_actor_set_size (lasso->actor, width, height); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - Lasso *lasso = g_new0 (Lasso, 1); - - ClutterActor *stage; - - /* seed random number generator */ - srand ((unsigned int) time (NULL)); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 320, 240); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - g_signal_connect (stage, - "button-press-event", - G_CALLBACK (button_pressed_cb), - lasso); - - g_signal_connect (stage, - "button-release-event", - G_CALLBACK (button_released_cb), - lasso); - - g_signal_connect (stage, - "motion-event", - G_CALLBACK (pointer_motion_cb), - lasso); - - clutter_actor_show (stage); - - clutter_main (); - - g_free (lasso); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/events-buttons.c b/doc/cookbook/examples/events-buttons.c deleted file mode 100644 index 87f456fc1..000000000 --- a/doc/cookbook/examples/events-buttons.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green_color = { 0x00, 0xff, 0x00, 0xff }; - -static gboolean -button_event_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat x, y; - gchar *event_type; - guint button_pressed; - ClutterModifierType state; - gchar *ctrl_pressed; - guint32 click_count; - - /* where the pointer was when the button event occurred */ - clutter_event_get_coords (event, &x, &y); - - /* check whether it was a press or release event */ - event_type = "released"; - if (clutter_event_type (event) == CLUTTER_BUTTON_PRESS) - event_type = "pressed"; - - /* which button triggered the event */ - button_pressed = clutter_event_get_button (event); - - /* keys down when the button was pressed */ - state = clutter_event_get_state (event); - - ctrl_pressed = "ctrl not pressed"; - if (state & CLUTTER_CONTROL_MASK) - ctrl_pressed = "ctrl pressed"; - - /* click count */ - click_count = clutter_event_get_click_count (event); - - g_debug ("button %d %s at %.0f,%.0f; %s; click count %d", - button_pressed, - event_type, - x, - y, - ctrl_pressed, - click_count); - - return TRUE; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *red; - ClutterActor *green; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - red = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (red, 100, 100); - clutter_actor_set_position (red, 50, 150); - clutter_actor_set_reactive (red, TRUE); - - green = clutter_rectangle_new_with_color (&green_color); - clutter_actor_set_size (green, 100, 100); - clutter_actor_set_position (green, 250, 150); - clutter_actor_set_reactive (green, TRUE); - - g_signal_connect (red, - "button-press-event", - G_CALLBACK (button_event_cb), - NULL); - - g_signal_connect (red, - "button-release-event", - G_CALLBACK (button_event_cb), - NULL); - - g_signal_connect (green, - "button-press-event", - G_CALLBACK (button_event_cb), - NULL); - - g_signal_connect (green, - "button-release-event", - G_CALLBACK (button_event_cb), - NULL); - - clutter_container_add (CLUTTER_CONTAINER (stage), - red, - green, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/events-mouse-scroll.c b/doc/cookbook/examples/events-mouse-scroll.c deleted file mode 100644 index 1b2c8386b..000000000 --- a/doc/cookbook/examples/events-mouse-scroll.c +++ /dev/null @@ -1,129 +0,0 @@ -#include - -#define STAGE_HEIGHT 300 -#define STAGE_WIDTH STAGE_HEIGHT -#define SCROLL_AMOUNT STAGE_HEIGHT * 0.125 - -static gboolean -_scroll_event_cb (ClutterActor *viewport, - ClutterEvent *event, - gpointer user_data) -{ - ClutterActor *scrollable = CLUTTER_ACTOR (user_data); - - gfloat viewport_height = clutter_actor_get_height (viewport); - gfloat scrollable_height = clutter_actor_get_height (scrollable); - gfloat y; - ClutterScrollDirection direction; - - /* no need to scroll if the scrollable is shorter than the viewport */ - if (scrollable_height < viewport_height) - return TRUE; - - y = clutter_actor_get_y (scrollable); - - direction = clutter_event_get_scroll_direction (event); - - switch (direction) - { - case CLUTTER_SCROLL_UP: - y -= SCROLL_AMOUNT; - break; - case CLUTTER_SCROLL_DOWN: - y += SCROLL_AMOUNT; - break; - - /* we're only interested in up and down */ - case CLUTTER_SCROLL_LEFT: - case CLUTTER_SCROLL_RIGHT: - break; - } - - /* - * the CLAMP macro returns a value for the first argument - * that falls within the range specified by the second and - * third arguments - * - * we allow the scrollable's y position to be decremented to the point - * where its base is aligned with the base of the viewport - */ - y = CLAMP (y, - viewport_height - scrollable_height, - 0.0); - - /* animate the change to the scrollable's y coordinate */ - clutter_actor_animate (scrollable, - CLUTTER_EASE_OUT_CUBIC, - 300, - "y", y, - NULL); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *viewport; - ClutterActor *texture; - - const gchar *image_file_path = "redhand.png"; - - if (argc > 1) - { - image_file_path = argv[1]; - } - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* the scrollable actor */ - texture = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), - TRUE); - - /* set the texture's height so it's as tall as the stage */ - clutter_actor_set_request_mode (texture, CLUTTER_REQUEST_WIDTH_FOR_HEIGHT); - clutter_actor_set_height (texture, STAGE_HEIGHT); - - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - image_file_path, - NULL); - - /* the viewport which the box is scrolled within */ - viewport = clutter_actor_new (); - - /* viewport is shorter than the stage */ - clutter_actor_set_size (viewport, STAGE_WIDTH, STAGE_HEIGHT * 0.5); - - /* align the viewport to the center of the stage's y axis */ - clutter_actor_add_constraint (viewport, clutter_align_constraint_new (stage, CLUTTER_BIND_Y, 0.5)); - - /* viewport needs to respond to scroll events */ - clutter_actor_set_reactive (viewport, TRUE); - - /* clip all actors inside the viewport to that group's allocation */ - clutter_actor_set_clip_to_allocation (viewport, TRUE); - - /* put the texture inside the viewport */ - clutter_actor_add_child (viewport, texture); - - /* add the viewport to the stage */ - clutter_actor_add_child (stage, viewport); - - g_signal_connect (viewport, - "scroll-event", - G_CALLBACK (_scroll_event_cb), - texture); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/events-pointer-motion-crossing.c b/doc/cookbook/examples/events-pointer-motion-crossing.c deleted file mode 100644 index 946ff2b09..000000000 --- a/doc/cookbook/examples/events-pointer-motion-crossing.c +++ /dev/null @@ -1,115 +0,0 @@ -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor yellow = { 0xaa, 0x99, 0x00, 0xff }; -static const ClutterColor white = { 0xff, 0xff, 0xff, 0xff }; - -static gboolean -_pointer_enter_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - clutter_state_set_state (transitions, "fade-in"); - return TRUE; -} - -static gboolean -_pointer_leave_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - clutter_state_set_state (transitions, "fade-out"); - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterLayoutManager *layout; - ClutterActor *box; - ClutterActor *rect; - ClutterActor *text; - ClutterState *transitions; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "btn"); - clutter_actor_set_background_color (stage, &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL, - CLUTTER_BIN_ALIGNMENT_FILL); - - box = clutter_actor_new (); - clutter_actor_set_layout_manager (box, layout); - clutter_actor_set_position (box, 25, 25); - clutter_actor_set_reactive (box, TRUE); - clutter_actor_set_size (box, 100, 30); - - /* background for the button */ - rect = clutter_rectangle_new_with_color (&yellow); - clutter_actor_add_child (box, rect); - - /* text for the button */ - text = clutter_text_new_full ("Sans 10pt", "Hover me", &white); - - /* - * NB don't set the height, so the actor assumes the height of the text; - * then when added to the bin layout, it gets centred on it; - * also if you don't set the width, the layout goes gets really wide; - * the 10pt text fits inside the 30px height of the rectangle - */ - clutter_actor_set_width (text, 100); - clutter_bin_layout_add (CLUTTER_BIN_LAYOUT (layout), - text, - CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); - - /* animations */ - transitions = clutter_state_new (); - clutter_state_set (transitions, NULL, "fade-out", - box, "opacity", CLUTTER_LINEAR, 180, - NULL); - - /* - * NB you can't use an easing mode where alpha > 1.0 if you're - * animating to a value of 255, as the value you're animating - * to will possibly go > 255 - */ - clutter_state_set (transitions, NULL, "fade-in", - box, "opacity", CLUTTER_LINEAR, 255, - NULL); - - clutter_state_set_duration (transitions, NULL, NULL, 50); - - clutter_state_warp_to_state (transitions, "fade-out"); - - g_signal_connect (box, - "enter-event", - G_CALLBACK (_pointer_enter_cb), - transitions); - - g_signal_connect (box, - "leave-event", - G_CALLBACK (_pointer_leave_cb), - transitions); - - /* bind the stage size to the box size + 50px in each axis */ - clutter_actor_add_constraint (stage, clutter_bind_constraint_new (box, CLUTTER_BIND_HEIGHT, 50.0)); - clutter_actor_add_constraint (stage, clutter_bind_constraint_new (box, CLUTTER_BIND_WIDTH, 50.0)); - - clutter_actor_add_child (stage, box); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (transitions); - - return 0; -} diff --git a/doc/cookbook/examples/events-pointer-motion-scribbler.c b/doc/cookbook/examples/events-pointer-motion-scribbler.c deleted file mode 100644 index de065332e..000000000 --- a/doc/cookbook/examples/events-pointer-motion-scribbler.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Simple scribble application: move mouse over the dark yellow - * rectangle to draw brighter yellow lines - */ - -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor actor_color = { 0xaa, 0x99, 0x00, 0xff }; - -typedef struct { - ClutterPath *path; - CoglPath *cogl_path; -} Context; - -static void -_convert_clutter_path_node_to_cogl_path (const ClutterPathNode *node, - gpointer data) -{ - ClutterKnot knot; - - g_return_if_fail (node != NULL); - - switch (node->type) - { - case CLUTTER_PATH_MOVE_TO: - knot = node->points[0]; - cogl_path_move_to (knot.x, knot.y); - g_debug ("move to %d, %d", knot.x, knot.y); - break; - case CLUTTER_PATH_LINE_TO: - knot = node->points[0]; - cogl_path_line_to (knot.x, knot.y); - g_debug ("line to %d, %d", knot.x, knot.y); - break; - default: - break; - } -} - -static void -_canvas_paint_cb (ClutterActor *actor, - gpointer user_data) -{ - Context *context = (Context *)user_data; - - cogl_set_source_color4ub (255, 255, 0, 255); - - cogl_set_path (context->cogl_path); - - clutter_path_foreach (context->path, _convert_clutter_path_node_to_cogl_path, NULL); - - cogl_path_stroke_preserve (); - - clutter_path_clear (context->path); - - context->cogl_path = cogl_get_path (); - - g_signal_stop_emission_by_name (actor, "paint"); -} - -static gboolean -_pointer_motion_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterMotionEvent *motion_event = (ClutterMotionEvent *)event; - Context *context = (Context *)user_data; - - gfloat x, y; - clutter_actor_transform_stage_point (actor, motion_event->x, motion_event->y, &x, &y); - - g_debug ("motion; x %f, y %f", x, y); - - clutter_path_add_line_to (context->path, x, y); - - clutter_actor_queue_redraw (actor); - - return TRUE; -} - -static gboolean -_pointer_enter_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterCrossingEvent *cross_event = (ClutterCrossingEvent *)event; - Context *context = (Context *)user_data; - - gfloat x, y; - clutter_actor_transform_stage_point (actor, cross_event->x, cross_event->y, &x, &y); - - g_debug ("enter; x %f, y %f", x, y); - - clutter_path_add_move_to (context->path, x, y); - - clutter_actor_queue_redraw (actor); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - Context *context = g_new0 (Context, 1); - - ClutterActor *stage; - ClutterActor *rect; - ClutterActor *canvas; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - context->path = clutter_path_new (); - - cogl_path_new (); - context->cogl_path = cogl_get_path (); - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - rect = clutter_rectangle_new_with_color (&actor_color); - clutter_actor_set_size (rect, 300, 300); - clutter_actor_add_constraint (rect, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (rect, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); - - canvas = clutter_texture_new (); - clutter_actor_set_size (canvas, 300, 300); - clutter_actor_add_constraint (canvas, clutter_align_constraint_new (rect, CLUTTER_ALIGN_X_AXIS, 0.0)); - clutter_actor_add_constraint (canvas, clutter_align_constraint_new (rect, CLUTTER_ALIGN_Y_AXIS, 0.0)); - clutter_actor_set_reactive (canvas, TRUE); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), canvas); - clutter_actor_raise_top (canvas); - - g_signal_connect (canvas, - "motion-event", - G_CALLBACK (_pointer_motion_cb), - context); - - g_signal_connect (canvas, - "enter-event", - G_CALLBACK (_pointer_enter_cb), - context); - - g_signal_connect (canvas, - "paint", - G_CALLBACK (_canvas_paint_cb), - context); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (context->path); - g_free (context); - - return 0; -} diff --git a/doc/cookbook/examples/events-pointer-motion-stacked.c b/doc/cookbook/examples/events-pointer-motion-stacked.c deleted file mode 100644 index f92fa0298..000000000 --- a/doc/cookbook/examples/events-pointer-motion-stacked.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Testing what happens with a stack of actors and pointer events - * red and green are reactive; blue is not - * - * when the pointer is over green (even if green is obscured by blue) - * signals are emitted by green (not by blue); - * - * but when the pointer is over the overlap between red and green, - * signals are emitted by green - * - * gcc -g -O0 -o stacked-actors-and-events stacked-actors-and-events.c `pkg-config --libs --cflags clutter-1.0 glib-2.0` -lm - */ -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor red = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green = { 0x00, 0xff, 0x00, 0xff }; -static const ClutterColor blue = { 0x00, 0x00, 0xff, 0xff }; - -static gboolean -_pointer_motion_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat stage_x, stage_y; - gfloat actor_x, actor_y; - - /* get the coordinates where the pointer crossed into the actor */ - clutter_event_get_coords (event, &stage_x, &stage_y); - - /* - * as the coordinates are relative to the stage, rather than - * the actor which emitted the signal, it can be useful to - * transform them to actor-relative coordinates - */ - clutter_actor_transform_stage_point (actor, - stage_x, stage_y, - &actor_x, &actor_y); - - g_debug ("pointer on actor %s @ x %.0f, y %.0f", - clutter_actor_get_name (actor), - actor_x, actor_y); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *r1, *r2, *r3; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 300, 300); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - r1 = clutter_rectangle_new_with_color (&red); - clutter_actor_set_size (r1, 150, 150); - clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.25)); - clutter_actor_add_constraint (r1, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.25)); - clutter_actor_set_reactive (r1, TRUE); - clutter_actor_set_name (r1, "red"); - - r2 = clutter_rectangle_new_with_color (&green); - clutter_actor_set_size (r2, 150, 150); - clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (r2, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - clutter_actor_set_reactive (r2, TRUE); - clutter_actor_set_depth (r2, -100); - clutter_actor_set_name (r2, "green"); - - r3 = clutter_rectangle_new_with_color (&blue); - clutter_actor_set_size (r3, 150, 150); - clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.75)); - clutter_actor_add_constraint (r3, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.75)); - clutter_actor_set_opacity (r3, 125); - clutter_actor_set_name (r3, "blue"); - - clutter_container_add (CLUTTER_CONTAINER (stage), r1, r2, r3, NULL); - - g_signal_connect (r1, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL); - g_signal_connect (r2, "motion-event", G_CALLBACK (_pointer_motion_cb), NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/events-pointer-motion.c b/doc/cookbook/examples/events-pointer-motion.c deleted file mode 100644 index 0a96bd7f1..000000000 --- a/doc/cookbook/examples/events-pointer-motion.c +++ /dev/null @@ -1,57 +0,0 @@ -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor rectangle_color = { 0xaa, 0x99, 0x00, 0xff }; - -static gboolean -_pointer_motion_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat stage_x, stage_y; - gfloat actor_x, actor_y; - - clutter_event_get_coords (event, &stage_x, &stage_y); - - clutter_actor_transform_stage_point (actor, - stage_x, stage_y, - &actor_x, &actor_y); - - g_debug ("pointer @ stage x %.0f, y %.0f; actor x %.0f, y %.0f", - stage_x, stage_y, - actor_x, actor_y); - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *rectangle; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - rectangle = clutter_rectangle_new_with_color (&rectangle_color); - clutter_actor_set_size (rectangle, 300, 300); - clutter_actor_set_position (rectangle, 50, 50); - clutter_actor_set_reactive (rectangle, TRUE); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), rectangle); - - g_signal_connect (rectangle, - "motion-event", - G_CALLBACK (_pointer_motion_cb), - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/layouts-bind-constraint-allocation.c b/doc/cookbook/examples/layouts-bind-constraint-allocation.c deleted file mode 100644 index 2bc690e9a..000000000 --- a/doc/cookbook/examples/layouts-bind-constraint-allocation.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include - -#define OVERLAY_FACTOR 1.1 - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; - -void -allocation_changed_cb (ClutterActor *actor, - const ClutterActorBox *allocation, - ClutterAllocationFlags flags, - gpointer user_data) -{ - ClutterActor *overlay = CLUTTER_ACTOR (user_data); - - gfloat width, height, x, y; - clutter_actor_box_get_size (allocation, &width, &height); - clutter_actor_box_get_origin (allocation, &x, &y); - - clutter_actor_set_size (overlay, - width * OVERLAY_FACTOR, - height * OVERLAY_FACTOR); - - clutter_actor_set_position (overlay, - x - ((OVERLAY_FACTOR - 1) * width * 0.5), - y - ((OVERLAY_FACTOR - 1) * width * 0.5)); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *actor; - ClutterActor *overlay; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - actor = clutter_actor_new (); - clutter_actor_set_background_color (actor, CLUTTER_COLOR_Red); - clutter_actor_set_size (actor, 100, 100); - clutter_actor_set_position (actor, 150, 150); - clutter_actor_add_child (stage, actor); - - overlay = clutter_actor_new (); - clutter_actor_set_background_color (overlay, CLUTTER_COLOR_Blue); - clutter_actor_set_opacity (overlay, 128); - - g_signal_connect (actor, - "allocation-changed", - G_CALLBACK (allocation_changed_cb), - overlay); - - clutter_actor_add_child (stage, overlay); - - clutter_actor_animate (actor, CLUTTER_LINEAR, 2000, - "width", 300.0, - "height", 300.0, - "x", 50.0, - "y", 50.0, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-bind-constraint-overlay.c b/doc/cookbook/examples/layouts-bind-constraint-overlay.c deleted file mode 100644 index 856955c70..000000000 --- a/doc/cookbook/examples/layouts-bind-constraint-overlay.c +++ /dev/null @@ -1,136 +0,0 @@ -#include -#include - -#define STAGE_SIDE 400 -#define RECTANGLE_SIDE STAGE_SIDE * 0.5 -#define TEXTURE_SIZE_MAX STAGE_SIDE * 0.9 -#define TEXTURE_SIZE_MIN STAGE_SIDE * 0.1 -#define TEXTURE_SIZE_STEP 0.2 -#define OVERLAY_OPACITY_OFF 0 -#define OVERLAY_OPACITY_ON 100 - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor overlay_color = { 0xaa, 0x99, 0x00, 0xff }; - -/* change the texture size with +/- */ -static gboolean -key_press_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterActor *texture; - gfloat texture_width, texture_height; - guint key_pressed; - - texture = CLUTTER_ACTOR (user_data); - clutter_actor_get_size (texture, &texture_width, &texture_height); - - key_pressed = clutter_event_get_key_symbol (event); - - if (key_pressed == CLUTTER_KEY_plus) - { - texture_width *= 1.0 + TEXTURE_SIZE_STEP; - texture_height *= 1.0 + TEXTURE_SIZE_STEP; - } - else if (key_pressed == CLUTTER_KEY_minus) - { - texture_width *= 1.0 - TEXTURE_SIZE_STEP; - texture_height *= 1.0 - TEXTURE_SIZE_STEP; - } - - if (texture_width <= TEXTURE_SIZE_MAX && texture_width >= TEXTURE_SIZE_MIN) - clutter_actor_animate (texture, CLUTTER_EASE_OUT_CUBIC, 500, - "width", texture_width, - "height", texture_height, - NULL); - - return TRUE; -} - -/* turn overlay opacity on/off */ -static void -click_cb (ClutterClickAction *action, - ClutterActor *actor, - gpointer user_data) -{ - ClutterActor *overlay = CLUTTER_ACTOR (user_data); - guint8 opacity = clutter_actor_get_opacity (overlay); - - if (opacity < OVERLAY_OPACITY_ON) - opacity = OVERLAY_OPACITY_ON; - else - opacity = OVERLAY_OPACITY_OFF; - - clutter_actor_set_opacity (overlay, opacity); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - ClutterActor *overlay; - ClutterAction *click; - GError *error = NULL; - - const gchar *filename = "redhand.png"; - - if (argc > 1) - filename = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture), TRUE); - clutter_actor_set_reactive (texture, TRUE); - clutter_actor_set_size (texture, RECTANGLE_SIDE, RECTANGLE_SIDE); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - filename, - &error); - - if (error != NULL) - { - g_warning ("Error loading %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - /* overlay is 10px wider and taller than the texture, and centered on it; - * initially, it is transparent; but it is made semi-opaque when the - * texture is clicked - */ - overlay = clutter_rectangle_new_with_color (&overlay_color); - clutter_actor_set_opacity (overlay, OVERLAY_OPACITY_OFF); - clutter_actor_add_constraint (overlay, clutter_bind_constraint_new (texture, CLUTTER_BIND_WIDTH, 10)); - clutter_actor_add_constraint (overlay, clutter_bind_constraint_new (texture, CLUTTER_BIND_HEIGHT, 10)); - clutter_actor_add_constraint (overlay, clutter_align_constraint_new (texture, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (overlay, clutter_align_constraint_new (texture, CLUTTER_ALIGN_Y_AXIS, 0.5)); - - click = clutter_click_action_new (); - clutter_actor_add_action (texture, click); - - clutter_container_add (CLUTTER_CONTAINER (stage), texture, overlay, NULL); - clutter_actor_raise_top (overlay); - - g_signal_connect (click, "clicked", G_CALLBACK (click_cb), overlay); - - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_press_cb), - texture); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-bind-constraint-stage.c b/doc/cookbook/examples/layouts-bind-constraint-stage.c deleted file mode 100644 index 250b434f5..000000000 --- a/doc/cookbook/examples/layouts-bind-constraint-stage.c +++ /dev/null @@ -1,56 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor rectangle_color = { 0xaa, 0x99, 0x00, 0xff }; - -int -main (int argc, char *argv[]) -{ - /* the stage is the "source" for constraints on the texture */ - ClutterActor *stage; - - /* the "target" actor which will be bound by the constraints */ - ClutterActor *texture; - - ClutterConstraint *width_binding; - ClutterConstraint *height_binding; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* make the stage resizable */ - clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); - - texture = clutter_texture_new (); - clutter_actor_set_opacity (texture, 50); - clutter_texture_set_repeat (CLUTTER_TEXTURE (texture), TRUE, TRUE); - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), "smiley.png", NULL); - - /* the texture's width will be 100px less than the stage's */ - width_binding = clutter_bind_constraint_new (stage, CLUTTER_BIND_WIDTH, -100); - - /* the texture's height will be 100px less than the stage's */ - height_binding = clutter_bind_constraint_new (stage, CLUTTER_BIND_HEIGHT, -100); - - /* add the constraints to the texture */ - clutter_actor_add_constraint (texture, width_binding); - clutter_actor_add_constraint (texture, height_binding); - - /* add some alignment constraints */ - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-box-menu.c b/doc/cookbook/examples/layouts-box-menu.c deleted file mode 100644 index 136f95ff3..000000000 --- a/doc/cookbook/examples/layouts-box-menu.c +++ /dev/null @@ -1,152 +0,0 @@ -#include -#include - -#define FONT "Sans 20px" - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor yellow_color = { 0xaa, 0xaa, 0x00, 0xff }; -static const ClutterColor black_color = { 0x00, 0x00, 0x00, 0xff }; - -static void -menu_run_option (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - g_debug ("%s pressed", (gchar *) user_data); -} - -static void -menu_add_option (ClutterBox *menu, - gchar *text, - gchar *shortcut) -{ - ClutterActor *entry; - - entry = clutter_box_new (clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER)); - clutter_box_set_color (CLUTTER_BOX (entry), &black_color); - clutter_actor_set_width (entry, 250); - clutter_actor_set_reactive (entry, TRUE); - - clutter_box_pack (CLUTTER_BOX (entry), - clutter_text_new_full (FONT, text, &yellow_color), - "x-align", CLUTTER_BIN_ALIGNMENT_START, - NULL); - - clutter_box_pack (CLUTTER_BOX (entry), - clutter_text_new_full (FONT, shortcut, &yellow_color), - "x-align", CLUTTER_BIN_ALIGNMENT_END, - NULL); - - clutter_container_add_actor (CLUTTER_CONTAINER (menu), entry); - - g_signal_connect (entry, - "button-press-event", - G_CALLBACK (menu_run_option), - text); -} - -static void -menu_toggle (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterAnimation *animation; - ClutterActor *menu = CLUTTER_ACTOR (user_data); - - if (clutter_actor_get_animation (menu)) - return; - - if (clutter_actor_get_opacity (menu) > 0) - { - animation = clutter_actor_animate (menu, CLUTTER_EASE_OUT_CUBIC, 200, - "opacity", 0, - NULL); - - /* hide the menu once it is fully transparent */ - g_signal_connect_swapped (animation, - "completed", - G_CALLBACK (clutter_actor_hide), - menu); - } - else - { - clutter_actor_show (menu); - - clutter_actor_animate (menu, CLUTTER_EASE_OUT_CUBIC, 200, - "opacity", 255, - NULL); - } -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterActor *button; - ClutterLayoutManager *menu_layout; - ClutterActor *menu; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* button */ - button = clutter_box_new (clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER)); - clutter_actor_set_width (button, 100); - clutter_actor_set_position (button, 50, 50); - clutter_actor_set_reactive (button, TRUE); - clutter_box_set_color (CLUTTER_BOX (button), &black_color); - clutter_box_pack (CLUTTER_BOX (button), - clutter_text_new_full (FONT, "Edit", &yellow_color), - "x-align", CLUTTER_BIN_ALIGNMENT_FILL, - "y-align", CLUTTER_BIN_ALIGNMENT_FILL, - NULL); - - /* menu */ - menu_layout = clutter_box_layout_new (); - clutter_box_layout_set_homogeneous (CLUTTER_BOX_LAYOUT (menu_layout), TRUE); - clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (menu_layout), TRUE); - clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (menu_layout), 2); - - menu = clutter_box_new (menu_layout); - clutter_box_set_color (CLUTTER_BOX (menu), &yellow_color); - menu_add_option (CLUTTER_BOX (menu), "Undo", "Ctrl-z"); - menu_add_option (CLUTTER_BOX (menu), "Redo", "Ctrl-Shift-z"); - menu_add_option (CLUTTER_BOX (menu), "Cut", "Ctrl-x"); - menu_add_option (CLUTTER_BOX (menu), "Copy", "Ctrl-c"); - menu_add_option (CLUTTER_BOX (menu), "Paste", "Ctrl-v"); - - /* align left-hand side of menu with left-hand side of button */ - clutter_actor_add_constraint (menu, clutter_align_constraint_new (button, - CLUTTER_ALIGN_X_AXIS, - 0.0)); - - /* align top of menu with the bottom of the button */ - clutter_actor_add_constraint (menu, clutter_bind_constraint_new (button, - CLUTTER_BIND_Y, - clutter_actor_get_height (button))); - - /* hide the menu until we're ready to animate it in */ - clutter_actor_set_opacity (menu, 0); - clutter_actor_hide (menu); - - /* clicking on the button toggles the menu */ - g_signal_connect (button, "button-press-event", G_CALLBACK (menu_toggle), menu); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), menu); - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), button); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-box-property-effects.c b/doc/cookbook/examples/layouts-box-property-effects.c deleted file mode 100644 index b712b91ec..000000000 --- a/doc/cookbook/examples/layouts-box-property-effects.c +++ /dev/null @@ -1,466 +0,0 @@ -/* - * Experiment with permutations of layout properties for a ClutterBoxLayout - * - * See the text (in brackets) at the bottom of the application - * window for available key presses - */ -#include -#include - -#define STAGE_SIDE 510 -#define BOX_SIDE STAGE_SIDE * 0.75 -#define RED_SIDE STAGE_SIDE / 4 -#define GREEN_SIDE STAGE_SIDE / 8 -#define BLUE_SIDE STAGE_SIDE / 16 - -typedef struct -{ - ClutterLayoutManager *box_layout; - ClutterActor *box; - ClutterActor *status_display; - gboolean x_fill; - gboolean y_fill; - gboolean expand; - ClutterBoxAlignment x_align; - ClutterBoxAlignment y_align; -} State; - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor box_color = { 0x66, 0x66, 0x00, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor green_color = { 0x00, 0xff, 0x00, 0xff }; -static const ClutterColor blue_color = { 0x00, 0x00, 0xff, 0xff }; -static const ClutterColor white_color = { 0xff, 0xff, 0xff, 0xff }; - -static GValue -gboolean_to_gvalue (gboolean value) -{ - GValue gval = {0}; - - g_value_init (&gval, G_TYPE_BOOLEAN); - g_value_set_boolean (&gval, value); - - return gval; -} - -static GValue -alignment_to_gvalue (ClutterBoxAlignment value) -{ - GValue gval = {0}; - - g_value_init (&gval, G_TYPE_INT); - g_value_set_int (&gval, value); - - return gval; -} - -static gchar* -alignment_as_string (ClutterBoxAlignment value) -{ - gchar *align_string = "start "; - - switch (value) - { - case CLUTTER_BOX_ALIGNMENT_CENTER: - align_string = "center"; - break; - - case CLUTTER_BOX_ALIGNMENT_END: - align_string = "end "; - break; - - case CLUTTER_BOX_ALIGNMENT_START: - align_string = "start "; - break; - } - - return align_string; -} - -static ClutterBoxAlignment -get_next_alignment (ClutterBoxAlignment alignment) -{ - alignment++; - - if (alignment > CLUTTER_BOX_ALIGNMENT_CENTER) - alignment = CLUTTER_BOX_ALIGNMENT_START; - - return alignment; -} - -static void -show_status (State *state) -{ - ClutterText *text = CLUTTER_TEXT (state->status_display); - ClutterBoxLayout *box_layout = CLUTTER_BOX_LAYOUT (state->box_layout); - - gboolean homogeneous = clutter_box_layout_get_homogeneous (box_layout); - gboolean vertical = clutter_box_layout_get_vertical (box_layout); - - gchar *message = g_strdup_printf ("x_fill (x): %s\t\t\t" - "y_fill (y): %s\n" - "expand (e): %s\t\t" - "homogeneous (h): %s\n" - "spacing (+/-): %dpx\t\t" - "vertical (v): %s\n" - "x_align (right): %s\t" - "y_align (up): %s", - (state->x_fill ? "true" : "false"), - (state->y_fill ? "true" : "false"), - (state->expand ? "true" : "false"), - (homogeneous ? "true" : "false"), - clutter_box_layout_get_spacing (box_layout), - (vertical ? "true" : "false"), - alignment_as_string (state->x_align), - alignment_as_string (state->y_align)); - - clutter_text_set_text (text, message); - - g_free (message); -} - -static void -set_property_on_layout_children (State *state, - const gchar *property, - GValue value) -{ - ClutterActor *actor; - ClutterContainer *container = CLUTTER_CONTAINER (state->box); - ClutterLayoutManager *manager = CLUTTER_LAYOUT_MANAGER (state->box_layout); - GList *actors = clutter_container_get_children (container); - - for (; actors; actors = actors->next) - { - actor = CLUTTER_ACTOR (actors->data); - - clutter_layout_manager_child_set_property (manager, - container, - actor, - property, - &value); - } - - g_list_free (actors); -} - -static void -toggle_x_fill (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - - state->x_fill = !state->x_fill; - - set_property_on_layout_children (state, - "x-fill", - gboolean_to_gvalue (state->x_fill)); -} - -static void -toggle_y_fill (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - - state->y_fill = !state->y_fill; - - set_property_on_layout_children (state, - "y-fill", - gboolean_to_gvalue (state->y_fill)); -} - -static void -toggle_expand (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - - state->expand = !state->expand; - - set_property_on_layout_children (state, - "expand", - gboolean_to_gvalue (state->expand)); -} - -static void -rotate_x_alignment (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - - state->x_align = get_next_alignment (state->x_align); - - set_property_on_layout_children (state, - "x-align", - alignment_to_gvalue (state->x_align)); -} - -static void -rotate_y_alignment (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - - state->y_align = get_next_alignment (state->y_align); - - set_property_on_layout_children (state, - "y-align", - alignment_to_gvalue (state->y_align)); -} - -static void -toggle_vertical (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - ClutterBoxLayout *box_layout = CLUTTER_BOX_LAYOUT (state->box_layout); - gboolean vertical = clutter_box_layout_get_vertical (box_layout); - - clutter_box_layout_set_vertical (box_layout, !vertical); -} - -static void -toggle_homogeneous (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - ClutterBoxLayout *box_layout = CLUTTER_BOX_LAYOUT (state->box_layout); - gboolean homogeneous = clutter_box_layout_get_homogeneous (box_layout); - - clutter_box_layout_set_homogeneous (box_layout, !homogeneous); -} - -static void -increase_spacing (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - ClutterBoxLayout *box_layout = CLUTTER_BOX_LAYOUT (state->box_layout); - guint spacing = clutter_box_layout_get_spacing (box_layout) + 5; - - clutter_box_layout_set_spacing (box_layout, spacing); -} - -static void -decrease_spacing (GObject *instance, - const gchar *action_name, - guint key_val, - ClutterModifierType modifiers, - gpointer user_data) -{ - State *state = (State *) user_data; - ClutterBoxLayout *box_layout = CLUTTER_BOX_LAYOUT (state->box_layout); - guint spacing = clutter_box_layout_get_spacing (box_layout); - - if (spacing >= 5) - clutter_box_layout_set_spacing (box_layout, spacing - 5); -} - -static gboolean -key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *state = (State *) user_data; - ClutterBindingPool *pool; - gboolean return_value; - - pool = clutter_binding_pool_find (G_OBJECT_TYPE_NAME (actor)); - - return_value = clutter_binding_pool_activate (pool, - clutter_event_get_key_symbol (event), - clutter_event_get_state (event), - G_OBJECT (actor)); - - show_status (state); - - return return_value; -} - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - GObjectClass *stage_class; - ClutterBindingPool *binding_pool; - ClutterActor *red; - ClutterActor *green; - ClutterActor *blue; - - State *state = g_new0 (State, 1); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - state->x_fill = FALSE; - state->y_fill = FALSE; - state->expand = FALSE; - state->x_align = CLUTTER_BOX_ALIGNMENT_START; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* for key bindings */ - stage_class = G_OBJECT_GET_CLASS (stage); - binding_pool = clutter_binding_pool_get_for_class (stage_class); - - clutter_binding_pool_install_action (binding_pool, - "toggle-expand", - CLUTTER_KEY_e, - 0, - G_CALLBACK (toggle_expand), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "toggle-x-fill", - CLUTTER_KEY_x, - 0, - G_CALLBACK (toggle_x_fill), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "toggle-y-fill", - CLUTTER_KEY_y, - 0, - G_CALLBACK (toggle_y_fill), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "toggle-vertical", - CLUTTER_KEY_v, - 0, - G_CALLBACK (toggle_vertical), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "toggle-homogeneous", - CLUTTER_KEY_h, - 0, - G_CALLBACK (toggle_homogeneous), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "rotate-x-alignment", - CLUTTER_KEY_Right, - 0, - G_CALLBACK (rotate_x_alignment), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "rotate-y-alignment", - CLUTTER_KEY_Up, - 0, - G_CALLBACK (rotate_y_alignment), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "increase-spacing", - CLUTTER_KEY_plus, - CLUTTER_SHIFT_MASK, - G_CALLBACK (increase_spacing), - state, - NULL); - - clutter_binding_pool_install_action (binding_pool, - "decrease-spacing", - CLUTTER_KEY_minus, - 0, - G_CALLBACK (decrease_spacing), - state, - NULL); - - /* rectangles inside the layout */ - red = clutter_rectangle_new_with_color (&red_color); - clutter_actor_set_size (red, RED_SIDE, RED_SIDE); - - green = clutter_rectangle_new_with_color (&green_color); - clutter_actor_set_size (green, GREEN_SIDE, GREEN_SIDE); - - blue = clutter_rectangle_new_with_color (&blue_color); - clutter_actor_set_size (blue, BLUE_SIDE, BLUE_SIDE); - - /* the layout */ - state->box_layout = clutter_box_layout_new (); - clutter_box_layout_set_use_animations (CLUTTER_BOX_LAYOUT (state->box_layout), - TRUE); - - state->box = clutter_box_new (state->box_layout); - clutter_box_set_color (CLUTTER_BOX (state->box), &box_color); - clutter_actor_set_size (state->box, BOX_SIDE, BOX_SIDE); - clutter_actor_add_constraint (state->box, - clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (state->box, - clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.1)); - - /* text to show status */ - state->status_display = clutter_text_new (); - clutter_text_set_color (CLUTTER_TEXT (state->status_display), &white_color); - clutter_actor_set_size (state->status_display, - STAGE_SIDE, - STAGE_SIDE * 0.2); - clutter_actor_set_position (state->status_display, - (STAGE_SIDE - BOX_SIDE) / 2, - STAGE_SIDE * 0.8); - - /* set text for initial state */ - show_status (state); - - /* connect key presses to a callback on the binding pool */ - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (key_pressed_cb), - state); - - /* pack UI */ - clutter_container_add (CLUTTER_CONTAINER (state->box), red, green, blue, NULL); - - clutter_container_add (CLUTTER_CONTAINER (stage), - state->box, - state->status_display, - NULL); - - /* show stage */ - clutter_actor_show (stage); - - clutter_main (); - - /* clean up */ - g_object_unref (binding_pool); - g_free (state); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-box.c b/doc/cookbook/examples/layouts-box.c deleted file mode 100644 index cef41ed95..000000000 --- a/doc/cookbook/examples/layouts-box.c +++ /dev/null @@ -1,97 +0,0 @@ -#include -#include - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; -static const ClutterColor box_color = { 0xff, 0xff, 0xff, 0xff }; -static const ClutterColor yellow_color = { 0xaa, 0xaa, 0x00, 0xff }; -static const ClutterColor red_color = { 0xff, 0x00, 0x00, 0xff }; -static const ClutterColor blue_color = { 0x00, 0x00, 0xff, 0xff }; - -int -main (int argc, - char *argv[]) -{ - ClutterActor *stage; - ClutterLayoutManager *box_layout; - ClutterActor *box; - ClutterActor *yellow; - ClutterActor *red; - ClutterActor *blue; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* create a ClutterBoxLayout */ - box_layout = clutter_box_layout_new (); - - /* configure it to lay out actors vertically */ - clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (box_layout), TRUE); - - /* put 5px of spacing between actors */ - clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (box_layout), 5); - - /* actors are packed into this actor; we set its width, but - * allow its height to be determined by the children it contains - */ - box = clutter_actor_new (); - clutter_actor_set_layout_manager (box, box_layout); - clutter_actor_set_background_color (box, CLUTTER_COLOR_White); - clutter_actor_set_position (box, 100, 50); - clutter_actor_set_width (box, 200); - - /* pack an actor into the layout and set all layout properties on it - * at the same time - */ - yellow = clutter_actor_new (); - clutter_actor_set_background_color (yellow, CLUTTER_COLOR_Yellow); - clutter_actor_set_size (yellow, 100, 100); - - clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (box_layout), - yellow, - FALSE, /* expand */ - TRUE, /* x-fill */ - FALSE, /* y-fill */ - CLUTTER_BOX_ALIGNMENT_START, /* x-align */ - CLUTTER_BOX_ALIGNMENT_START); /* y-align */ - - /* add an actor to the box as a container and set layout properties - * afterwards; the latter is useful if you want to change properties on - * actors already inside a layout, but note that you have to - * pass the function both the layout AND the container - */ - red = clutter_actor_new (); - clutter_actor_set_background_color (red, CLUTTER_COLOR_Red); - clutter_actor_set_size (red, 100, 100); - - clutter_actor_add_child (box, red); - clutter_layout_manager_child_set (box_layout, - CLUTTER_CONTAINER (box), - red, - "x-fill", TRUE, - NULL); - - blue = clutter_actor_new (); - clutter_actor_set_background_color (blue, CLUTTER_COLOR_Blue); - clutter_actor_set_size (blue, 100, 100); - - clutter_actor_add_child (box, blue); - clutter_layout_manager_child_set (box_layout, - CLUTTER_CONTAINER (box), - blue, - "x-fill", TRUE, - NULL); - - /* put the box on the stage */ - clutter_actor_add_child (stage, box); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/layouts-stacking-diff-sized-actors.c b/doc/cookbook/examples/layouts-stacking-diff-sized-actors.c deleted file mode 100644 index 45f47e181..000000000 --- a/doc/cookbook/examples/layouts-stacking-diff-sized-actors.c +++ /dev/null @@ -1,82 +0,0 @@ -#include - -static const ClutterColor dark_grey = { 0x66, 0x66, 0x66, 0xff }; -static const ClutterColor light_grey = { 0xcc, 0xcc, 0xcc, 0xff }; - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterLayoutManager *layout; - ClutterActor *box; - ClutterActor *rect1, *rect2; - guint align_x, align_y, diff_x, diff_y; - ClutterColor *color; - ClutterActor *rect; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, 400, 400); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_START, - CLUTTER_BIN_ALIGNMENT_START); - - box = clutter_box_new (layout); - - rect1 = clutter_rectangle_new_with_color (&dark_grey); - clutter_actor_set_size (rect1, 400, 200); - - rect2 = clutter_rectangle_new_with_color (&light_grey); - clutter_actor_set_size (rect2, 200, 400); - - clutter_container_add (CLUTTER_CONTAINER (box), - rect1, - rect2, - NULL); - - /* - * 2 = CLUTTER_BIN_ALIGNMENT_START - * 3 = CLUTTER_BIN_ALIGNMENT_END - * 4 = CLUTTER_BIN_ALIGNMENT_CENTER - */ - for (align_x = 2; align_x < 5; align_x++) - { - for (align_y = 2; align_y < 5; align_y++) - { - diff_x = align_x - 1; - if (align_x == 3) - diff_x = 3; - else if (align_x == 4) - diff_x = 2; - - diff_y = align_y - 1; - if (align_y == 3) - diff_y = 3; - else if (align_y == 4) - diff_y = 2; - - color = clutter_color_new (255 - diff_x * 50, - 100 + diff_y * 50, - 0, - 255); - rect = clutter_rectangle_new_with_color (color); - clutter_actor_set_size (rect, 100, 100); - clutter_bin_layout_set_alignment (CLUTTER_BIN_LAYOUT (layout), - rect, - align_x, - align_y); - clutter_container_add_actor (CLUTTER_CONTAINER (box), rect); - } - } - - clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/layouts-stacking.c b/doc/cookbook/examples/layouts-stacking.c deleted file mode 100644 index d1d6321a5..000000000 --- a/doc/cookbook/examples/layouts-stacking.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Display multiple rotated copies of an image on top of each other - * - * Invoke with the path to a file to load a custom image - */ -#include - -#define STAGE_SIDE 512 - -static const ClutterColor box_color = { 0x33, 0x33, 0x55, 0xff }; - -int -main (int argc, char *argv[]) -{ - ClutterLayoutManager *layout; - ClutterActor *box; - ClutterActor *stage; - ClutterActor *texture; - CoglHandle *cogl_texture; - GError *error = NULL; - gfloat width; - - const gchar *filename = "redhand.png"; - - if (argc > 1) - filename = argv[1]; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_set_size (stage, STAGE_SIDE, STAGE_SIDE); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); - - box = clutter_actor_new (); - clutter_actor_set_layout_manager (box, layout); - clutter_actor_set_background_color (box, &box_color); - - texture = clutter_texture_new_from_file (filename, &error); - - if (error != NULL) - g_error ("Error loading file %s; message was:\n%s", - filename, - error->message); - - /* - * get a reference to the underlying Cogl texture - * for copying onto each Clutter texture placed into the layout - */ - cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (texture)); - - /* - * add gradually turning and shrinking textures, - * smallest one last; each actor ends up on top - * of the one added just before it - */ - for (width = STAGE_SIDE * 0.75; width >= STAGE_SIDE * 0.0625; width -= STAGE_SIDE * 0.0625) - { - ClutterActor *texture_copy = clutter_texture_new (); - clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (texture_copy), - cogl_texture); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (texture_copy), - TRUE); - clutter_actor_set_z_rotation_from_gravity (texture_copy, - (gfloat)(width * 0.5) - (STAGE_SIDE * 0.03125), - CLUTTER_GRAVITY_CENTER); - clutter_actor_set_width (texture_copy, width); - clutter_actor_add_child (box, texture_copy); - } - - clutter_actor_add_constraint (box, clutter_align_constraint_new (stage, CLUTTER_ALIGN_BOTH, 0.5)); - clutter_actor_add_child (stage, box); - - clutter_actor_show (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/redhand.png b/doc/cookbook/examples/redhand.png deleted file mode 100644 index c07d8acd3..000000000 Binary files a/doc/cookbook/examples/redhand.png and /dev/null differ diff --git a/doc/cookbook/examples/script-signals.c b/doc/cookbook/examples/script-signals.c deleted file mode 100644 index da177176b..000000000 --- a/doc/cookbook/examples/script-signals.c +++ /dev/null @@ -1,98 +0,0 @@ -#include -#include - -/* callbacks cannot be declared static as they - * are looked up dynamically by ClutterScript - */ -gboolean -foo_pointer_motion_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - gfloat x, y; - clutter_event_get_coords (event, &x, &y); - - g_print ("Pointer movement at %.0f,%.0f\n", x, y); - - return TRUE; -} - -void -foo_button_clicked_cb (ClutterClickAction *action, - ClutterActor *actor, - gpointer user_data) -{ - gfloat z_angle; - - /* get the UI definition passed to the handler */ - ClutterScript *ui = CLUTTER_SCRIPT (user_data); - - /* get the rectangle defined in the JSON */ - ClutterActor *rectangle; - clutter_script_get_objects (ui, - "rectangle", &rectangle, - NULL); - - /* do nothing if the actor is already animating */ - if (clutter_actor_get_animation (rectangle) != NULL) - return; - - /* get the current rotation and increment it */ - z_angle = clutter_actor_get_rotation (rectangle, - CLUTTER_Z_AXIS, - NULL, NULL, NULL); - - if (clutter_click_action_get_button (action) == 1) - z_angle += 90.0; - else - z_angle -= 90.0; - - /* animate to new rotation angle */ - clutter_actor_animate (rectangle, - CLUTTER_EASE_OUT_CUBIC, - 1000, - "rotation-angle-z", z_angle, - NULL); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterScript *ui; - - gchar *filename = "script-signals.json"; - GError *error = NULL; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - ui = clutter_script_new (); - - clutter_script_load_from_file (ui, filename, &error); - - if (error != NULL) - { - g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - clutter_script_get_objects (ui, - "stage", &stage, - NULL); - - /* make the objects in the script available to all signals - * by passing the script as the second argument - * to clutter_script_connect_signals() - */ - clutter_script_connect_signals (ui, ui); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (ui); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/script-signals.json b/doc/cookbook/examples/script-signals.json deleted file mode 100644 index 239428b2c..000000000 --- a/doc/cookbook/examples/script-signals.json +++ /dev/null @@ -1,40 +0,0 @@ -[ - { - "id" : "stage", - "type" : "ClutterStage", - "width" : 300, - "height" : 300, - "color" : "#335", - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" } - ], - - "children" : [ "rectangle" ] - }, - - { - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "x" : 50, - "y" : 50, - "color" : "#a90", - "rotation-center-z-gravity" : "center", - "reactive" : true, - - "signals" : [ - { "name" : "motion-event", "handler" : "foo_pointer_motion_cb" } - ], - - "actions" : [ - { - "type" : "ClutterClickAction", - "signals" : [ - { "name" : "clicked", "handler" : "foo_button_clicked_cb" } - ] - } - ] - } -] diff --git a/doc/cookbook/examples/script-states.c b/doc/cookbook/examples/script-states.c deleted file mode 100644 index d82f09b21..000000000 --- a/doc/cookbook/examples/script-states.c +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterScript *ui; - - gchar *filename = "script-states.json"; - GError *error = NULL; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - ui = clutter_script_new (); - - clutter_script_load_from_file (ui, filename, &error); - - if (error != NULL) - { - g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - clutter_script_get_objects (ui, - "stage", &stage, - NULL); - - /* make the objects in the script available to all signals - * by passing the script as the second argument - * to clutter_script_connect_signals() - */ - clutter_script_connect_signals (ui, ui); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (ui); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/script-states.json b/doc/cookbook/examples/script-states.json deleted file mode 100644 index aa69299b1..000000000 --- a/doc/cookbook/examples/script-states.json +++ /dev/null @@ -1,92 +0,0 @@ -[ - { - "id" : "stage", - "type" : "ClutterStage", - "width" : 300, - "height" : 300, - "color" : "#335", - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" } - ], - - "children" : [ "rectangle" ] - }, - - { - "id" : "rectangle-states", - "type" : "ClutterState", - "duration" : 1000, - - "transitions" : [ - { - "source" : null, - "target" : "base", - - "keys" : [ - [ "rectangle", "scale-x", "ease-in-cubic", 0.7 ], - [ "rectangle", "scale-y", "ease-in-cubic", 0.7 ], - [ "rectangle", "rotation-angle-z", "ease-out-cubic", 0.0 ] - ] - }, - { - "source" : null, - "target" : "hover", - - "keys" : [ - [ "rectangle", "scale-x", "ease-in-cubic", 1.2 ], - [ "rectangle", "scale-y", "ease-in-cubic", 1.2 ] - ] - }, - { - "source" : null, - "target" : "clicked", - - "keys" : [ - [ "rectangle", "rotation-angle-z", "ease-out-bounce", 90.0 ] - ] - } - ] - }, - - { - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "x" : 50, - "y" : 50, - "color" : "#a90", - "rotation-center-z-gravity" : "center", - "scale-gravity" : "center", - "scale-x" : 0.7, - "scale-y" : 0.7, - "reactive" : true, - - "signals" : [ - { - "name" : "enter-event", - "states" : "rectangle-states", - "target-state" : "hover" - }, - { - "name" : "leave-event", - "states" : "rectangle-states", - "target-state" : "base" - } - ], - - "actions" : [ - { - "type" : "ClutterClickAction", - "signals" : [ - { - "name" : "clicked", - "states" : "rectangle-states", - "target-state" : "clicked" - } - ] - } - ] - } -] diff --git a/doc/cookbook/examples/script-ui.c b/doc/cookbook/examples/script-ui.c deleted file mode 100644 index a488763bc..000000000 --- a/doc/cookbook/examples/script-ui.c +++ /dev/null @@ -1,38 +0,0 @@ -#include -#include - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterScript *ui; - - gchar *filename = "script-ui.json"; - GError *error = NULL; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - ui = clutter_script_new (); - - /* load a JSON file into the script */ - clutter_script_load_from_file (ui, filename, &error); - - if (error != NULL) - { - g_critical ("Error loading ClutterScript file %s\n%s", filename, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - /* retrieve objects from the script */ - clutter_script_get_objects (ui, - "stage", &stage, - NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/script-ui.json b/doc/cookbook/examples/script-ui.json deleted file mode 100644 index d7b8f9a13..000000000 --- a/doc/cookbook/examples/script-ui.json +++ /dev/null @@ -1,34 +0,0 @@ -[ - { - "id" : "stage", - "type" : "ClutterStage", - "width" : 400, - "height" : 400, - "color" : "#333355ff", - "children" : [ "box" ] - }, - - { - "id" : "box", - "type" : "ClutterBox", - "width" : 400, - "height" : 400, - - "layout-manager" : { - "type" : "ClutterBinLayout", - "x-align" : "center", - "y-align" : "center" - }, - - "children" : [ - { - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "color" : "red" - } - ] - } - -] diff --git a/doc/cookbook/examples/smiley.png b/doc/cookbook/examples/smiley.png deleted file mode 100644 index 5bcc67a2d..000000000 Binary files a/doc/cookbook/examples/smiley.png and /dev/null differ diff --git a/doc/cookbook/examples/text-shadow.c b/doc/cookbook/examples/text-shadow.c deleted file mode 100644 index 1488f8172..000000000 --- a/doc/cookbook/examples/text-shadow.c +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include - -#define SHADOW_X_OFFSET 3 -#define SHADOW_Y_OFFSET 3 - -static void -_text_paint_cb (ClutterActor *actor) -{ - PangoLayout *layout; - guint8 real_opacity; - CoglColor color; - ClutterText *text = CLUTTER_TEXT (actor); - ClutterColor text_color = { 0, }; - - /* Get the PangoLayout that the Text actor is going to paint */ - layout = clutter_text_get_layout (text); - - /* Get the color of the text, to extract the alpha component */ - clutter_text_get_color (text, &text_color); - - /* Composite the opacity so that the shadow is correctly blended */ - real_opacity = clutter_actor_get_paint_opacity (actor) - * text_color.alpha - / 255; - - /* Create a #ccc color and premultiply it */ - cogl_color_init_from_4ub (&color, 0xcc, 0xcc, 0xcc, real_opacity); - cogl_color_premultiply (&color); - - /* Finally, render the Text layout at a given offset using the color */ - cogl_pango_render_layout (layout, SHADOW_X_OFFSET, SHADOW_Y_OFFSET, &color, 0); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *text; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Text shadow"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - text = clutter_text_new (); - clutter_text_set_text (CLUTTER_TEXT (text), "Hello, World!"); - clutter_text_set_font_name (CLUTTER_TEXT (text), "Sans 64px"); - clutter_actor_add_constraint (text, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (text, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - g_signal_connect (text, "paint", G_CALLBACK (_text_paint_cb), NULL); - - clutter_container_add (CLUTTER_CONTAINER (stage), text, NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/textures-crossfade-cogl.c b/doc/cookbook/examples/textures-crossfade-cogl.c deleted file mode 100644 index 6c111b1f5..000000000 --- a/doc/cookbook/examples/textures-crossfade-cogl.c +++ /dev/null @@ -1,175 +0,0 @@ -#include -#include - -static gchar *source = NULL; -static gchar *target = NULL; -static guint duration = 1000; - -static GOptionEntry entries[] = { - { - "source", 's', - 0, - G_OPTION_ARG_FILENAME, &source, - "The source image of the cross-fade", "FILE" - }, - { - "target", 't', - 0, - G_OPTION_ARG_FILENAME, &target, - "The target image of the cross-fade", "FILE" - }, - { - "duration", 'd', - 0, - G_OPTION_ARG_INT, &duration, - "The duration of the cross-fade, in milliseconds", "MSECS" - }, - - { NULL } -}; - -static void -_update_progress_cb (ClutterTimeline *timeline, - guint elapsed_msecs, - ClutterTexture *texture) -{ - CoglHandle copy; - gdouble progress; - CoglColor constant; - - CoglHandle material = clutter_texture_get_cogl_material (texture); - - if (material == COGL_INVALID_HANDLE) - return; - - /* You should assume that a material can only be modified once, after - * its creation; if you need to modify it later you should use a copy - * instead. Cogl makes copying materials reasonably cheap - */ - copy = cogl_material_copy (material); - - progress = clutter_timeline_get_progress (timeline); - - /* Create the constant color to be used when combining the two - * material layers; we use a black color with an alpha component - * depending on the current progress of the timeline - */ - cogl_color_init_from_4ub (&constant, 0x00, 0x00, 0x00, 0xff * progress); - - /* This sets the value of the constant color we use when combining - * the two layers - */ - cogl_material_set_layer_combine_constant (copy, 1, &constant); - - /* The Texture now owns the material */ - clutter_texture_set_cogl_material (texture, copy); - cogl_handle_unref (copy); - - clutter_actor_queue_redraw (CLUTTER_ACTOR (texture)); -} - -static CoglHandle -load_cogl_texture (const char *type, - const char *file) -{ - GError *error = NULL; - - CoglHandle retval = cogl_texture_new_from_file (file, - COGL_TEXTURE_NO_SLICING, - COGL_PIXEL_FORMAT_ANY, - &error); - if (error != NULL) - { - g_print ("Unable to load %s image: %s\n", type, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - return retval; -} - -static int -print_usage_and_exit (const char *exec_name, - int exit_code) -{ - g_print ("Usage: %s -s -t [-d ]\n", exec_name); - return exit_code; -} - -int -main (int argc, char *argv[]) -{ - CoglHandle texture_1; - CoglHandle texture_2; - CoglHandle material; - ClutterActor *stage; - ClutterActor *texture; - ClutterTimeline *timeline; - - if (clutter_init_with_args (&argc, &argv, - " - Crossfade", entries, - NULL, - NULL) != CLUTTER_INIT_SUCCESS) - return 1; - - if (source == NULL || target == NULL) - return print_usage_and_exit (argv[0], EXIT_FAILURE); - - /* Load the source and target images using Cogl, because we need - * to combine them into the same ClutterTexture. - */ - texture_1 = load_cogl_texture ("source", source); - texture_2 = load_cogl_texture ("target", target); - - /* Create a new Cogl material holding the two textures inside two - * separate layers. - */ - material = cogl_material_new (); - cogl_material_set_layer (material, 1, texture_1); - cogl_material_set_layer (material, 0, texture_2); - - /* Set the layer combination description for the second layer; the - * default for Cogl is to simply multiply the layer with the - * precendent one. In this case we interpolate the color for each - * pixel between the pixel value of the previous layer and the - * current one, using the alpha component of a constant color as - * the interpolation factor. - */ - cogl_material_set_layer_combine (material, 1, - "RGBA = INTERPOLATE (PREVIOUS, " - "TEXTURE, " - "CONSTANT[A])", - NULL); - - /* The material now owns the two textures */ - cogl_handle_unref (texture_1); - cogl_handle_unref (texture_2); - - /* Create a Texture and place it in the middle of the stage; then - * assign the material we created earlier to the Texture for painting - * it - */ - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); - clutter_actor_set_size (stage, 400, 300); - clutter_actor_show (stage); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), texture); - clutter_texture_set_cogl_material (CLUTTER_TEXTURE (texture), material); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.5)); - cogl_handle_unref (material); - - /* The timeline will drive the cross-fading */ - timeline = clutter_timeline_new (duration); - g_signal_connect (timeline, "new-frame", G_CALLBACK (_update_progress_cb), texture); - clutter_timeline_start (timeline); - - clutter_main (); - - g_object_unref (timeline); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/textures-crossfade-slideshow.c b/doc/cookbook/examples/textures-crossfade-slideshow.c deleted file mode 100644 index 1a8b3ef58..000000000 --- a/doc/cookbook/examples/textures-crossfade-slideshow.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Simple slideshow application, cycling images between - * two ClutterTextures - * - * Run by passing one or more image paths or directory globs - * which will pick up image files - * - * When running, press any key to go to the next image - */ -#include -#include - -static guint stage_side = 600; -static guint animation_duration_ms = 1500; - -static const ClutterColor stage_color = { 0x33, 0x33, 0x55, 0xff }; - -typedef struct { - ClutterActor *top; - ClutterActor *bottom; - ClutterState *transitions; - GSList *image_paths; - guint next_image_index; -} State; - -static gboolean -load_next_image (State *app) -{ - gpointer next; - gchar *image_path; - CoglHandle *cogl_texture; - GError *error = NULL; - - /* don't do anything if already animating */ - ClutterTimeline *timeline = clutter_state_get_timeline (app->transitions); - - if (clutter_timeline_is_playing (timeline) == 1) - { - g_debug ("Animation is running already"); - return FALSE; - } - - if (!app->next_image_index) - app->next_image_index = 0; - - next = g_slist_nth_data (app->image_paths, app->next_image_index); - - if (next == NULL) - return FALSE; - - image_path = (gchar *)next; - - g_debug ("Loading %s", image_path); - - cogl_texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (app->top)); - - if (cogl_texture != NULL) - { - /* copy the current texture into the background */ - clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (app->bottom), cogl_texture); - - /* make the bottom opaque and top transparent */ - clutter_state_warp_to_state (app->transitions, "show-bottom"); - } - - /* load the next image into the top */ - clutter_texture_set_from_file (CLUTTER_TEXTURE (app->top), - image_path, - &error); - - if (error != NULL) - { - g_warning ("Error loading %s\n%s", image_path, error->message); - g_error_free (error); - return FALSE; - } - - /* fade in the top texture and fade out the bottom texture */ - clutter_state_set_state (app->transitions, "show-top"); - - app->next_image_index++; - - return TRUE; -} - -static gboolean -_key_pressed_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - State *app = (State *)user_data; - - load_next_image (app); - - return TRUE; -} - -int -main (int argc, char *argv[]) -{ - State *app = g_new0 (State, 1); - guint i; - GError *error = NULL; - - /* UI */ - ClutterActor *stage; - ClutterLayoutManager *layout; - ClutterActor *box; - - if (argc < 2) - { - g_print ("Usage: %s \n", argv[0]); - exit (EXIT_FAILURE); - } - - app->image_paths = NULL; - - /* - * NB if your shell globs arguments to this program so argv - * includes non-image files, they will fail to load and throw errors - */ - for (i = 1; i < argc; i++) - app->image_paths = g_slist_append (app->image_paths, argv[i]); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); - clutter_actor_set_size (stage, stage_side, stage_side); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); - - box = clutter_box_new (layout); - clutter_actor_set_size (box, stage_side, stage_side); - - app->bottom = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (app->bottom), TRUE); - - app->top = clutter_texture_new (); - clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (app->top), TRUE); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), app->bottom); - clutter_container_add_actor (CLUTTER_CONTAINER (box), app->top); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); - - /* animations */ - app->transitions = clutter_state_new (); - clutter_state_set (app->transitions, NULL, "show-top", - app->top, "opacity", CLUTTER_EASE_IN_CUBIC, 255, - app->bottom, "opacity", CLUTTER_EASE_IN_CUBIC, 0, - NULL); - clutter_state_set (app->transitions, NULL, "show-bottom", - app->top, "opacity", CLUTTER_LINEAR, 0, - app->bottom, "opacity", CLUTTER_LINEAR, 255, - NULL); - clutter_state_set_duration (app->transitions, - NULL, - NULL, - animation_duration_ms); - - /* display the next (first) image */ - load_next_image (app); - - /* key press displays the next image */ - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (_key_pressed_cb), - app); - - clutter_actor_show (stage); - - clutter_main (); - - g_slist_free (app->image_paths); - g_object_unref (app->transitions); - g_free (app); - - if (error != NULL) - g_error_free (error); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/textures-crossfade.c b/doc/cookbook/examples/textures-crossfade.c deleted file mode 100644 index 6fbd53adf..000000000 --- a/doc/cookbook/examples/textures-crossfade.c +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include - -static gchar *source = NULL; -static gchar *target = NULL; -static guint duration = 1000; - -static GOptionEntry entries[] = { - { - "source", 's', - 0, - G_OPTION_ARG_FILENAME, &source, - "The source image of the cross-fade", "FILE" - }, - { - "target", 't', - 0, - G_OPTION_ARG_FILENAME, &target, - "The target image of the cross-fade", "FILE" - }, - { - "duration", 'd', - 0, - G_OPTION_ARG_INT, &duration, - "The duration of the cross-fade, in milliseconds", "MSECS" - }, - - { NULL } -}; - -static gboolean -start_animation (ClutterActor *actor, - ClutterEvent *event, - gpointer user_data) -{ - ClutterState *transitions = CLUTTER_STATE (user_data); - clutter_state_set_state (transitions, "show-top"); - return TRUE; -} - -static gboolean -load_image (ClutterTexture *texture, - gchar *image_path) -{ - GError *error = NULL; - - gboolean success = clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - image_path, - &error); - - if (error != NULL) - { - g_warning ("Error loading %s\n%s", image_path, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - return success; -} - -int -main (int argc, char *argv[]) -{ - GError *error = NULL; - - /* UI */ - ClutterActor *stage; - ClutterLayoutManager *layout; - ClutterActor *box; - ClutterActor *top, *bottom; - ClutterState *transitions; - - if (clutter_init_with_args (&argc, &argv, - " - cross-fade", entries, - NULL, - NULL) != CLUTTER_INIT_SUCCESS) - return 1; - - if (source == NULL || target == NULL) - { - g_print ("Usage: %s -s -t [-d ]\n", argv[0]); - exit (EXIT_FAILURE); - } - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "cross-fade"); - clutter_actor_set_size (stage, 400, 300); - clutter_actor_show (stage); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_CENTER, - CLUTTER_BIN_ALIGNMENT_CENTER); - - box = clutter_box_new (layout); - clutter_actor_set_size (box, 400, 300); - - bottom = clutter_texture_new (); - top = clutter_texture_new (); - - clutter_container_add_actor (CLUTTER_CONTAINER (box), bottom); - clutter_container_add_actor (CLUTTER_CONTAINER (box), top); - clutter_container_add_actor (CLUTTER_CONTAINER (stage), box); - - /* load the first image into the bottom */ - load_image (CLUTTER_TEXTURE (bottom), source); - - /* load the second image into the top */ - load_image (CLUTTER_TEXTURE (top), target); - - /* animations */ - transitions = clutter_state_new (); - clutter_state_set (transitions, NULL, "show-bottom", - top, "opacity", CLUTTER_LINEAR, 0, - bottom, "opacity", CLUTTER_LINEAR, 255, - NULL); - clutter_state_set (transitions, NULL, "show-top", - top, "opacity", CLUTTER_EASE_IN_CUBIC, 255, - bottom, "opacity", CLUTTER_EASE_IN_CUBIC, 0, - NULL); - clutter_state_set_duration (transitions, NULL, NULL, duration); - - /* make the bottom opaque and top transparent */ - clutter_state_warp_to_state (transitions, "show-bottom"); - - /* on key press, fade in the top texture and fade out the bottom texture */ - g_signal_connect (stage, - "key-press-event", - G_CALLBACK (start_animation), - transitions); - - clutter_actor_show (stage); - - clutter_main (); - - g_object_unref (transitions); - - if (error != NULL) - g_error_free (error); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/textures-reflection.c b/doc/cookbook/examples/textures-reflection.c deleted file mode 100644 index 03c970d66..000000000 --- a/doc/cookbook/examples/textures-reflection.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include - -/* pixels between the source and its reflection */ -#define V_PADDING 4 - -static void -_clone_paint_cb (ClutterActor *actor) -{ - ClutterActor *source; - ClutterActorBox box; - CoglHandle material; - gfloat width, height; - guint8 opacity; - CoglColor color_1, color_2; - CoglTextureVertex vertices[4]; - - /* if we don't have a source actor, don't paint */ - source = clutter_clone_get_source (CLUTTER_CLONE (actor)); - if (source == NULL) - goto out; - - /* if the source texture does not have any content, don't paint */ - material = clutter_texture_get_cogl_material (CLUTTER_TEXTURE (source)); - if (material == NULL) - goto out; - - /* get the size of the reflection */ - clutter_actor_get_allocation_box (actor, &box); - clutter_actor_box_get_size (&box, &width, &height); - - /* get the composite opacity of the actor */ - opacity = clutter_actor_get_paint_opacity (actor); - - /* figure out the two colors for the reflection: the first is - * full color and the second is the same, but at 0 opacity - */ - cogl_color_init_from_4f (&color_1, 1.0, 1.0, 1.0, opacity / 255.); - cogl_color_premultiply (&color_1); - cogl_color_init_from_4f (&color_2, 1.0, 1.0, 1.0, 0.0); - cogl_color_premultiply (&color_2); - - /* now describe the four vertices of the quad; since it has - * to be a reflection, we need to invert it as well - */ - vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; - vertices[0].tx = 0.0; vertices[0].ty = 1.0; - vertices[0].color = color_1; - - vertices[1].x = width; vertices[1].y = 0; vertices[1].z = 0; - vertices[1].tx = 1.0; vertices[1].ty = 1.0; - vertices[1].color = color_1; - - vertices[2].x = width; vertices[2].y = height; vertices[2].z = 0; - vertices[2].tx = 1.0; vertices[2].ty = 0.0; - vertices[2].color = color_2; - - vertices[3].x = 0; vertices[3].y = height; vertices[3].z = 0; - vertices[3].tx = 0.0; vertices[3].ty = 0.0; - vertices[3].color = color_2; - - /* paint the same texture but with a different geometry */ - cogl_set_source (material); - cogl_polygon (vertices, 4, TRUE); - -out: - /* prevent the default clone handler from running */ - g_signal_stop_emission_by_name (actor, "paint"); -} - -int -main (int argc, char *argv[]) -{ - ClutterActor *stage; - ClutterActor *texture; - GError *error = NULL; - ClutterActor *clone; - gfloat y_offset; - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Reflection"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - texture = clutter_texture_new (); - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - "redhand.png", - &error); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_X_AXIS, 0.5)); - clutter_actor_add_constraint (texture, clutter_align_constraint_new (stage, CLUTTER_ALIGN_Y_AXIS, 0.2)); - - y_offset = clutter_actor_get_height (texture) + V_PADDING; - - clone = clutter_clone_new (texture); - clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_X, 0.0)); - clutter_actor_add_constraint (clone, clutter_bind_constraint_new (texture, CLUTTER_BIND_Y, y_offset)); - g_signal_connect (clone, - "paint", - G_CALLBACK (_clone_paint_cb), - NULL); - - clutter_container_add (CLUTTER_CONTAINER (stage), texture, clone, NULL); - - clutter_actor_show (stage); - - clutter_main (); - - return EXIT_SUCCESS; -} diff --git a/doc/cookbook/examples/textures-split-go.c b/doc/cookbook/examples/textures-split-go.c deleted file mode 100644 index 47fee88a3..000000000 --- a/doc/cookbook/examples/textures-split-go.c +++ /dev/null @@ -1,186 +0,0 @@ -#include - -/* Context will be used to carry interesting variables between functions */ -typedef struct -{ - ClutterActor *sub_nw, *sub_ne, *sub_sw, *sub_se; - gfloat image_width, image_height; -} Context; - -/* Here, we animate the texture to go way by giving the new coordinates - * outside of the stage. We rotate the sub-textures around their anchor - * point (set in setup_sub() as well, it looks cool. */ -static gboolean -go_away (gpointer data) -{ - Context *context = data; - - clutter_actor_animate (context->sub_nw, CLUTTER_EASE_OUT_CUBIC, 1500, - "x", -context->image_width, - "y", -context->image_height, - "rotation-angle-z", 2000., - NULL); - clutter_actor_animate (context->sub_ne, CLUTTER_EASE_OUT_CUBIC, 1500, - "x", +context->image_width, - "y", -context->image_height, - "rotation-angle-z", 2000., - NULL); - clutter_actor_animate (context->sub_sw, CLUTTER_EASE_OUT_CUBIC, 1500, - "x", -context->image_width, - "y", +context->image_height, - "rotation-angle-z", 2000., - NULL); - clutter_actor_animate (context->sub_se, CLUTTER_EASE_OUT_CUBIC, 1500, - "x", -context->image_width, - "y", +context->image_height, - "rotation-angle-z", 2000., - NULL); - return G_SOURCE_REMOVE; /* remove the timeout source */ -} - -/* We split the four sub-textures faking to be the big texture, moving them - * away by 10 pixels in each direction */ -static gboolean -split (gpointer data) -{ - Context *context = data; - gfloat x, y; - - clutter_actor_get_position (context->sub_nw, &x, &y); - clutter_actor_animate (context->sub_nw, CLUTTER_EASE_OUT_CUBIC, 300, - "x", x - 10, - "y", y - 10, - NULL); - clutter_actor_get_position (context->sub_ne, &x, &y); - clutter_actor_animate (context->sub_ne, CLUTTER_EASE_OUT_CUBIC, 300, - "x", x + 10, - "y", y - 10, - NULL); - clutter_actor_get_position (context->sub_sw, &x, &y); - clutter_actor_animate (context->sub_sw, CLUTTER_EASE_OUT_CUBIC, 300, - "x", x - 10, - "y", y + 10, - NULL); - clutter_actor_get_position (context->sub_se, &x, &y); - clutter_actor_animate (context->sub_se, CLUTTER_EASE_OUT_CUBIC, 300, - "x", x + 10, - "y", y + 10, - NULL); - - /* In 500ms the textures will flee! */ - clutter_threads_add_timeout (500, go_away, context); - - return G_SOURCE_REMOVE; /* remove the timeout source */ -} - -static ClutterActor * -setup_sub (CoglHandle texture, - gint image_width, - gint image_height, - gint t_x, - gint t_y, - gint t_width, - gint t_height) -{ - CoglHandle sub_texture; - ClutterActor *sub_image; - - /* Create a new sub-texture from textures */ - sub_texture = cogl_texture_new_from_sub_texture (texture, - t_x, t_y, - t_width, t_height); - - /* Create the corresponding ClutterTexture */ - sub_image = g_object_new (CLUTTER_TYPE_TEXTURE, - "cogl-texture", sub_texture, - NULL); - - /* Set the anchor point in the middle of each sub_image so the position and - * rotation of the textures are relative to that point */ - clutter_actor_set_anchor_point (sub_image, image_width / 4, image_height / 4); - - return sub_image; -} - -#define IMAGE "smiley.png" - -int -main (int argc, - char **argv) -{ - gfloat image_width, image_height, stage_width, stage_height; - ClutterActor *stage, *image; - GError *error = NULL; - CoglHandle texture; - Context context; - - if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS) - return 1; - - stage = clutter_stage_new (); - clutter_actor_get_size (stage, &stage_width, &stage_height); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Animate sub-textures"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* Load smiley.png, creating a new ClutterTexture, get its size and the - * Cogl texture handle */ - image = clutter_texture_new_from_file (IMAGE, &error); - if (error != NULL) - { - g_warning ("Could not load " IMAGE ": %s", error->message); - g_clear_error (&error); - return 1; - } - clutter_actor_get_size (image, &image_width, &image_height); - texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (image)); - - /* Create four sub-textures from image, actually splitting the image in - * four */ - context.sub_nw = setup_sub (texture, image_width, image_height, - 0, 0, image_width / 2 , image_height / 2); - context.sub_ne = setup_sub (texture, image_width, image_height, - image_width / 2 , 0, - image_width / 2, image_height / 2); - context.sub_sw = setup_sub (texture, image_width, image_height, - 0.f, image_height / 2, - image_width / 2, image_height / 2); - context.sub_se = setup_sub (texture, image_width, image_height, - image_width / 2, image_height / 2, - image_width / 2, image_height / 2); - - /* We don't need the image anymore as we won't display it and as - * cogl_texture_new_from_sub_texture() keeps a reference to the underlying - * texture ressource */ - g_object_unref (image); - - /* Position the sub-texures in the middle of the screen, recreating the - * original texture */ - clutter_actor_set_position (context.sub_nw, - stage_width / 2 - image_width / 4, - stage_height / 2 - image_height / 4); - clutter_actor_set_position (context.sub_ne, - stage_width / 2 + image_width / 4, - stage_height / 2 - image_height / 4); - clutter_actor_set_position (context.sub_sw, - stage_width / 2 - image_width / 4, - stage_height / 2 + image_height / 4); - clutter_actor_set_position (context.sub_se, - stage_width / 2 + image_width / 4, - stage_height / 2 + image_height / 4); - - /* Add the four sub-textures to the stage */ - clutter_container_add (CLUTTER_CONTAINER (stage), context.sub_nw, - context.sub_ne, context.sub_sw, context.sub_se, NULL); - - clutter_actor_show_all (stage); - - context.image_width = image_width; - context.image_height = image_height; - - /* In two seconds, we'll split the texture! */ - clutter_threads_add_timeout (2000, split, &context); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/examples/textures-sub-texture.c b/doc/cookbook/examples/textures-sub-texture.c deleted file mode 100644 index 5deda90d9..000000000 --- a/doc/cookbook/examples/textures-sub-texture.c +++ /dev/null @@ -1,62 +0,0 @@ -#include - -int -main (int argc, char **argv) -{ - ClutterActor *stage, *image, *sub_image; - CoglHandle texture, sub_texture; - gfloat image_width, image_height; - - /* Initialize Clutter */ - if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS) - return 1; - - /* Get the default stage */ - stage = clutter_stage_new (); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Sub-texture"); - g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - - /* Create a new ClutterTexture that shows smiley.png */ - image = clutter_texture_new_from_file ("smiley.png", NULL); - clutter_actor_get_size (image, &image_width, &image_height); - clutter_actor_set_size (stage, - image_width * 3 / 2 + 30, - image_height + 20); - - /* Grab the CoglHandle of the underlying Cogl texture */ - texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (image)); - - /* Create a new Cogl texture from the handle above. That new texture is a - * rectangular region from image, more precisely the northwest corner - * of the image */ - sub_texture = cogl_texture_new_from_sub_texture (texture, - 0, 0, - image_width / 2, - image_height / 2); - - /* Finally, use the newly created Cogl texture to feed a new ClutterTexture - * and thus create a new actor that displays sub_texture */ - sub_image = clutter_texture_new (); - clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (sub_image), sub_texture); - - /* - * You could have used the more straightforward g_object_new() function that - * can create an object and set some properties on it at the same time: - * sub_image = g_object_new (CLUTTER_TYPE_TEXTURE, - * "cogl-texture", sub_texture, - * NULL); - */ - - /* Put the original image at (10,10) and the new sub image next to it */ - clutter_actor_set_position (image, 10, 10); - clutter_actor_set_position (sub_image, 20 + image_width, 10); - - /* Add both ClutterTexture to the stage */ - clutter_container_add (CLUTTER_CONTAINER (stage), image, sub_image, NULL); - - clutter_actor_show_all (stage); - - clutter_main (); - - return 0; -} diff --git a/doc/cookbook/images/actors-opacity-container-affects-opacity.png b/doc/cookbook/images/actors-opacity-container-affects-opacity.png deleted file mode 100644 index 46be2e178..000000000 Binary files a/doc/cookbook/images/actors-opacity-container-affects-opacity.png and /dev/null differ diff --git a/doc/cookbook/images/actors-opacity.png b/doc/cookbook/images/actors-opacity.png deleted file mode 100644 index 1080c9904..000000000 Binary files a/doc/cookbook/images/actors-opacity.png and /dev/null differ diff --git a/doc/cookbook/images/clutter-logo.png b/doc/cookbook/images/clutter-logo.png deleted file mode 100644 index 77f46636a..000000000 Binary files a/doc/cookbook/images/clutter-logo.png and /dev/null differ diff --git a/doc/cookbook/images/effects-basic-background.png b/doc/cookbook/images/effects-basic-background.png deleted file mode 100644 index 737affe91..000000000 Binary files a/doc/cookbook/images/effects-basic-background.png and /dev/null differ diff --git a/doc/cookbook/images/effects-basic.png b/doc/cookbook/images/effects-basic.png deleted file mode 100644 index 38c36a258..000000000 Binary files a/doc/cookbook/images/effects-basic.png and /dev/null differ diff --git a/doc/cookbook/images/effects-built-in.png b/doc/cookbook/images/effects-built-in.png deleted file mode 100644 index 81606023d..000000000 Binary files a/doc/cookbook/images/effects-built-in.png and /dev/null differ diff --git a/doc/cookbook/images/effects-custom-deform-back-material.png b/doc/cookbook/images/effects-custom-deform-back-material.png deleted file mode 100644 index 975e227eb..000000000 Binary files a/doc/cookbook/images/effects-custom-deform-back-material.png and /dev/null differ diff --git a/doc/cookbook/images/effects-custom-deform.png b/doc/cookbook/images/effects-custom-deform.png deleted file mode 100644 index 83dc9dff3..000000000 Binary files a/doc/cookbook/images/effects-custom-deform.png and /dev/null differ diff --git a/doc/cookbook/images/events-pointer-motion-stacking.png b/doc/cookbook/images/events-pointer-motion-stacking.png deleted file mode 100644 index 7eb782d7f..000000000 Binary files a/doc/cookbook/images/events-pointer-motion-stacking.png and /dev/null differ diff --git a/doc/cookbook/images/layouts-bind-constraint-stage.png b/doc/cookbook/images/layouts-bind-constraint-stage.png deleted file mode 100644 index 66d9d3690..000000000 Binary files a/doc/cookbook/images/layouts-bind-constraint-stage.png and /dev/null differ diff --git a/doc/cookbook/images/layouts-box.png b/doc/cookbook/images/layouts-box.png deleted file mode 100644 index 5de21dd7c..000000000 Binary files a/doc/cookbook/images/layouts-box.png and /dev/null differ diff --git a/doc/cookbook/images/layouts-stacking-diff-actor-sizes.png b/doc/cookbook/images/layouts-stacking-diff-actor-sizes.png deleted file mode 100644 index 54c59f1c7..000000000 Binary files a/doc/cookbook/images/layouts-stacking-diff-actor-sizes.png and /dev/null differ diff --git a/doc/cookbook/images/text-shadow.png b/doc/cookbook/images/text-shadow.png deleted file mode 100644 index 61824ef14..000000000 Binary files a/doc/cookbook/images/text-shadow.png and /dev/null differ diff --git a/doc/cookbook/images/textures-reflection.png b/doc/cookbook/images/textures-reflection.png deleted file mode 100644 index 431b66d96..000000000 Binary files a/doc/cookbook/images/textures-reflection.png and /dev/null differ diff --git a/doc/cookbook/images/textures-sub-texture.png b/doc/cookbook/images/textures-sub-texture.png deleted file mode 100644 index 5650a8fc0..000000000 Binary files a/doc/cookbook/images/textures-sub-texture.png and /dev/null differ diff --git a/doc/cookbook/introduction.xml b/doc/cookbook/introduction.xml deleted file mode 100644 index ee9ac1b1c..000000000 --- a/doc/cookbook/introduction.xml +++ /dev/null @@ -1,147 +0,0 @@ - - -]> - - - Preface - - - The Perl Cookbook - Let me show you that easy way, so others may easily follow. - - - There is a wonderful simile in the preface of the Perl - Cookbook: approaching a programming problem is oftentimes - similar to balancing Columbus's egg. The initial difficulties of dealing - with, and more importantly solving, problems in the software engineering - field sometimes can only be overcome if somebody shows you how to use a - new tool. This is true for programming languages but also for programming - libraries. - - This book has been written to try and give you a reference on - how to solve common issues that you might have to face when using - the Clutter toolkit. - - This book is not meant to be a replacement for the Clutter API - reference, even though there will be descriptions of how Clutter works - and how its API looks like. We will require knowledge of the Clutter API, - but we will also point out where to find more information on the API that - examples have used. - - Indeed, this book should be used as a companion to the API reference, - expanding its examples and showing how to achieve a specific result. - - This is not a book for learning Clutter. This is also not a book - for learning C, or GObject or even GUI development. - - Above all, this is a book for learning more - about Clutter, and about how to use it in the most efficient and easiest - way. It is meant to help you move past the basic usage of Clutter. - - This book is divided into chapters. Each chapter is dedicated to - a specific class, like ClutterTexture, or a specific area, like animations. - Each chapter starts with a short introduction, followed by different - recipes. Each recipe starts with a problem, or a short - statement describing what we want to achieve; a solution, containing the - source code; and a discussion section, where the code is explained, where - alternative approaches might be useful, and where caveats and references to - the Clutter API for further studying can be found. - - This book, in the cookbook spirit, can be accessed mostly at - random. - -
- About Clutter - - Clutter is an free and open source software library for creating - portable, dynamic, compelling and fast graphical user interfaces. - - Clutter uses OpenGL (and, optionally, OpenGL ES on mobile and - embedded platforms) for rendering the user interface elements, but - at the same time it exposes an application program interface that hides - the underlying complexity of the OpenGL state machine from the - developer. - - The program interface of Clutter is intended to be easy to use, - efficient, flexible and as self-documenting as possible. -
- -
- About this document - - This document is available in various formats like HTML, and - PDF. - - The latest version is always available at - &docurl;. - - To contribute to this document, see the - Contributing appendix. - -
- Compiling the examples - - This document comes with full examples, usually stored - on disk in datadir/clutter-1.0/cookbook/examples - directory. - - Each example can be compiled using: - - - -cc \ - `pkg-config --cflags clutter-1.0` \ - -o example example.c \ - `pkg-config --libs clutter-1.0` - - - - substituting the example with in the - line above with the name of the example. - -
- -
- -
- Acknowledgments - - This book has been written taking the inspiration from the Perl - Cookbook, authored by Tom Christiansen and Nathan Torkington. - - This book would not have been possible without the existence of - the Clutter library itself, and without the help and contributions of - all the people that have been working on it every day. - -
- Acknowledgments from Emmanuele - - To Matthew, for starting the flame. To Robert and Neil, for - keeping it ablaze. - - To Marta, for her love and patience. -
- -
- Acknowledgements from Elliot -
- -
- -
- Where to get Clutter - - You can obtain the Clutter source code ready for compilation - from &appurl;. - - Clutter is also available on all major GNU/Linux distributions, - in various package formats. - - On OSX, Clutter is available with both Fink and MacPorts. - - Binaries for Microsoft Windows are also available. -
- -
diff --git a/doc/cookbook/layouts.xml b/doc/cookbook/layouts.xml deleted file mode 100644 index 4e96a37e0..000000000 --- a/doc/cookbook/layouts.xml +++ /dev/null @@ -1,1189 +0,0 @@ - - - - - Layout management - - - Abigail Adams, wife of John Adams, in a letter to John - Thaxter (1778-09-29) - If we do not lay out ourselves in the service of mankind, - whom should we serve? - - -
- Introduction - - Layout management in Clutter controls how an actor and - children "inside" that actor are sized and positioned. More - specifically, layouts are managed by associating a parent with a - ClutterLayoutManager; the parent is usually either a - composite ClutterActor (composed of several - ClutterActors) or a ClutterContainer - (containing child ClutterActors). The - ClutterLayoutManager then manages: - - - - The size requisition - (determination of the desired height and width) of the - parent. - - - The allocation (size and position) - assigned to each composed or child ClutterActor. - - - - - To make this more concrete, imagine you have a sheet of - paper and some coloured squares to place on it. Someone stands - next to you telling you how big the piece of paper should be, - how big the squares should be, and where to put each square on the - piece of paper. - The sheet of paper is analogous to the container or - composite actor; the squares are analogous to the child - ClutterActors; and the person giving you instructions - is analogous to the layout manager. - - - The following sections give an overview of how layout - management works in Clutter. - -
- Using layouts - - Although Clutter provides plenty of flexibility in how you - can use layout management, the simplest way to get started is to - use the built-in ClutterActor class with one of the - provided ClutterLayoutManager implementations. - - The pattern for doing this is: - - - - Create an instance of one of the - ClutterLayoutManager implementations (see - the - following section). - - - Configure the layout manager's default policies - (e.g. how actors are aligned by default, whether to pack - actors horizontally or vertically, spacing between actors - in the layout). - - - Create a ClutterActor, setting its layout - manager to the one you just created. - - - Pack actors into the ClutterActor, - setting layout properties (if required) as each is added. - - - Modify layout properties of child actors using - clutter_layout_manager_child_set() - (if required). - - - - Individual recipes in this section give more examples of - how to make use of the different layout manager - implementations. - -
- -
- Types of layout manager - - Clutter provides a range of layout managers suitable - for different use cases: - - - - ClutterFixedLayout arranges actors - at fixed positions on the stage. No alignment options are - available, so you have to manually compute and manage the - coordinates (or use ClutterConstraints) which - will align actors how you want them. - - - ClutterBinLayout arranges actors in a - depth-ordered stack on top of each other, aligned to the container. - This is useful for arranging actors inside composites (e.g. - creating a button widget from a ClutterTexture - with a ClutterText on top of it). - - - ClutterBoxLayout arranges actors in a - single horizontal row or vertical column. This type of layout is - common in UI elements like toolbars and menus. - - - ClutterFlowLayout arranges actors - in reflowing columns and rows. If the container's allocation - changes, the child actors are rearranged to fit inside its - new allocation. This can be useful for arranging actors - where you're not sure how many there might be; or where - new ones are going to be added into the UI, perhaps displacing - others. An example might be a photo viewer or an - RSS feed display. - - - -
- -
- Layout properties - - How actors are sized and positioned inside a container - associated with a layout manager depends on two things: - - - - - Properties which apply to all actors added to the layout - There will be one setting at the layout level which can't - be overridden per actor. This includes properties like spacing - between rows and columns, whether the layout is homogenous - (each actor gets the same allocation), etc. - - - - - Properties for each actor added to the layout - These are properties of the relationship between the - layout, the container associated with the layout, and the - children of the container. Each layout/container/actor - combination can have different settings for each of these - properties. - - - - - Each layout manager implementation supports a subset of the - following layout properties; different managers may have different - names or functions for setting them, but the functionality remains - the same. Individual recipes give more details about which - properties can be set for each layout manager implementation. - - - - - Alignment - How an actor aligns to the container's axes, e.g. - aligned to the container's left, right, or center. For some - layouts (like ClutterBinLayout) alignment - is also used to set expand and fill properties. - - - - - Horizontal/vertical orientation - Whether actors are arranged in a horizontal row or - vertical column. - - - - - Homogenous rows and columns - Grid-like layouts (e.g. ClutterFlowLayout) - can be configured to have uniform rows and/or columns, - expanding to fit the largest actor they contain. - - - - - Row height and column width - Grid-like layouts arranged in rows and columns - can be configured with maximum and minimum row height and - column width. - - - - - Row and column spacing - Grid-like layouts enable you to define a space (in pixels) - between rows and columns. - - - - - Expand - Some layouts can be configured to minimize their size request - to fit the actors they contain (expand is FALSE); - or to increase the allocation of actors they contain so - that all available space in the layout is used - (expand is TRUE). In the latter case, you'd - also need to set a size for the container associated with - the layout, otherwise the container will just fit itself to the - actors inside it. - - - - - Fill - This property only has an effect when - expand is on. The fill - setting controls whether actors are resized to fill their - allocation (fill is TRUE); or if the - space around the actor is increased (fill is - FALSE). - - - - - Pack at start/end - This controls whether actors at prepended or appended - to the layout. - - - If the orientation is vertical, prepended - actors are added to the top of the layout and appended - actors to the bottom. - - - If the orientation is horizontal, prepended - actors are added at the left of the layout and appended actors - on the right. - - - - - - -
- Setting layout properties - - Layout properties can be set in one or more of the following ways - (depending on the type of property and the layout manager): - - - - By setting a default value for the property on the - layout manager (e.g. using - clutter_bin_layout_set_alignment(), - clutter_box_layout_set_expand()). Any - actor added to the layout gets this value for the property, - unless it is overridden for that actor. - - - When adding an actor to a ClutterBox container - using clutter_box_pack(), you can set - properties on the actor which you're adding. - - - When adding an actor to a layout you can use a function - which enables setting properties simultaneously (e.g. - clutter_box_layout_pack(), - clutter_bin_layout_add()). - - - By using - clutter_layout_manager_child_set() on - the child of a layout. - - - -
- -
- -
- Not using layout managers - - It is perfectly possible to arrange ClutterActors - without using layout managers; however, you may have to do - more of your own calculations about actor sizes and positions. - - There are two (not mutually-exclusive) approaches you can - take to do this, described below. - -
- Manual positioning and alignment - - This basically means using the ClutterActor - bounding box mechanism (see the ClutterActor - documentation for details) to set actor sizes and positions. - This is the approach you will see in a lot of older Clutter - code (written before layout managers were available). - - This approach is simplest where the UI is relatively static - and is composed of a few known actors. It will work in larger, - more complex scenarios, but in those sorts of cases it is better - to make use of layout managers and constraints (see below) instead. -
- -
- Using <type>ClutterConstraint</type> - - Constraints provide mechanisms for: - - - - Aligning actors with each other - (ClutterAlignConstraint). For example, you - can align the top, bottom or center of one actor with the - top, bottom or center of another (on the y - axis). Similarly, you can align one actor to another - on the x axis. - - - Binding properties of one actor to those of - another. For example, you could ensure that two actors - always remain the same width; or you could specify - that two actors always have the same x - coordinate. In both these cases and others, you can - specify that the properties should be the same, or the same - +/- some offset. - - - - - ClutterConstraints can be used in combination - with some layout managers, but you need to be careful that - constraints don't fight with the layout manager policies. - Unpredictable results could ensue. - - -
- -
- -
- -
- Stacking actors on top of each other - -
- Problem - - You want to lay out several actors so that they are in - layers on top of each other (e.g. to create a button widget - composed from a rectangle with text on top of it). -
- -
- Solution - - The most flexible approach is to use a ClutterBinLayout - associated with a ClutterActor: - - - - - - -
- -
- Discussion - - This section covers some other aspects of using a - ClutterBinLayout. - -
- Setting and changing alignment - - Alignment is the only - layout - property available for ClutterBinLayout. Each - actor can have a different setting for its alignment in one or both - of the x or y axes. However, as shown in the - solution above, alignment can also be used to expand an actor to - fill the container (CLUTTER_BIN_ALIGNMENT_FILL) - in one or both axes. - - Setting alignment does not have any effect if the container - is the same size as all of the actors inside it: in this case, - every alignment produces the same layout. But if the container - associated with the layout is larger than the actor being aligned, - alignment will have an effect; see - this - section for more details. - - Changing an actor's alignment after it has been added - to a ClutterBinLayout may make the actor "jump" - (without animation) to a new position and/or change its size. - The exception is changing from some other alignment to - CLUTTER_BIN_ALIGNMENT_FIXED: - in this case, the actor will retain the position and size it - had before its alignment was fixed. -
- -
- Size requisitioning - - A container with a ClutterBinLayout will by - default request the width of the widest actor in it, and the - height of the tallest. If you add actors smaller than those - dimensions, they will be aligned inside the container according - to the layout's policies. Here's an example where a - ClutterBinLayout requests a size to encompass the - tallest (light grey rectangle) and widest (dark grey rectangle) - actors inside it, with other actors aligned within - those bounds: - - - - - - - - Size requisition in a ClutterBinLayout - - - - - - The screenshot also shows the 9 possible combinations - of start, center and end alignments on the x and - y axes. See - the sample - code for more details. - - - The white space is the stage visible behind the - ClutterActor holding the coloured rectangles. - Notice that the layout is the width of the widest actor - within it and the height of the tallest. - - You can also manually set a size on the container associated - with a layout to override the automatically-computed size - requisition. - -
- -
- Depth ordering - - Another important consideration is the - depth ordering of actors inside a - ClutterBinLayout. By default, the depth ordering - mirrors the order in which actors are added to the layout: the - earlier an actor is added, the lower down in the depth order it - is. If this isn't what you want, you can fix the depth ordering using - clutter_actor_set_child_above_sibling(), - clutter_actor_set_child_below_sibling() and - their relatives. -
- -
- Other ways to stack actors - - ClutterBinLayout makes it simple to lay out - large numbers of actors in a stack and align them to the - container; see the - example below which shows layering of many actors on - top of each other. - - However, if you have a small number of actors and you - need some simple alignment, an alternative is to use - manual positioning inside a ClutterFixedLayout, possibly - combined with ClutterConstraints to align actors with - each other and bind their widths and heights together. See - this - section for more details. - - By default, ClutterActor uses a - ClutterFixedLayout as its layout manager. -
- -
- -
- Full examples - - - <type>ClutterBinLayout</type>, with actors in 9 - combinations of start, center and end alignment combinations - - - a code sample should be here... but isn't - - - - - - Layering multiple textures on top of each other - inside a <type>ClutterBinLayout</type> - - - a code sample should be here... but isn't - - - - -
- -
- -
- Binding the size of one actor to the size of another - -
- Problem - - You want one actor (the "target") to automatically change - its width or height (or both) when the size of another - actor (the "source") changes. - - Example use cases: - - - - Making an actor adjust itself to the size of the stage - (particularly when the stage is resizable). - - - Putting one actor on top of another and keeping their - sizes in sync. - - - -
- -
- Solution - - Create a ClutterBindConstraint bound to the - width and/or height of one actor (the "source"). Add that constraint - to an actor (the "target") whose size should follow the - size of the source. - - This short example shows how to create and add a constraint; - source and target can - be any two ClutterActors: - - - -ClutterConstraint *width_constraint; - -/* create a constraint which binds a target actor's width to 100px less than - * the width of the source actor (use CLUTTER_BIND_HEIGHT to create a - * constraint based on an actor's height) - * - * the third argument is a positive or negative offset from the actor's - * dimension, in pixels; this is added to the height or width of the source - * actor before the constraint is applied to the target actor - */ -width_constraint = clutter_bind_constraint_new (source, CLUTTER_BIND_WIDTH, -100); - -/* add the constraint to an actor */ -clutter_actor_add_constraint (target, width_constraint); - - - - Below is a full example, showing how to incorporate a - constraint into a Clutter application. - - - Constraining the size of a texture to - the size of the stage using <type>ClutterBindConstraint</type> - - - a code sample should be here... but isn't - - - - - The texture in this example is 100px smaller than the stage, - leaving a border of visible stage around the texture; and the texture - has a tiled image on it. The tiling changes as the texture changes - size. Also note that two ClutterAlignConstraints are - added to center the actor on the stage. - - The result looks like this: - - - - - - - - A texture bound to the height and width of the - stage using ClutterBindConstraint - - - - -
- -
- Discussion - - Sizing constraints are a good solution in these cases: - - - - Where you can't use a layout manager. For - example, you can't apply a layout manager to the stage - directly; so if you want to control the size of an actor - based on the size of the stage (as in - the example - above), constraints are a good substitute for a layout - manager . - - - - Where the layout of a UI is fairly simple (perhaps - up to half a dozen actors) and fairly static. An example - might be something like a text editor, where the arrangement - of the UI (menu bar, toolbar, editing panel, footer) changes - infrequently. Of course, it is possible to arrange top-level - components using constraints, but still use layout - managers inside individual components (e.g. a flow layout - manager to manage buttons in the toolbar). - - - - Where you have an actor whose size can change erratically, - but you still want to be able to track its size to control - another actor's size. An example might be an application like - a drawing program, where a user can create their own actors: - you might want the user to be able to describe loose, custom - constraints between actors like "keep these actors at the - same width", then allow those actors to be moved around and - resized in a free-form way as a group. In this situation, a - layout manager is too rigid and not appropriate; - but adding ClutterConstraints to actors - in response to user actions could work well. - - The sample - code in the appendix is the kind of thing you might include - in a drawing program: you can resize a texture with a key press - (+ to increase size, - to decrease), and - click on the actor to select/deselect it (a semi-transparent overlay is - toggled on the texture). The size of the overlay is bound and - aligned to the texture, so that it covers and slightly overlaps the - texture regardless of its size. - - - - - You can bind an actor to a single dimension (just height or - depth) of another actor: you don't have to bind both height - and width. Also, you don't have to bind both dimensions of the - target to the same source: for example, you could bind the target's - height to one source (actor A) and its width to another source - (actor B). - - A ClutterBindConstraint can also be used to - constrain a target actor's position on the x and - y axes to the position of a source actor. This is - covered in another recipe. - - -
- Another way to bind actors' sizes together - - There is another way to control the size of a target - actor, based on the size of a source: you can create a handler - for the allocation-changed signal - of the source, emitted when its size and/or position - changes. This signal includes all the data - about the source's new allocation (height, width, x and y - coordindates), which the handler function can then use to - resize the target. - - Alternatively, if you're only interested in - a change to width or height, you can create a handler - for the notify::width or - notify::height signal (respectively), and modify - the target's width/height in the handler. - - This approach may be useful if you need a type of - control over alignment and size which is not possible using - constraints alone (e.g. one actor's size should be - a proportion of another's). See - the code in - this section for an example where the size - of one actor is dynamically set to 10% more than the - size of another. - - - This recipe - explains more about monitoring changes to an actor's size. - -
- -
- -
- Full examples - - - Creating an automatically-resizing overlay for a - texture using <type>ClutterBindConstraint</type> - - - a code sample should be here... but isn't - - - - - - Using the <code>allocation-changed</code> - signal of one actor to trigger proportional size changes in - another - - - a code sample should be here... but isn't - - - - -
- -
- -
- Arranging actors in a single row or column - -
- Problem - - You want to layout several actors in a single row - or column. - - Example use cases: - - - - Creating an application menu. - - - Showing message subject lines as a list in an - email client. - - -
- -
- Solution - - Create a ClutterActor with a - ClutterBoxLayout as its layout manager. - - A ClutterBoxLayout can hold a single row or - column of ClutterActors, and has configurable spacing, - actor alignments, and expand and fill options. - - The code fragment below is excerpted from the - full example. It - demonstrates how to lay out three rectangles in a vertical - column. A different approach is used to set the x-fill - property on each rectangle, so each fills the horizontal space in - the layout (each rectangle is 100 pixels wide, while the - box they are inside is 200 pixels wide). - - - - - - - - The result looks like this: - - - - - - - - A simple vertical ClutterBoxLayout - - - - -
- -
- Discussion - - ClutterBoxLayout is not a reflowing layout: - that is, if the layout's container changes size, the actors inside - aren't automatically repositioned to occupy or find new positions - in its available area. If you want that behaviour, use - ClutterFlowLayout instead. - - If you want the container to be resizable, but find that - resizing the container obscures its child actors, you could put - the container inside a scrollable area. Then the container's actors - can be scrolled to if they go out of sight. - This recipe explains - how to make a container scrollable. - -
- Layout properties - - ClutterBoxLayout is very flexible, with - several properties which influence the appearance of the - layout and its children. As with other layouts, these properties - are either applicable to the layout itself, or to individual - children of the layout. - - As most of these properties are documented in the API reference, - they aren't covered in much detail here. However, below is a brief - overview of the properties available, as well as details of properties - particular to ClutterBoxLayout. - - The main issue you may face when applying these properties - is understanding how they interact. As this is harder to describe - than to show, you can run the - example - below to toggle and tweak various properties and see - how they affect the layout's appearance. - - - The "toggle and tweak" - example sets - child properties (fill, alignment, expand) on all children - of the layout when those properties are changed. If you want - to see the effect of setting these to different values for - each child, you will have to experiment - yourself. - - -
- <type>ClutterBoxLayout</type> properties - - ClutterBoxLayout has the following properties - which affect the appearance of all children inside the container. - - - Animation properties are covered separately - later. - - - - - - - <varname>vertical</varname>; set with - <function>clutter_box_layout_set_vertical()</function> - - Set to TRUE to lay out - child actors in a column; if FALSE - (the default), actors are laid out horizontally. - - - - - - <varname>homogeneous</varname>; set with - <function>clutter_box_layout_set_homogeneous()</function> - - Set to TRUE to allocate all - child actors the same amount of space in the row or column - (depending on the setting for vertical). - This overrides per-actor expand settings - and preferred sizes for child actors. The default value for - this property is FALSE. - - - - - - <varname>spacing</varname>; set with - <function>clutter_box_layout_set_spacing()</function> - - Sets the number of pixels to place between actors - in the layout. - - - Note that if you increase spacing too much, actors - may go outside the edges of the layout's container (if - the container has a fixed size). - - - - - <varname>pack-start</varname>; set with - <function>clutter_box_layout_set_pack_start()</function> - - Set pack-start to - TRUE to configure the layout to - prepend actors to the row or column; the default is - FALSE, meaning that actors are - appended to the row or column when added. - - - Changing this property on a layout which already has - actors in it will reverse the order of those actors, as - well as changing how new actors are added to the layout. - - - -
- -
- Child properties - - These properties apply to individual children within - the layout's container. Each child can have different values - for each of these properties. - - To set properties, you can use - clutter_box_layout_pack() or - clutter_box_pack() (if using a - ClutterBox) while packing actors into the layout. - You can also set properties later using - clutter_layout_manager_child_set() - etc. See the layouts - introduction for more details. - - - - x-fill and y-fill - set whether an actor will fill its allocated horizontal - or vertical space (respectively) within the layout. Setting - these properties only has an effect where an actor is smaller - (on the appropriate fill axes) than the layout's container. - - Note that the actor's actual size is not changed - if it is set to fill: the reported width and height are - unaffected. - - - - expand sets whether an actor - will be expanded inside the layout. If - expand is TRUE - and fill is TRUE - for the orientation axis, the actor is resized to fill - its whole allocation on that axis; if expand - is TRUE but fill - is FALSE, extra padding is added - around the actor to fill the allocation. - - - - x-align and y-align - set how an actor is aligned within its allocation, in - cases where it doesn't fill that allocation. In practical - terms, these properties come into effect if a child is set - to expand but fill is set to - FALSE on the align axis. - - For example, if expand is - TRUE but x-fill - is FALSE, some padding is added - around the actor to fill its allocation. In this case, - the x-align property can be set to - align the actor to the left, center or right of the - allocation; any whitespace would be redistributed around - the actor's new position after alignment. - - - - These properties are only useful where you have - actors of non-uniform sizes and/or a container which is - either wider or taller (or both) than one or more of the - child actors it contains. - -
- -
- -
- Animating layout changes - - If actors are added to a layout, or if the layout's - properties or its children's properties are changed, the - appearance of the layout may also change. The - use-animations property (set with - clutter_box_layout_set_use_animations()) - determines whether such changes to the layout are animated: if set - to TRUE, any changes to actor - allocations resulting from the changes (movements, resizings) - are animated. - - If this property is FALSE (the default) - changes to other properties or addition of new actors will - cause actors to be laid out instantaneously. For example, if - a new actor is prepended with animations on, the new actor is - added to the layout and the other actors shifted to make room - for it; if animations are off, child actors jump to their new - positions at the same instant as the new actor is added. - - To change the appearance of the animations, you can use - clutter_box_layout_set_easing_mode() and - clutter_box_layout_set_duration() (see the - animations - introduction for more about easing and duration - properties). - - The "toggle and tweak" - example uses animation for layout changes, and can give - you some idea of what to expect in your own animated layouts. - -
-
- -
- Full examples - - - Different approaches to setting child layout properties - in a <type>ClutterBoxLayout</type> - - - a code sample should be here... but isn't - - - - - - A simple <type>ClutterBoxLayout</type> menu - - - a code sample should be here... but isn't - - - - - - A demonstrator for "toggling and tweaking" a - <type>ClutterBoxLayout's</type> properties - - - a code sample should be here... but isn't - - - - -
- -
- -
diff --git a/doc/cookbook/recipe-template.xml b/doc/cookbook/recipe-template.xml deleted file mode 100644 index 9dfe62876..000000000 --- a/doc/cookbook/recipe-template.xml +++ /dev/null @@ -1,24 +0,0 @@ - diff --git a/doc/cookbook/script.xml b/doc/cookbook/script.xml deleted file mode 100644 index f22d5b364..000000000 --- a/doc/cookbook/script.xml +++ /dev/null @@ -1,857 +0,0 @@ - - - - Script - - - Alfred Hitchcock - When an actor comes to me and wants to discuss his character, - I say, "It's in the script". If he says, "But what's my motivation?", - I say, "Your salary". - - -
- Introduction - - User interfaces can become difficult to maintain when - described entirely in code: declarations of UI - elements become entwined with procedural code for - handling interactions. This can make refactoring tough, as - you have to find the right place in the code to modify the UI - ("Where did I set the color of that rectangle?") and make sure - your UI modifications don't break any behaviour. - - Many frameworks separate presentation from programming - logic, making it easier to change the appearance of the UI - without affecting its behaviour (and vice versa). For example, - in web development you can use HTML and CSS to define - presentation, and JavaScript to implement application logic. - - ClutterScript enables a similar separation: - you can define the UI declaratively using - JSON, load - the UI from the JSON, then handle interactions with it through Clutter code - (in C, Python, Vala or some other language). This has several - benefits, including: - - - - Separation of UI element declarations from control logic - (see above). - - - More concise code: typically, describing a UI in JSON - requires far fewer characters than the equivalent procedural - code (at least, once you have more than three or four actors in - your application). - - - If you write your JSON in external files, you can make the - structure of the UI evident in the layout of the file. For - example, child elements can be indented within the parent - element. This can make identifying relationships between - elements simpler and less error-prone. - - - Creating and configuring some objects (e.g. animations, - layouts) can be much simpler in JSON. - - - Less compilation (if you're using a compiled language): - because you can change the UI by editing external JSON files, - you can make changes to it without needing to recompile - the whole application. - - - - The following sections are intended - to give an overview of how ClutterScript works, and - how to use it in an application. The recipes in this chapter - then provide more detail about particular aspects of - ClutterScript, such as how to connect signals to handlers, - how to merge multiple JSON definitions in a single script, etc. - There is also a lot of useful information in the ClutterScript - API reference. - -
- Basic principles of <type>ClutterScript</type> - - Clutter is built on top of - GObject, - an object system for C. ClutterScript - provides a way to create instances of GObjects and - set their properties. For example: - - - Example UI definition in JSON for use with - <type>ClutterScript</type> - - - -[ - { - "id" : "stage", - "type" : "ClutterStage", - "width" : 400, - "height" : 400, - "color" : "#333355ff", - "children" : [ "box" ] - }, - - { - "id" : "box", - "type" : "ClutterBox", - "width" : 400, - "height" : 400, - - "layout-manager" : { - "type" : "ClutterBinLayout", - "x-align" : "center", - "y-align" : "center" - }, - - "children" : [ - { - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "color" : "red" - } - ] - } -] - - - - N.B. The numbers in brackets in the example further - explain the JSON structure, and are not part of the UI - definition. - - - - - All the objects defined for the UI sit inside a JSON - list structure, marked with square brackets. - - - A pair of braces surrounds each object definition; - inside the braces, key-value pairs set properties on the - object. See the - section on - datatypes for more about the acceptable values. - - - An id is required for objects which - are referred to elsewhere in the JSON or which need to be - accessible from code (see - this recipe for the basics of - using object IDs from code). - In cases where an object doesn't need to be accessible - from code and is not referenced elsewhere in the JSON file, - the id can be omitted. - - - The type key is mandatory, and - specifies the type of the object; usually this will be - one of the Clutter object types. - - - Colors can be set using hexadecimal color code strings, - as used in HTML and CSS; or by using color words. The - range of acceptable values is as for the - pango_color_from_string() function. - - - Children can be associated with a parent through - the children property. Children are - either added to the children list by ID; - or by directly embedding the child JSON object as an element - within the list. The two can be mixed in a single - list of children. - - - This uses the nickname for a value in an enumeration - (in this case, the nickname for - CLUTTER_BIN_ALIGNMENT_CENTER). - To get the nickname for an enumeration value, take - the component which is unique to that value in the - enumeration, lowercase it, and replace any underscores - with hyphens. Some examples: - - - CLUTTER_ALIGN_X_AXIS has - the nickname x-axis - - - CLUTTER_GRAVITY_NORTH has - the nickname north - - - CLUTTER_REQUEST_HEIGHT_FOR_WIDTH - has the nickname height-for-width - - - - - - - - - Once you grasp that Clutter objects are GObjects, and you - are setting their properties, you can work out what is "scriptable" - by referring to the Properties sections - of the API reference for each Clutter type. Any of the properties - described there can be set using ClutterScript. - - Having said this, there are some special properties which - aren't obvious, but which can be set via JSON; - layout properties are one example. These aren't - listed as properties of ClutterActor but can be set - as part of a ClutterActor object definition - (using the layout::<property name> - syntax for the key). Some of these are covered in recipes later in - this chapter. - -
- -
- Data types - - ClutterScript uses the standard JSON format. - It is very important that you respect the data type of the property - you are setting, ensuring that you use the right JSON data type. - You may get unexpected results or errors if you try to set a property - using the wrong data type: for example, setting a property - to an integer number in the JSON, when the Clutter property - is expecting a gfloat, may cause errors. - - To assist in using the right data types in your JSON - definitions, the table below shows how Clutter and GLib data - types map to JSON: - - - - - C data type (Clutter/GLib) - Maps to JSON - Example (C => JSON) - - - - - floating point number (gfloat, gdouble) - number (int frac, int exp, int frac exp) - - 1.0 => 1.0 - 1e-1 => 1e-1 - 1E-1 => 1E-1 - 0.1E-1 => 0.1E-1 - - - - integer (guint8, gint) - number (int) - - 1 => 1 - 0x00 => 0 (no hex in JSON) - 01 => 1 (no octal in JSON) - - - - gboolean - true/false - - TRUE => true - FALSE => false - - - - gchar - string - "hello world" => "hello world" - - - enum (e.g. Clutter constants) - string - - CLUTTER_ALIGN_X_AXIS => - "CLUTTER_ALIGN_X_AXIS" or "x-axis" - (the latter is the GEnum nickname for the constant) - - - - ClutterColor - color string - - clutter_color_new (255, 0, 0, 255) => - "red" or "#f00f" or - "#ff0000ff"; alternatively, - "#f00" or "#ff0000" - (implicitly sets alpha value to 255) - - - - ClutterActor (or other Clutter type) - object - - clutter_rectangle_new () => - { "type" : "ClutterRectangle" } - - - - Property which takes a list or array of values - array of objects and/or IDs - - clutter_container_add_actor (stage, rectangle) => - -{ - "id" : "stage", - "type" : "ClutterStage", - ..., - - "children" : [ - { - "id" : "rectangle", - "type" : "ClutterRectangle", - ... - } - ] -} - - - - - NULL - null - - - - - - -
- -
- -
- Defining a user interface with JSON - -
- Problem - - You want to create a user interface as quickly as - possible; you also need to change it easily as requirements shift. - - This need can arise when: - - - - you are prototyping a user interface, and you need to - quickly test new ideas. - - - the user interface you are building is likely to contain many - elements and relationships between them. - - -
- -
- Solution - - Define the user interface in an external JSON file. Then - create a ClutterScript object and load the JSON - into it from the file. - - This keeps the UI definition separate from the application - logic and makes it easier to manage. - - - See the introduction - for the reasons why ClutterScript is a good solution, - and for an overview of how JSON definitions work. - - - Here's an example JSON definition to put in the file: - - - - - a code sample should be here... but isn't - - - - - In the application, load the JSON from the file with - clutter_script_load_from_file(). (You can - also load JSON from a string (gchar*) with - clutter_script_load_from_data().) - - Then retrieve objects by ID to use them in your code: - - - Loading JSON from a file and retrieving objects - defined by it - - - a code sample should be here... but isn't - - - - - Although we only retrieved the stage in the example above, - clutter_script_get_objects() can - retrieve multiple objects with a single call: - - - - - - - - You can also use clutter_script_get_object() - to retrieve a single object, though you may have to cast - it to the right type before use; for example: - - - -ClutterStage *stage = CLUTTER_STAGE (clutter_script_get_object (script, "stage)); - - - -
- -
- Discussion - - In the sample code, the stage is part of the JSON definition. - However, it doesn't have to be: it is possible to create the - stage in application code; then load more components from one - or more JSON definitions and attach them to the stage you - constructed in code. - - However, keeping most of the user interface definition - in external JSON files makes it easier to change - the UI without having to touch any code. If you have some user - interface elements constructed in code and some in JSON, it can - make refactoring more difficult. - -
- -
- -
- Connecting to signals in <type>ClutterScript</type> - -
- Problem - - You have declared an actor using JSON, and want to add - handlers for signals emitted by it. -
- -
- Solution - - Add a signals property to the actor's - JSON definition. - - Here's how to connect a ClutterStage's - destroy signal to the - clutter_main_quit() function: - - - -{ - "id" : "stage", - "type" : "ClutterStage", - "width" : 300, - "height" : 300, - - "signals" : [ - { "name" : "destroy", "handler" : "clutter_main_quit" } - ] -} - - - - The highlighted part of the code is where the - signal is connected. In this case, a Clutter function is used - as the handler; in most cases, you'll want to define your own - handlers, rather than using functions from other libraries, - as follows: - - - -{ - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "reactive" : true, - - "signals" : [ - { "name" : "motion-event", "handler" : "foo_pointer_motion_cb" } - ] -} - - - - This signal handler definition sets - foo_pointer_motion_cb() - as the handler for the motion-event - signal on the rectangle. (NB the rectangle has - reactive set to true, otherwise it - can't emit this signal.) - - As per standard event handling in Clutter, - you define the handler function next. For example: - - - - - - - - - See the - Discussion - section for more about writing handler functions. - - - To make the signal connections active in your code, - call the clutter_script_connect_signals() - function after loading the JSON: - - - - - - - -
- -
- Discussion - -
- Options for connecting signals to handlers - - Every connection between a signal and handler requires - a JSON object with name and - handler keys. The name - is the name of the signal you're connecting a handler to; the - handler is the name of the function which - will handle the signal. - - You can also specify these optional keys for a handler - object: - - - - "after" : true configures the handler - to run after the default handler for the signal. (Default is - "after" : false). - - - "swapped" : true specifies that - the instance and the user data passed to the - handler function are swapped around; i.e. the instance emitting - the signal is passed in as the user data argument (usually the - last argument), and any user data is passed in as the first - argument. (Default is "swapped" : false). - - - - - While the connections to signals were specified in JSON - above, it is still possible to connect handlers to signals in - code (e.g. if you need to conditionally connect a handler). Just - retrieve the object from the ClutterScript and - connect to its signals with - g_signal_connect(). - - -
- -
- Writing handler functions - - The handler function has the usual signature required - for the signal. However, the function cannot be static, otherwise - the function is invisible to GModule (the mechanism used by - ClutterScript to look up functions named - in the JSON definition). Consequently, callback functions should be - namespaced in such a way that they won't clash with function - definitions in other parts of your code or in libraries you link - to. - - You should also ensure that you use the - flag when you compile your - application: either by passing it on the command line (if you're - calling gcc directly); or by adding - it to the appropriate LDFLAGS variable in - your Makefile (if you're using - make); or by whatever other mechanism is - appropriate for your build environment. - -
- -
- Passing objects to handler functions - - In a typical Clutter application, handler functions - require access to objects other than the one which emitted a - signal. For example, a button may move another actor when - clicked. Typically, you would pass any required objects - to the handler function as user data, like this: - - - -g_signal_connect (button, - "clicked", - G_CALLBACK (_button_clicked_cb), - actor_to_move); - - - - Note how actor_to_move is passed - as user data to the handler. - - However, the JSON definition doesn't allow you to specify - that different user data be passed to different handlers. So, - to get at all required objects in the handler, a simple - solution is to pass the ClutterScript to - every handler function; then inside - each handler function, retrieve - the required objects from the script. - - This was done in the code example above, by passing - the ClutterScript instance as two arguments to - clutter_script_connect_signals(): - the first argument specifies the script which defines the - signal handlers; the second specifies the user data passed to every - handler function. This ensures that each handler has access - to all of the elements defined in the JSON file. - - - Alternatively, you could create some other structure to - hold the objects you need and pass it to all handler functions. - But this would effectively be a reimplementation of some aspects - of ClutterScript. - - -
- -
- -
- Full examples - - - <type>ClutterScript</type> JSON with signal handler - definitions - - - a code sample should be here... but isn't - - - - - - Loading a JSON file into a <type>ClutterScript</type> - and connecting signal handlers - - - a code sample should be here... but isn't - - - - -
- -
- -
- Connecting <type>ClutterState</type> states in <type>ClutterScript</type> - -
- Problem - - You have declared an actor using JSON, and want to connect - signals to ClutterState transitions. -
- -
- Solution - - Connect the ClutterState states to the signals - using the states and target-state - keys of the signals definition, and call - clutter_script_connect_signals(); for instance, - the following JSON declares that the enter-event - signal should transition to the hover state - and the leave-event should transition to the - base state: - - - -{ - "id" : "rectangle", - "type" : "ClutterRectangle", - "width" : 200, - "height" : 200, - "reactive" : true, - - "signals" : [ - { "name" : "enter-event", "states" : "rectangle-states", "target-state" : "hover" }, - { "name" : "leave-event", "states" : "rectangle-states", "target-state" : "base" } - ] -} - - - - The rectangle-states state machine holds - the various states. - -
- -
- Discussion - - Connecting a ClutterState state transition to - a signal defined inside a ClutterScript JSON without - requiring a real function to wrap clutter_state_set_state() - allows to minimize the amount of code that has to be written, and - ties the state to the UI element being defined. - - The connection between a signal and a ClutterState - state is similar to the connection between a signal and a handler - function. Each definition must contain the name of the signal; the - script id of the ClutterState object that is used to - store the target state definition; and the target state of the - transition. - - The states key can also contain a full - definition of the ClutterState. - - The target-state key works exactly like - the argument of clutter_state_set_state(): it - will transition the ClutterState from the current state - to the desired state. - - The ClutterState instance that will be used to - resolve the target state can be defined in JSON like any other - object, but it is also possible to create a ClutterState - in code, and associate it to a ClutterScript instance - prior to parsing the signal connection JSON, through the - clutter_script_add_states() function of - ClutterScript. - - The warp boolean key can be used to - perform a transition to the target state without an animation, - similarly to what clutter_state_warp_to_state() - does, for instance: - - - -{ - "signals" : [ - { - "name" : "enter-event", - "states" : "rectangle-states", - "target-state" : "hover", - "warp" : true - } - ] -} - - - - will not animate the transition between the current state - and the target hover state when the signal - is emitted. - -
- -
- Full examples - - - <type>ClutterScript</type> JSON with state definitions - - - a code sample should be here... but isn't - - - - - - Loading a JSON file into a <type>ClutterScript</type> and connecting states - - - a code sample should be here... but isn't - - - - -
- -
- -
diff --git a/doc/cookbook/text.xml b/doc/cookbook/text.xml deleted file mode 100644 index d10551e75..000000000 --- a/doc/cookbook/text.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - - Text - - - Alan Perlis - A picture is worth 10K words - but only those to describe the - picture. Hardly any sets of 10K words can be adequately described with - pictures. - - -
- Introduction - - User interfaces can rely on textures to represent actions, but there - are cases where you need to convey an idea using words. - - Clutter provides an actor that allows displaying and editing - arbitrary text, called ClutterText. A ClutterText - actor can be positioned like any other actor; its preferred size is - determined by its contents, as well as the font family and size used to - render those contents. - -
- -
- Drawing a shadow under the text - -
- Problem - - You want to draw a shadow under the text displayed by a - ClutterText actor. -
- -
- Solution - - Override the paint signal of - ClutterText and use the CoglPango API to paint the - PangoLayout of the actor with the color of the - shadow at a given offset. - - - - - - - - A ClutterText actor painting a shadow underneath its - contents - - - -
- -
- Discussion - - The ClutterText class provides an actor that - transforms the PangoLayout object into an element of - the Clutter scene graph. The underlying layout is painted, though, - through a subset of the Cogl API, called - CoglPango. - - It is possible to paint PangoLayout created by a - ClutterText by invoking - cogl_pango_render_layout(): - - - - - - This function will paint the layout at the given offsets using the - provided color. - - The cogl_pango_render_layout() - function will only work with PangoLayouts created by - Clutter. - - Since the shadow of the text is literally the same text but painted - with a different color and at an offset, we can use the - paint signal of ClutterText to paint - the shadow, and then let ClutterText paint its contents on - top: - - - - - - Note that we are using the PangoLayout of the - ClutterText because the ClutterText actor - always keeps an updated layout internally. It is, however, possible for - any ClutterActor to create a PangoLayout using - clutter_actor_create_pango_layout(), and then paint - that layout using cogl_pango_render_layout() in - their implementation of the paint virtual - function. - -
- -
- Full example - - - Creating a shadow of a text - - - FIXME: MISSING XINCLUDE CONTENT - - - -
- -
- -
diff --git a/doc/cookbook/textures.xml b/doc/cookbook/textures.xml deleted file mode 100644 index 927e8f5ed..000000000 --- a/doc/cookbook/textures.xml +++ /dev/null @@ -1,1382 +0,0 @@ - - - - Textures - - - Antoine de Saint-Exupery - A rock pile ceases to be a rock pile the moment a single man - contemplates it, bearing within him the image of a cathedral. - - -
- Introduction - - Textures are one of the most important actors in Clutter. Whether - they are employed as the background for a user interface control, or - to show the picture of a kitten, a big part of any Clutter-based - application is going to involve textures. - - A ClutterTexture is an actor that can hold any raw image data and - paint it. ClutterTexture can also load image data from a file on disk and - convert it. - - The actual formats supported by ClutterTexture depend on the - platform on which Clutter is being used. -
- -
- Drawing 2D graphics onto a texture - -
- Problem - - You want to draw 2D graphics inside a Clutter application. -
- -
- Solution - - Create a ClutterCairoTexture, then draw onto - the Cairo context it wraps using the Cairo API: - - - -ClutterActor *texture; -cairo_t *cr; - -guint width, height; -width = 800; -height = 600; - -texture = clutter_cairo_texture_new (width, height); - -cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (texture)); - -/* - * write onto the Cairo context cr using the Cairo API; - * see the Cairo API reference for details - */ -cairo_move_to (cr, 0, 0); -cairo_line_to (cr, 800, 600); -cairo_stroke (cr); - -/* does the actual drawing onto the texture */ -cairo_destroy (cr); - - - - Here's a useful - Cairo tutorial if you want to learn more about the Cairo API - itself. -
- -
- Discussion - - A ClutterCairoTexture is a standard - ClutterActor, so it can be added to a - ClutterContainer (e.g. a ClutterStage - or ClutterGroup), animated, resized etc. in the - usual ways. - - Other useful operations: - - - - - To draw on part of the texture: - use clutter_cairo_texture_create_region() to - retrieve a Cairo context for the region you want to draw on. - - - - To clear existing content from a texture: - use clutter_cairo_texture_clear(). - - You may need to do this as the texture reuses the same - Cairo context each time you call - clutter_cairo_texture_create() or - clutter_cairo_texture_create_region(). - - - - To resize the Cairo context wrapped - by a texture, use - clutter_cairo_texture_set_surface_size(). - - - - -
- Drawing pages from a PDF onto a ClutterCairoContext - - Other libraries may provide an API for writing onto a - Cairo context; you can make use of these APIs on the exposed - Cairo context of a ClutterCairoTexture. For example, you - can use the poppler-glib API to display pages - from a PopplerDocument inside a Clutter application: - - - - - -/* snipped setup code (as above) */ - -/* - * cast to CLUTTER_CAIRO_TEXTURE, as the functions - * used below require that type - */ -ClutterCairoTexture *cc_texture = CLUTTER_CAIRO_TEXTURE (texture); - -clutter_cairo_texture_clear (cc_texture); - -gchar *file_uri = "file:///path/to/file.pdf"; -guint page_num = 0; -double page_width, page_height; - -PopplerDocument *doc; -PopplerPage *page; -GError *error = NULL; - -doc = poppler_document_new_from_file (file_uri, NULL, &error); - -page = poppler_document_get_page (doc, page_num); - -poppler_page_get_size (page, &page_width, &page_height); - -cr = clutter_cairo_texture_create (cc_texture); - -/* render the page to the context */ -poppler_page_render (page, cr); - -cairo_destroy (cr); -]]> - - - - If the page is larger than the Cairo context, - some of it might not be visible. Similarly, if the - ClutterCairoTexture is larger than the stage, - some of that might not be visible. So you - may need to do some work to make the ClutterCairoTexture - fit inside the stage properly (e.g. resize the stage), and/or some work - to make the PDF page sit inside the Cairo context (e.g. scale the PDF - page or put it inside a scrollable actor). - -
- -
- -
- -
- Maintaining the aspect ratio when loading an - image into a texture - -
- Problem - - You want want to load an image into a texture - and scale it, while retaining the underlying image's aspect ratio. -
- -
- Solution - - Set the texture to keep the aspect ratio of the - underlying image (so it doesn't distort when it's scaled); use - the actor's request-mode property to set - the correct geometry management (see the discussion section); then - resize the texture along one dimension (height or width). - Now, when an image is loaded into the texture, the image is - scaled to fit the set height or width; the other dimension - is automatically scaled by the same factor so the image fits - the texture: - - - - - - -
- -
- Discussion - - The request-mode for an actor - determines how geometry requisition is performed; in this case, this - includes how scaling is applied if you change the actor's - width or height. There are two possible values for - request-mode: - - - - If set to CLUTTER_REQUEST_HEIGHT_FOR_WIDTH - (the default), changing the width causes the height - to be scaled by the same factor as the width. - - - If set to CLUTTER_REQUEST_WIDTH_FOR_HEIGHT, - changing the height causes the width to be scaled by the - same factor as the height. - - - - In the example above, the texture is set to keep its - aspect ratio then fixed to a width of 300 pixels; the - request-mode is set to CLUTTER_REQUEST_HEIGHT_FOR_WIDTH. - If a standard, photo-sized image in landscape orientation were - loaded into it (2848 pixels wide x 2136 high), it would be scaled - down to 300 pixels wide; then, its height would be scaled by the - same factor as the width (i.e. scaled down to 225 pixels). - - With request-mode set to - CLUTTER_REQUEST_WIDTH_FOR_HEIGHT, - you would get the same effect by setting the height first; - then, computation of the width for the scaled image would be - based on the scaling factor applied to its height instead. - - You can work out which side of the source image is longest using - clutter_texture_base_size() to get its - width and height. This can be useful when trying to scale images - with different orientations to fit into uniform rows or columns: - - - - - - - - If you explicitly set the size (both width and height) - of a texture with clutter_actor_set_size() (or - with clutter_actor_set_width() and - clutter_actor_set_height()), any - image loaded into the texture is automatically stretched/shrunk to - fit the texture. This is the case regardless of any other settings - (like whether to keep aspect ratio). - - Since a texture can scale down its contents, its minimum - preferred size is 0. - -
- -
- -
- Loading image data into a texture - -
- Problem - - You want to display an image inside a Clutter - application. -
- -
- Solution - - Create a ClutterTexture directly from an - image file: - - - - - - - - Or create a texture and set its source to an image - file: - - - - - - - -
- -
- Discussion - - Bear the following in mind when loading images into a - texture: - - - - An image load may fail if: - - - The file does not exist. - - - The image format is unsupported: most of the - common bitmap formats (PNG, JPEG, BMP, GIF, TIFF, XPM) - are supported, but more exotic ones may not be. - - - - - - Whether you're creating a texture from an image file, - or loading an image from a file into an existing texture, - you should specify the filesystem path to the file, rather - than a URI. - - - -
- Synchronous vs. asynchronous image loading - - The code examples above show the simplest approach: - loading an image into a texture synchronously. This means that - the application waits for each image to be loaded before continuing; - which is acceptable in this case, but may not be when - loading images into multiple textures. - - Another approach is to load data into textures - asynchronously. This requires some extra set up in your code: - - - - Call g_thread_init() (from the - GLib library) prior to calling clutter_init(), - so that a local thread is used to load the file, rather - than the main loop. (Note that this is not necessary if - you're using GLib version >= 2.24, since GObject - initializes threading with the type system.) - - - Set the texture to load data asynchronously. - - - Connect a callback to the texture's load-finished - signal to handle any errors which occur during loading, - and/or to do extra work if data loads successfully. - - - - The code below shows how to put these together: - - - -message); - else - g_debug ("Image loaded from %s", image_path); -} - -int -main (int argc, char *argv[]) -{ - /* initialize GLib's default threading implementation */ - g_thread_init (NULL); - - if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) - return 1; - - /* ... get stage etc. */ - - ClutterActor *texture; - GError *error = NULL; - - texture = clutter_texture_new (); - - /* load data asynchronously */ - clutter_texture_set_load_async (CLUTTER_TEXTURE (texture), TRUE); - - /* connect a callback to the "load-finished" signal */ - g_signal_connect (texture, - "load-finished", - G_CALLBACK (_load_finished_cb), - image_path); - - /* load the image from a file */ - clutter_texture_set_from_file (CLUTTER_TEXTURE (texture), - image_path, - &error); - - /* ... clutter_main () etc. */ -} -]]> - - - -
- -
- Other ways to load image data into a texture - - While it's useful to load image data into a texture directly - from a file, there are occasions where you may have image data - in some other (non-file) format: - - - - Various GNOME libraries provide image data in - GdkPixbuf structures; clutter-gtk has - functions for creating or setting a texture from a - GdkPixbuf: - gtk_clutter_texture_new_from_pixbuf() - and gtk_clutter_texture_set_from_pixbuf() - respectively. - - - If you have raw RGB pixel data, ClutterTexture - also has a clutter_texture_set_from_rgb_data() - function for loading it. - - - -
- -
-
- -
- Creating sub-textures from an existing texture - -
- Problem - - You want to create a new ClutterTexture that only - displays a rectangular sub-region of an existing texture. -
- -
- Solution - - A possible way of achieving this is to retrieve the - CoglHandle of the underlying Cogl texture of the existing - ClutterTexture, create a new handle representing the - sub-region with cogl_texture_new_from_sub_texture() - and finally populate a new ClutterTexture with that handle. - - - - - - - - - - - - - - A texture and its sub-texture next to it - - - - -
- -
- Discussion - - The key of this recipe is the Cogl handle that represents the - underlying texture, the actual array of pixels the GPU will use - when it's told to texture geometry. - - From this handle, it's possible to create a new texture handle - that represents a rectangular region of the former texture. To do this - one must call cogl_texture_new_from_sub_texture() - with the position and size of the said region. The interesting bit - about this function is that, when drawing either with the original - texture or with the new one, it's still the same GPU resource (pixels) - being used, meaning that creating a sub-texture doesn't use extra GPU - memory. - - Once the sub-texture handle is created, the next step is - to create a new actor that will be able to draw it, namely a new - ClutterTexture. You then need to tell the texture to - draw from the sub-texture. - - The handle you can get from - clutter_texture_get_cogl_texture() is effectively - the same texture than the first layer of the material retrieved by - clutter_texture_get_cogl_material() - -
- -
- Full example - - - Creating a sub-texture from an existing texture - - FIXME: MISSING XINCLUDE CONTENT - - -
- -
- Going further - - Now that we know how to create sub-textures, it's time to make - something a bit more shiny with them. Let's animate them! In case you - have not heard about implicit animations in Clutter yet, it's a good - time to have a look at the animation section of this cookbook. - - - - - - - - Video showing 4 sub-textures being animated - - - - - Creating a sub-texture from an existing texture - - FIXME: MISSING XINCLUDE CONTENT - - -
- -
- -
- Creating a reflection of a texture - -
- Problem - - You want to create the reflection of a texture. - - The reflection is going to be positioned below the original - texture, and is going to fade out as if the original was placed on - a glassy surface. -
- -
- Solution - - You can use a ClutterClone actor and override its paint - implementation with a custom one: - - - - - - - - - - - - - - A texture and its reflection below - - - - -
- -
- Discussion - - The essence of painting a reflection of a texture lies in reusing - the same material used by the original. This not only allows painting - always an up to date version of the original, but it also saves - resources. - - In the code example above we take the CoglMaterial - out of the source ClutterTexture and we ask the Cogl - pipeline to paint it by using cogl_set_source(). The - main difference between this code and the equivalent code inside the - ClutterTexture paint() implementation - is that we also specify the texture vertices and their color by using the - CoglTextureVertex structure and the - cogl_polygon() function. - - The CoglTextureVertex structure contains three fields - for the position of the vertex in 3D space: - - - - - - It also contains the normalized texture coordinate (also known as - texture element, or texel): - - - - - - And, finally, the color of the vertex, expressed as a - CoglColor: - - - - - - The example code sets the position of the vertices in clockwise - order starting from the top left corner, and sets the coordinate of the - texels in counter-clockwise order, starting with the bottom left corner. - This makes sure that the copy of the original texture appears as being - flipped vertically. - - The gradual fading out to the background color is done by setting - the color of the top vertices to be fully opaque, and the color of the - bottom ones to be fully transparent; GL will then automatically create a - gradient that will be applied when painting the material. - - The color values must be pre-multiplied with their alpha - component, otherwise the bleding will not be correct. You can either - multiply the values by yourself when creating the color or, better yet, - use the cogl_color_premultiply() that Cogl provides - for this operation. - -
- -
- Full example - - - Creating a glassy reflection of a texture - - - FIXME: MISSING XINCLUDE CONTENT - - - -
- -
- -
- Cross-fading between two images - -
- Problem - - You want to do a cross-fade animation (a.k.a. a dissolve - transition) between two images. - - An example use case would be creating a slideshow effect: - load an image from a file, display it in the UI, then load a second - image and cross-fade to it. -
- -
- Solutions - - There are two main approaches you could take: - - - - Use two ClutterTextures, one on top - of the other. - - - Use a single ClutterTexture - with the two images in separate layers inside it. - - - -
- Solution 1: two textures - - This approach uses two ClutterTextures, - bottom and top. To begin - with, the bottom texture shows the - source image and is opaque; the - top texture is loaded with - the target image, but is not visible as - it is fully transparent. - - An animation is then used to fade in the - top texture and fade out the - bottom texture, leaving just top - visible. - - To implement this, first create the two textures inside a - ClutterBinLayout: - - - - - - - - Load the source image into the bottom - texture and the target image into the top one. - As this is the same operation each time, it makes sense to write - a function for loading an image into a texture and checking - for errors, e.g.: - - - -message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - return success; -} -]]> - - - - The load_image() function can then - be called for each texture: - - - - - - - - For the animations, we use ClutterState as we - want to animate two actors at once (top - and bottom): - - - - - - - - Note that rather than set the start opacities manually - on the actors (e.g. using - clutter_actor_set_opacity()), - I've used a ClutterState to define the start - state (as well as the end state). This makes it easier to - track transitions, as they are all kept in one data structure. - - - The easing modes used for the cross-fade animation - (CLUTTER_EASE_IN_CUBIC) - can be set to whatever you like. I personally think that - ease-in modes look best for cross-fading. - - - "Warp" the two textures into the start state - (bottom opaque, top - transparent): - - - - - - - - Using clutter_state_warp_to_state() - immediately transitions to a state without animating, which - in this case sets up the initial state of the UI. - - Finally, use the ClutterState to animate - the two textures, so top fades in and - bottom fades out: - - - - - - - - Here's what it looks like: - - - - - - - Video showing a cross-fade between two textures - - - - The full code for this example - is in the - appendix. - -
- -
- Solution 2: one texture with two layers - - The alternative solution is to use a single texture - and the low-level COGL API to set up two different layers - inside it, one for each image. - - Then, rather than fade between two textures, - progressively combine the two layers together using an - alpha value which changes over the course of an animation - (from 0.0 at the start of the animation to 1.0 at its end). - - At any point in the cross-fade animation, you are - actually seeing a combination of the color - values in the two images (modified by an alpha component), rather - than seeing one image through the other. This can give a smoother - cross-fade effect than the two texture approach. - - As this solution is more complex - and relies on the lower-level (and more difficult to follow) - COGL API, the next section is just a short summary of how it - works; see the - sample code, which has liberal comments for more details. - - - For more about texture combining, refer to the COGL - API documentation (particularly the section about material - blend strings). You may also find it useful to get hold of - a decent OpenGL reference. (So you can look it up, what we're - doing in this solution is using a texture combiner with - interpolation as the texture combiner function.) - - -
- Cross-fading using a texture combiner with interpolation - - The cross-fade is implemented by combining the two layers, - computing a color value for each pixel in the resulting texture. - The value for each pixel at a given point in the animation - is based on three things: - - - - The color value of the source - pixel - - - The color value of the target - pixel - - - The alpha value of a third colour at the given point - in the animation's timeline - - - - The resulting value for each RGBA color component in each pixel - is computed using an interpolation function. In pseudo-code, it - looks like this: - - - - color component value = (target pixel value * alpha) + (source pixel value * (1 - alpha)) - - - - The effect is that as the alpha increases towards 1.0, - progressively more of the target pixel's - color is used, and progressively less of the source - pixel's: so the target fades in, while - the source fades out. - - The advantage of this approach is that color and - brightness transitions only occur where pixels differ between - the two images. This means that you transitions are smoother - where you are cross-fading between images with similar color ranges - and brightness levels. - - A special case is where you're cross-fading - from an image to itself: the two texture approach can cause some - dimming during this kind of transition; but the single texture - approach results in no color or brightness changes (it's not even - a transition as such, as all the pixels are identical in - the two layers). - -
- -
- -
- -
- Discussion - -
- Cross-fades between images of different sizes - - The code examples - (two textures, - one texture with - COGL) don't take account of the size of the images being - loaded. - - In the two texture example, this isn't so much of a problem, - as you can resize the textures individually to the images: - providing you use - clutter_texture_set_keep_aspect_ratio(), - different image sizes shouldn't be a problem. See - the slideshow - example, for a demonstration of how to cycle through - different sized images. - - In the case of the single texture approach, you will get - problems when cross-fading between two images with - different sizes. There is no easy way to maintain the aspect - ratio (as you have two layers, potentially with different sizes, - in the same texture). The last layer added to the - CoglMaterial determines the size of the texture; - so if the previous layer has different dimensions, it will - appear distorted in the UI. In the - single texture - code example, the source layer - is added first; so, if the target layer has - different dimensions, the source will - appear distorted. - - There are a couple of ways you can remedy this: - - - - - As you load each image into its own - CoglTexture, get its size with - cogl_texture_get_width() and - cogl_texture_get_height(). Then set the - ClutterTexture's size to the - size of the source layer. Next, as - you cross-fade, simultaneously animate a - size change in the ClutterTexture to - the target image's size. - This could work with non-realistic images where - some distortion of the image is acceptable (the target image - may be the wrong size to start with, but transition to the - correct size by the time it's fully faded in). But it can - look a bit odd for transitions between photos. - - - - Use GdkPixbuf (or similar) to load the images into a temporary - data structure. (GdkPixbuf works well for this as it can resize - the image while retaining its aspect ratio.) Then load the data from - the pixbuf into a region of a - CoglTexture which has the same dimensions as - the ClutterTexture. - - Here's an example of how you can rewrite the - load_cogl_texture() function of - the single - texture example to do this: - - - - - -static CoglHandle -load_cogl_texture (const char *type, - const char *file, - const guint texture_width, - const guint texture_height) -{ - GError *error = NULL; - - /* - * Load image data from a file into a GdkPixbuf, - * but constrained to the size of the target ClutterTexture; - * aspect ratio is maintained - * - * texture_width and texture_height are set elsewhere to - * the width and height of the ClutterTexture - */ - GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_size (file, - texture_width, - texture_height, - &error); - - if (error != NULL) - { - g_print ("Unable to load %s image: %s\n", type, error->message); - g_error_free (error); - exit (EXIT_FAILURE); - } - - guint rowstride = gdk_pixbuf_get_rowstride (pixbuf); - guint width = gdk_pixbuf_get_width (pixbuf); - guint height = gdk_pixbuf_get_height (pixbuf); - guchar *data = gdk_pixbuf_get_pixels (pixbuf); - - CoglPixelFormat format = COGL_PIXEL_FORMAT_RGB_888; - if (gdk_pixbuf_get_has_alpha (pixbuf) == TRUE) - format = COGL_PIXEL_FORMAT_RGBA_8888; - - /* CoglTexture with the same dimensions as the ClutterTexture */ - CoglHandle *tex = cogl_texture_new_with_size (texture_width, - texture_height, - COGL_TEXTURE_NO_SLICING, - format); - - /* - * load the texture data into a region of the full-sized texture; - * the size of the region is set from the size of the image data - * (as resized by GdkPixbuf) - */ - cogl_texture_set_region (tex, - 0, 0, /* from top-left corner of the pixbuf */ - (texture_width - width) / 2, /* center on the CoglTexture */ - (texture_height - height) / 2, /* center on the CoglTexture */ - width, height, - width, height, - format, - rowstride, - data); - - return tex; -} -]]> - - - - Because you're copying the image data from the - file into a region of the CoglTexture - that's the same size as the image data in the pixbuf, it isn't - distorted. - - - - - -
- -
- Slideshows - - The two texture solution can be easily extended - to cycle through multiple images. To begin with, the first - image is loaded into the top texture. Then, - the basic pattern for transitioning to the next image is as follows: - - - - Copy the data from the top texture - to the bottom texture. - - - Make the top texture transparent - and the bottom texture opaque (using - clutter_state_warp_to_state()). At this - point, it appears as though the textures haven't changed. - - - Load the next image into top. - - - When top has finished loading, - fade it in while simultaneously fading out - bottom (using - clutter_state_set_state()). - - - - The sample - code in the appendix implements this as part of - a simple slideshow application. - -
- -
- -
- Full examples - - - Cross-fading between two images using two - <type>ClutterTextures</type> - - - there should be a code sample here, but there isn't... - - - - - - Cross-fading between two images using one - <type>ClutterTexture</type> and the COGL API - - - there should be a code sample here, but there isn't... - - - - - - A simple slideshow application using two - <type>ClutterTextures</type> - - - there should be a code sample here, but there isn't... - - - - -
- -
- -
diff --git a/doc/cookbook/version.xml.in b/doc/cookbook/version.xml.in deleted file mode 100644 index dd16174aa..000000000 --- a/doc/cookbook/version.xml.in +++ /dev/null @@ -1 +0,0 @@ -@CLUTTER_API_VERSION@ diff --git a/doc/cookbook/videos/README b/doc/cookbook/videos/README deleted file mode 100644 index cee46c963..000000000 --- a/doc/cookbook/videos/README +++ /dev/null @@ -1 +0,0 @@ -Put videos for inclusion in cookbook (Ogg Theora, preferably) here. diff --git a/doc/cookbook/videos/animations-complex.ogv b/doc/cookbook/videos/animations-complex.ogv deleted file mode 100644 index 1effec846..000000000 Binary files a/doc/cookbook/videos/animations-complex.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-fading-in-then-out.ogv b/doc/cookbook/videos/animations-fading-in-then-out.ogv deleted file mode 100644 index e8fdc75a3..000000000 Binary files a/doc/cookbook/videos/animations-fading-in-then-out.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-fading-out.ogv b/doc/cookbook/videos/animations-fading-out.ogv deleted file mode 100644 index 93628ff9b..000000000 Binary files a/doc/cookbook/videos/animations-fading-out.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-looping.ogv b/doc/cookbook/videos/animations-looping.ogv deleted file mode 100644 index f1e23cfe0..000000000 Binary files a/doc/cookbook/videos/animations-looping.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-moving-anchors.ogv b/doc/cookbook/videos/animations-moving-anchors.ogv deleted file mode 100644 index 5fc7952d2..000000000 Binary files a/doc/cookbook/videos/animations-moving-anchors.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-moving-depth.ogv b/doc/cookbook/videos/animations-moving-depth.ogv deleted file mode 100644 index 93c75cdd6..000000000 Binary files a/doc/cookbook/videos/animations-moving-depth.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-path.ogv b/doc/cookbook/videos/animations-path.ogv deleted file mode 100644 index 13578c816..000000000 Binary files a/doc/cookbook/videos/animations-path.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-reuse.ogv b/doc/cookbook/videos/animations-reuse.ogv deleted file mode 100644 index 07b0c4e40..000000000 Binary files a/doc/cookbook/videos/animations-reuse.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-container-reverses-direction.ogv b/doc/cookbook/videos/animations-rotating-container-reverses-direction.ogv deleted file mode 100644 index 9d41bc3d3..000000000 Binary files a/doc/cookbook/videos/animations-rotating-container-reverses-direction.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-x-centered.ogv b/doc/cookbook/videos/animations-rotating-x-centered.ogv deleted file mode 100644 index dc1fa83ca..000000000 Binary files a/doc/cookbook/videos/animations-rotating-x-centered.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-x-minus-180-with-y-minus-96.ogv b/doc/cookbook/videos/animations-rotating-x-minus-180-with-y-minus-96.ogv deleted file mode 100644 index 4acaaafd3..000000000 Binary files a/doc/cookbook/videos/animations-rotating-x-minus-180-with-y-minus-96.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-x-minus-180-with-z-minus-96.ogv b/doc/cookbook/videos/animations-rotating-x-minus-180-with-z-minus-96.ogv deleted file mode 100644 index 74a4464d8..000000000 Binary files a/doc/cookbook/videos/animations-rotating-x-minus-180-with-z-minus-96.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-x-minus-45.ogv b/doc/cookbook/videos/animations-rotating-x-minus-45.ogv deleted file mode 100644 index 827f3e4df..000000000 Binary files a/doc/cookbook/videos/animations-rotating-x-minus-45.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-y-45.ogv b/doc/cookbook/videos/animations-rotating-y-45.ogv deleted file mode 100644 index 483284c1a..000000000 Binary files a/doc/cookbook/videos/animations-rotating-y-45.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-y-centered.ogv b/doc/cookbook/videos/animations-rotating-y-centered.ogv deleted file mode 100644 index 1e37b8fb4..000000000 Binary files a/doc/cookbook/videos/animations-rotating-y-centered.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-z-90.ogv b/doc/cookbook/videos/animations-rotating-z-90.ogv deleted file mode 100644 index 24192eac3..000000000 Binary files a/doc/cookbook/videos/animations-rotating-z-90.ogv and /dev/null differ diff --git a/doc/cookbook/videos/animations-rotating-z-centered.ogv b/doc/cookbook/videos/animations-rotating-z-centered.ogv deleted file mode 100644 index 0ead686ff..000000000 Binary files a/doc/cookbook/videos/animations-rotating-z-centered.ogv and /dev/null differ diff --git a/doc/cookbook/videos/effects-custom-deform.ogv b/doc/cookbook/videos/effects-custom-deform.ogv deleted file mode 100644 index bf7f95978..000000000 Binary files a/doc/cookbook/videos/effects-custom-deform.ogv and /dev/null differ diff --git a/doc/cookbook/videos/events-mouse-scroll.ogv b/doc/cookbook/videos/events-mouse-scroll.ogv deleted file mode 100644 index 42f42d2ae..000000000 Binary files a/doc/cookbook/videos/events-mouse-scroll.ogv and /dev/null differ diff --git a/doc/cookbook/videos/textures-crossfade-two-textures.ogv b/doc/cookbook/videos/textures-crossfade-two-textures.ogv deleted file mode 100644 index b9c3c1b84..000000000 Binary files a/doc/cookbook/videos/textures-crossfade-two-textures.ogv and /dev/null differ diff --git a/doc/cookbook/videos/textures-split-go.ogv b/doc/cookbook/videos/textures-split-go.ogv deleted file mode 100644 index b9e9e8da7..000000000 Binary files a/doc/cookbook/videos/textures-split-go.ogv and /dev/null differ diff --git a/doc/reference/ChangeLog b/doc/reference/ChangeLog deleted file mode 100644 index bd0702b6e..000000000 --- a/doc/reference/ChangeLog +++ /dev/null @@ -1,1076 +0,0 @@ -2008-12-08 Emmanuele Bassi - - * clutter/clutter-docs.xml: - * clutter/clutter-sections.txt: Add ClutterBindingPool - section and link. - -2008-11-12 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add new symbols. - -2008-10-17 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add the new ClutterColor - symbols. - -2008-09-25 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add - clutter_get_option_group_without_init() - -2008-08-27 Emmanuele Bassi - - * doc/reference/clutter/clutter-sections.txt: Add - clutter_script_list_objects(). - -2008-07-30 Ross Burton - - * clutter/version.xml.in: - * cogl/version.xml.in: - Remove trailing newline as it upsets Devhelp - -2008-07-17 Emmanuele Bassi - - * clutter/subclassing-ClutterActor.xml: Update the ClutterActor - subclassing section by removing the cogl_push/pop_matrix() calls - where not needed. - -2008-07-10 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add the missing X11 backend - API. - -2008-07-01 Emmanuele Bassi - - * cogl/cogl-docs.sgml: Add an index to the COGL API reference - and the licensing information. - -2008-06-26 Emmanuele Bassi - - * clutter/clutter-overview.xml: Split the overview into its own - file, so we gtk-doc can linkify all class names. - - * clutter/building-clutter.xml: Split the building instructions - into its own file, for better maintainability. - - * clutter/clutter-animation.xml: - * clutter/creating-behaviours.xml: - * clutter/subclassing-ClutterActor.xml: Rename from SGML to XML; - these were not SGML files anyway, but templates. - - * clutter/clutter-docs.sgml: Use XInclude instead of the ugly - entities hack. - - * clutter/Makefile.am: Update the build. - -2008-06-25 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add missing symbols. - -2008-06-25 Emmanuele Bassi - - * clutter/clutter-sections.txt: Add - clutter_backend_get_display_size() to the documented symbols. - -2008-06-24 Matthew Allum - - * cogl/Makefile.am: - * cogl/cogl-docs.sgml: - * cogl/version.xml.in: - * clutter/version.xml.in: - Add full version (including minor) to docs. - Add version to COGL docs - -2008-06-23 Emmanuele Bassi - - * clutter/clutter-sections.txt: Remove clutter_actor_get_paint_area() - and add clutter_actor_allocate_preferred_size(). - -2008-06-23 Emmanuele Bassi - - * clutter/subclassing-ClutterActor.sgml: Remove mention of the - get_paint_area() function and virtual function. - -2008-06-23 Øyvind Kolås - - * clutter/subclassing-ClutterActor.sgml: added missing call to - cogl_push_matrix () - -2008-06-16 Matthew Allum - - * cogl/cogl-docs.sgml: - Add an intro. - -2008-06-13 Øyvind Kolås - - * clutter/event-flow.png: fixed typo. - * clutter/event-flow.dia: added source for event-flow.png, this file - is not referred to in Makefile.am and thus not distributed in - tarballs. - -2008-06-12 Emmanuele Bassi - - * clutter/clutter-docs.sgml: Clean up. - - * clutter/clutter-sections.txt: Add missing new symbols. - - * clutter/clutter.types: Add ClutterChildMeta type. - -2008-06-11 Emmanuele Bassi - - * clutter/subclassing-ClutterActor.sgml: Add more notes and - remind to relayout when adding children to an actor. - -2008-06-10 Emmanuele Bassi - - * clutter/clutter-sections.txt: Update with the new API. - - * clutter/subclassing-ClutterActor.sgml: Update with the new - size negotiation API. - -2008-06-09 Chris Lord - - * cogl/cogl-sections.txt: - Add missing cogl_path_arc - -2008-06-06 Emmanuele Bassi - - Bug #927 - Created ports for clutter, clutter-cairo in macports - - * clutter/clutter-docs.sgml: Update the OSX build instructions - and mention that the preferred way to build Clutter for developing - applications is via MacPorts. (#927, Idan Gazit) - -2008-05-15 Emmanuele Bassi - - * clutter/clutter-sections.txt: Update with new symbols. - -2008-05-09 Neil Roberts - - * clutter/clutter-sections.txt: Added - clutter_threads_add_frame_source, - clutter_threads_add_frame_source_full, clutter_frame_source_add - and clutter_frame_source_add_full. - -2008-04-29 Neil Roberts - - * cogl/cogl-sections.txt: Added cogl_shader_ref, - cogl_shader_unref, cogl_is_shader, cogl_program_ref, - cogl_program_unref, cogl_is_program and cogl_is_offscreen. - -2008-04-29 Øyvind Kolås - - * cogl/cogl-sections.txt: updated after cogl primitives api rename - session. - -2008-04-28 Emmanuele Bassi - - * clutter/clutter-docs.sgml: Add index for the 0.8 symbols. - - * clutter/Makefile.am: - * cogl/Makefile.am: Revert back, as EXTRA_DIST has been defined - by gtk-doc.make and automake-1.9 complains loudly about a - redefinition of EXTRA_DIST. - -2008-04-22 Øyvind Kolås - - * clutter/Makefile.am: - * cogl/Makefile.am: s/EXTRA_DIST +=/EXTRA_DIST =/ since newer automake - is more stringent and EXTRA_DIST has not been defined earlier. - -2008-04-21 Neil Roberts - - * cogl/cogl-sections.txt: Added CoglTextureVertex, - cogl_texture_can_polygon and cogl_texture_polygon. - -2008-04-18 Emmanuele Bassi - - * cogl/cogl-docs.sgml: Fill out and add an "about" section. - - * cogl/cogl-sections.txt: Remove unused/redundant stuff, - divide into logical subsections and in general make the - documentation more structured. - - * cogl/Makefile.am: Ignore some private header files. - -2008-04-18 Emmanuele Bassi - - * cogl/: Add COGL documentation. - - * Makefile.am: Add cogl/ to the list of SUBDIRS. - -2008-04-18 Emmanuele Bassi - - * clutter/: - * *: Moved everything into the clutter/ subdirectory, to make - room for the COGL API reference. - -2008-04-07 Neil Roberts - - * clutter-sections.txt: Removed clutter_texture_new_from_pixbuf - and clutter_texture_{get,set}_pixbuf. Added - clutter_texture_{set,new}_from_file. - -2008-04-03 Neil Roberts - - * clutter-sections.txt: Removed ClutterTexture functions that are - no longer neccessary to implement ClutterCloneTexture because of - the new COGL texture API. Added - clutter_texture_{get,set}_filter_quality and - clutter_texture_get_cogl_texture. - -2008-03-30 Neil Roberts - - * clutter-sections.txt: Added clutter_win32_get_stage_from_window - -2008-03-26 Neil Roberts - - * clutter-sections.txt: Added a section for the Win32 specific - API. - - * clutter-docs.sgml: Added comments about the Win32 backend. - - * Makefile.am: Added bits to ignore the headers for the Win32 - backend. - -2008-03-18 Emmanuele Bassi - - * clutter-section.txt: Update after API change in ClutterScore. - -2008-03-18 Emmanuele Bassi - - * clutter-section.txt: Add new score API. - -2008-03-18 Emmanuele Bassi - - * clutter-section.txt: Add timeline-marker API. - -2008-03-07 Øyvind Kolås - - * Makefile.am: Ignore clutter-id-pool.h to avoid picking up - private symbols. - -2008-02-18 Emmanuele Bassi - - * clutter-docs.sgml: Add building instructions for OSX - -2008-02-18 Emmanuele Bassi - - * clutter-animation.sgml: Fix warning - - * creating-your-own-behaviours.sgml: Add a paragraph about - setting an initial state on the actors. - -2008-02-15 Matthew Allum - - * clutter-docs.sgml: - Minor tweakery. - -2008-02-15 Emmanuele Bassi - - * clutter-sections.txt: Fix ClutterMedia section. - -2008-02-15 Emmanuele Bassi - - * clutter-docs.sgml: Move ClutterStage from the base actors - to the container actors section. - -2008-02-15 Tomas Frydrych - - * clutter-docs.sgml: - Build instructions for Linux and Windows. - -2008-02-15 Emmanuele Bassi - - * clutter-animation.sgml: Fix the animations documentation. - -2008-02-15 Chris Lord - - * clutter-docs.sgml: Fix documentation. - -2008-02-15 Matthew Allum - - * clutter-docs.sgml: - Overhaul the overview. - -2008-02-15 Emmanuele Bassi - - * clutter-animation.sgml: Fix some of the grammar; add a timeout-based - animation example. - - * creating-your-own-behaviours.sgml: Fix some of the linking. - - * subclassing-ClutterActor.sgml: Remove the FIXMEs; add the initial - structure of a section about containers. - -2008-02-15 Emmanuele Bassi - - * clutter-docs.sgml: Fix varlistentry usage. - -2008-02-15 Emmanuele Bassi - - * clutter-sections.txt: Add last-minute API additions. - - * subclassing-ClutterActor.sgml: Fix some of the notes; the - Container implementation will need its own section. - -2008-02-14 Matthew Allum - - * clutter-animation.sgml: - Add new animation docs. Needs work. - -2008-02-13 Matthew Allum - - * Makefile.am: - * clutter-docs.sgml: - Add new appendix + FIXME for building - * creating-your-own-behaviours.sgml: - Add new initial doc on custom behaviour creation. - * subclassing-ClutterActor.sgml: - Add FIXME notes. - -2008-02-08 Emmanuele Bassi - - * actor-box.png: - * Makefile.am: Add actor-box.png. - -2008-02-08 Emmanuele Bassi - - * clutter-docs.sgml: Add dependencies inside the overview. - -2008-02-08 Emmanuele Bassi - - * Makefile.am: - * alpha-func.png: - * event-flow.png: More figures. alpha-func.png is a graph - showing the flow of some alpha functions; event-flow.png maps - the path of an event coming from the underlying windowing - system into Clutter and through the entire library. - -2008-02-08 Emmanuele Bassi - - * path-alpha-func.png: Image showing the effects of different - alpha functions on the same path behaviour. - - * Makefile.am: Add fixxref options. - -2008-02-04 Emmanuele Bassi - - * clutter-sections.txt: Add: - - clutter_actor_move_anchor_point - clutter_actor_move_anchor_point_from_gravity - clutter_actor_set_shader - clutter_actor_get_shader - clutter_actor_move_anchor_pointu - clutter_texture_new_from_actor - clutter_entry_set_cursor_position - clutter_entry_get_cursor_position - - Remove: - - clutter_actor_apply_shader - clutter_behaviour_scale_set_gravity - clutter_behaviour_scale_get_gravity - clutter_entry_set_position - clutter_entry_get_position - -2008-01-21 Emmanuele Bassi - - * clutter-sections.txt: Add ClutterBehaviourDepth properties - accessors. - -2008-01-18 Emmanuele Bassi - - * subclassing-ClutterActor.sgml: Fix up the wording and the - examples a bit; add a paragraph about the ClutterActor::pick() - virtual method. - -2008-01-18 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterBehaviourOpacity - accessors. - -2008-01-17 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterBehaviourScale setters. - -2008-01-14 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_model_insertv() - -2008-01-09 Emmanuele Bassi - - * Makefile.am: Add clutter-model-private.h - - * clutter-docs.sgml: - * clutter-sections.txt: - * clutter.types: Rename ClutterModelDefault into ClutterListModel - -2008-01-07 Emmanuele Bassi - - * clutter-sections.txt: Remove symbols of the ClutterModelDefault - iterator class. - -2008-01-07 Emmanuele Bassi - - * clutter-sections.txt: Remove clutter_model_append_value() - and clutter_model_prepend_value(), and add clutter_model_appendv() - and clutter_model_prependv(). - -2008-01-04 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_actor_move_byu() - -2007-12-24 Emmanuele Bassi - - * clutter-sections.txt: Add the units-based clip accessors - -2007-12-21 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_group_add() and - clutter_stage_add() convenience macros. - -2007-12-21 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_texture_set_area_from_rgb_data() - -2007-12-15 Emmanuele Bassi - - * clutter-sections.txt: Move the shorthand fixed point macros - in the private section - -2007-12-15 Emmanuele Bassi - - * clutter-sections.txt: Added all the unused symbols. - -2007-12-14 Emmanuele Bassi - - * Makefile.am: - * clutter-docs.sgml: - * clutter-sections.txt: - * clutter.types: Update for ClutterModel changes. - -2007-12-10 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterModel API. - -2007-12-10 Emmanuele Bassi - - * clutter-docs.sgml: Add ClutterShader... - - * clutter.types: ... and its type function. - -2007-12-04 Emmanuele Bassi - - * clutter.types: - * clutter-docs.sgml: - * clutter-sections.txt: Fix ClutterScore symbols. - -2007-11-30 Emmanuele Bassi - - * clutter-sections.txt: Update with the newly added API. - -2007-11-28 Tomas Frydrych - - * clutter-sections.txt: added new CLUTTER_UNITS_FROM_* macros. - -2007-11-28 Emmanuele Bassi - - * clutter-sections.txt: Documentation fixes. - - * clutter.types: Remove layout and boxes types. - -2007-11-28 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterEffectTemplate::construct - method. - -2007-11-23 Emmanuele Bassi - - * clutter-docs.sgml: Shuffle around non-actor classes. - -2007-11-23 Emmanuele Bassi - - * subclassing-ClutterActor.sgml: Mention the chain-up needed when - overriding the request_coords() vfunc of ClutterActor. - -2007-11-23 Emmanuele Bassi - - * clutter-sections.txt: Add unused API. - -2007-11-21 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterStage fog API. - -2007-11-19 Emmanuele Bassi - - * clutter-sections.txt: Add ClutterScore symbols and - ClutterLabel:justify accessors. - -2007-11-19 Emmanuele Bassi - - * clutter-sections.txt: Remove clutter_behaviour_bspline_append() and - add the new motion events settings API. - -2007-11-18 Emmanuele Bassi - - * Makefile.am: Add clutter-x11.h to the headers scanned. - - * clutter-sections.txt: Update with the newly added and removed - symbols. - -2007-11-15 Emmanuele Bassi - - * Makefile.am: Ignore the OSX backend subdirectory and - scan the clutter-x11.h header - - * clutter-docs.sgml: - * clutter-sections.txt: Update. - -2007-11-15 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterTimeline API - -2007-11-15 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterEffectTemplate constructor. - -2007-11-15 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterScript signal connection - functions. - -2007-11-15 Neil J. Patel - - * clutter-sections.txt: - Fix typo. - -2007-11-15 Neil J. Patel - - * clutter-docs.sgml: - * clutter-sections.txt: - * clutter.types: - Added support for ClutterModel. - -2007-11-14 Emmanuele Bassi - - * clutter-sections.txt: Update with the ClutterScriptable changes - and add clutter_get_script_id(). - -2007-10-28 Matthew Allum - - * clutter-animation.sgml: - Fix missing func param (#583) - -2007-10-25 Emmanuele Bassi - - * Makefile.am: Ignore clutter-json.h header. - -2007-10-25 Emmanuele Bassi - - * clutter.types: - * clutter-sections.txt: - * clutter-docs.sgml: Add new ClutterScriptable API. - -2007-10-18 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterScript API. - -2007-10-10 Emmanuele Bassi - - * clutter-sections.txt: Add new API and rearrange the subsections. - -2007-10-10 Emmanuele Bassi - - * clutter.types: - * Makefile.am: Add ClutterScript and ignore clutter-script-private.h - to avoid picking up private symbols. - -2007-08-21 Emmanuele Bassi - - * clutter-sections.txt: Move ClutterStage and ClutterStageClass - symbols in the right section. - -2007-08-20 Emmanuele Bassi - - * clutter-sections.txt: Move ClutterTimeline and ClutterTimelineClass - symbols in the right section. - -2007-08-15 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_effect_depth(). - -2007-08-14 Emmanuele Bassi - - * clutter-sections.txt: Rename raise() and lower() methods of - ClutterContainer. - -2007-08-13 Emmanuele Bassi - - * clutter-sections.txt: Add the new ClutterContainer methods. - - * clutter-docs.sgml: Generate the index for the symbols added - in the 0.5/0.6 cycle. - -2007-08-08 Emmanuele Bassi - - * clutter-sections.txt: Add the new clutter_threads_* API. - -2007-08-07 Emmanuele Bassi - - * clutter-sections.txt: Shuffle around a bit the symbols. - -2007-08-06 Emmanuele Bassi - - * clutter-sections.txt: Update with the new ClutterBox API. - -2007-08-04 Emmanuele Bassi - - * clutter-docs.sgml: Add autogeneration of the per-version - indexes of symbols, plus the index of deprecated symbols. - -2007-08-01 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_actot_get_r[xyz]ang() - functions. - -2007-07-31 Emmanuele Bassi - - * clutter-sections.txt: Update ClutterBackend API. - -2007-07-30 Matthew Allum - - * clutter-animation.sgml: - Note on ClutterEffects - -2007-07-28 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterBehaviourEllipse - and ClutterStage API. - -2007-07-26 Emmanuele Bassi - - * clutter-sections.txt: Add new symbols. - -2007-07-26 Matthew Allum - - * Makefile.am: - * clutter-animation.sgml: - * clutter-docs.sgml: - An initial shot at some general animation documentation. - Needs some love. - -2007-07-25 Emmanuele Bassi - - * clutter-sections.txt: Rename clutter_behaviour_clear() to - clutter_behaviour_remove_all(). - -2007-07-24 Emmanuele Bassi - - * clutter-sections.txt: Add new rotate behaviour methods. - -2007-07-24 Emmanuele Bassi - - * clutter-sections.txt: Add undocumented symbols - -2007-07-09 Emmanuele Bassi - - * clutter.types: - * clutter-docs.sgml: - * clutter-sections.txt: Add ClutterBehaviourDepth. - -2007-07-04 Emmanuele Bassi - - * clutter-docs.sgml: Remove partintro, as it messes up with - devhelp books. - - * clutter-sections.txt: Update functions. - -2007-07-04 Emmanuele Bassi - - * clutter-docs.sgml: Use the right include file for the - effects section. - -2007-06-16 Emmanuele Bassi - - * subclassing-ClutterActor.sgml: Add a chapter about how to - correctly subclass the actor base class. - - * clutter-docs.sgml: Include the new chapter about subclassing - ClutterActor; add a description for some of the API reference - parts. - -2007-06-14 Emmanuele Bassi - - * clutter-sections.txt: - * clutter.types: - * clutter-docs.sgml: Add ClutterBox and subclasses. Rework - the layout of the API reference, now that we have fairly more - classes. - -2007-06-09 Emmanuele Bassi - - * clutter-sections.txt: Add ClutterTimeoutPool API. - -2007-06-07 Emmanuele Bassi - - * tmpl/*.sgml: Remove from revision control the templates: - everything is now documented from within the source code. - - * clutter-sections.txt: Add missing titles. - -2007-06-07 Emmanuele Bassi - - * clutter.types: - * clutter-sections.txt: - * clutter-docs.sgml: Add ClutterLayout API. - -2007-06-07 Emmanuele Bassi - - * clutter-sections.txt: Add new ClutterTimeline API. - -2007-06-01 Neil J. Patel - - * clutter-sections.txt: - * tmpl/clutter-entry.sgml: - updated for new functions. - -2007-06-01 Neil J. Patel - - * clutter-sections.txt: - * tmpl/clutter-entry.sgml: - Added new functions. - -2007-06-01 Neil J. Patel - * clutter.types: - * tmpl/clutter-entry.sgml: - Updated for new signals/properties. - -2007-06-01 Neil J. Patel - - * clutter-sections.txt: - * tmpl/clutter-entry.sgml: - Updated for new functions. - -2007-06-01 Tomas Frydrych - - * tmpl/clutter-alpha.sgml: - * tmpl/clutter-fixed.sgml: - * tmpl/clutter-units.sgml: - * tmpl/clutter-behaviour-rotate.sgml: - * tmpl/clutter-behaviour-bspline.sgml: - * tmpl/clutter-behaviour-ellipse.sgml: - Updated templates. - -2007-05-31 Neil J Patel - - * clutter-docs.sgml: - * clutter-sections.txt: - * tmpl/clutter-entry.sgml: - Added ClutterEntry - -2007-05-31 Tomas Frydrych - - * tmpl/clutter-behaviour-ellipse.sgml: - Updated template. - -2007-05-31 Tomas Frydrych - - * clutter.types: - Added clutter_vertices_get_type. - -2007-05-30 Tomas Frydrych - - * clutter.types: - removed clutter_smoothstep_get_type. - - * tmpl/clutter-alpha.sgml: - * tmpl/clutter-actor.sgml: - * tmpl/clutter-media.sgml: - Updated templates. - -2007-05-22 Tomas Frydrych - - * clutter-sections.txt: - * clutter-docs.sgml: - * tmpl/clutter-units.sgml: - Added clutter-units. - - * tmpl/clutter-alpha.sgml: - * tmpl/clutter-actor.sgml: - * tmpl/clutter-media.sgml: - * tmpl/clutter-behaviour-ellipse.sgml: - Updated templates. - -2007-05-17 Emmanuele Bassi - - * Makefile.am: Ignore the sdl backend. - - * clutter-sections.txt: Add undocumented symbols. - -2007-05-16 Emmanuele Bassi - - * Makefile.am: Use the newly added clutter_base_init() function - when scanning the library for documentation. - -2007-04-16 Emmanuele Bassi - - * clutter-docs.sgml: - * clutter-sections.txt: - * clutter.types: Add new b-spline and rotate behaviours - to the API documentation. - -2007-03-27 Emmanuele Bassi - - * Makefile.am: Ignore clutter/cogl: it's private API. - - * clutter-sections.txt: Remove the now private ClutterBackend - API; add the ClutterPerspective API. - -2007-03-25 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_get_default_backend(). - -2007-03-23 Emmanuele Bassi - - * clutter-sections.txt: Remove duplicae symbol. - -2007-03-22 Emmanuele Bassi - - * Makefile.am: Include the clutter-glx backend API. - -2007-03-22 Emmanuele Bassi - - * clutter-sections.txt: Update with the backend and API - changes - - * Makefile.am: Don't check into the backend subdirs. - -2007-01-18 Emmanuele Bassi - - * clutter-sections.txt: Add forgotten ClutterGroup API. - -2007-01-18 Matthew Allum - - * clutter-docs.sgml: - Update overview. - -2007-01-18 Tomas Frydrych - - * clutter-docs.sgml: added clutter-fixed - * tmpl/clutter-fixed.sgml: added intro to fixed point math - -2007-01-18 Emmanuele Bassi - - * clutter-sections.txt: Remove old cruft. - - * clutter-docs.sgml: Add index of symbols. - - * tmpl/clutter-fixed.sgml: Fix doc template. - -2007-01-16 Emmanuele Bassi - - * clutter-sections.txt: Remove clutter_vblank_method(): it's - private. - -2007-01-16 Emmanuele Bassi - - * clutter-sections.txt: Update. - - * tmpl/*.sgml: Update templates. - -2006-12-13 Emmanuele Bassi - - * clutter-sections.txt: Update; add clutter_color_equal(). - - * tmpl/clutter-color.sgml: Update template. - -2006-12-13 Emmanuele Bassi - - * clutter-sections.txt: Update. - - * tmpl/*.sgml: Update the templates. - -2006-12-04 Emmanuele Bassi - - * clutter-sections.txt: Update with the newly added API. - - * tmpl/clutter-event.sgml: - * tmpl/clutter-fixed.sgml: Provide short and long descriptions. - - * tmpl/clutter-actor.sgml: - * tmpl/clutter-alpha.sgml: - * tmpl/clutter-behaviour-path.sgml: - * tmpl/clutter-behaviour-scale.sgml: - * tmpl/clutter-color.sgml: - * tmpl/clutter-feature.sgml: - * tmpl/clutter-main.sgml: Update templates. - -2006-11-20 Emmanuele Bassi - - * clutter-sections.txt: Remove debug macros; add clutter-version - section. - - * Makefile.am: Ignore the stamp files. - - * clutter-docs.sgml: Add a link to the version utils. - - * tmpl/clutter-actor.sgml: - * tmpl/clutter-main.sgml: - * tmpl/clutter-version.sgml: Update templates. - -2006-11-17 Emmanuele Bassi - - * clutter-sections.txt: Move stuff around: get_type and Private - stuff go in the Private subsection; remove private symbols like - pango stuff and the enum gtype signatures; remove cruft. - - * Makefile.am: Add more private files. - - * tmpl/clutter-fixed.sgml: - * tmpl/clutter-feature.sgml: - * tmpl/clutter-actor.sgml: - * tmpl/clutter-media.sgml: - * tmpl/clutter-behaviour-opacity.sgml: - * tmpl/clutter-behaviour-path.sgml: - * tmpl/clutter-behaviour-scale.sgml: - * tmpl/clutter-behaviour.sgml: - * tmpl/clutter-alpha.sgml: Add templates. - - * tmpl/clutter-0.0-unused.sgml: - * tmpl/clutter.sgml: - * tmpl/clutter-enum-types.sgml: - * tmpl/clutter-element.sgml: Remove old templates. - -2006-11-15 Emmanuele Bassi - - * clutter-sections.txt: - * tmpl/*.sgml: Update with the latest API changes. - -2006-09-14 Emmanuele Bassi - - D tmpl/clutter-video-texture.sgml - - * clutter-sections.txt: - * clutter.types: Remove ClutterVideoTexture. - -2006-08-30 Jorn Baayen - - * Makefile.am: - -2006-07-06 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_actor_has_clip() and - clutter_actor_unparent(). - -2006-06-22 Matthew Allum - - reviewed by: - - * tmpl/clutter-main.sgml: - -2006-06-22 Iain Holmes - - * clutter-sections.txt: Remove clutter_util_can_create_texture - -2006-06-22 Ross Burton - - * tmp/*.sgml: - Add lots of "no public members" and document some signals. - -2006-06-22 Iain Holmes - - * clutter-sections.txt: Move _get_type to private sections - -2006-06-22 Emmanuele Bassi - - * clutter-sections.txt: Add clutter_timeline_get_loop(). - - * Makefile.am: Add clutter-marshal.h to the ignored header - files. - -2006-06-22 Emmanuele Bassi - - * clutter-docs.sgml: Fix typos. - -2006-06-22 Ross Burton - - * tmpl/clutter-group.sgml: - Fix braindead source parser. - -2006-06-22 Ross Burton - - * clutter.sections.txt: - * clutter-sections.txt: - Rename . to -, and add missing class members. - - * tmpl/*: - Resync - -2006-06-22 Matthew Allum - - * clutter-docs.sgml: - Add copyright info. - -2006-06-22 Matthew Allum - - * clutter-docs.sgml: - Add overview text. - -2006-06-22 Matthew Allum - - * Makefile.am: - * clutter-0.0-sections.txt: - * clutter-docs.sgml: - * clutter.sections.txt: - * clutter.types: - * tmpl/clutter-0.0-unused.sgml: - * tmpl/clutter-clone-texture.sgml: - * tmpl/clutter-color.sgml: - * tmpl/clutter-event.sgml: - * tmpl/clutter-group.sgml: - * tmpl/clutter-keysyms.sgml: - * tmpl/clutter-label.sgml: - * tmpl/clutter-main.sgml: - * tmpl/clutter-marshal.sgml: - * tmpl/clutter-rectangle.sgml: - * tmpl/clutter-stage.sgml: - * tmpl/clutter-texture.sgml: - * tmpl/clutter-timeline.sgml: - * tmpl/clutter-util.sgml: - * tmpl/clutter-video-texture.sgml: - Rejig a little and sync up with latest source. - -2006-06-13 Matthew Allum - - * ChangeLog: - * clutter-0.0-sections.txt: - * clutter.types: - * tmpl/clutter-0.0-unused.sgml: - * tmpl/clutter-enum-types.sgml: - * tmpl/clutter-group.sgml: - * tmpl/clutter-main.sgml: - * tmpl/clutter-stage.sgml: - * tmpl/clutter-video-texture.sgml: - rename element -> actor - -2006-05-26 Emmanuele Bassi - - A clutter-0.0-sections.txt - - * clutter-0.0-sections.txt: Add the -section file: every method - signature should go in this file in order to let gtk-doc pick - it up when building the template for it. - -2006-05-26 Emmanuele Bassi - - A tmpl - A tmpl/*.sgml - - * tmpl/*.sgml: Add gtk-doc templates. - -2006-05-26 Emmanuele Bassi - - * *: Initial entry. - diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am deleted file mode 100644 index df25a598f..000000000 --- a/doc/reference/Makefile.am +++ /dev/null @@ -1,169 +0,0 @@ -DOC_MODULE = clutter -DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml -DOC_SOURCE_DIR = $(top_srcdir)/clutter $(top_builddir)/clutter - -SCANGOBJ_OPTIONS = -SCAN_OPTIONS = -MKDB_OPTIONS = --xml-mode --output-format=xml --name-space=clutter -MKTMPL_OPTIONS = -FIXXREF_OPTIONS = \ - --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \ - --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject \ - --extra-dir=$(CAIRO_PREFIX)/share/gtk-doc/html/cairo \ - --extra-dir=$(PANGO_PREFIX)/share/gtk-doc/html/pango \ - --extra-dir=$(COGL_PREFIX)/share/gtk-doc/html/cogl \ - --extra-dir=$(GDK_PREFIX)/share/gtk-doc/html/gdk \ - --extra-dir=$(ATK_PREFIX)/share/gtk-doc/html/atk - -BUILT_HFILES = \ - clutter-enum-types.h \ - clutter-version.h \ - clutter-marshal.h - -HFILE_GLOB = \ - $(top_srcdir)/clutter/*.h \ - $(top_builddir)/clutter/*.h \ - $(top_srcdir)/clutter/deprecated/*.h \ - $(top_srcdir)/clutter/x11/clutter-x11.h \ - $(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \ - $(top_srcdir)/clutter/x11/clutter-glx-texture-pixmap.h \ - $(top_srcdir)/clutter/egl/clutter-egl.h \ - $(top_builddir)/clutter/cex100/clutter-cex100.h \ - $(top_srcdir)/clutter/win32/clutter-win32.h \ - $(top_srcdir)/clutter/gdk/clutter-gdk.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland-compositor.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland-surface.h \ - $(top_srcdir)/clutter/mir/clutter-mir.h \ - $(top_srcdir)/clutter/cally/*.h - -CFILE_GLOB = \ - $(top_srcdir)/clutter/*.c \ - $(top_srcdir)/clutter/cally/*.c \ - $(top_srcdir)/clutter/cogl/*.c \ - $(top_srcdir)/clutter/x11/*.c \ - $(top_srcdir)/clutter/win32/*.c \ - $(top_srcdir)/clutter/gdk/*.c \ - $(top_srcdir)/clutter/cex100/*.c \ - $(top_srcdir)/clutter/egl/*.c \ - $(top_srcdir)/clutter/wayland/*.c \ - $(top_srcdir)/clutter/mir/*.c \ - $(top_srcdir)/clutter/deprecated/*.c - -IGNORE_HFILES = \ - config.h \ - clutter.h \ - clutter-actor-meta-private.h \ - clutter-actor-private.h \ - clutter-backend-private.h \ - clutter-bezier.h \ - clutter-cogl-compat.h \ - clutter-color-static.h \ - clutter-config.h \ - clutter-constraint-private.h \ - clutter-debug.h \ - clutter-deprecated.h \ - clutter-device-manager-private.h \ - clutter-easing.h \ - clutter-enum-types.h \ - clutter-event-translator.h \ - clutter-flatten-effect.h \ - clutter-gesture-action-private.h \ - clutter-id-pool.h \ - clutter-keysyms.h \ - clutter-keysyms-compat.h \ - clutter-keysyms-table.h \ - clutter-marshal.h \ - clutter-master-clock-default.h \ - clutter-master-clock.h \ - clutter-model-private.h \ - clutter-paint-node-private.h \ - clutter-paint-volume-private.h \ - clutter-private.h \ - clutter-script-private.h \ - clutter-settings-private.h \ - clutter-stage-manager-private.h \ - clutter-stage-private.h \ - clutter-stage-window.h \ - clutter-timeout-interval.h \ - cally-actor-private.h \ - cex100 \ - cogl \ - egl \ - evdev \ - gdk \ - mir \ - osx \ - tslib \ - x11 \ - wayland \ - win32 - -EXTRA_HFILES = \ - $(top_srcdir)/clutter/x11/clutter-x11.h \ - $(top_srcdir)/clutter/x11/clutter-x11-texture-pixmap.h \ - $(top_srcdir)/clutter/x11/clutter-glx-texture-pixmap.h \ - $(top_srcdir)/clutter/egl/clutter-egl.h \ - $(top_srcdir)/clutter/cex100/clutter-cex100.h \ - $(top_srcdir)/clutter/win32/clutter-win32.h \ - $(top_srcdir)/clutter/gdk/clutter-gdk.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland-compositor.h \ - $(top_srcdir)/clutter/wayland/clutter-wayland-surface.h \ - $(top_srcdir)/clutter/mir/clutter-mir.h - -HTML_IMAGES = \ - actor-box.png \ - actor-example.png \ - animator-key-frames.png \ - bin-layout.png \ - box-layout.png \ - constraints-example.png \ - easing-modes.png \ - event-flow.png \ - flow-layout.png \ - path-alpha-func.png \ - offscreen-redirect.png \ - table-layout.png - -SVG_IMAGES = \ - animator-key-frames.svg \ - easing-modes.svg - -content_files = \ - glossary.xml \ - clutter-overview.xml \ - building-clutter.xml \ - running-clutter.xml \ - migrating-ClutterAnimation.xml \ - migrating-ClutterBehaviour.xml \ - migrating-ClutterEffect.xml \ - migrating-ClutterPath.xml - -expand_content_files = \ - glossary.xml \ - clutter-overview.xml \ - building-clutter.xml \ - running-clutter.xml \ - migrating-ClutterAnimation.xml \ - migrating-ClutterBehaviour.xml \ - migrating-ClutterEffect.xml \ - migrating-ClutterPath.xml - -GTKDOC_CFLAGS = -I$(top_srcdir) -I$(top_builddir) -DCLUTTER_DISABLE_DEPRECATION_WARNINGS $(CLUTTER_CFLAGS) -GTKDOC_LIBS = $(top_builddir)/clutter/libclutter-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) - -include $(top_srcdir)/gtk-doc.make - -EXTRA_DIST += clutter.types -EXTRA_DIST += $(HTML_IMAGES) $(SVG_IMAGES) - -if ENABLE_GTK_DOC -TESTS_ENVIRONMENT = \ - DOC_MODULE=$(DOC_MODULE) \ - DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ - SRCDIR=$(abs_srcdir) \ - BUILDDIR=$(abs_builddir) - -TESTS = $(GTKDOC_CHECK) -endif diff --git a/doc/reference/actor-box.png b/doc/reference/actor-box.png deleted file mode 100644 index eb957b6eb..000000000 Binary files a/doc/reference/actor-box.png and /dev/null differ diff --git a/doc/reference/actor-example.png b/doc/reference/actor-example.png deleted file mode 100644 index fa42044a9..000000000 Binary files a/doc/reference/actor-example.png and /dev/null differ diff --git a/doc/reference/animator-key-frames.png b/doc/reference/animator-key-frames.png deleted file mode 100644 index c646dd3a0..000000000 Binary files a/doc/reference/animator-key-frames.png and /dev/null differ diff --git a/doc/reference/animator-key-frames.svg b/doc/reference/animator-key-frames.svg deleted file mode 100644 index 613ecec64..000000000 --- a/doc/reference/animator-key-frames.svg +++ /dev/null @@ -1,271 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - 0.20. - - - - - - - - - - - 0.2 0.5 0.8 - - diff --git a/doc/reference/bin-layout.png b/doc/reference/bin-layout.png deleted file mode 100644 index aeed4d6a0..000000000 Binary files a/doc/reference/bin-layout.png and /dev/null differ diff --git a/doc/reference/box-layout.png b/doc/reference/box-layout.png deleted file mode 100644 index 6e50ef19b..000000000 Binary files a/doc/reference/box-layout.png and /dev/null differ diff --git a/doc/reference/building-clutter.xml b/doc/reference/building-clutter.xml deleted file mode 100644 index c922a1297..000000000 --- a/doc/reference/building-clutter.xml +++ /dev/null @@ -1,284 +0,0 @@ - - - - Emmanuele - Bassi - -
- ebassi@openedhand.com -
-
-
-
- - Building Clutter - - - -
- Clutter Dependencies - - - - GLib - - A general-purpose utility library, not specific to - graphical user interfaces. GLib provides many useful data - types, macros, type conversions, string utilities, file - utilities, a main loop abstraction, and so on. - - - - GObject - - The GLib Object System provides the required - implementations of a flexible, extensible and intentionally - easy to map (into other languages) object-oriented framework - for C. - - - - Pango - - Pango is a library for laying out and rendering - text, with an emphasis on internationalization. - - - - Backend Windowing System Library - - GLX, EGL (1.1), Cocoa (OS X) and WGL (Windows) - - - - Graphics Rendering - - Open GL (1.3+ or 1.2 with multitexturing support) or - Open GL ES (1.1 or 2.0) - - - - -
- -
- Platform-specific instructions - -
- Linux - - If you are using Debian or Ubuntu, you can install pre-compiled - binary packages the normal Debian way following the instructions at - - http://debian.o-hand.com/. - - - To build Clutter clutter from sources, get the latest source - archives from - http://www.clutter-project.org/sources/. Once you have extracted - the sources from the archive execute the following commands in the - top-level directory: - - - - $ ./configure - $ make - # make install - - - You can configure the build with number of additional arguments - passed to the configure script, the full list of which can be obtained - by running ./configure --help. The following arguments are specific to - Clutter: - - - - --enable-debug=[no/minimum/yes] - - Controls the Clutter debugging level. Possible values - are: yes (all GLib asserts, checks and runtime debug - messages); minimum - just GLib cast checks and runtime - debug messages; no (no GLib asserts or checks and no - runtime debug messages). The default is yes for development - cycles, and minimum for stable releases. You should not use - no, unless the only performance critical paths are the - GLib type system checks. - - - - - --enable-cogl-debug=[no/minimum/yes] - - Controls the COGL debugging level, similarly to - --enable-debug. - - - - - --enable-maintainer-flags=[no/yes] - - Use strict compiler flags; default=no. - - - - - - --enable-gtk-doc - - Use gtk-doc to build documentation; default=no. - - - - - - --enable-manual=[no/yes] - - Build application developers manual; requires jw and - xmlto binaries; default=no. - - - - - - --with-flavour=[glx/eglx/eglnative/win32/osx/cex100] - - Select the Clutter backend; default=glx. - - - - - - --with-imagebackend=[gdk-pixbuf/quartz/internal] - - Select the image loading backend; default is - set to gdk-pixbuf on Linux and Windows, and to quartz - on OS X. The internal image loading backend should only - be used when porting to a new platform or for testing - purposes, and its stability or functionality are not - guaranteed. - - - - - --with-gles=[1.1/2.0] - - Select the version of GLES to support in COGL; - default is 1.1. - - - - - --with-json=[internal/check] - - Select whether to use the internal copy of - JSON-GLib to parse the ClutterScript UI definition - files, or to check for the system installed library; - default is internal. - - - - - --enable-xinput=[no/yes] - - Whether to enable XInput 1 support; default is - no. - - - - - --enable-introspection=[no/auto/yes] - - Whether to generate GObject Introspection data - at build time; default is auto. - - - - - - - -
- -
- Windows - - The recommended way of building Clutter for Windows is using the - mingw tool chain. This - will work either by cross compiling from a Linux - installation or directly on Windows using MSYS. See - the - wiki for more information. - -
- -
- OSX - - Before you start you should install XCode either from the OSX - installation disk or by downloading it from the Apple website. - - - - Note: These instructions have only been tested on OS X 10.6 - (a.k.a Snow Leopard) - - - - Currently the only way to install Clutter for developing - applications, or hacking on Clutter itself, is to build it yourself. - The recommended route is to install the dependencies with - the MacPorts - project, by simply invoking: - - - - $ sudo port install libpixman-devel cairo-devel pango gtk-doc - - - - on a terminal, after installing and updating MacPorts. - This should give you all of the required dependencies for building - Clutter. - - - - It should be noted that building gtk-doc pulls in a lot of other - MacPorts dependencies and takes some considerable time. You can omit - this dependency so long as you disable documentation when you are - configuring the build with - --disable-gtk-doc --disable-docs - - - - The Clutter Quartz backend is built by passing the - --with-flavour=osx command line argument - to the configure script. If not passed, the GLX backend will - be built. By default, the Quartz backend depends on CoreGraphics - in order to load images into textures, but it can also depend - on GDK-Pixbuf or an internal, highly experimental PNG and JPEG - loader. - - - - GTK introspection is untested on OSX (as there isn't a MacPorts - package) so it is recommended that you disable this with the - --disable-introspection. - - - - If building on top of MacPorts, as recommended, the following - configure command should suffice: - - - - ./configure --with-flavour=osx --disable-introspection --prefix=/opt - -
- -
- -
-
diff --git a/doc/reference/clutter-docs.xml.in b/doc/reference/clutter-docs.xml.in deleted file mode 100644 index baa0e4c21..000000000 --- a/doc/reference/clutter-docs.xml.in +++ /dev/null @@ -1,461 +0,0 @@ - - -]> - - - - Clutter Reference Manual - for Clutter &version; - - - 2006 - 2007 - 2008 - OpenedHand LTD - - - - 2009 - 2010 - 2011 - 2012 - Intel Corporation - - - - - Permission is granted to copy, distribute and/or modify this - document under the terms of the GNU Free - Documentation License, Version 1.1 or any later - version published by the Free Software Foundation with no - Invariant Sections, no Front-Cover Texts, and no Back-Cover - Texts. You may obtain a copy of the GNU Free - Documentation License from the Free Software - Foundation by visiting their Web site or by writing - to: - -
- The Free Software Foundation, Inc., - 59 Temple Place - Suite 330, - Boston, MA 02111-1307, - USA -
-
-
-
- - - - - - - Clutter Core Reference - - - Abstract classes and interfaces - - - - - - - - - - - - - - - Base actors - - - - - - - - Layout managers - - - - - - - - - - Actions - - - - - - - - - - - - - - Constraints - - - - - - - - - Effects - - - - - - - - - - - - - - Content - - - - - - - Paint Objects - - - - - - - - - Clutter Animation Framework - - - Clutter has a fully extensible animation framework - providing support for explicit and implicit animations of - single actors as well as groups of actors. - - - - Base classes - - - - - - - - - - - - - - Clutter Tools - - - General purpose API - - - - - - - - - - - - - - - - - - - - - User interface definition - - - - - - - Generic list model - - - - - - - - - - Clutter Backends - - - Clutter is usually compiled against a specific drawing backend. - All backends have a common API for querying the underlying platform, - and some of them might have specific API exposed by Clutter. - - - - - - - - - - - - - - - - - - Accessibility - - - Clutter provides support for accessibility technologies by - implementing the ATK interfaces. Since Clutter is a low-level tool - kit, and developers are supposed to create more complex actor - classes, we expose a low level API under the Cally namespace; this - API can be used as the base to build more accessibility features - inside custom derived ClutterActor classes. - - - - Base Classes - - - - - - - - - - - - Utility API - - - - - - - - - - Migrating from previous version of Clutter - - - This section describes the changes that need to be - done in applications using Clutter to use new features or - to migrate from old, deprecated API to the new ones. - - - - - - - - - - - Deprecated Classes - - - - - - - - - - - - - - - - - - - - - - - - Clutter Actors and Objects - - - Object Hierarchy - - - - - - Object Index - - - - - - - Glossaries - - - - - - - Index of all symbols - - - - - Index of deprecated symbols - - - - - Index of new symbols in 0.2 - - - - - Index of new symbols in 0.4 - - - - - Index of new symbols in 0.6 - - - - - Index of new symbols in 0.8 - - - - - Index of new symbols in 1.0 - - - - - Index of new symbols in 1.2 - - - - - Index of new symbols in 1.4 - - - - - Index of new symbols in 1.6 - - - - - Index of new symbols in 1.8 - - - - - Index of new symbols in 1.10 - - - - - Index of new symbols in 1.12 - - - - - Index of new symbols in 1.14 - - - - - Index of new symbols in 1.16 - - - - - Index of new symbols in 1.18 - - - - - Index of new symbols in 1.20 - - - - - Index of new symbols in 1.22 - - - - - Index of new symbols in 1.24 - - - - - Index of new symbols in 1.26 - - - - - License - - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General - Public License as published by the Free Software - Foundation; either version 2 of the License, or (at your option) - any later version. - - - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Library General Public License for - more details. - - - - You may obtain a copy of the GNU Library General - Public License from the Free Software Foundation by - visiting their Web - site or by writing to: - -
- Free Software Foundation, Inc. - 59 Temple Place - Suite 330 - Boston, MA 02111-1307 - USA -
-
-
- -
diff --git a/doc/reference/clutter-overview.xml b/doc/reference/clutter-overview.xml deleted file mode 100644 index c14d02b42..000000000 --- a/doc/reference/clutter-overview.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - Emmanuele - Bassi - -
- ebassi@openedhand.com -
-
-
-
- - Overview - - - - Clutter is a GObject based library for creating fast, visually - rich, graphical user interfaces. - - Clutter works by manipulating a scene-graph of 2D surfaces, or - 'actors', inside a 3D space. - - #ClutterActor is the base class for such surfaces. All - #ClutterActors can be positioned, scaled and rotated in 3D space. - In addition, other properties can be set, such as 2D clipping, children and - opacity. Tranforms applied to a parent actor also apply to any children. - Actors are also able to receive events. - - Subclasses of #ClutterActor include #ClutterStage, #ClutterTexture, - #ClutterText, #ClutterRectangle, #ClutterCairoTexture, #ClutterGroup and - #ClutterBox. #ClutterActors are added to a parent, transformed - and then made visible. - - #ClutterStage is the top level #ClutterActor - it's the - representation of a window, or framebuffer. It is created automatically - when Clutter is initialised. #ClutterStage is a #ClutterGroup, a class - implementing the #ClutterContainer interface. - - Clutter allows explicit positioning and sizing through the - #ClutterFixedLayout layout manager; and implicit positioning and sizing - through fluid layout managers like #ClutterBoxLayout, #ClutterFlowLayout - and #ClutterTableLayout. Actors inside fixed layout managers like - #ClutterGroup and #ClutterStage can also be positioned and sized implicitly - using the #ClutterConstraint sub-classes. - - #ClutterTimelines provide the basis for Clutter's animation - utilities. #ClutterActors can be animated using explicit animations - through the various #ClutterBehaviour implementations, or implicit - animations, through the clutter_actor_animate() function. Animations can - also be defined as named states through the #ClutterState class. - - Clutter further contains a number of utilities, including; - #ClutterScript - for loading 'UI definition' files formatted in - JSON; #ClutterShader - a - class for applying GPU shaders to actors, #ClutterModel - a utility class - for MVC list type implementations; #ClutterActions, - #ClutterConstraints and #ClutterEffects. - - - -
diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt deleted file mode 100644 index bb40d33e5..000000000 --- a/doc/reference/clutter-sections.txt +++ /dev/null @@ -1,3807 +0,0 @@ -
-clutter-media -ClutterMedia -ClutterMedia -ClutterMediaIface -clutter_media_set_uri -clutter_media_get_uri -clutter_media_set_playing -clutter_media_get_playing -clutter_media_set_progress -clutter_media_get_progress -clutter_media_set_subtitle_uri -clutter_media_get_subtitle_uri -clutter_media_set_subtitle_font_name -clutter_media_get_subtitle_font_name -clutter_media_set_audio_volume -clutter_media_get_audio_volume -clutter_media_get_can_seek -clutter_media_get_buffer_fill -clutter_media_get_duration -clutter_media_set_filename - -CLUTTER_MEDIA -CLUTTER_IS_MEDIA -CLUTTER_TYPE_MEDIA -CLUTTER_MEDIA_GET_INTERFACE - -clutter_media_get_type -
- -
-clutter-units -Unit conversion -ClutterUnitType -ClutterUnits -clutter_units_from_cm -clutter_units_from_em -clutter_units_from_em_for_font -clutter_units_from_mm -clutter_units_from_pixels -clutter_units_from_pt -clutter_units_to_pixels -clutter_units_copy -clutter_units_free -clutter_units_get_unit_type -clutter_units_get_unit_value -clutter_units_from_string -clutter_units_to_string - - -ClutterParamSpecUnits -clutter_param_spec_units -CLUTTER_VALUE_HOLDS_UNITS -clutter_value_set_units -clutter_value_get_units - - -CLUTTER_TYPE_UNITS -CLUTTER_TYPE_PARAM_UNITS -CLUTTER_PARAM_SPEC_UNITS -CLUTTER_IS_PARAM_SPEC_UNITS -clutter_units_get_type -clutter_param_units_get_type -clutter_units_cm -clutter_units_em -clutter_units_em_for_font -clutter_units_mm -clutter_units_pixels -clutter_units_pt -
- -
-clutter-behaviour -ClutterBehaviour -ClutterBehaviour -ClutterBehaviourClass -clutter_behaviour_apply -clutter_behaviour_remove -clutter_behaviour_remove_all -clutter_behaviour_is_applied -ClutterBehaviourForeachFunc -clutter_behaviour_actors_foreach -clutter_behaviour_get_actors -clutter_behaviour_get_n_actors -clutter_behaviour_get_nth_actor -clutter_behaviour_get_alpha -clutter_behaviour_set_alpha - -CLUTTER_BEHAVIOUR -CLUTTER_IS_BEHAVIOUR -CLUTTER_TYPE_BEHAVIOUR -CLUTTER_BEHAVIOUR_CLASS -CLUTTER_IS_BEHAVIOUR_CLASS -CLUTTER_BEHAVIOUR_GET_CLASS - -ClutterBehaviourPrivate -clutter_behaviour_get_type -
- -
-clutter-alpha -ClutterAlpha -ClutterAlpha -ClutterAlphaClass -ClutterAlphaFunc -clutter_alpha_new -clutter_alpha_new_full -clutter_alpha_new_with_func -clutter_alpha_set_timeline -clutter_alpha_get_timeline -clutter_alpha_set_mode -clutter_alpha_get_mode -clutter_alpha_get_alpha - - -clutter_alpha_set_func -clutter_alpha_set_closure - - -clutter_alpha_register_closure -clutter_alpha_register_func - - -CLUTTER_ALPHA -CLUTTER_IS_ALPHA -CLUTTER_TYPE_ALPHA -CLUTTER_ALPHA_CLASS -CLUTTER_IS_ALPHA_CLASS -CLUTTER_ALPHA_GET_CLASS - - -ClutterAlphaPrivate -clutter_alpha_get_type -
- -
-clutter-clone -ClutterClone -ClutterClone -ClutterCloneClass -clutter_clone_new -clutter_clone_set_source -clutter_clone_get_source - -CLUTTER_CLONE -CLUTTER_IS_CLONE -CLUTTER_TYPE_CLONE -CLUTTER_CLONE_CLASS -CLUTTER_IS_CLONE_CLASS -CLUTTER_CLONE_GET_CLASS - -ClutterClonePrivate -clutter_clone_get_type -
- -
-clutter-group -ClutterGroup -ClutterGroup -ClutterGroupClass -clutter_group_new -clutter_group_remove_all -clutter_group_get_n_children -clutter_group_get_nth_child - -CLUTTER_GROUP -CLUTTER_IS_GROUP -CLUTTER_TYPE_GROUP -CLUTTER_GROUP_CLASS -CLUTTER_IS_GROUP_CLASS -CLUTTER_GROUP_GET_CLASS - -ClutterGroupPrivate -clutter_group_get_type -clutter_group_add -
- -
-clutter-container -ClutterContainer -ClutterContainer -ClutterContainerIface -clutter_container_add_actor -clutter_container_add -clutter_container_add_valist -clutter_container_remove_actor -clutter_container_remove -clutter_container_remove_valist -clutter_container_get_children -clutter_container_foreach -clutter_container_foreach_with_internals - - -clutter_container_find_child_by_name -clutter_container_raise_child -clutter_container_lower_child -clutter_container_sort_depth_order - - -clutter_container_class_find_child_property -clutter_container_class_list_child_properties -clutter_container_child_set_property -clutter_container_child_get_property -clutter_container_child_set -clutter_container_child_get -clutter_container_child_notify - - -clutter_container_create_child_meta -clutter_container_destroy_child_meta -clutter_container_get_child_meta - - -CLUTTER_TYPE_CONTAINER -CLUTTER_CONTAINER -CLUTTER_IS_CONTAINER -CLUTTER_CONTAINER_GET_IFACE - -clutter_container_get_type -
- -
-clutter-child-meta -ClutterChildMeta -ClutterChildMeta -ClutterChildMetaClass -clutter_child_meta_get_container -clutter_child_meta_get_actor - -CLUTTER_TYPE_CHILD_META -CLUTTER_CHILD_META -CLUTTER_IS_CHILD_META -CLUTTER_CHILD_META_CLASS -CLUTTER_IS_CHILD_META_CLASS -CLUTTER_CHILD_META_GET_CLASS - -clutter_child_meta_get_type -
- -
-clutter-rectangle -ClutterRectangle -ClutterRectangle -ClutterRectangleClass -clutter_rectangle_new -clutter_rectangle_new_with_color -clutter_rectangle_get_color -clutter_rectangle_set_color -clutter_rectangle_get_border_color -clutter_rectangle_set_border_color -clutter_rectangle_get_border_width -clutter_rectangle_set_border_width - -CLUTTER_RECTANGLE -CLUTTER_IS_RECTANGLE -CLUTTER_TYPE_RECTANGLE -CLUTTER_RECTANGLE_CLASS -CLUTTER_IS_RECTANGLE_CLASS -CLUTTER_RECTANGLE_GET_CLASS - -ClutterRectanglePrivate -clutter_rectangle_get_type -
- -
-clutter-actor -ClutterActor -CLUTTER_ACTOR_SET_FLAGS -CLUTTER_ACTOR_UNSET_FLAGS -CLUTTER_ACTOR_IS_MAPPED -CLUTTER_ACTOR_IS_REALIZED -CLUTTER_ACTOR_IS_VISIBLE -CLUTTER_ACTOR_IS_REACTIVE - - -ClutterActorFlags -ClutterRequestMode -CLUTTER_CALLBACK -ClutterCallback -ClutterActor -ClutterActorClass -clutter_actor_new -clutter_actor_set_flags -clutter_actor_unset_flags -clutter_actor_get_flags -clutter_actor_set_name -clutter_actor_get_name -clutter_actor_get_gid - - -clutter_actor_show -clutter_actor_show_all -clutter_actor_hide -clutter_actor_hide_all -clutter_actor_is_visible -clutter_actor_realize -clutter_actor_unrealize -clutter_actor_is_realized -clutter_actor_paint -clutter_actor_continue_paint -clutter_actor_queue_redraw -clutter_actor_queue_redraw_with_clip -clutter_actor_queue_relayout -clutter_actor_destroy -clutter_actor_event -clutter_actor_should_pick_paint -clutter_actor_map -clutter_actor_unmap -clutter_actor_is_mapped -clutter_actor_has_overlaps -clutter_actor_has_mapped_clones - - -ClutterAllocationFlags -clutter_actor_allocate -clutter_actor_allocate_preferred_size -clutter_actor_allocate_available_size -clutter_actor_allocate_align_fill -clutter_actor_set_allocation -clutter_actor_get_allocation_box -clutter_actor_get_allocation_geometry -clutter_actor_get_allocation_vertices -clutter_actor_get_preferred_size -clutter_actor_get_preferred_width -clutter_actor_get_preferred_height -clutter_actor_set_fixed_position_set -clutter_actor_get_fixed_position_set -clutter_actor_set_request_mode -clutter_actor_get_request_mode -clutter_actor_has_allocation -ClutterActorAlign -clutter_actor_set_x_align -clutter_actor_get_x_align -clutter_actor_set_y_align -clutter_actor_get_y_align -ClutterMargin -clutter_margin_copy -clutter_margin_free -clutter_margin_new -clutter_actor_set_margin -clutter_actor_get_margin -clutter_actor_set_margin_top -clutter_actor_get_margin_top -clutter_actor_set_margin_right -clutter_actor_get_margin_right -clutter_actor_set_margin_bottom -clutter_actor_get_margin_bottom -clutter_actor_set_margin_left -clutter_actor_get_margin_left -clutter_actor_set_x_expand -clutter_actor_get_x_expand -clutter_actor_set_y_expand -clutter_actor_get_y_expand -clutter_actor_needs_expand -clutter_actor_set_layout_manager -clutter_actor_get_layout_manager -clutter_actor_set_background_color -clutter_actor_get_background_color - - -clutter_actor_set_geometry -clutter_actor_get_geometry -clutter_actor_set_size -clutter_actor_get_size -clutter_actor_set_position -clutter_actor_get_position -clutter_actor_set_width -clutter_actor_get_width -clutter_actor_set_height -clutter_actor_get_height -clutter_actor_set_x -clutter_actor_get_x -clutter_actor_set_y -clutter_actor_get_y -clutter_actor_move_by - - -clutter_actor_set_z_position -clutter_actor_get_z_position -clutter_actor_set_pivot_point -clutter_actor_get_pivot_point -clutter_actor_set_pivot_point_z -clutter_actor_get_pivot_point_z -clutter_actor_set_scale -clutter_actor_get_scale -clutter_actor_set_scale_z -clutter_actor_get_scale_z -clutter_actor_is_scaled -clutter_actor_set_rotation_angle -clutter_actor_get_rotation_angle -clutter_actor_is_rotated -clutter_actor_set_translation -clutter_actor_get_translation -clutter_actor_set_transform -clutter_actor_get_transform -clutter_actor_set_child_transform -clutter_actor_get_child_transform -clutter_actor_apply_transform_to_point -clutter_actor_transform_stage_point -clutter_actor_apply_relative_transform_to_point -clutter_actor_get_transformed_position -clutter_actor_get_transformed_size -clutter_actor_get_paint_opacity -clutter_actor_get_paint_visibility -clutter_actor_get_abs_allocation_vertices -clutter_actor_get_paint_volume -clutter_actor_get_paint_box -clutter_actor_get_transformed_paint_volume -clutter_actor_get_default_paint_volume - - -clutter_actor_set_content -clutter_actor_get_content -ClutterContentGravity -clutter_actor_set_content_gravity -clutter_actor_get_content_gravity -ClutterScalingFilter -clutter_actor_set_content_scaling_filters -clutter_actor_get_content_scaling_filters -ClutterContentRepeat -clutter_actor_set_content_repeat -clutter_actor_get_content_repeat -clutter_actor_get_content_box -clutter_actor_set_clip -clutter_actor_remove_clip -clutter_actor_has_clip -clutter_actor_get_clip -clutter_actor_set_clip_to_allocation -clutter_actor_get_clip_to_allocation -clutter_actor_set_opacity -clutter_actor_get_opacity -clutter_actor_set_opacity_override -clutter_actor_get_opacity_override -ClutterOffscreenRedirect -clutter_actor_set_offscreen_redirect -clutter_actor_get_offscreen_redirect -clutter_actor_is_in_clone_paint - - -clutter_actor_add_child -clutter_actor_insert_child_above -clutter_actor_insert_child_at_index -clutter_actor_insert_child_below -clutter_actor_replace_child -clutter_actor_remove_child -clutter_actor_remove_all_children -clutter_actor_destroy_all_children -clutter_actor_get_first_child -clutter_actor_get_next_sibling -clutter_actor_get_previous_sibling -clutter_actor_get_last_child -clutter_actor_get_child_at_index -clutter_actor_get_children -clutter_actor_get_n_children -clutter_actor_get_parent -clutter_actor_set_child_above_sibling -clutter_actor_set_child_at_index -clutter_actor_set_child_below_sibling -clutter_actor_contains -clutter_actor_get_stage -ClutterActorIter -clutter_actor_iter_init -clutter_actor_iter_is_valid -clutter_actor_iter_next -clutter_actor_iter_prev -clutter_actor_iter_remove -clutter_actor_iter_destroy -ClutterActorCreateChildFunc -clutter_actor_bind_model -clutter_actor_bind_model_with_properties - - -clutter_actor_save_easing_state -clutter_actor_restore_easing_state -clutter_actor_set_easing_duration -clutter_actor_get_easing_duration -clutter_actor_set_easing_mode -clutter_actor_get_easing_mode -clutter_actor_set_easing_delay -clutter_actor_get_easing_delay -clutter_actor_get_transition -clutter_actor_add_transition -clutter_actor_remove_transition -clutter_actor_remove_all_transitions - - -clutter_actor_set_reactive -clutter_actor_get_reactive -clutter_actor_has_key_focus -clutter_actor_grab_key_focus -clutter_actor_has_pointer -clutter_actor_get_pango_context -clutter_actor_create_pango_context -clutter_actor_create_pango_layout -clutter_actor_set_text_direction -clutter_actor_get_text_direction -clutter_actor_get_accessible - - -clutter_actor_add_action -clutter_actor_add_action_with_name -clutter_actor_remove_action -clutter_actor_remove_action_by_name -clutter_actor_has_actions -clutter_actor_get_actions -clutter_actor_get_action -clutter_actor_clear_actions -clutter_actor_add_constraint -clutter_actor_add_constraint_with_name -clutter_actor_remove_constraint -clutter_actor_remove_constraint_by_name -clutter_actor_has_constraints -clutter_actor_get_constraints -clutter_actor_get_constraint -clutter_actor_clear_constraints -clutter_actor_add_effect -clutter_actor_add_effect_with_name -clutter_actor_remove_effect -clutter_actor_remove_effect_by_name -clutter_actor_has_effects -clutter_actor_get_effects -clutter_actor_get_effect -clutter_actor_clear_effects - - -clutter_actor_set_scale_full -clutter_actor_set_scale_with_gravity -clutter_actor_get_scale_center -clutter_actor_get_scale_gravity -clutter_actor_set_depth -clutter_actor_get_depth -clutter_actor_push_internal -clutter_actor_pop_internal -clutter_actor_set_parent -clutter_actor_reparent -clutter_actor_unparent -clutter_actor_raise -clutter_actor_lower -clutter_actor_raise_top -clutter_actor_lower_bottom -clutter_actor_set_shader -clutter_actor_get_shader -clutter_actor_set_shader_param -clutter_actor_set_shader_param_float -clutter_actor_set_shader_param_int -clutter_actor_set_anchor_point -clutter_actor_get_anchor_point -clutter_actor_set_anchor_point_from_gravity -clutter_actor_get_anchor_point_gravity -clutter_actor_move_anchor_point -clutter_actor_move_anchor_point_from_gravity -clutter_actor_set_rotation -clutter_actor_get_rotation -clutter_actor_set_z_rotation_from_gravity -clutter_actor_get_z_rotation_gravity -clutter_actor_get_transformation_matrix - - -CLUTTER_TYPE_MARGIN -CLUTTER_ACTOR -CLUTTER_IS_ACTOR -CLUTTER_TYPE_ACTOR -CLUTTER_ACTOR_CLASS -CLUTTER_IS_ACTOR_CLASS -CLUTTER_ACTOR_GET_CLASS - - -ClutterRedrawFlags -ClutterActorPrivate -clutter_actor_get_type -clutter_margin_get_type -
- -
-clutter-texture -ClutterTexture -ClutterTexture -ClutterTextureClass -ClutterTextureFlags -ClutterTextureQuality -clutter_texture_new -clutter_texture_new_from_file -clutter_texture_new_from_actor - - -CLUTTER_TEXTURE_ERROR -ClutterTextureError -clutter_texture_set_from_file -clutter_texture_set_from_rgb_data -clutter_texture_set_from_yuv_data -clutter_texture_set_area_from_rgb_data - - -clutter_texture_get_base_size -clutter_texture_get_pixel_format -clutter_texture_get_max_tile_waste - - -clutter_texture_get_filter_quality -clutter_texture_set_filter_quality -clutter_texture_get_cogl_texture -clutter_texture_set_cogl_texture -clutter_texture_get_cogl_material -clutter_texture_set_cogl_material -clutter_texture_get_sync_size -clutter_texture_set_sync_size -clutter_texture_get_repeat -clutter_texture_set_repeat -clutter_texture_get_keep_aspect_ratio -clutter_texture_set_keep_aspect_ratio -clutter_texture_get_load_async -clutter_texture_set_load_async -clutter_texture_get_load_data_async -clutter_texture_set_load_data_async -clutter_texture_get_pick_with_alpha -clutter_texture_set_pick_with_alpha - - -CLUTTER_TEXTURE -CLUTTER_IS_TEXTURE -CLUTTER_TYPE_TEXTURE -CLUTTER_TEXTURE_CLASS -CLUTTER_IS_TEXTURE_CLASS -CLUTTER_TEXTURE_GET_CLASS - - -ClutterTexturePrivate -clutter_texture_error_quark -clutter_texture_get_type -
- -
-clutter-stage -ClutterStage -ClutterStage -ClutterStageClass -clutter_stage_new - - -ClutterPickMode -clutter_stage_get_actor_at_pos -clutter_stage_ensure_current -clutter_stage_ensure_viewport -clutter_stage_ensure_redraw -clutter_stage_event -clutter_stage_set_key_focus -clutter_stage_get_key_focus -clutter_stage_read_pixels -clutter_stage_set_throttle_motion_events -clutter_stage_get_throttle_motion_events -clutter_stage_set_use_alpha -clutter_stage_get_use_alpha -clutter_stage_set_minimum_size -clutter_stage_get_minimum_size -clutter_stage_set_no_clear_hint -clutter_stage_get_no_clear_hint -clutter_stage_get_redraw_clip_bounds -clutter_stage_get_motion_events_enabled -clutter_stage_set_motion_events_enabled - - -ClutterPerspective -clutter_stage_set_perspective -clutter_stage_get_perspective - - -clutter_stage_set_title -clutter_stage_get_title -clutter_stage_set_user_resizable -clutter_stage_get_user_resizable -clutter_stage_set_fullscreen -clutter_stage_get_fullscreen -clutter_stage_show_cursor -clutter_stage_hide_cursor -clutter_stage_set_accept_focus -clutter_stage_get_accept_focus - - -clutter_stage_set_sync_delay -clutter_stage_skip_sync_delay - - -CLUTTER_STAGE_WIDTH -CLUTTER_STAGE_HEIGHT -clutter_stage_get_default -clutter_stage_is_default -clutter_stage_set_color -clutter_stage_get_color -clutter_stage_queue_redraw -ClutterFog -clutter_stage_set_use_fog -clutter_stage_get_use_fog -clutter_stage_set_fog -clutter_stage_get_fog - - -CLUTTER_STAGE -CLUTTER_IS_STAGE -CLUTTER_TYPE_STAGE -CLUTTER_STAGE_CLASS -CLUTTER_IS_STAGE_CLASS -CLUTTER_STAGE_GET_CLASS -CLUTTER_STAGE_TYPE -CLUTTER_TYPE_PERSPECTIVE -CLUTTER_TYPE_FOG - -ClutterStagePrivate -clutter_stage_get_type -clutter_perspective_get_type -clutter_fog_get_type -clutter_stage_add -
- -
-clutter-timeline -ClutterTimeline -ClutterTimeline -ClutterTimelineClass -clutter_timeline_new -clutter_timeline_clone - - -clutter_timeline_set_duration -clutter_timeline_get_duration -clutter_timeline_set_repeat_count -clutter_timeline_get_repeat_count -clutter_timeline_set_delay -clutter_timeline_get_delay -ClutterTimelineDirection -clutter_timeline_set_direction -clutter_timeline_get_direction -clutter_timeline_set_auto_reverse -clutter_timeline_get_auto_reverse -ClutterAnimationMode -ClutterStepMode -clutter_timeline_set_progress_mode -clutter_timeline_get_progress_mode -clutter_timeline_set_cubic_bezier_progress -clutter_timeline_get_cubic_bezier_progress -clutter_timeline_set_step_progress -clutter_timeline_get_step_progress -ClutterTimelineProgressFunc -clutter_timeline_set_progress_func -clutter_timeline_get_duration_hint -clutter_timeline_get_current_repeat -clutter_timeline_set_loop -clutter_timeline_get_loop - - -clutter_timeline_start -clutter_timeline_pause -clutter_timeline_stop -clutter_timeline_rewind -clutter_timeline_skip -clutter_timeline_advance -clutter_timeline_get_elapsed_time -clutter_timeline_get_delta -clutter_timeline_get_progress -clutter_timeline_is_playing - - -clutter_timeline_add_marker -clutter_timeline_add_marker_at_time -clutter_timeline_has_marker -clutter_timeline_list_markers -clutter_timeline_remove_marker -clutter_timeline_advance_to_marker - - -CLUTTER_TIMELINE -CLUTTER_IS_TIMELINE -CLUTTER_TYPE_TIMELINE -CLUTTER_TIMELINE_CLASS -CLUTTER_IS_TIMELINE_CLASS -CLUTTER_TIMELINE_GET_CLASS - -ClutterTimelinePrivate -clutter_timeline_get_type -clutter_timeline_do_tick -
- -
-clutter-behaviour-path -ClutterBehaviourPath -ClutterBehaviourPath -ClutterBehaviourPathClass -clutter_behaviour_path_new -clutter_behaviour_path_new_with_description -clutter_behaviour_path_new_with_knots -clutter_behaviour_path_set_path -clutter_behaviour_path_get_path - - -CLUTTER_BEHAVIOUR_PATH -CLUTTER_IS_BEHAVIOUR_PATH -CLUTTER_TYPE_BEHAVIOUR_PATH -CLUTTER_BEHAVIOUR_PATH_CLASS -CLUTTER_IS_BEHAVIOUR_PATH_CLASS -CLUTTER_BEHAVIOUR_PATH_GET_CLASS - -ClutterBehaviourPathPrivate -clutter_behaviour_path_get_type -
- -
-clutter-path -ClutterPath -ClutterPath -ClutterPathClass -ClutterPathCallback -ClutterPathNodeType -clutter_path_new -clutter_path_new_with_description - - -clutter_path_add_move_to -clutter_path_add_rel_move_to -clutter_path_add_line_to -clutter_path_add_rel_line_to -clutter_path_add_curve_to -clutter_path_add_rel_curve_to -clutter_path_add_close -clutter_path_add_string -clutter_path_add_node -clutter_path_add_cairo_path - - -clutter_path_get_n_nodes -clutter_path_get_node -clutter_path_get_nodes -clutter_path_foreach -clutter_path_insert_node -clutter_path_remove_node -clutter_path_replace_node -clutter_path_get_description -clutter_path_set_description -clutter_path_to_cairo_path -clutter_path_clear -clutter_path_get_position -clutter_path_get_length - - -ClutterPathNode -clutter_path_node_copy -clutter_path_node_free -clutter_path_node_equal - - -CLUTTER_TYPE_PATH -CLUTTER_TYPE_PATH_NODE -CLUTTER_PATH -CLUTTER_PATH_CLASS -CLUTTER_IS_PATH -CLUTTER_IS_PATH_CLASS -CLUTTER_PATH_GET_CLASS -CLUTTER_PATH_RELATIVE - - -ClutterPathPrivate -clutter_path_get_type -clutter_path_node_get_type -
- -
-clutter-behaviour-opacity -ClutterBehaviourOpacity -ClutterBehaviourOpacity -ClutterBehaviourOpacityClass -clutter_behaviour_opacity_new -clutter_behaviour_opacity_set_bounds -clutter_behaviour_opacity_get_bounds - -CLUTTER_BEHAVIOUR_OPACITY -CLUTTER_IS_BEHAVIOUR_OPACITY -CLUTTER_TYPE_BEHAVIOUR_OPACITY -CLUTTER_BEHAVIOUR_OPACITY_CLASS -CLUTTER_IS_BEHAVIOUR_OPACITY_CLASS -CLUTTER_BEHAVIOUR_OPACITY_GET_CLASS - -ClutterBehaviourOpacityPrivate -clutter_behaviour_opacity_get_type -
- -
-clutter-behaviour-rotate -ClutterBehaviourRotate -ClutterRotateAxis -ClutterRotateDirection -ClutterBehaviourRotate -ClutterBehaviourRotateClass -clutter_behaviour_rotate_new -clutter_behaviour_rotate_set_axis -clutter_behaviour_rotate_get_axis -clutter_behaviour_rotate_set_direction -clutter_behaviour_rotate_get_direction -clutter_behaviour_rotate_set_bounds -clutter_behaviour_rotate_get_bounds -clutter_behaviour_rotate_set_center -clutter_behaviour_rotate_get_center - -CLUTTER_TYPE_BEHAVIOUR_ROTATE -CLUTTER_BEHAVIOUR_ROTATE -CLUTTER_IS_BEHAVIOUR_ROTATE -CLUTTER_BEHAVIOUR_ROTATE_CLASS -CLUTTER_IS_BEHAVIOUR_ROTATE_CLASS -CLUTTER_BEHAVIOUR_ROTATE_GET_CLASS - -ClutterBehaviourRotatePrivate -clutter_behaviour_rotate_get_type -
- -
-clutter-behaviour-scale -ClutterBehaviourScale -ClutterGravity -ClutterBehaviourScale -ClutterBehaviourScaleClass -clutter_behaviour_scale_new -clutter_behaviour_scale_set_bounds -clutter_behaviour_scale_get_bounds - -CLUTTER_BEHAVIOUR_SCALE -CLUTTER_IS_BEHAVIOUR_SCALE -CLUTTER_TYPE_BEHAVIOUR_SCALE -CLUTTER_BEHAVIOUR_SCALE_CLASS -CLUTTER_IS_BEHAVIOUR_SCALE_CLASS -CLUTTER_BEHAVIOUR_SCALE_GET_CLASS - -ClutterBehaviourScalePrivate -clutter_behaviour_scale_get_type -
- -
-clutter-behaviour-ellipse -ClutterBehaviourEllipse -ClutterBehaviourEllipse -ClutterBehaviourEllipseClass -clutter_behaviour_ellipse_new -clutter_behaviour_ellipse_set_center -clutter_behaviour_ellipse_get_center -clutter_behaviour_ellipse_set_angle_start -clutter_behaviour_ellipse_get_angle_start -clutter_behaviour_ellipse_set_angle_end -clutter_behaviour_ellipse_get_angle_end -clutter_behaviour_ellipse_set_angle_tilt -clutter_behaviour_ellipse_get_angle_tilt -clutter_behaviour_ellipse_set_height -clutter_behaviour_ellipse_get_height -clutter_behaviour_ellipse_set_width -clutter_behaviour_ellipse_get_width -clutter_behaviour_ellipse_set_tilt -clutter_behaviour_ellipse_get_tilt -clutter_behaviour_ellipse_set_direction -clutter_behaviour_ellipse_get_direction - -CLUTTER_TYPE_BEHAVIOUR_ELLIPSE -CLUTTER_BEHAVIOUR_ELLIPSE -CLUTTER_BEHAVIOUR_ELLIPSE_CLASS -CLUTTER_IS_BEHAVIOUR_ELLIPSE -CLUTTER_IS_BEHAVIOUR_ELLIPSE_CLASS -CLUTTER_BEHAVIOUR_ELLIPSE_GET_CLASS - -ClutterBehaviourEllipsePrivate -clutter_behaviour_ellipse_get_type -
- - -
-clutter-backend -ClutterBackend -ClutterBackend -clutter_get_default_backend -clutter_backend_set_resolution -clutter_backend_get_resolution -clutter_backend_set_double_click_time -clutter_backend_get_double_click_time -clutter_backend_set_double_click_distance -clutter_backend_get_double_click_distance -clutter_backend_set_font_options -clutter_backend_get_font_options -clutter_backend_set_font_name -clutter_backend_get_font_name -clutter_backend_get_cogl_context - - -clutter_check_windowing_backend -clutter_set_windowing_backend - - -CLUTTER_BACKEND -CLUTTER_IS_BACKEND -CLUTTER_BACKEND_CLASS -CLUTTER_IS_BACKEND_CLASS -CLUTTER_BACKEND_GET_CLASS -CLUTTER_TYPE_BACKEND - -ClutterBackendClass -clutter_backend_get_type -
- -
-clutter-util -Utilities -clutter_util_next_p2 - - -clutter_timeout_pool_new -clutter_timeout_pool_add -clutter_timeout_pool_remove - - -clutter_frame_source_add -clutter_frame_source_add_full - - -ClutterParamSpecFixed -clutter_param_spec_fixed -CLUTTER_VALUE_HOLDS_FIXED -clutter_value_set_fixed -clutter_value_get_fixed - - -ClutterTimeoutPool -CLUTTER_TYPE_PARAM_FIXED -CLUTTER_PARAM_SPEC_FIXED -CLUTTER_IS_PARAM_SPEC_FIXED -clutter_param_fixed_get_type -
- -
-clutter-feature -Features -ClutterFeatureFlags -clutter_feature_available -clutter_feature_get_all -
- -
-clutter-color -Colors -CLUTTER_COLOR_INIT -ClutterColor -clutter_color_new -clutter_color_alloc -clutter_color_init -clutter_color_copy -clutter_color_free -clutter_color_equal -clutter_color_hash -ClutterStaticColor -clutter_color_get_static - - -clutter_color_from_string -clutter_color_to_string -clutter_color_from_hls -clutter_color_to_hls -clutter_color_from_pixel -clutter_color_to_pixel - - -clutter_color_add -clutter_color_subtract -clutter_color_lighten -clutter_color_darken -clutter_color_shade -clutter_color_interpolate - - -ClutterParamSpecColor -clutter_param_spec_color -CLUTTER_VALUE_HOLDS_COLOR -clutter_value_set_color -clutter_value_get_color - - -CLUTTER_TYPE_COLOR -CLUTTER_TYPE_PARAM_COLOR -CLUTTER_PARAM_SPEC_COLOR -CLUTTER_IS_PARAM_SPEC_COLOR - - -clutter_color_get_type -clutter_param_color_get_type -
- -
-clutter-event -Events -CLUTTER_CURRENT_TIME -CLUTTER_PRIORITY_EVENTS -CLUTTER_EVENT_PROPAGATE -CLUTTER_EVENT_STOP -ClutterModifierType -ClutterScrollDirection -ClutterScrollFinishFlags -ClutterScrollSource -ClutterStageState -ClutterEventType -ClutterEvent -ClutterEventFlags -ClutterButtonEvent -ClutterKeyEvent -ClutterMotionEvent -ClutterScrollEvent -ClutterStageStateEvent -ClutterCrossingEvent -ClutterTouchEvent -ClutterEventSequence -ClutterTouchpadPinchEvent -ClutterTouchpadSwipeEvent -ClutterTouchpadGesturePhase -clutter_event_new -clutter_event_copy -clutter_event_free -clutter_event_type - - -clutter_event_set_coords -clutter_event_get_coords -clutter_event_set_state -clutter_event_get_state -clutter_event_get_state_full -clutter_event_set_time -clutter_event_get_time -clutter_event_set_source -clutter_event_get_source -clutter_event_set_stage -clutter_event_get_stage -clutter_event_set_flags -clutter_event_get_flags -clutter_event_get_axes -clutter_event_get_event_sequence -clutter_event_get_angle -clutter_event_get_distance -clutter_event_get_position -clutter_event_has_control_modifier -clutter_event_has_shift_modifier -clutter_event_is_pointer_emulated -clutter_event_get_gesture_swipe_finger_count -clutter_event_get_gesture_pinch_angle_delta -clutter_event_get_gesture_pinch_scale -clutter_event_get_gesture_phase -clutter_event_get_gesture_motion_delta -clutter_event_get_scroll_source -clutter_event_get_scroll_finish_flags - - -clutter_event_get -clutter_event_peek -clutter_event_put -clutter_events_pending -ClutterEventFilterFunc -clutter_event_add_filter -clutter_event_remove_filter - - -CLUTTER_BUTTON_PRIMARY -CLUTTER_BUTTON_MIDDLE -CLUTTER_BUTTON_SECONDARY -clutter_event_set_button -clutter_event_get_button -clutter_event_get_click_count - - -clutter_event_set_key_symbol -clutter_event_get_key_symbol -clutter_event_set_key_code -clutter_event_get_key_code -clutter_event_set_key_unicode -clutter_event_get_key_unicode -clutter_keysym_to_unicode -clutter_unicode_to_keysym - - -clutter_event_set_related -clutter_event_get_related - - -clutter_event_set_scroll_direction -clutter_event_get_scroll_direction -clutter_event_get_scroll_delta -clutter_event_set_scroll_delta - - -clutter_event_set_device -clutter_event_get_device -clutter_event_set_source_device -clutter_event_get_source_device -clutter_event_get_device_id -clutter_event_get_device_type - - -clutter_get_current_event_time -clutter_get_current_event - - -CLUTTER_TYPE_EVENT_SEQUENCE -CLUTTER_TYPE_EVENT - -ClutterAnyEvent -clutter_event_sequence_get_type -clutter_event_get_type -
- -
-clutter-input-device -ClutterInputDevice -ClutterInputDeviceType -ClutterInputAxis -ClutterInputMode -ClutterInputDevice -clutter_input_device_get_device_id -clutter_input_device_get_device_type -clutter_input_device_get_device_name -clutter_input_device_get_device_mode -clutter_input_device_get_has_cursor -clutter_input_device_set_enabled -clutter_input_device_get_enabled -clutter_input_device_get_associated_device -clutter_input_device_get_slave_devices -clutter_input_device_get_modifier_state -clutter_input_device_keycode_to_evdev -clutter_input_device_get_vendor_id -clutter_input_device_get_product_id - - -clutter_input_device_get_n_keys -clutter_input_device_set_key -clutter_input_device_get_key - - -clutter_input_device_get_n_axes -clutter_input_device_get_axis -clutter_input_device_get_axis_value - - -clutter_input_device_get_coords -clutter_input_device_get_device_coords -clutter_input_device_get_pointer_actor -clutter_input_device_get_pointer_stage - - -clutter_input_device_grab -clutter_input_device_ungrab -clutter_input_device_get_grabbed_actor -clutter_input_device_sequence_grab -clutter_input_device_sequence_ungrab -clutter_input_device_sequence_get_grabbed_actor - - -clutter_input_device_update_from_event - - -CLUTTER_TYPE_INPUT_DEVICE -CLUTTER_INPUT_DEVICE -CLUTTER_INPUT_DEVICE_CLASS -CLUTTER_IS_INPUT_DEVICE -CLUTTER_IS_INPUT_DEVICE_CLASS -CLUTTER_INPUT_DEVICE_GET_CLASS - - -ClutterInputDeviceClass -clutter_input_device_get_type -
- -
-clutter-device-manager -ClutterDeviceManager -ClutterDeviceManager -ClutterDeviceManagerClass -clutter_device_manager_get_default -clutter_device_manager_list_devices -clutter_device_manager_peek_devices -clutter_device_manager_get_device -clutter_device_manager_get_core_device - - -clutter_get_input_device_for_id - - -CLUTTER_TYPE_DEVICE_MANAGER -CLUTTER_DEVICE_MANAGER -CLUTTER_DEVICE_MANAGER_CLASS -CLUTTER_IS_DEVICE_MANAGER -CLUTTER_IS_DEVICE_MANAGER_CLASS -CLUTTER_DEVICE_MANAGER_GET_CLASS - - -ClutterDeviceManagerPrivate -clutter_device_manager_get_type -
- -
-clutter-main -General -CLUTTER_PRIORITY_REDRAW - - -ClutterInitError -clutter_init -clutter_init_with_args -clutter_get_option_group -clutter_get_option_group_without_init - - -clutter_main -clutter_main_quit -clutter_main_level - - -clutter_get_debug_enabled -clutter_get_show_fps -clutter_get_timestamp -clutter_get_actor_by_gid -clutter_set_default_frame_rate -clutter_get_default_frame_rate -clutter_set_motion_events_enabled -clutter_get_motion_events_enabled -clutter_clear_glyph_cache -ClutterFontFlags -clutter_set_font_flags -clutter_get_font_flags -clutter_get_font_map -ClutterTextDirection -clutter_get_default_text_direction -clutter_get_accessibility_enabled -clutter_disable_accessibility - - -clutter_threads_set_lock_functions -clutter_threads_init -clutter_threads_enter -clutter_threads_leave -clutter_threads_add_idle -clutter_threads_add_idle_full -clutter_threads_add_timeout -clutter_threads_add_timeout_full -clutter_threads_add_frame_source -clutter_threads_add_frame_source_full -clutter_threads_add_repaint_func -ClutterRepaintFlags -clutter_threads_add_repaint_func_full -clutter_threads_remove_repaint_func - - -clutter_get_keyboard_grab -clutter_get_pointer_grab -clutter_grab_keyboard -clutter_grab_pointer -clutter_ungrab_keyboard -clutter_ungrab_pointer -clutter_grab_pointer_for_device -clutter_ungrab_pointer_for_device - - -clutter_do_event - - -CLUTTER_TEST_UNIT -CLUTTER_TEST_SUITE -clutter_test_init -clutter_test_run -clutter_test_add -clutter_test_add_data -clutter_test_add_data_full -clutter_test_get_stage -clutter_test_check_actor_at_point -clutter_test_check_color_at_point -clutter_test_assert_actor_at_point -clutter_test_assert_color_at_point - - -CLUTTER_INIT_ERROR - -CLUTTER_DEPRECATED -CLUTTER_DEPRECATED_FOR -CLUTTER_PRIVATE_FIELD -CLUTTER_VAR -clutter_init_error_quark -clutter_base_init -clutter_redraw -
- -
-clutter-x11 -X11 Specific Support -clutter_x11_set_display -clutter_x11_disable_event_retrieval -clutter_x11_has_event_retrieval -clutter_x11_get_stage_from_window -clutter_x11_handle_event -clutter_x11_get_default_display -clutter_x11_get_default_screen -clutter_x11_get_root_window -clutter_x11_get_stage_visual -clutter_x11_get_stage_window -clutter_x11_set_stage_foreign -clutter_x11_trap_x_errors -clutter_x11_untrap_x_errors -clutter_x11_has_composite_extension -clutter_x11_get_current_event_time -clutter_x11_set_use_argb_visual -clutter_x11_get_use_argb_visual -clutter_x11_get_visual_info -clutter_x11_get_use_stereo_stage -clutter_x11_set_use_stereo_stage - - -ClutterX11FilterFunc -ClutterX11FilterReturn -clutter_x11_add_filter -clutter_x11_remove_filter - - -clutter_x11_get_input_devices -clutter_x11_has_xinput -clutter_x11_enable_xinput -clutter_x11_event_get_key_group -clutter_x11_event_sequence_get_touch_detail - - -ClutterX11XInputDevice -clutter_x11_filter_return_get_type -
- -
-clutter-x11-texture-pixmap -ClutterX11TexturePixmap -ClutterX11TexturePixmapClass -clutter_x11_texture_pixmap_new -clutter_x11_texture_pixmap_new_with_pixmap -clutter_x11_texture_pixmap_new_with_window -clutter_x11_texture_pixmap_set_pixmap -clutter_x11_texture_pixmap_set_window -clutter_x11_texture_pixmap_sync_window -clutter_x11_texture_pixmap_update_area -clutter_x11_texture_pixmap_set_automatic - - -CLUTTER_X11_TYPE_TEXTURE_PIXMAP -CLUTTER_X11_TEXTURE_PIXMAP -CLUTTER_X11_IS_TEXTURE_PIXMAP -CLUTTER_X11_TEXTURE_PIXMAP_CLASS -CLUTTER_X11_IS_TEXTURE_PIXMAP_CLASS -CLUTTER_X11_TEXTURE_PIXMAP_GET_CLASS -clutter_x11_texture_pixmap_get_type - - -ClutterX11TexturePixmapPrivate -
- -
-clutter-glx-texture-pixmap -ClutterGLXTexturePixmap -ClutterGLXTexturePixmapClass -clutter_glx_texture_pixmap_new -clutter_glx_texture_pixmap_new_with_pixmap -clutter_glx_texture_pixmap_new_with_window - - -clutter_glx_texture_pixmap_using_extension - - -CLUTTER_GLX_TYPE_TEXTURE_PIXMAP -CLUTTER_GLX_TEXTURE_PIXMAP -CLUTTER_GLX_IS_TEXTURE_PIXMAP -CLUTTER_GLX_TEXTURE_PIXMAP_CLASS -CLUTTER_GLX_IS_TEXTURE_PIXMAP_CLASS -CLUTTER_GLX_TEXTURE_PIXMAP_GET_CLASS - - -ClutterGLXTexturePixmapPrivate -clutter_glx_texture_pixmap_get_type -
- -
-clutter-wayland -Wayland specific support -clutter_wayland_input_device_get_wl_seat -clutter_wayland_stage_get_wl_shell_surface -clutter_wayland_stage_get_wl_surface -clutter_wayland_stage_set_wl_surface -clutter_wayland_set_display -clutter_wayland_disable_event_retrieval -
- -
-clutter-wayland-compositor -Wayland compositor specific support -clutter_wayland_set_compositor_display -
- -
-clutter-wayland-surface -ClutterWaylandSurface -ClutterWaylandSurface -ClutterWaylandSurfaceClass -clutter_wayland_surface_new -clutter_wayland_surface_attach_buffer -clutter_wayland_surface_damage_buffer -clutter_wayland_surface_get_cogl_texture -clutter_wayland_surface_get_surface -clutter_wayland_surface_set_surface - -CLUTTER_WAYLAND_IS_SURFACE -CLUTTER_WAYLAND_IS_SURFACE_CLASS -CLUTTER_WAYLAND_SURFACE -CLUTTER_WAYLAND_SURFACE_CLASS -CLUTTER_WAYLAND_SURFACE_GET_CLASS -CLUTTER_WAYLAND_TYPE_SURFACE - -ClutterWaylandSurfacePrivate -clutter_wayland_surface_get_type -
- -
-clutter-win32 -Win32 Specific Support -clutter_win32_disable_event_retrieval -clutter_win32_set_stage_foreign -clutter_win32_get_stage_from_window -clutter_win32_get_stage_window -clutter_win32_handle_event -
- -
-clutter-gdk -GDK Specific Support -clutter_gdk_disable_event_retrieval -clutter_gdk_get_stage_from_window -clutter_gdk_get_stage_window -clutter_gdk_handle_event -clutter_gdk_set_display -clutter_gdk_get_default_display -clutter_gdk_set_stage_foreign -clutter_gdk_get_visual -
- -
-clutter-version -Versioning Macros -CLUTTER_MAJOR_VERSION -CLUTTER_MINOR_VERSION -CLUTTER_MICRO_VERSION -CLUTTER_VERSION -CLUTTER_VERSION_S -CLUTTER_VERSION_HEX - - -CLUTTER_CHECK_VERSION - - -CLUTTER_FLAVOUR -CLUTTER_COGL -CLUTTER_NO_FPU - - -CLUTTER_VERSION_1_0 -CLUTTER_VERSION_1_2 -CLUTTER_VERSION_1_4 -CLUTTER_VERSION_1_6 -CLUTTER_VERSION_1_8 -CLUTTER_VERSION_1_10 -CLUTTER_VERSION_1_12 -CLUTTER_VERSION_1_14 -CLUTTER_VERSION_1_16 -CLUTTER_VERSION_1_18 -CLUTTER_VERSION_1_20 -CLUTTER_VERSION_1_22 -CLUTTER_VERSION_1_24 -CLUTTER_VERSION_1_26 -CLUTTER_VERSION_MAX_ALLOWED -CLUTTER_VERSION_MIN_REQUIRED - - -clutter_major_version -clutter_minor_version -clutter_micro_version -clutter_check_version - - -CLUTTER_VERSION_CUR_STABLE -CLUTTER_VERSION_PREV_STABLE -CLUTTER_AVAILABLE_IN_ALL -CLUTTER_AVAILABLE_IN_1_0 -CLUTTER_AVAILABLE_IN_1_2 -CLUTTER_AVAILABLE_IN_1_4 -CLUTTER_AVAILABLE_IN_1_6 -CLUTTER_AVAILABLE_IN_1_8 -CLUTTER_AVAILABLE_IN_1_10 -CLUTTER_AVAILABLE_IN_1_12 -CLUTTER_AVAILABLE_IN_1_14 -CLUTTER_AVAILABLE_IN_1_16 -CLUTTER_AVAILABLE_IN_1_18 -CLUTTER_AVAILABLE_IN_1_20 -CLUTTER_AVAILABLE_IN_1_22 -CLUTTER_AVAILABLE_IN_1_24 -CLUTTER_AVAILABLE_IN_1_26 -CLUTTER_DEPRECATED_IN_1_0 -CLUTTER_DEPRECATED_IN_1_0_FOR -CLUTTER_DEPRECATED_IN_1_2 -CLUTTER_DEPRECATED_IN_1_2_FOR -CLUTTER_DEPRECATED_IN_1_4 -CLUTTER_DEPRECATED_IN_1_4_FOR -CLUTTER_DEPRECATED_IN_1_6 -CLUTTER_DEPRECATED_IN_1_6_FOR -CLUTTER_DEPRECATED_IN_1_8 -CLUTTER_DEPRECATED_IN_1_8_FOR -CLUTTER_DEPRECATED_IN_1_10 -CLUTTER_DEPRECATED_IN_1_10_FOR -CLUTTER_DEPRECATED_IN_1_12 -CLUTTER_DEPRECATED_IN_1_12_FOR -CLUTTER_DEPRECATED_IN_1_14 -CLUTTER_DEPRECATED_IN_1_14_FOR -CLUTTER_DEPRECATED_IN_1_16 -CLUTTER_DEPRECATED_IN_1_16_FOR -CLUTTER_DEPRECATED_IN_1_18 -CLUTTER_DEPRECATED_IN_1_18_FOR -CLUTTER_DEPRECATED_IN_1_20 -CLUTTER_DEPRECATED_IN_1_20_FOR -CLUTTER_DEPRECATED_IN_1_22 -CLUTTER_DEPRECATED_IN_1_22_FOR -CLUTTER_DEPRECATED_IN_1_24 -CLUTTER_DEPRECATED_IN_1_24_FOR -CLUTTER_DEPRECATED_IN_1_26 -CLUTTER_DEPRECATED_IN_1_26_FOR -CLUTTER_MACRO_DEPRECATED_IN_1_24 -CLUTTER_MACRO_DEPRECATED_IN_1_24_FOR -CLUTTER_MACRO_DEPRECATED_IN_1_26 -CLUTTER_MACRO_DEPRECATED_IN_1_26_FOR -CLUTTER_DEPRECATED_MACRO -CLUTTER_DEPRECATED_MACRO_FOR -CLUTTER_UNAVAILABLE -
- -
-clutter-behaviour-depth -ClutterBehaviourDepth -ClutterBehaviourDepth -ClutterBehaviourDepthClass -clutter_behaviour_depth_new -clutter_behaviour_depth_set_bounds -clutter_behaviour_depth_get_bounds - -CLUTTER_BEHAVIOUR_DEPTH -CLUTTER_IS_BEHAVIOUR_DEPTH -CLUTTER_TYPE_BEHAVIOUR_DEPTH -CLUTTER_BEHAVIOUR_DEPTH_CLASS -CLUTTER_IS_BEHAVIOUR_DEPTH_CLASS -CLUTTER_BEHAVIOUR_DEPTH_GET_CLASS - -ClutterBehaviourDepthPrivate -clutter_behaviour_depth_get_type -
- -
-clutter-script -ClutterScript -ClutterScript -ClutterScriptClass -clutter_script_new -ClutterScriptError -clutter_script_load_from_data -clutter_script_load_from_file -clutter_script_load_from_resource -clutter_script_add_search_paths -clutter_script_lookup_filename - - -clutter_script_get_object -clutter_script_get_objects -clutter_script_unmerge_objects -clutter_script_ensure_objects -clutter_script_list_objects - - -ClutterScriptConnectFunc -clutter_script_connect_signals -clutter_script_connect_signals_full -clutter_script_add_states -clutter_script_get_states - - -clutter_script_get_type_from_name -clutter_get_script_id -clutter_script_get_translation_domain -clutter_script_set_translation_domain - - -CLUTTER_TYPE_SCRIPT -CLUTTER_SCRIPT -CLUTTER_IS_SCRIPT -CLUTTER_SCRIPT_CLASS -CLUTTER_IS_SCRIPT_CLASS -CLUTTER_SCRIPT_GET_CLASS -CLUTTER_SCRIPT_ERROR - -ClutterScriptPrivate -clutter_script_get_type -clutter_script_error_quark -
- -
-clutter-scriptable -ClutterScriptable -ClutterScriptable -ClutterScriptableIface -clutter_scriptable_set_id -clutter_scriptable_get_id -clutter_scriptable_parse_custom_node -clutter_scriptable_set_custom_property - -CLUTTER_TYPE_SCRIPTABLE -CLUTTER_SCRIPTABLE -CLUTTER_IS_SCRIPTABLE -CLUTTER_SCRIPTABLE_GET_IFACE - -clutter_scriptable_get_type -
- -
-clutter-model -ClutterModel -ClutterModel -ClutterModelClass -clutter_model_set_names -clutter_model_set_types -clutter_model_get_column_name -clutter_model_get_column_type -clutter_model_get_n_columns -clutter_model_get_n_rows - - -clutter_model_append -clutter_model_appendv -clutter_model_prepend -clutter_model_prependv -clutter_model_insert -clutter_model_insertv -clutter_model_insert_value -clutter_model_remove - - -ClutterModelForeachFunc -clutter_model_foreach -clutter_model_set_sorting_column -clutter_model_get_sorting_column -ClutterModelSortFunc -clutter_model_set_sort -clutter_model_resort -ClutterModelFilterFunc -clutter_model_set_filter -clutter_model_get_filter_set -clutter_model_filter_iter -clutter_model_filter_row - - -clutter_model_get_first_iter -clutter_model_get_last_iter -clutter_model_get_iter_at_row - - -CLUTTER_TYPE_MODEL -CLUTTER_MODEL -CLUTTER_IS_MODEL -CLUTTER_MODEL_CLASS -CLUTTER_IS_MODEL_CLASS -CLUTTER_MODEL_GET_CLASS - -ClutterModelPrivate -clutter_model_get_type -
- -
-clutter-model-iter -ClutterModelIter -ClutterModelIter -ClutterModelIterClass -clutter_model_iter_copy - - -clutter_model_iter_get -clutter_model_iter_get_valist -clutter_model_iter_get_value -clutter_model_iter_set -clutter_model_iter_set_valist -clutter_model_iter_set_value - - -clutter_model_iter_is_first -clutter_model_iter_is_last -clutter_model_iter_next -clutter_model_iter_prev - - -clutter_model_iter_get_model -clutter_model_iter_get_row - - -CLUTTER_TYPE_MODEL_ITER -CLUTTER_MODEL_ITER -CLUTTER_IS_MODEL_ITER -CLUTTER_MODEL_ITER_CLASS -CLUTTER_IS_MODEL_ITER_CLASS -CLUTTER_MODEL_GET_CLASS -CLUTTER_MODEL_ITER_GET_CLASS - -ClutterModelIterPrivate -clutter_model_iter_get_type -
- -
-clutter-list-model -ClutterListModel -ClutterListModel -ClutterListModelClass -clutter_list_model_new -clutter_list_model_newv - -CLUTTER_TYPE_LIST_MODEL -CLUTTER_LIST_MODEL -CLUTTER_IS_LIST_MODEL -CLUTTER_IS_LIST_MODEL_CLASS -CLUTTER_LIST_MODEL_CLASS -CLUTTER_LIST_MODEL_GET_CLASS - -ClutterListModelPrivate -clutter_list_model_get_type -
- -
-clutter-score -ClutterScore -ClutterScore -ClutterScoreClass -clutter_score_new -clutter_score_set_loop -clutter_score_get_loop - - -clutter_score_append -clutter_score_append_at_marker -clutter_score_remove -clutter_score_remove_all -clutter_score_get_timeline -clutter_score_list_timelines - - -clutter_score_start -clutter_score_pause -clutter_score_stop -clutter_score_is_playing -clutter_score_rewind - - -CLUTTER_IS_SCORE -CLUTTER_IS_SCORE_CLASS -CLUTTER_SCORE -CLUTTER_SCORE_CLASS -CLUTTER_SCORE_GET_CLASS -CLUTTER_TYPE_SCORE - - -ClutterScorePrivate -clutter_score_get_type -
- -
-clutter-shader -Shaders -ClutterShaderError -ClutterShader -ClutterShaderClass -clutter_shader_new -clutter_shader_set_vertex_source -clutter_shader_get_vertex_source -clutter_shader_set_fragment_source -clutter_shader_get_fragment_source -clutter_shader_compile -clutter_shader_release -clutter_shader_is_compiled -clutter_shader_set_is_enabled -clutter_shader_get_is_enabled - - -clutter_shader_set_uniform -clutter_shader_get_cogl_program -clutter_shader_get_cogl_fragment_shader -clutter_shader_get_cogl_vertex_shader - - -CLUTTER_VALUE_HOLDS_SHADER_FLOAT -clutter_value_set_shader_float -clutter_value_get_shader_float -CLUTTER_VALUE_HOLDS_SHADER_INT -clutter_value_set_shader_int -clutter_value_get_shader_int -CLUTTER_VALUE_HOLDS_SHADER_MATRIX -clutter_value_set_shader_matrix -clutter_value_get_shader_matrix - - -CLUTTER_IS_SHADER -CLUTTER_IS_SHADER_CLASS -CLUTTER_SHADER -CLUTTER_SHADER_CLASS -CLUTTER_SHADER_ERROR -CLUTTER_SHADER_GET_CLASS -CLUTTER_TYPE_SHADER -CLUTTER_TYPE_SHADER_FLOAT -CLUTTER_TYPE_SHADER_INT -CLUTTER_TYPE_SHADER_MATRIX - - -ClutterShaderPrivate -clutter_shader_get_type -ClutterShaderFloat -clutter_shader_float_get_type -ClutterShaderInt -clutter_shader_int_get_type -ClutterShaderMatrix -clutter_shader_matrix_get_type -clutter_shader_error_quark -
- -
-Implicit Animations -clutter-animation -ClutterAnimation -ClutterAnimationClass -clutter_animation_new -clutter_animation_set_object -clutter_animation_get_object -clutter_animation_set_mode -clutter_animation_get_mode -clutter_animation_set_duration -clutter_animation_get_duration -clutter_animation_set_loop -clutter_animation_get_loop -clutter_animation_set_timeline -clutter_animation_get_timeline -clutter_animation_set_alpha -clutter_animation_get_alpha -clutter_animation_completed - - -clutter_animation_bind -clutter_animation_bind_interval -clutter_animation_update -clutter_animation_update_interval -clutter_animation_has_property -clutter_animation_unbind_property -clutter_animation_get_interval - - -clutter_actor_animate -clutter_actor_animate_with_timeline -clutter_actor_animate_with_alpha -clutter_actor_animatev -clutter_actor_animate_with_timelinev -clutter_actor_animate_with_alphav -clutter_actor_get_animation -clutter_actor_detach_animation - - -CLUTTER_TYPE_ANIMATION -CLUTTER_ANIMATION -CLUTTER_ANIMATION_CLASS -CLUTTER_IS_ANIMATION -CLUTTER_IS_ANIMATION_CLASS -CLUTTER_ANIMATION_GET_CLASS - - -ClutterAnimationPrivate -clutter_animation_get_type -
- -
-Value intervals -clutter-interval -ClutterInterval -ClutterIntervalClass -clutter_interval_new -clutter_interval_new_with_values -clutter_interval_clone -clutter_interval_get_value_type -clutter_interval_set_initial_value -clutter_interval_get_initial_value -clutter_interval_peek_initial_value -clutter_interval_set_final_value -clutter_interval_get_final_value -clutter_interval_peek_final_value -clutter_interval_set_interval -clutter_interval_get_interval -clutter_interval_set_initial -clutter_interval_set_final - - -clutter_interval_is_valid -clutter_interval_validate -clutter_interval_compute_value -clutter_interval_compute - - -ClutterProgressFunc -clutter_interval_register_progress_func - - -CLUTTER_TYPE_INTERVAL -CLUTTER_INTERVAL -CLUTTER_INTERVAL_CLASS -CLUTTER_IS_INTERVAL -CLUTTER_IS_INTERVAL_CLASS -CLUTTER_INTERVAL_GET_CLASS - - -ClutterIntervalPrivate -clutter_interval_get_type -
- -
-clutter-cairo -CLUTTER_CAIRO_FORMAT_ARGB32 -clutter_cairo_clear -clutter_cairo_set_source_color -
- -
-clutter-cairo-texture -ClutterCairoTexture -ClutterCairoTexture -ClutterCairoTextureClass -clutter_cairo_texture_new -clutter_cairo_texture_set_surface_size -clutter_cairo_texture_get_surface_size -clutter_cairo_texture_set_auto_resize -clutter_cairo_texture_get_auto_resize - - -clutter_cairo_texture_create -clutter_cairo_texture_create_region - - -clutter_cairo_texture_invalidate_rectangle -clutter_cairo_texture_invalidate -clutter_cairo_texture_clear - - -CLUTTER_TYPE_CAIRO_TEXTURE -CLUTTER_CAIRO_TEXTURE -CLUTTER_IS_CAIRO_TEXTURE -CLUTTER_CAIRO_TEXTURE_CLASS -CLUTTER_IS_CAIRO_TEXTURE_CLASS -CLUTTER_CAIRO_TEXTURE_GET_CLASS - - -ClutterCairoTexturePrivate -clutter_cairo_texture_get_type -
- -
-ClutterText -clutter-text -ClutterText -ClutterTextClass -clutter_text_new -clutter_text_new_full -clutter_text_new_with_text -clutter_text_new_with_buffer - - -clutter_text_set_buffer -clutter_text_get_buffer -clutter_text_set_text -clutter_text_set_markup -clutter_text_get_text -clutter_text_set_activatable -clutter_text_get_activatable -clutter_text_set_attributes -clutter_text_get_attributes -clutter_text_set_color -clutter_text_get_color -clutter_text_set_ellipsize -clutter_text_get_ellipsize -clutter_text_set_font_name -clutter_text_get_font_name -clutter_text_set_font_description -clutter_text_get_font_description -clutter_text_set_password_char -clutter_text_get_password_char -clutter_text_set_justify -clutter_text_get_justify -clutter_text_get_layout -clutter_text_set_line_alignment -clutter_text_get_line_alignment -clutter_text_set_line_wrap -clutter_text_get_line_wrap -clutter_text_set_line_wrap_mode -clutter_text_get_line_wrap_mode -clutter_text_set_max_length -clutter_text_get_max_length -clutter_text_set_selectable -clutter_text_get_selectable -clutter_text_set_selection -clutter_text_get_selection -clutter_text_set_selection_bound -clutter_text_get_selection_bound -clutter_text_set_single_line_mode -clutter_text_get_single_line_mode -clutter_text_set_use_markup -clutter_text_get_use_markup - - -clutter_text_set_editable -clutter_text_get_editable -clutter_text_insert_text -clutter_text_insert_unichar -clutter_text_delete_chars -clutter_text_delete_text -clutter_text_delete_selection -clutter_text_get_chars -clutter_text_set_cursor_color -clutter_text_get_cursor_color -clutter_text_set_selection_color -clutter_text_get_selection_color -clutter_text_set_selected_text_color -clutter_text_get_selected_text_color -clutter_text_set_cursor_position -clutter_text_get_cursor_position -clutter_text_set_cursor_visible -clutter_text_get_cursor_visible -clutter_text_set_cursor_size -clutter_text_get_cursor_size -clutter_text_get_cursor_rect - - -clutter_text_activate -clutter_text_coords_to_position -clutter_text_position_to_coords -clutter_text_set_preedit_string -clutter_text_get_layout_offsets - - -CLUTTER_IS_TEXT -CLUTTER_IS_TEXT_CLASS -CLUTTER_TEXT -CLUTTER_TEXT_CLASS -CLUTTER_TEXT_GET_CLASS -CLUTTER_TYPE_TEXT - - -ClutterTextPrivate -clutter_text_get_type -
- -
-clutter-animatable -ClutterAnimatable -ClutterAnimatable -ClutterAnimatableIface -clutter_animatable_animate_property -clutter_animatable_find_property -clutter_animatable_get_initial_state -clutter_animatable_set_final_state -clutter_animatable_interpolate_value - - -CLUTTER_TYPE_ANIMATABLE -CLUTTER_ANIMATABLE -CLUTTER_IS_ANIMATABLE -CLUTTER_ANIMATABLE_GET_IFACE - - -clutter_animatable_get_type -
- -
-Key Bindings -clutter-binding-pool -ClutterBindingPool -ClutterBindingActionFunc - - -clutter_binding_pool_new -clutter_binding_pool_get_for_class -clutter_binding_pool_find - - -clutter_binding_pool_install_action -clutter_binding_pool_install_closure -clutter_binding_pool_override_action -clutter_binding_pool_override_closure -clutter_binding_pool_find_action -clutter_binding_pool_remove_action -clutter_binding_pool_block_action -clutter_binding_pool_unblock_action - - -clutter_binding_pool_activate - - -CLUTTER_BINDING_POOL -CLUTTER_IS_BINDING_POOL -CLUTTER_TYPE_BINDING_POOL - - -ClutterBindingPoolClass -clutter_binding_pool_get_type -
- -
-EGL Specific Support -clutter-egl -clutter_egl_display -clutter_eglx_display -clutter_egl_get_egl_display -clutter_egl_set_kms_fd -clutter_egl_freeze_master_clock -clutter_egl_thaw_master_clock - -
- -
-Intel CE3100, CE4100 Specific Support -clutter-cex100 -clutter_cex100_set_plane -ClutterCex100BufferingMode -clutter_cex100_set_buffering_mode -clutter_cex100_get_egl_display -
- -
-Stage Manager -clutter-stage-manager -ClutterStageManager -ClutterStageManagerClass -clutter_stage_manager_get_default -clutter_stage_manager_set_default_stage -clutter_stage_manager_get_default_stage -clutter_stage_manager_list_stages -clutter_stage_manager_peek_stages - - -CLUTTER_TYPE_STAGE_MANAGER -CLUTTER_STAGE_MANAGER -CLUTTER_STAGE_MANAGER_CLASS -CLUTTER_IS_STAGE_MANAGER -CLUTTER_IS_STAGE_MANAGER_CLASS -CLUTTER_STAGE_MANAGER_GET_CLASS - - -clutter_stage_manager_get_type -
- -
-ClutterLayoutManager -clutter-layout-manager -ClutterLayoutManager -ClutterLayoutManagerClass -clutter_layout_manager_get_preferred_width -clutter_layout_manager_get_preferred_height -clutter_layout_manager_allocate -clutter_layout_manager_layout_changed -clutter_layout_manager_set_container - - -clutter_layout_manager_get_child_meta -clutter_layout_manager_child_set -clutter_layout_manager_child_set_property -clutter_layout_manager_child_get -clutter_layout_manager_child_get_property - - -clutter_layout_manager_find_child_property -clutter_layout_manager_list_child_properties - - -clutter_layout_manager_begin_animation -clutter_layout_manager_end_animation -clutter_layout_manager_get_animation_progress - - -CLUTTER_TYPE_LAYOUT_MANAGER -CLUTTER_LAYOUT_MANAGER -CLUTTER_LAYOUT_MANAGER_CLASS -CLUTTER_IS_LAYOUT_MANAGER -CLUTTER_IS_LAYOUT_MANAGER_CLASS -CLUTTER_LAYOUT_MANAGER_GET_CLASS - - -clutter_layout_manager_get_type -ClutterLayoutManagerPrivate -
- -
-ClutterFixedLayout -clutter-fixed-layout -ClutterFixedLayout -ClutterFixedLayoutClass -clutter_fixed_layout_new - - -CLUTTER_TYPE_FIXED_LAYOUT -CLUTTER_FIXED_LAYOUT -CLUTTER_FIXED_LAYOUT_CLASS -CLUTTER_IS_FIXED_LAYOUT -CLUTTER_IS_FIXED_LAYOUT_CLASS -CLUTTER_FIXED_LAYOUT_GET_CLASS - - -clutter_fixed_layout_get_type -
- -
-ClutterBinLayout -clutter-bin-layout -ClutterBinAlignment -ClutterBinLayout -ClutterBinLayoutClass -clutter_bin_layout_new -clutter_bin_layout_set_alignment -clutter_bin_layout_get_alignment -clutter_bin_layout_add - - -CLUTTER_TYPE_BIN_LAYOUT -CLUTTER_BIN_LAYOUT -CLUTTER_BIN_LAYOUT_CLASS -CLUTTER_IS_BIN_LAYOUT -CLUTTER_IS_BIN_LAYOUT_CLASS -CLUTTER_BIN_LAYOUT_GET_CLASS - - -ClutterBinLayoutPrivate -clutter_bin_layout_get_type -
- -
-ClutterBox -clutter-box -ClutterBox -ClutterBoxClass -clutter_box_new -clutter_box_set_layout_manager -clutter_box_get_layout_manager -clutter_box_set_color -clutter_box_get_color - - -clutter_box_pack -clutter_box_packv -clutter_box_pack_after -clutter_box_pack_before -clutter_box_pack_at - - -CLUTTER_TYPE_BOX -CLUTTER_BOX -CLUTTER_BOX_CLASS -CLUTTER_IS_BOX -CLUTTER_IS_BOX_CLASS -CLUTTER_BOX_GET_CLASS - - -ClutterBoxPrivate -clutter_box_get_type -
- -
-ClutterLayoutMeta -clutter-layout-meta -ClutterLayoutMeta -ClutterLayoutMetaClass -clutter_layout_meta_get_manager - - -CLUTTER_TYPE_LAYOUT_META -CLUTTER_LAYOUT_META -CLUTTER_LAYOUT_META_CLASS -CLUTTER_IS_LAYOUT_META -CLUTTER_IS_LAYOUT_META_CLASS -CLUTTER_LAYOUT_META_GET_CLASS - - -clutter_layout_meta_get_type -
- -
-clutter-flow-layout -ClutterFlowLayout -ClutterFlowOrientation -ClutterFlowLayout -ClutterFlowLayoutClass -clutter_flow_layout_new -clutter_flow_layout_set_homogeneous -clutter_flow_layout_get_homogeneous -clutter_flow_layout_set_orientation -clutter_flow_layout_get_orientation -clutter_flow_layout_set_snap_to_grid -clutter_flow_layout_get_snap_to_grid - - -clutter_flow_layout_set_column_spacing -clutter_flow_layout_get_column_spacing -clutter_flow_layout_set_row_spacing -clutter_flow_layout_get_row_spacing -clutter_flow_layout_set_column_width -clutter_flow_layout_get_column_width -clutter_flow_layout_set_row_height -clutter_flow_layout_get_row_height - - -CLUTTER_TYPE_FLOW_LAYOUT -CLUTTER_FLOW_LAYOUT -CLUTTER_FLOW_LAYOUT_CLASS -CLUTTER_IS_FLOW_LAYOUT -CLUTTER_IS_FLOW_LAYOUT_CLASS -CLUTTER_FLOW_LAYOUT_GET_CLASS - -ClutterFlowLayoutPrivate -clutter_flow_layout_get_type -
- -
-clutter-grid-layout -ClutterGridLayout -ClutterGridPosition -ClutterGridLayout -ClutterGridLayoutClass -clutter_grid_layout_new -clutter_grid_layout_attach -clutter_grid_layout_attach_next_to -clutter_grid_layout_get_child_at -clutter_grid_layout_insert_column -clutter_grid_layout_insert_row -clutter_grid_layout_insert_next_to - - -clutter_grid_layout_set_orientation -clutter_grid_layout_get_orientation -clutter_grid_layout_set_column_homogeneous -clutter_grid_layout_get_column_homogeneous -clutter_grid_layout_set_row_homogeneous -clutter_grid_layout_get_row_homogeneous -clutter_grid_layout_set_column_spacing -clutter_grid_layout_get_column_spacing -clutter_grid_layout_set_row_spacing -clutter_grid_layout_get_row_spacing - - -CLUTTER_TYPE_GRID_LAYOUT -CLUTTER_GRID_LAYOUT -CLUTTER_GRID_LAYOUT_CLASS -CLUTTER_GRID_LAYOUT_GET_CLASS -CLUTTER_IS_GRID_LAYOUT -CLUTTER_IS_GRID_LAYOUT_CLASS - - -ClutterGridLayoutPrivate -clutter_grid_layout_get_type -
- -
-ClutterBoxLayout -clutter-box-layout -ClutterBoxAlignment -ClutterBoxLayout -ClutterBoxLayoutClass -clutter_box_layout_new -clutter_box_layout_set_pack_start -clutter_box_layout_get_pack_start -clutter_box_layout_set_spacing -clutter_box_layout_get_spacing -clutter_box_layout_set_homogeneous -clutter_box_layout_get_homogeneous -ClutterOrientation -clutter_box_layout_get_orientation -clutter_box_layout_set_orientation -clutter_box_layout_set_vertical -clutter_box_layout_get_vertical - - -clutter_box_layout_pack - - -clutter_box_layout_set_alignment -clutter_box_layout_get_alignment -clutter_box_layout_set_expand -clutter_box_layout_get_expand -clutter_box_layout_set_fill -clutter_box_layout_get_fill - - -clutter_box_layout_set_use_animations -clutter_box_layout_get_use_animations -clutter_box_layout_set_easing_duration -clutter_box_layout_get_easing_duration -clutter_box_layout_set_easing_mode -clutter_box_layout_get_easing_mode - - -CLUTTER_TYPE_BOX_LAYOUT -CLUTTER_BOX_LAYOUT -CLUTTER_BOX_LAYOUT_CLASS -CLUTTER_IS_BOX_LAYOUT -CLUTTER_IS_BOX_LAYOUT_CLASS -CLUTTER_BOX_LAYOUT_GET_CLASS - - -ClutterBoxLayoutPrivate -clutter_box_layout_get_type -
- -
-clutter-table-layout -ClutterTableAlignment -ClutterTableLayout -ClutterTableLayoutClass -clutter_table_layout_new -clutter_table_layout_set_row_spacing -clutter_table_layout_get_row_spacing -clutter_table_layout_set_column_spacing -clutter_table_layout_get_column_spacing -clutter_table_layout_get_row_count -clutter_table_layout_get_column_count - - -clutter_table_layout_pack - - -clutter_table_layout_set_alignment -clutter_table_layout_get_alignment -clutter_table_layout_set_expand -clutter_table_layout_get_expand -clutter_table_layout_set_fill -clutter_table_layout_get_fill -clutter_table_layout_get_span -clutter_table_layout_set_span - - -clutter_table_layout_set_use_animations -clutter_table_layout_get_use_animations -clutter_table_layout_set_easing_duration -clutter_table_layout_get_easing_duration -clutter_table_layout_set_easing_mode -clutter_table_layout_get_easing_mode - - -CLUTTER_TYPE_TABLE_LAYOUT -CLUTTER_TABLE_LAYOUT -CLUTTER_TABLE_LAYOUT_CLASS -CLUTTER_IS_TABLE_LAYOUT -CLUTTER_IS_TABLE_LAYOUT_CLASS -CLUTTER_TABLE_LAYOUT_GET_CLASS - - -ClutterTableLayoutPrivate -clutter_table_layout_get_type -
- -
-clutter-animator -ClutterAnimator -ClutterAnimator -ClutterAnimatorClass -clutter_animator_new -clutter_animator_set -clutter_animator_set_key -clutter_animator_remove_key -clutter_animator_get_keys -clutter_animator_start -clutter_animator_compute_value - - -clutter_animator_set_timeline -clutter_animator_get_timeline -clutter_animator_set_duration -clutter_animator_get_duration - - -clutter_animator_property_set_ease_in -clutter_animator_property_get_ease_in -ClutterInterpolation -clutter_animator_property_set_interpolation -clutter_animator_property_get_interpolation - - -ClutterAnimatorKey -clutter_animator_key_get_object -clutter_animator_key_get_property_name -clutter_animator_key_get_property_type -clutter_animator_key_get_mode -clutter_animator_key_get_progress -clutter_animator_key_get_value - - -CLUTTER_TYPE_ANIMATOR -CLUTTER_TYPE_ANIMATOR_KEY -CLUTTER_ANIMATOR -CLUTTER_ANIMATOR_CLASS -CLUTTER_IS_ANIMATOR -CLUTTER_IS_ANIMATOR_CLASS -CLUTTER_ANIMATOR_GET_CLASS - - -clutter_animator_get_type -clutter_animator_key_get_type -ClutterAnimatorPrivate -
- -
-clutter-actor-meta -ClutterActorMeta -ClutterActorMeta -ClutterActorMetaClass -clutter_actor_meta_set_name -clutter_actor_meta_get_name -clutter_actor_meta_set_enabled -clutter_actor_meta_get_enabled - - -clutter_actor_meta_get_actor - - -CLUTTER_TYPE_ACTOR_META -CLUTTER_ACTOR_META -CLUTTER_ACTOR_META_CLASS -CLUTTER_IS_ACTOR_META -CLUTTER_IS_ACTOR_META_CLASS -CLUTTER_ACTOR_META_GET_CLASS -clutter_actor_meta_get_type - - -ClutterActorMetaPrivate -
- -
-clutter-action -ClutterAction -ClutterAction -ClutterActionClass - - -CLUTTER_TYPE_ACTION -CLUTTER_ACTION -CLUTTER_ACTION_CLASS -CLUTTER_IS_ACTION -CLUTTER_IS_ACTION_CLASS -CLUTTER_ACTION_GET_CLASS -clutter_action_get_type -
- -
-clutter-constraint -ClutterConstraint -ClutterConstraint -ClutterConstraintClass - - -CLUTTER_TYPE_CONSTRAINT -CLUTTER_CONSTRAINT -CLUTTER_CONSTRAINT_CLASS -CLUTTER_IS_CONSTRAINT -CLUTTER_IS_CONSTRAINT_CLASS -CLUTTER_CONSTRAINT_GET_CLASS -clutter_constraint_get_type -
- -
-clutter-drag-action -ClutterDragAction -ClutterDragAction -ClutterDragActionClass -clutter_drag_action_new -clutter_drag_action_set_drag_threshold -clutter_drag_action_get_drag_threshold -clutter_drag_action_set_drag_handle -clutter_drag_action_get_drag_handle -ClutterDragAxis -clutter_drag_action_set_drag_axis -clutter_drag_action_get_drag_axis -clutter_drag_action_set_drag_area -clutter_drag_action_get_drag_area - - -clutter_drag_action_get_press_coords -clutter_drag_action_get_motion_coords - - -CLUTTER_TYPE_DRAG_ACTION -CLUTTER_DRAG_ACTION -CLUTTER_DRAG_ACTION_CLASS -CLUTTER_IS_DRAG_ACTION -CLUTTER_IS_DRAG_ACTION_CLASS -CLUTTER_DRAG_ACTION_GET_CLASS -clutter_drag_action_get_type - - -ClutterDragActionPrivate -
- -
-clutter-bind-constraint -ClutterBindConstraint -ClutterBindConstraint -ClutterBindCoordinate -clutter_bind_constraint_new -clutter_bind_constraint_set_source -clutter_bind_constraint_get_source -clutter_bind_constraint_set_coordinate -clutter_bind_constraint_get_coordinate -clutter_bind_constraint_set_offset -clutter_bind_constraint_get_offset - -CLUTTER_TYPE_BIND_CONSTRAINT -CLUTTER_BIND_CONSTRAINT -CLUTTER_IS_BIND_CONSTRAINT - -ClutterBindConstraintClass -clutter_bind_constraint_get_type -
- -
-clutter-align-constraint -ClutterAlignConstraint -ClutterAlignConstraint -ClutterAlignAxis -clutter_align_constraint_new -clutter_align_constraint_set_source -clutter_align_constraint_get_source -clutter_align_constraint_set_align_axis -clutter_align_constraint_get_align_axis -clutter_align_constraint_set_factor -clutter_align_constraint_get_factor - - -CLUTTER_TYPE_ALIGN_CONSTRAINT -CLUTTER_ALIGN_CONSTRAINT -CLUTTER_IS_ALIGN_CONSTRAINT - - -ClutterAlignConstraintClass -clutter_align_constraint_get_type -
- -
-clutter-state -ClutterState -ClutterState -ClutterStateClass -clutter_state_new -clutter_state_set_state -clutter_state_get_state -clutter_state_warp_to_state -clutter_state_set -clutter_state_set_key -clutter_state_set_duration -clutter_state_get_duration -clutter_state_get_states -clutter_state_get_keys -clutter_state_remove_key -clutter_state_get_timeline -clutter_state_set_animator -clutter_state_get_animator - - -ClutterStateKey -clutter_state_key_get_source_state_name -clutter_state_key_get_target_state_name -clutter_state_key_get_object -clutter_state_key_get_property_name -clutter_state_key_get_mode -clutter_state_key_get_value -clutter_state_key_get_property_type -clutter_state_key_get_pre_delay -clutter_state_key_get_post_delay - - -CLUTTER_TYPE_STATE -CLUTTER_TYPE_STATE_KEY -CLUTTER_STATE -CLUTTER_STATE_CLASS -CLUTTER_IS_STATE -CLUTTER_IS_STATE_CLASS -CLUTTER_STATE_GET_CLASS -clutter_state_get_type -clutter_state_key_get_type - - -ClutterStatePrivate -
- -
-clutter-click-action -ClutterClickAction -ClutterClickAction -ClutterClickActionClass -ClutterLongPressState -clutter_click_action_new - - -clutter_click_action_get_button -clutter_click_action_get_state -clutter_click_action_get_coords - - -clutter_click_action_release - - -CLUTTER_TYPE_CLICK_ACTION -CLUTTER_CLICK_ACTION -CLUTTER_CLICK_ACTION_CLASS -CLUTTER_IS_CLICK_ACTION -CLUTTER_IS_CLICK_ACTION_CLASS -CLUTTER_CLICK_ACTION_GET_CLASS -clutter_click_action_get_type - - -ClutterClickActionPrivate -
- -
-ClutterEffect -clutter-effect -ClutterEffect -ClutterEffectClass -ClutterEffectPaintFlags -clutter_effect_queue_repaint - -CLUTTER_TYPE_EFFECT -CLUTTER_EFFECT -CLUTTER_EFFECT_CLASS -CLUTTER_IS_EFFECT -CLUTTER_IS_EFFECT_CLASS -CLUTTER_EFFECT_GET_CLASS - -clutter_effect_get_type -
- -
-ClutterOffscreenEffect -clutter-offscreen-effect -ClutterOffscreenEffect -ClutterOffscreenEffectClass -clutter_offscreen_effect_get_target -clutter_offscreen_effect_get_texture -clutter_offscreen_effect_create_texture -clutter_offscreen_effect_paint_target -clutter_offscreen_effect_get_target_size -clutter_offscreen_effect_get_target_rect - -CLUTTER_TYPE_OFFSCREEN_EFFECT -CLUTTER_OFFSCREEN_EFFECT -CLUTTER_OFFSCREEN_EFFECT_CLASS -CLUTTER_IS_OFFSCREEN_EFFECT -CLUTTER_IS_OFFSCREEN_EFFECT_CLASS -CLUTTER_OFFSCREEN_EFFECT_GET_CLASS - -ClutterOffscreenEffectPrivate -clutter_offscreen_effect_get_type -
- -
-ClutterShaderEffect -clutter-shader-effect -ClutterShaderType -ClutterShaderEffect -ClutterShaderEffectClass -clutter_shader_effect_new -clutter_shader_effect_set_uniform -clutter_shader_effect_set_uniform_value - -clutter_shader_effect_set_shader_source -clutter_shader_effect_get_program -clutter_shader_effect_get_shader - -CLUTTER_TYPE_SHADER_EFFECT -CLUTTER_SHADER_EFFECT -CLUTTER_SHADER_EFFECT_CLASS -CLUTTER_IS_SHADER_EFFECT -CLUTTER_IS_SHADER_EFFECT_CLASS -CLUTTER_SHADER_EFFECT_GET_CLASS - -ClutterShaderEffectPrivate -clutter_shader_effect_get_type -
- -
-ClutterBlurEffect -clutter-blur-effect -ClutterBlurEffect -clutter_blur_effect_new - -CLUTTER_TYPE_BLUR_EFFECT -CLUTTER_BLUR_EFFECT -CLUTTER_IS_BLUR_EFFECT - -ClutterBlurEffectClass -clutter_blur_effect_get_type -
- -
-ClutterColorizeEffect -clutter-colorize-effect -ClutterColorizeEffect -clutter_colorize_effect_new -clutter_colorize_effect_set_tint -clutter_colorize_effect_get_tint - -CLUTTER_TYPE_COLORIZE_EFFECT -CLUTTER_COLORIZE_EFFECT -CLUTTER_IS_COLORIZE_EFFECT - -ClutterColorizeEffectClass -clutter_colorize_effect_get_type -
- -
-ClutterDesaturateEffect -clutter-desaturate-effect -ClutterDesaturateEffect -clutter_desaturate_effect_new -clutter_desaturate_effect_set_factor -clutter_desaturate_effect_get_factor - -CLUTTER_TYPE_DESATURATE_EFFECT -CLUTTER_DESATURATE_EFFECT -CLUTTER_IS_DESATURATE_EFFECT - -ClutterDesaturateEffectClass -clutter_desaturate_effect_get_type -
- -
-clutter-deform-effect -ClutterDeformEffect -ClutterDeformEffectClass -clutter_deform_effect_set_back_material -clutter_deform_effect_get_back_material -clutter_deform_effect_set_n_tiles -clutter_deform_effect_get_n_tiles - -clutter_deform_effect_invalidate - -CLUTTER_TYPE_DEFORM_EFFECT -CLUTTER_DEFORM_EFFECT -CLUTTER_DEFORM_EFFECT_CLASS -CLUTTER_IS_DEFORM_EFFECT -CLUTTER_IS_DEFORM_EFFECT_CLASS -CLUTTER_DEFORM_EFFECT_GET_CLASS - -ClutterDeformEffectPrivate -clutter_deform_effect_get_type -
- -
-clutter-page-turn-effect -ClutterPageTurnEffect -clutter_page_turn_effect_new -clutter_page_turn_effect_set_period -clutter_page_turn_effect_get_period -clutter_page_turn_effect_set_angle -clutter_page_turn_effect_get_angle -clutter_page_turn_effect_set_radius -clutter_page_turn_effect_get_radius - -CLUTTER_TYPE_PAGE_TURN_EFFECT -CLUTTER_PAGE_TURN_EFFECT -CLUTTER_IS_PAGE_TURN_EFFECT - -ClutterPageTurnEffectClass -clutter_page_turn_effect_get_type -
- -
-ClutterBrightnessContrastEffect -clutter-brightness-contrast-effect -ClutterBrightnessContrastEffect -clutter_brightness_contrast_effect_new -clutter_brightness_contrast_effect_set_brightness -clutter_brightness_contrast_effect_set_brightness_full -clutter_brightness_contrast_effect_get_brightness -clutter_brightness_contrast_effect_set_contrast -clutter_brightness_contrast_effect_set_contrast_full -clutter_brightness_contrast_effect_get_contrast - -CLUTTER_TYPE_BRIGHTNESS_CONTRAST_EFFECT -CLUTTER_BRIGHTNESS_CONTRAST_EFFECT -CLUTTER_IS_BRIGHTNESS_CONTRAST_EFFECT - -ClutterBrightnessContrastEffectClass -clutter_brightness_contrast_effect_get_type -
- -
-clutter-settings -ClutterSettings -clutter_settings_get_default - -CLUTTER_TYPE_SETTINGS -CLUTTER_SETTINGS -CLUTTER_IS_SETTINGS - -ClutterSettingsClass -clutter_settings_get_type -
- -
-clutter-path-constraint -ClutterPathConstraint -clutter_path_constraint_new -clutter_path_constraint_set_path -clutter_path_constraint_get_path -clutter_path_constraint_set_offset -clutter_path_constraint_get_offset - -CLUTTER_PATH_CONSTRAINT -CLUTTER_IS_PATH_CONSTRAINT -CLUTTER_TYPE_PATH_CONSTRAINT - -ClutterPathConstraintClass -clutter_path_constraint_get_type -
- -
-clutter-snap-constraint -ClutterSnapEdge -ClutterSnapConstraint -clutter_snap_constraint_new -clutter_snap_constraint_set_source -clutter_snap_constraint_get_source -clutter_snap_constraint_set_edges -clutter_snap_constraint_get_edges -clutter_snap_constraint_set_offset -clutter_snap_constraint_get_offset - -CLUTTER_SNAP_CONSTRAINT -CLUTTER_IS_SNAP_CONSTRAINT -CLUTTER_TYPE_SNAP_CONSTRAINT - -ClutterSnapConstraintClass -clutter_snap_constraint_get_type -
- -
-clutter-gesture-action -ClutterGestureAction -ClutterGestureActionClass -clutter_gesture_action_new -clutter_gesture_action_get_last_event -clutter_gesture_action_get_press_coords -clutter_gesture_action_get_motion_coords -clutter_gesture_action_get_motion_delta -clutter_gesture_action_get_release_coords -clutter_gesture_action_get_velocity -clutter_gesture_action_get_n_touch_points -clutter_gesture_action_set_n_touch_points -clutter_gesture_action_get_n_current_points -clutter_gesture_action_get_sequence -clutter_gesture_action_get_device -clutter_gesture_action_get_threshold_trigger_distance -clutter_gesture_action_set_threshold_trigger_distance -ClutterGestureTriggerEdge -clutter_gesture_action_set_threshold_trigger_edge -clutter_gesture_action_get_threshold_trigger_edge -clutter_gesture_action_cancel - -CLUTTER_GESTURE_ACTION -CLUTTER_GESTURE_ACTION_CLASS -CLUTTER_IS_GESTURE_ACTION -CLUTTER_IS_GESTURE_ACTION_CLASS -CLUTTER_GESTURE_ACTION_GET_CLASS -CLUTTER_TYPE_GESTURE_ACTION - -ClutterGestureActionPrivate -clutter_gesture_action_get_type -clutter_gesture_action_get_threshold_trigger_egde -
- -
-clutter-swipe-action -ClutterSwipeAction -ClutterSwipeActionClass -ClutterSwipeDirection -clutter_swipe_action_new - -CLUTTER_SWIPE_ACTION -CLUTTER_SWIPE_ACTION_CLASS -CLUTTER_IS_SWIPE_ACTION -CLUTTER_IS_SWIPE_ACTION_CLASS -CLUTTER_SWIPE_ACTION_GET_CLASS -CLUTTER_TYPE_SWIPE_ACTION - -ClutterSwipeActionPrivate -clutter_swipe_action_get_type -
- -
-clutter-drop-action -ClutterDropAction -ClutterDropActionClass -clutter_drop_action_new - -CLUTTER_TYPE_DROP_ACTION -CLUTTER_DROP_ACTION -CLUTTER_DROP_ACTION_CLASS -CLUTTER_IS_DROP_ACTION -CLUTTER_IS_DROP_ACTION_CLASS -CLUTTER_DROP_ACTION_GET_CLASS - -ClutterDropActionPrivate -clutter_drop_action_get_type -
- -
-clutter-rotate-action -ClutterRotateAction -ClutterRotateActionClass -clutter_rotate_action_new - -CLUTTER_ROTATE_ACTION -CLUTTER_ROTATE_ACTION_CLASS -CLUTTER_IS_ROTATE_ACTION -CLUTTER_IS_ROTATE_ACTION_CLASS -CLUTTER_ROTATE_ACTION_GET_CLASS -CLUTTER_TYPE_ROTATE_ACTION - -ClutterRotateActionPrivate -clutter_rotate_action_get_type -
- -
-clutter-transition -ClutterTransition -ClutterTransitionClass -clutter_transition_set_from -clutter_transition_set_from_value -clutter_transition_set_to -clutter_transition_set_to_value -clutter_transition_set_interval -clutter_transition_get_interval -clutter_transition_set_animatable -clutter_transition_get_animatable -clutter_transition_set_remove_on_complete -clutter_transition_get_remove_on_complete - -CLUTTER_TYPE_TRANSITION -CLUTTER_TRANSITION -CLUTTER_TRANSITION_CLASS -CLUTTER_IS_TRANSITION -CLUTTER_IS_TRANSITION_CLASS -CLUTTER_TRANSITION_GET_CLASS - -ClutterTransitionPrivate -clutter_transition_get_type -
- -
-clutter-property-transition -ClutterPropertyTransition -ClutterPropertyTransitionClass -clutter_property_transition_new -clutter_property_transition_set_property_name -clutter_property_transition_get_property_name - -CLUTTER_TYPE_PROPERTY_TRANSITION -CLUTTER_PROPERTY_TRANSITION -CLUTTER_PROPERTY_TRANSITION_CLASS -CLUTTER_IS_PROPERTY_TRANSITION -CLUTTER_IS_PROPERTY_TRANSITION_CLASS -CLUTTER_PROPERTY_TRANSITION_GET_CLASS - -ClutterPropertyTransitionPrivate -clutter_property_transition_get_type -
- -
-clutter-text-buffer -CLUTTER_TEXT_BUFFER_MAX_SIZE -ClutterTextBuffer -ClutterTextBufferClass -clutter_text_buffer_new -clutter_text_buffer_new_with_text -clutter_text_buffer_set_text -clutter_text_buffer_get_text -clutter_text_buffer_get_bytes -clutter_text_buffer_get_length -clutter_text_buffer_set_max_length -clutter_text_buffer_get_max_length -clutter_text_buffer_insert_text -clutter_text_buffer_delete_text -clutter_text_buffer_emit_inserted_text -clutter_text_buffer_emit_deleted_text - -CLUTTER_TYPE_TEXT_BUFFER -CLUTTER_TEXT_BUFFER -CLUTTER_TEXT_BUFFER_CLASS -CLUTTER_IS_TEXT_BUFFER -CLUTTER_IS_TEXT_BUFFER_CLASS -CLUTTER_TEXT_BUFFER_GET_CLASS - -ClutterTextBufferPrivate -clutter_text_buffer_get_type -
- -
-clutter-content -ClutterContent -ClutterContentIface -clutter_content_get_preferred_size -clutter_content_invalidate - -CLUTTER_TYPE_CONTENT -CLUTTER_CONTENT -CLUTTER_CONTENT_GET_IFACE -CLUTTER_IS_CONTENT - -clutter_content_get_type -
- -
-clutter-paint-node -ClutterPaintNode -ClutterPaintNodeClass -clutter_paint_node_ref -clutter_paint_node_unref -clutter_paint_node_set_name - -clutter_paint_node_add_child - -clutter_paint_node_add_rectangle -clutter_paint_node_add_texture_rectangle -clutter_paint_node_add_path -clutter_paint_node_add_primitive - -CLUTTER_VALUE_HOLDS_PAINT_NODE -clutter_value_set_paint_node -clutter_value_take_paint_node -clutter_value_get_paint_node -clutter_value_dup_paint_node - -CLUTTER_TYPE_PAINT_NODE -CLUTTER_PAINT_NODE -CLUTTER_IS_PAINT_NODE - -ClutterPaintNodePrivate -clutter_paint_node_get_type -
- -
-clutter-paint-nodes -ClutterColorNode -ClutterColorNodeClass -clutter_color_node_new - -ClutterTextureNode -ClutterTextureNodeClass -clutter_texture_node_new - -ClutterPipelineNode -ClutterPipelineNodeClass -clutter_pipeline_node_new - -ClutterTextNode -ClutterTextNodeClass -clutter_text_node_new - -ClutterClipNode -ClutterClipNodeClass -clutter_clip_node_new - -CLUTTER_TYPE_COLOR_NODE -CLUTTER_TYPE_TEXTURE_NODE -CLUTTER_TYPE_PIPELINE_NODE -CLUTTER_TYPE_TEXT_NODE -CLUTTER_TYPE_CLIP_NODE -CLUTTER_COLOR_NODE -CLUTTER_TEXTURE_NODE -CLUTTER_PIPELINE_NODE -CLUTTER_TEXT_NODE -CLUTTER_CLIP_NODE -CLUTTER_IS_COLOR_NODE -CLUTTER_IS_TEXTURE_NODE -CLUTTER_IS_PIPELINE_NODE -CLUTTER_IS_TEXT_NODE -CLUTTER_IS_CLIP_NODE - -clutter_color_node_get_type -clutter_texture_node_get_type -clutter_pipeline_node_get_type -clutter_text_node_get_type -clutter_clip_node_get_type -
- -
-clutter-canvas -ClutterCanvas -ClutterCanvasClass -clutter_canvas_new -clutter_canvas_set_size -clutter_canvas_set_scale_factor -clutter_canvas_get_scale_factor - -CLUTTER_TYPE_CANVAS -CLUTTER_CANVAS -CLUTTER_CANVAS_CLASS -CLUTTER_IS_CANVAS -CLUTTER_IS_CANVAS_CLASS -CLUTTER_CANVAS_GET_CLASS - -ClutterCanvasPrivate -clutter_canvas_get_type -
- -
-clutter-image -ClutterImage -ClutterImageClass -CLUTTER_IMAGE_ERROR -ClutterImageError -clutter_image_new -clutter_image_set_data -clutter_image_set_bytes -clutter_image_set_area -clutter_image_get_texture - -CLUTTER_TYPE_IMAGE -CLUTTER_IMAGE -CLUTTER_IMAGE_CLASS -CLUTTER_IS_IMAGE -CLUTTER_IS_IMAGE_CLASS -CLUTTER_IMAGE_GET_CLASS - -ClutterImagePrivate -clutter_image_get_type -clutter_image_error_quark -
- -
-clutter-geometric-types -ClutterPoint -ClutterSize -ClutterRect -ClutterVertex -ClutterActorBox -ClutterGeometry -ClutterKnot -ClutterPaintVolume -ClutterMatrix - - -CLUTTER_POINT_INIT -CLUTTER_POINT_INIT_ZERO -clutter_point_zero -clutter_point_alloc -clutter_point_init -clutter_point_copy -clutter_point_free -clutter_point_equals -clutter_point_distance - - -CLUTTER_SIZE_INIT -CLUTTER_SIZE_INIT_ZERO -clutter_size_alloc -clutter_size_init -clutter_size_copy -clutter_size_free -clutter_size_equals - - -CLUTTER_RECT_INIT -CLUTTER_RECT_INIT_ZERO -clutter_rect_zero -clutter_rect_alloc -clutter_rect_init -clutter_rect_copy -clutter_rect_free -clutter_rect_equals -clutter_rect_normalize -clutter_rect_get_center -clutter_rect_contains_point -clutter_rect_contains_rect -clutter_rect_union -clutter_rect_intersection -clutter_rect_offset -clutter_rect_inset -clutter_rect_clamp_to_pixel -clutter_rect_get_x -clutter_rect_get_y -clutter_rect_get_width -clutter_rect_get_height - - -CLUTTER_VERTEX_INIT -CLUTTER_VERTEX_INIT_ZERO -clutter_vertex_new -clutter_vertex_alloc -clutter_vertex_init -clutter_vertex_copy -clutter_vertex_free -clutter_vertex_equal - - -CLUTTER_ACTOR_BOX_INIT -CLUTTER_ACTOR_BOX_INIT_ZERO -clutter_actor_box_new -clutter_actor_box_alloc -clutter_actor_box_init -clutter_actor_box_init_rect -clutter_actor_box_copy -clutter_actor_box_free -clutter_actor_box_equal -clutter_actor_box_get_x -clutter_actor_box_get_y -clutter_actor_box_get_width -clutter_actor_box_get_height -clutter_actor_box_set_origin -clutter_actor_box_get_origin -clutter_actor_box_set_size -clutter_actor_box_get_size -clutter_actor_box_get_area -clutter_actor_box_contains -clutter_actor_box_from_vertices -clutter_actor_box_clamp_to_pixel -clutter_actor_box_interpolate -clutter_actor_box_union - - -clutter_paint_volume_copy -clutter_paint_volume_free -clutter_paint_volume_set_origin -clutter_paint_volume_get_origin -clutter_paint_volume_set_width -clutter_paint_volume_get_width -clutter_paint_volume_set_height -clutter_paint_volume_get_height -clutter_paint_volume_set_depth -clutter_paint_volume_get_depth -clutter_paint_volume_set_from_allocation -clutter_paint_volume_union -clutter_paint_volume_union_box - - -clutter_matrix_alloc -clutter_matrix_free -clutter_matrix_init_from_array -clutter_matrix_init_from_matrix -clutter_matrix_init_identity - - -clutter_knot_copy -clutter_knot_free -clutter_knot_equal - - -clutter_geometry_union -clutter_geometry_intersects - - -CLUTTER_TYPE_ACTOR_BOX -CLUTTER_TYPE_GEOMETRY -CLUTTER_TYPE_KNOT -CLUTTER_TYPE_MATRIX -CLUTTER_TYPE_PAINT_VOLUME -CLUTTER_TYPE_POINT -CLUTTER_TYPE_RECT -CLUTTER_TYPE_SIZE -CLUTTER_TYPE_VERTEX - -clutter_actor_box_get_type -clutter_geometry_get_type -clutter_knot_get_type -clutter_matrix_get_type -clutter_paint_volume_get_type -clutter_point_get_type -clutter_rect_get_type -clutter_size_get_type -clutter_vertex_get_type -
- -
-clutter-keyframe-transition -ClutterKeyframeTransition -ClutterKeyframeTransitionClass -clutter_keyframe_transition_new -clutter_keyframe_transition_set -clutter_keyframe_transition_set_key_frames -clutter_keyframe_transition_set_modes -clutter_keyframe_transition_set_values - - -clutter_keyframe_transition_get_n_key_frames -clutter_keyframe_transition_set_key_frame -clutter_keyframe_transition_get_key_frame -clutter_keyframe_transition_clear - -CLUTTER_TYPE_KEYFRAME_TRANSITION -CLUTTER_KEYFRAME_TRANSITION -CLUTTER_KEYFRAME_TRANSITION_CLASS -CLUTTER_IS_KEYFRAME_TRANSITION -CLUTTER_IS_KEYFRAME_TRANSITION_CLASS -CLUTTER_KEYFRAME_TRANSITION_GET_CLASS - -ClutterKeyframeTransitionPrivate -clutter_keyframe_transition_get_type -
- -
-clutter-transition-group -ClutterTransitionGroup -ClutterTransitionGroupClass -clutter_transition_group_new -clutter_transition_group_add_transition -clutter_transition_group_remove_transition -clutter_transition_group_remove_all - -CLUTTER_TYPE_TRANSITION_GROUP -CLUTTER_TRANSITION_GROUP -CLUTTER_TRANSITION_GROUP_CLASS -CLUTTER_IS_TRANSITION_GROUP -CLUTTER_IS_TRANSITION_GROUP_CLASS -CLUTTER_TRANSITION_GROUP_GET_CLASS - -ClutterTransitionGroupPrivate -clutter_transition_group_get_type -
- -
-clutter-scroll-actor -ClutterScrollActor -ClutterScrollActorClass -clutter_scroll_actor_new -ClutterScrollMode -clutter_scroll_actor_set_scroll_mode -clutter_scroll_actor_get_scroll_mode -clutter_scroll_actor_scroll_to_point -clutter_scroll_actor_scroll_to_rect - -CLUTTER_TYPE_SCROLL_ACTOR -CLUTTER_SCROLL_ACTOR -CLUTTER_SCROLL_ACTOR_CLASS -CLUTTER_IS_SCROLL_ACTOR -CLUTTER_IS_SCROLL_ACTOR_CLASS -CLUTTER_SCROLL_ACTOR_GET_CLASS - -ClutterScrollActorPrivate -clutter_scroll_actor_get_type -
- -
-clutter-zoom-action -ClutterZoomAction -ClutterZoomActionClass -clutter_zoom_action_new -ClutterZoomAxis -clutter_zoom_action_set_zoom_axis -clutter_zoom_action_get_zoom_axis - -clutter_zoom_action_get_focal_point -clutter_zoom_action_get_transformed_focal_point - -CLUTTER_IS_ZOOM_ACTION -CLUTTER_IS_ZOOM_ACTION_CLASS -CLUTTER_TYPE_ZOOM_ACTION -CLUTTER_ZOOM_ACTION -CLUTTER_ZOOM_ACTION_CLASS -CLUTTER_ZOOM_ACTION_GET_CLASS - -ClutterZoomActionPrivate -clutter_zoom_action_get_type -
- -
-clutter-pan-action -ClutterPanAction -ClutterPanActionClass -clutter_pan_action_new -ClutterPanAxis -clutter_pan_action_set_pan_axis -clutter_pan_action_get_pan_axis -clutter_pan_action_set_interpolate -clutter_pan_action_get_interpolate -clutter_pan_action_set_deceleration -clutter_pan_action_get_deceleration -clutter_pan_action_set_acceleration_factor -clutter_pan_action_get_acceleration_factor - -clutter_pan_action_get_interpolated_coords -clutter_pan_action_get_interpolated_delta -clutter_pan_action_get_motion_coords -clutter_pan_action_get_motion_delta -clutter_pan_action_get_constrained_motion_delta - -CLUTTER_IS_PAN_ACTION -CLUTTER_IS_PAN_ACTION_CLASS -CLUTTER_TYPE_PAN_ACTION -CLUTTER_PAN_ACTION -CLUTTER_PAN_ACTION_CLASS -CLUTTER_PAN_ACTION_GET_CLASS - -ClutterPanActionPrivate -clutter_pan_action_get_type -
- -
-clutter-tap-action -ClutterTapAction -ClutterTapActionClass -clutter_tap_action_new - -CLUTTER_IS_TAP_ACTION -CLUTTER_IS_TAP_ACTION_CLASS -CLUTTER_TYPE_TAP_ACTION -CLUTTER_TAP_ACTION -CLUTTER_TAP_ACTION_CLASS -CLUTTER_TAP_ACTION_GET_CLASS - -ClutterTapActionPrivate -clutter_tap_action_get_type -
- -
-clutter-mir -clutter_mir_disable_event_retrieval -clutter_mir_set_connection -clutter_mir_stage_get_mir_surface -clutter_mir_stage_set_mir_surface -
- -
-cally-stage -CallyStage -CallyStage -CallyStageClass -cally_stage_new - -CALLY_STAGE -CALLY_IS_STAGE -CALLY_TYPE_STAGE -CALLY_STAGE_CLASS -CALLY_IS_STAGE_CLASS -CALLY_STAGE_GET_CLASS - -CallyStagePrivate -cally_stage_get_type -
- -
-cally-clone -CallyClone -CallyClone -CallyCloneClass -cally_clone_new - -CALLY_CLONE -CALLY_IS_CLONE -CALLY_TYPE_CLONE -CALLY_CLONE_CLASS -CALLY_IS_CLONE_CLASS -CALLY_CLONE_GET_CLASS - -CallyClonePrivate -cally_clone_get_type -
- -
-cally-actor -CallyActor -CallyActor -CallyActorClass -CallyActionFunc -CallyActionCallback -cally_actor_new -cally_actor_add_action -cally_actor_add_action_full -cally_actor_remove_action -cally_actor_remove_action_by_name - -CALLY_ACTOR -CALLY_IS_ACTOR -CALLY_TYPE_ACTOR -CALLY_ACTOR_CLASS -CALLY_IS_ACTOR_CLASS -CALLY_ACTOR_GET_CLASS - -CallyActorPrivate -cally_actor_get_type -
- -
-cally-text -CallyText -CallyText -CallyTextClass -cally_text_new - -CALLY_TEXT -CALLY_IS_TEXT -CALLY_TYPE_TEXT -CALLY_TEXT_CLASS -CALLY_IS_TEXT_CLASS -CALLY_TEXT_GET_CLASS - -CallyTextPrivate -cally_text_get_type -
- -
-cally-util -CallyUtil -CallyUtil -CallyUtilClass - -CALLY_UTIL -CALLY_IS_UTIL -CALLY_TYPE_UTIL -CALLY_UTIL_CLASS -CALLY_IS_UTIL_CLASS -CALLY_UTIL_GET_CLASS - -CallyUtilPrivate -cally_util_get_type -
- -
-cally-texture -CallyTexture -CallyTexture -CallyTextureClass -cally_texture_new - -CALLY_TEXTURE -CALLY_IS_TEXTURE -CALLY_TYPE_TEXTURE -CALLY_TEXTURE_CLASS -CALLY_IS_TEXTURE_CLASS -CALLY_TEXTURE_GET_CLASS - -CallyTexturePrivate -cally_texture_get_type -
- -
-cally-root -CallyRoot -CallyRoot -CallyRootClass -cally_root_new - -CALLY_ROOT -CALLY_IS_ROOT -CALLY_TYPE_ROOT -CALLY_ROOT_CLASS -CALLY_IS_ROOT_CLASS -CALLY_ROOT_GET_CLASS - -CallyRootPrivate -cally_root_get_type -
- -
-cally-group -CallyGroup -CallyGroup -CallyGroupClass -cally_group_new - -CALLY_GROUP -CALLY_IS_GROUP -CALLY_TYPE_GROUP -CALLY_GROUP_CLASS -CALLY_IS_GROUP_CLASS -CALLY_GROUP_GET_CLASS - -CallyGroupPrivate -cally_group_get_type -
- -
-cally-rectangle -CallyRectangle -CallyRectangle -CallyRectangleClass -cally_rectangle_new - -CALLY_RECTANGLE -CALLY_IS_RECTANGLE -CALLY_TYPE_RECTANGLE -CALLY_RECTANGLE_CLASS -CALLY_IS_RECTANGLE_CLASS -CALLY_RECTANGLE_GET_CLASS - -CallyRectanglePrivate -cally_rectangle_get_type -
- -
-cally -General API -cally_get_cally_initialized -cally_accessibility_init - -CALLY_ACCESSIBLE_FACTORY -CALLY_ACTOR_SET_FACTORY -
diff --git a/doc/reference/clutter.types b/doc/reference/clutter.types deleted file mode 100644 index 0037accca..000000000 --- a/doc/reference/clutter.types +++ /dev/null @@ -1,122 +0,0 @@ -cally_actor_get_type -cally_clone_get_type -cally_group_get_type -cally_rectangle_get_type -cally_root_get_type -cally_stage_get_type -cally_text_get_type -cally_texture_get_type -cally_util_get_type -clutter_action_get_type -clutter_actor_box_get_type -clutter_actor_get_type -clutter_actor_meta_get_type -clutter_align_constraint_get_type -clutter_alpha_get_type -clutter_animatable_get_type -clutter_animation_get_type -clutter_animator_get_type -clutter_animator_key_get_type -clutter_backend_get_type -clutter_behaviour_depth_get_type -clutter_behaviour_ellipse_get_type -clutter_behaviour_get_type -clutter_behaviour_opacity_get_type -clutter_behaviour_path_get_type -clutter_behaviour_rotate_get_type -clutter_behaviour_scale_get_type -clutter_bin_layout_get_type -clutter_bind_constraint_get_type -clutter_binding_pool_get_type -clutter_blur_effect_get_type -clutter_box_get_type -clutter_box_layout_get_type -clutter_brightness_contrast_effect_get_type -clutter_cairo_texture_get_type -clutter_canvas_get_type -clutter_child_meta_get_type -clutter_click_action_get_type -clutter_clip_node_get_type -clutter_clone_get_type -clutter_color_get_type -clutter_color_node_get_type -clutter_colorize_effect_get_type -clutter_constraint_get_type -clutter_container_get_type -clutter_content_get_type -clutter_deform_effect_get_type -clutter_desaturate_effect_get_type -clutter_device_manager_get_type -clutter_drag_action_get_type -clutter_drop_action_get_type -clutter_effect_get_type -clutter_event_get_type -clutter_event_sequence_get_type -clutter_fixed_layout_get_type -clutter_flow_layout_get_type -clutter_fog_get_type -clutter_geometry_get_type -clutter_gesture_action_get_type -clutter_glx_texture_pixmap_get_type -clutter_grid_layout_get_type -clutter_group_get_type -clutter_image_get_type -clutter_input_device_get_type -clutter_interval_get_type -clutter_keyframe_transition_get_type -clutter_knot_get_type -clutter_layout_manager_get_type -clutter_layout_meta_get_type -clutter_list_model_get_type -clutter_margin_get_type -clutter_media_get_type -clutter_model_get_type -clutter_model_iter_get_type -clutter_offscreen_effect_get_type -clutter_page_turn_effect_get_type -clutter_paint_node_get_type -clutter_paint_volume_get_type -clutter_pan_action_get_type -clutter_param_color_get_type -clutter_param_fixed_get_type -clutter_param_units_get_type -clutter_path_constraint_get_type -clutter_path_get_type -clutter_path_node_get_type -clutter_perspective_get_type -clutter_pipeline_node_get_type -clutter_point_get_type -clutter_property_transition_get_type -clutter_rect_get_type -clutter_rectangle_get_type -clutter_rotate_action_get_type -clutter_score_get_type -clutter_script_get_type -clutter_scriptable_get_type -clutter_scroll_actor_get_type -clutter_settings_get_type -clutter_shader_effect_get_type -clutter_shader_float_get_type -clutter_shader_get_type -clutter_shader_int_get_type -clutter_shader_matrix_get_type -clutter_size_get_type -clutter_snap_constraint_get_type -clutter_stage_get_type -clutter_stage_manager_get_type -clutter_state_get_type -clutter_state_key_get_type -clutter_swipe_action_get_type -clutter_table_layout_get_type -clutter_tap_action_get_type -clutter_text_buffer_get_type -clutter_text_get_type -clutter_text_node_get_type -clutter_texture_get_type -clutter_texture_node_get_type -clutter_timeline_get_type -clutter_transition_get_type -clutter_transition_group_get_type -clutter_units_get_type -clutter_vertex_get_type -clutter_zoom_action_get_type diff --git a/doc/reference/constraints-example.png b/doc/reference/constraints-example.png deleted file mode 100644 index c2a71b2d2..000000000 Binary files a/doc/reference/constraints-example.png and /dev/null differ diff --git a/doc/reference/easing-modes.png b/doc/reference/easing-modes.png deleted file mode 100644 index c1cbe1460..000000000 Binary files a/doc/reference/easing-modes.png and /dev/null differ diff --git a/doc/reference/easing-modes.svg b/doc/reference/easing-modes.svg deleted file mode 100644 index 34e0b34a3..000000000 --- a/doc/reference/easing-modes.svg +++ /dev/null @@ -1,920 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/reference/event-flow.dia b/doc/reference/event-flow.dia deleted file mode 100644 index b0ff1bbd5..000000000 Binary files a/doc/reference/event-flow.dia and /dev/null differ diff --git a/doc/reference/event-flow.png b/doc/reference/event-flow.png deleted file mode 100644 index 6d2b3ab0f..000000000 Binary files a/doc/reference/event-flow.png and /dev/null differ diff --git a/doc/reference/flow-layout.png b/doc/reference/flow-layout.png deleted file mode 100644 index 809ae918a..000000000 Binary files a/doc/reference/flow-layout.png and /dev/null differ diff --git a/doc/reference/glossary.xml b/doc/reference/glossary.xml deleted file mode 100644 index 5a71a8902..000000000 --- a/doc/reference/glossary.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Glossary - - - actor - - An item on the scenegraph. Every - actor has a parent, except the stage, and some actors can be containers. Every actor has a geometry and, when visible, it should paint its - contents. The base class for actors is #ClutterActor. - - - - - allocation - - The final size of an actor within its - parent. For example, an actor might have - a preferred minimum size of - 20×20 pixels and a natural - size of - 40×40 pixels, but its parent may decide to allocate 50×20 pixels for - it instead. - - minimum size - natural size - - - - - - child - - A container's child is an - actor contained inside it. - - - - - container - - An actor which can contain other - actors. If a container is meant to be extended using public API it should implement - the #ClutterContainer interface; otherwise it is a composite actor. A container - can let its children manage their geometry, like #ClutterGroup, or they can take care of - assigning one. - - - - - event - - Events are the way in which the Clutter backend informs Clutter about external - events like pointer motion, button clicks, key presses, etc. - - - - - geometry - - An actor's position and size. A - geometry can be expressed in actor-relative - untransformed coordinates; or in - stage-relative, transformed coordinates. - - - - - minimum size - - The minimum, useful size of an actor. - For instance, a button might have a minimum size of 20×20 millimeters on a - touch screen, to retain the ability for the user to press it. A container that manages the size of its children should always try to allocate at least their minimum size. - - natural size - allocation - - - - - - natural size - - The default size requested by an actor. - - minimum size - allocation - - - - - - parent - - An actor's parent is the - container inside which the actor - resides. - - - - - scenegraph - - The tree of all actors, starting - from the stage at the root and following - the containers. - - - - - stage - - The top-level container for - actors. Depending on the Clutter back end a - stage can be associated to a window or to a frame buffer; also depending on the back - end is the number of instantiatable stages. Stages in Clutter can be manipulated using - the #ClutterStage API. - - - - - transformation - - A rotation, scaling or traslation of an actor. Transformations are independent - of the actor's geometry. - - - - diff --git a/doc/reference/migrating-ClutterAnimation.xml b/doc/reference/migrating-ClutterAnimation.xml deleted file mode 100644 index 87b6ac1eb..000000000 --- a/doc/reference/migrating-ClutterAnimation.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - Emmanuele - Bassi - -
- ebassi@gnome.org -
-
-
-
- - Migrating from ClutterAnimation - - The #ClutterAnimation class, along with the #ClutterActor wrappers - clutter_actor_animate(), clutter_actor_animate_with_timeline() and - clutter_actor_animate_with_alpha(), has been deprecated in Clutter 1.12, - and should not be used in newly written code. - - The direct replacement for a #ClutterAnimation is the - #ClutterPropertyTransition class, which allows the transition of a - single #GObject property from an initial value to a final value over a - user-defined time using a user-defined easing curve. - - The #ClutterPropertyTransition class inherits from #ClutterTransition, - which allows setting the transition interval, as well as the animatable - instance to be transitioned; and from #ClutterTimeline, which allows setting - the duration and easing curve of the transition. - - For instance, the following #ClutterAnimation set up: - - - - Can be replaced by #ClutterPropertyTransition: - - - - It is important to note that only #ClutterAnimatable implementations - can be used directly with #ClutterTransition. - - A #ClutterPropertyTransition can only animate a single property; if - more than one property transition is required, you can use the - #ClutterTransitionGroup class to group the transitions together. - -
- Migrating clutter_actor_animate() - - #ClutterActor animatable properties can use implicit transitions - through their setter functions. The duration and easing curve of the - animation is controlled by clutter_actor_set_easing_duration() and by - clutter_actor_set_easing_mode(), respectively; for instance, the - equivalent of the following clutter_actor_animate() call: - - - - Can be replaced by the following: - - - - The default easing duration for the 1.0 API series is set to 0, - which means no transition at all. - - It is possible to set the easing state of a #ClutterActor to its - default values by using clutter_actor_save_easing_state(), and return - to the previous values by calling clutter_actor_restore_easing_state() - instead. The easing state affects all the animatable properties that - are modified after changing it; so, for instance: - - - - The animation above will implicitly transition the opacity from - its current value to 255 in 500 milliseconds using the default easing - curve; at the same time, the size of the actor will be transitioned in - 500 milliseconds after a delay of 500 milliseconds to the new size - stored in the variables width and - height. - -
- -
diff --git a/doc/reference/migrating-ClutterBehaviour.xml b/doc/reference/migrating-ClutterBehaviour.xml deleted file mode 100644 index cc4c39ea0..000000000 --- a/doc/reference/migrating-ClutterBehaviour.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - Emmanuele - Bassi - -
- ebassi@linux.intel.com -
-
-
-
- - Migrating from ClutterBehaviour - - The #ClutterBehaviour class and its sub-classes have been deprecated - since Clutter 1.6. The animation framework provided by #ClutterAnimation, - #ClutterAnimator and #ClutterState fully replaces all functionality from the - #ClutterBehaviour classes. - - Generally, animations using #ClutterBehaviour sub-classes can be - effectively re-implemented just by using #ClutterActor properties. - - Here is an example of an animation using a - #ClutterBehaviourOpacity instance: - - - - ClutterTimeline *timeline = clutter_timeline_new (250); - ClutterAlpha *alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); - ClutterBehaviour *behaviour = clutter_behaviour_opacity_new (alpha, 255, 0); - - clutter_behaviour_apply (behaviour, some_actor); - - clutter_timeline_start (timeline); - - - - The same effect can be achieved by using clutter_actor_animate() and - the #ClutterActor:opacity property: - - - - clutter_actor_set_opacity (some_actor, 255); - clutter_actor_animate (some_actor, CLUTTER_LINEAR, 250, - "opacity", 0, - NULL); - - - - #ClutterBehaviours used for continuous animations with looping - timelines can still be effectively replaced by looping animations; for - instance, the following example of a "pulsating" actor using - #ClutterBehaviourScale: - - - -static void -reverse_timeline (ClutterTimeline *timeline) -{ - ClutterTimelineDirection dir = clutter_timeline_get_direction (timeline); - - if (dir == CLUTTER_TIMELINE_FORWARD) - dir = CLUTTER_TIMELINE_BACKWARD; - else - dir = CLUTTER_TIMELINE_FORWARD; - - clutter_timeline_set_direction (timeline, dir); -} - - ClutterTimeline *timeline = clutter_timeline_new (500); - ClutterAlpha *alpha = clutter_alpha_new_full (timeline, CLUTTER_LINEAR); - ClutterBehaviour *behaviour; - - g_object_set (some_actor, "scale-gravity", CLUTTER_GRAVITY_CENTER, NULL); - behaviour = clutter_behaviour_scale_new (alpha, - 1.0, 2.0, - 1.0, 2.0); - clutter_behaviour_apply (behaviour, some_actor); - - g_signal_connect (timeline, - "completed", G_CALLBACK (reverse_timeline), - NULL); - - clutter_timeline_set_loop (timeline); - clutter_timeline_start (timeline); - - - - The same effect can be achieved using a #ClutterAnimation: - - - - ClutterAnimation *animation = - clutter_actor_animate (some_actor, CLUTTER_LINEAR, 500, - "scale-x", 2.0, - "scale-y", 2.0, - "fixed::scale-gravity", CLUTTER_GRAVITY_CENTER, - NULL); - - ClutterTimeline *timeline = clutter_animation_get_timeline (animation); - clutter_timeline_set_repeat_count (timeline, -1); - clutter_timeline_set_auto_reverse (timeline, TRUE); - - - - #ClutterBehaviour sub-classes can be applied to multiple actors, in - order to share the duration and the easing mode. It is possible to use the - same underlying #ClutterTimeline and #ClutterAlpha instances with - #ClutterAnimation to achieve the same effect. Complex animations, spanning - multiple actors, should use the #ClutterAnimator and #ClutterState classes - instead. - -
diff --git a/doc/reference/migrating-ClutterEffect.xml b/doc/reference/migrating-ClutterEffect.xml deleted file mode 100644 index 5b6f109ae..000000000 --- a/doc/reference/migrating-ClutterEffect.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - Emmanuele - Bassi - -
- ebassi@linux.intel.com -
-
-
-
- - Migrating from ClutterEffect - - Since version 1.0, Clutter provides the #ClutterAnimation API - and the clutter_actor_animate() family of functions as replacements - for the ClutterEffectTemplate and - clutter_effect_* API for creating simple, one-off animations. - -
- Using <function>clutter_actor_animate()</function> - - Prior to Clutter 1.0, the way to create simple, one-off - animations involving a single actor was the ClutterEffect API. The - major downside of this API was that to abstract the duration and - easing function of the animation the application developer had to - create a ClutterEffectTemplate and keep it - around for the duration of the application. - - The clutter_actor_animate() function performs all of the - memory management that was delegated to the - ClutterEffectTemplate, freeing the developer - from having to deal with object bookkeeping. - - Another downside of the ClutterEffect API is that every - possible animation has its own function (scaling, opacity, rotation, - movement, etc.), and new functions cannot be added outside of - Clutter. - - - Effect example - The following code shows a simple animation using - the ClutterEffect API. It animates an actor linearly in 500 - milliseconds, by moving it to the (100, 100) coordinates - while fading it out. - - ClutterEffectTemplate *tmpl; - - tmpl = clutter_effect_template_new_for_duration (500, clutter_ramp_inc_func); - clutter_effect_move (tmpl, actor, 100, 100, NULL, NULL); - clutter_effect_fade (tmpl, actor, 0, NULL, NULL); - - g_object_unref (tmpl); - - - - The clutter_actor_animate() function will implicitely - create a #ClutterAnimation with the passed duration and easing - mode, and will bind all the passed properties. All readable and - writable properties specified by a #ClutterActor are animatable - through clutter_actor_animate(). - - - Animation example - The following code shows the clutter_actor_animate() call - equivalent to the previous ClutterEffect example. - - clutter_actor_animate (actor, CLUTTER_LINEAR, 500, - "x", 100.0, - "y", 100.0, - "opacity", 0, - NULL); - - - - The ClutterEffect API provided a way to be notified of the - effect completion. Since the clutter_actor_animate() function creates - a #ClutterAnimation instance it's possible to use the - #ClutterAnimation::completed signal for the same notification. - - - Effect complete example - The following code shows how to receive notification of the - completion of the animation. - -static void -on_fade_complete (ClutterActor *actor, - gpointer data) -{ - clutter_actor_hide (actor); -} - - ClutterEffectTemplate *tmpl; - - tmpl = clutter_effect_template_new_for_duration (500, clutter_ramp_inc_func); - clutter_effect_fade (tmpl, actor, 0, on_fade_complete, NULL); - - g_object_unref (tmpl); - - - - The clutter_actor_animate() function also has a convenience - wrapper that allows to inline the signal connection: - - - Animation completed example - The following code shows how to get the same notification - as the example above. - - ClutterAnimation *animation; - - animation = clutter_actor_animate (actor, CLUTTER_LINEAR, 500, - "opacity", 0, - NULL); - g_signal_connect_swapped (animation, - "completed", G_CALLBACK (clutter_actor_hide), - actor); - - /* OR */ - - clutter_actor_animate (actor, CLUTTER_LINEAR, 500, - "opacity", 0, - "signal-swapped::completed", clutter_actor_hide, actor, - NULL); - - - -
- -
diff --git a/doc/reference/migrating-ClutterPath.xml b/doc/reference/migrating-ClutterPath.xml deleted file mode 100644 index 4273fa3b6..000000000 --- a/doc/reference/migrating-ClutterPath.xml +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - Emmanuele - Bassi - -
- ebassi@linux.intel.com -
-
-
-
- - Migrating to ClutterPath - - Between Clutter 0.8 and Clutter 1.0 the #ClutterBehaviourPath - behaviour lost all the path manipulation functions and the - ClutterBehaviourBspline class was entirely - deprecated. - - The class that replaced the path description and manipulation - functionality is called #ClutterPath. A #ClutterPath allows - describing a path using a sequence of #ClutterPathNodes or - using a subset of the SVG path description syntax. A Path instance - also allows describing complex paths, with linear and Bezier segments - and with gaps. - - Finally, #ClutterPath also provides integration with Cairo, - by being able to add paths described by the Cairo - cairo_path_t data structure and being able - to "replay" a #ClutterPath onto a cairo_t - Cairo context. - -
- Creating a #ClutterPath - - Before Clutter 1.0, all the path-related functions inside - #ClutterBehaviourPath and ClutterBehaviourBspline - were replicated, but were also subtly different given the different nature - of the types of path handled by the two #ClutterBehaviours. - - - ClutterBehaviourPath example - The following code shows how a #ClutterBehaviourPath was - created prior to the introduction of #ClutterPath. The path described - is a square box between 100, 100 and 200, 200. - - ClutterBehaviour *behaviour; - ClutterKnot knots[] = { - { 100, 100 }, - { 200, 100 }, - { 200, 200 }, - { 100, 200 }, - { 100, 100 } - }; - - behaviour = clutter_behaviour_path_new (alpha, knots, G_N_ELEMENTS (knots)); - - - - The construction for a B-Spline path behaviour was similar, though - the #ClutterKnots could only describe a curvilinear path. - - - Constructing ClutterPath - The following code shows how to construct a #ClutterPath and - assign it to a #ClutterBehaviourPath. The created path is the same as - the example above. - - ClutterBehaviour *behaviour; - ClutterPath *path; - - path = clutter_path_new (); - clutter_path_add_move_to (path, 100, 100); - clutter_path_add_line_to (path, 200, 100); - clutter_path_add_line_to (path, 200, 200); - clutter_path_add_line_to (path, 100, 200); - clutter_path_add_close (path); - - behaviour = clutter_behaviour_path_new (alpha, path); - - - - A #ClutterPath object can be shared across behaviours, just - like the #ClutterAlpha objects can. - - Path can be described by using a subset of the SVG notation for - paths as well as using #ClutterPathNode structures. - - - Describing ClutterPath - The SVG path notation subset used by #ClutterPath is in - string format and can be both set as the whole path description - using clutter_path_set_description() or can be added to an - existing #ClutterPath using clutter_path_add_string(). The following - example shows the same path as the two examples above. - - ClutterPath *path = clutter_path_new (); - - clutter_path_set_description (path, - "M 100,100 " /* move to */ - "L 200,100 " /* line to */ - "L 200,200 " - "L 100,200 " - "z" /* close */); - - - - A #ClutterPath can describe not only linear, closed paths; it - can also describe paths with Beziér curvers and can add gaps. - - - Describing a mixed ClutterPath - A mixed #ClutterPath, with a Beziér curve between the point - at 200, 200 and 100, 100 and both control points in 100, 200. - - ClutterPath *path = clutter_path_new (); - - clutter_path_set_description (path, - "M 100,100 " - "L 200,100 " - "L 200,200 " - "C 100,200 100,200 100,100"); - - - -
- -
- Iterating over a #ClutterPath - - It is possible to iterate over all the #ClutterPathNodes - inside a #ClutterPath by using clutter_path_get_nodes(), which will return - a #GSList of #ClutterPathNodes; or by using clutter_path_foreach() - with a function. - - The function pointer passed to clutter_path_foreach() should have the - following definition: - - - static void - foreach_node (ClutterPathNode *path_node, - gpointer user_data) - { - } - -
- -
- Integration with Cairo - - A #ClutterPath can use a previously defined - cairo_path_t to add new nodes, by using - the clutter_path_add_cairo_path() function. - - It is also possible to paint a #ClutterPath on a Cairo context, - by moving the Cairo pen across the nodes of the path using the - clutter_path_to_cairo_path() function. -
- -
diff --git a/doc/reference/offscreen-redirect.png b/doc/reference/offscreen-redirect.png deleted file mode 100644 index ff36c8082..000000000 Binary files a/doc/reference/offscreen-redirect.png and /dev/null differ diff --git a/doc/reference/path-alpha-func.png b/doc/reference/path-alpha-func.png deleted file mode 100644 index ede962aa9..000000000 Binary files a/doc/reference/path-alpha-func.png and /dev/null differ diff --git a/doc/reference/running-clutter.xml b/doc/reference/running-clutter.xml deleted file mode 100644 index 2d782b3fa..000000000 --- a/doc/reference/running-clutter.xml +++ /dev/null @@ -1,402 +0,0 @@ - - - - Emmanuele - Bassi - -
- ebassi@linux.intel.com -
-
-
-
- - Running Clutter - - - -
- Environment Variables - - - Clutter automatically checks environment variables during - its initialization. These environment variables are meant - as debug tools, overrides for default behaviours or to - address known hardware issues: - - - - - CLUTTER_BACKEND - - Changes the windowing system backend used by Clutter. - The allowed values for this environment variable depend on - the configuration options used when compiling Clutter. The - available values are: - - x11, for the X11 backend - wayland, for the Wayland backend - win32, for the Windows backend - osx, for the MacOS X backend - gsk, for the GDK backend - eglnative, for the EGL/KMS backend - cex100, for the CEx100 backend - - All of the above options except for the eglnative - and cex100 backends also have an input backend. - - - - CLUTTER_INPUT_BACKEND - - Changes the input backend used by Clutter. - The allowed values for this environment variable depend on - the configuration options used when compiling Clutter. The - available values are: - - tslib - evdev - null - - This environment variable is only useful for setting the input - backend when using a windowing system backend that does not have an - input API, like the eglnative or the cex100 - windowing system backends. - - - - CLUTTER_DRIVER - - Changes the GL driver used when initializing Clutter. - The allowed values for this environment variable are: - - gl3, for the GL driver using a 3.2+ core profile - gl, for the GL driver using a legacy profile - gles2, for the GLES 2.0 driver - any, for the default chosen by Cogl - - The special '*' value can be used to ask Clutter to use the - default list of drivers, e.g. 'CLUTTER_DRIVER=gles2,*' will ask Clutter - to try the GLES 2.0 driver first, and then fall back to the default list - of Cogl drivers. - - - - CLUTTER_SCALE - - Forces the window scaling factor to that value - inside Clutter instead of relying on what backends detect. - - - - CLUTTER_TEXT_DIRECTION - - Forces the text direction of every Pango layout - inside Clutter. Valid values are: ltr or rtl - - - - CLUTTER_SHOW_FPS - - Prints out the frames per second achieved by Clutter. - - - - CLUTTER_DEFAULT_FPS - - Sets the default framerate. - - - - CLUTTER_DISABLE_MIPMAPPED_TEXT - - Disables mipmapping when rendering text. - - - - CLUTTER_FUZZY_PICK - - Enables "fuzzy picking". - - - - CLUTTER_DEBUG - - Enables debugging modes for Clutter; debugging modes are - used to print debugging messages on the console. Clutter must be - compiled with the --enable-debug configuration switch for these - messages to be printed out. Multiple debugging modes can be - enabled by separating them using a colon (":") or a comma - (","). - - - - CLUTTER_PAINT - - Enables paint debugging modes for Clutter; the modes change - the way Clutter paints a scene and are useful for debugging the - behaviour of the paint cycle. - - - - CLUTTER_ENABLE_DIAGNOSTIC - - When set to 1, enables diagnostic messages for run-time - deprecations, similarly to G_ENABLE_DIAGNOSTIC in - GLib. - - - - - On the GLX backend there is also: - - - - CLUTTER_VBLANK - - Selects the sync-to-vblank mode to be used. - Valid values are: none, dri or glx - - - - -
- -
- Command Line Arguments - - Similarly to the environment variables, Clutter also installs - command line switches that are parsed during initialization: - - - - --clutter-show-fps - Equivalent of CLUTTER_SHOW_FPS. Prints the - current rendering speed in frames per second. - - - --clutter-default-fps=FPS - Equivalent of CLUTTER_DEFAULT_FPS. Sets the - default framerate. - - - --clutter-text-direction=DIRECTION - Equivalent of CLUTTER_TEXT_DIRECTION. Sets the - direction for the text. - - - --clutter-disable-mipmapped-text - Equivalent of CLUTTER_DISABLE_MIPMAPPED_TEXT. - Disables mipmapping when rendering text. - - - --clutter-use-fuzzy-picking - Equivalent of CLUTTER_FUZZY_PICK. Enables - "fuzzy" picking. - - - --clutter-debug=FLAGS - Equivalent of CLUTTER_DEBUG. Sets FLAGS as the - Clutter debugging flags. - - - --clutter-no-debug=FLAGS - Unsets FLAGS from the Clutter debugging - flags. - - - --cogl-debug=FLAGS - Equivalent of COGL_DEBUG. Sets FLAGS as the - Cogl debugging flags. - - - --cogl-no-debug=FLAGS - Unsets FLAGS from the Cogl debugging - flags. - - - --clutter-enable-accessibility - Enables accessibility support. - - - - The X11 backends also have the following command line - options: - - - - --display=DISPLAY - Sets the X11 display to use. - - - --screen=SCREEN - Sets the X11 screen number to use. - - - --synch - Make X11 calls synchronous. - - -
- - The GLX backend also has the following command line option: - - - - --vblank=METHOD - Equivalent of CLUTTER_VBLANK. Sets the sync-to-vblank - method to be used. - - - -
- Debug flags for Clutter - - The debugging flags can be used for the CLUTTER_DEBUG environment - variable and the --clutter-debug command line switch. Multiple flags can - be separated by a colon (:) or a comma (,). - - - - - actor - Generic actor-related notes - - - animation - #ClutterAnimation notes - - - backend - Backend-related notes, including initialization of - the backend features and GL context creation - - - event - Event handling notes - - - layout - #ClutterLayoutManager notes - - - misc - Miscellaneous notes - - - scheduler - Notes related to timelines and the master - clock - - - script - Notes related to #ClutterScript - - - - It is possible to get all the debugging notes using the - special "all" flag. - -
- -
- Configuration File - - Clutter will look for files named settings.ini - located in the /etc/clutter-1.0 and - $XDG_CONFIG_HOME/clutter-1.0 directories. These files - must be valid key files (see #GKeyFile in the GLib documentation) and may - have three sections: - - - - Environment - The keys in this section map the environment variables - honoured by Clutter. - - - Debug - The keys in this section related to the debugging notes - that Clutter exposes when compiled with debugging support; similarly to - the environment variables and command line arguments related to the - debugging notes, Clutter must be compiled with support for these notes - in order to use them. - - - Settings - The keys in this section strictly map to the #GObject - properties exposed by the #ClutterSettings type; if Clutter is running - on an X11 platform, the XSettings manager will take precedence over the - values specified in the settings.ini - file. - - - -
- Keys available for the Environment group - - - - ShowFps - A boolean value, equivalent to setting - CLUTTER_SHOW_FPS. - - - DisableMipmappedText - A boolean value, equivalent to setting - CLUTTER_DISABLE_MIPMAPPED_TEXT. - - - UseFuzzyPicking - A boolean value, equivalent to setting - CLUTTER_FUZZY_PICK. - - - EnableAccessibility - A boolean value, equivalent to setting - CLUTTER_ENABLE_ACCESSIBILITY. - - - DefaultFps - An integer value, equivalent to setting - CLUTTER_DEFAULT_FPS. - - - TextDirection - A string value, equivalent to setting - CLUTTER_TEXT_DIRECTION. - - -
- -
- Keys available for the Debug group - - - - Debug - A string containing the debugging flags, in the same - format that should be used with the CLUTTER_DEBUG - environment variable. - - - PaintDebug - A string containing the paint debugging flags, in the same - format that should be used with the CLUTTER_PAINT - environment variable. - - - PickDebug - A string containing the pick debugging flags, in the same - format that should be used with the CLUTTER_PICK - environment variable. - - -
- -
- -
-
diff --git a/doc/reference/table-layout.png b/doc/reference/table-layout.png deleted file mode 100644 index b0b361743..000000000 Binary files a/doc/reference/table-layout.png and /dev/null differ diff --git a/doc/size-negotiation.txt b/doc/size-negotiation.txt deleted file mode 100644 index c7b0debbd..000000000 --- a/doc/size-negotiation.txt +++ /dev/null @@ -1,98 +0,0 @@ -Size negotiation in Clutter ---------------------------- - -Clutter uses a two-pass size negotiation mechanism. Each parent will ask its -children (if any) for their preferred size, which will affect the parent's own -preferred size; once this preferred size query returns to the stage, the stage -will allocate the size of each child, which in turn will allocate each one of -their own children, until it reaches the end of the scene graph. - -The preferred size of an actor is defined through the: - - get_preferred_width() - get_preferred_height() - -virtual functions that should be implemented by every actor. The virtual -functions will only be invoked if the corresponding flags: - - needs_width_request - needs_height_request - -are set; otherwise, the preferred size will be cached inside ClutterActor -itself. - -Actors can inform their parents that their preferred size has changed by using: - - clutter_actor_queue_relayout() - -on themselves. This function will "bubble up" through the scene graph, and it -will clear the: - - needs_width_request - needs_height_request - needs_allocation - -flags inside the actor and its parents up to the stage. - -At the beginning of the next frame, the stage will check if there is a relayout -pending, and it will ask each child for its preferred size; depending on the -state of the flags, the implementations for the virtual functions: - - get_preferred_width() - get_preferred_height() - allocate() - -will be invoked in that order. Each parent is responsible for calling -clutter_actor_allocate() on its children. - -Example -------- - -Let's consider a scene composed by actors following this layout: - - +---------------------------------------+ - |3 +=============+ +==+ +=============+ | - | | +-+ +-+ +-+ | | | |2 +-+ +----+ | | - | | | | | | | | | | | | |1| | | | | - | | +-+ +-+ +-+ | | | | +-+ +----+ | | - | +=============+ +==+ +=============+ | - +---------------------------------------+ - -The actor (1) calls queue_relayout(), which clears the needs_* flags on its -parent (2), and its grand-parent (3); the state of the other siblings will be -left untouched. - - +---------------------------------------+ - |a +=============+ +==+ +=============+ | - | |b+-+ +-+ +-+ | |f | |g +---+ +--+ | | - | | |c| |d| |e| | | | | |h | |i | | | - | | +-+ +-+ +-+ | | | | +---+ +--+ | | - | +=============+ +==+ +=============+ | - +---------------------------------------+ - -At the beginning of the following frame, clutter_actor_allocate() will be called -starting from the actor (a). Since its needs_* flags have been cleared, the -allocate() virtual function will be invoked. This will cause -clutter_actor_allocate() to be called on its children, starting from (b). The -size computed by the parent (a) for its child (b) hasn't changed, and its -needs_* flags haven't been cleared, so clutter_actor_allocate() will -short-circuit, and will not cause the implementation of the allocate() virtual -function for (b) to be called, effectively skipping the branch of the scene -graph. The same will happen for (f). - -The child (g) has the same size, but its needs_* flags will have been cleared, -so its allocate() implementation will be invoked; this will cause the (h) and -(i) children to be allocated as well. - -Fixed preferred size --------------------- - -If an actor has a fixed size then that size will take precedence over the cached -size and the actor's implementation of the get_preferred_* virtual functions. - -Constraints ------------ - -Constraints only affect the allocation phase; each constraint is allowed to -modify the allocation passed to clutter_actor_allocate(), before it will be -checked and eventually discarded.