2006-08-28 17:11:15 +00:00
|
|
|
/*
|
|
|
|
* Clutter.
|
|
|
|
*
|
|
|
|
* An OpenGL based 'interactive canvas' library.
|
|
|
|
*
|
|
|
|
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
|
|
* Jorn Baayen <jorn@openedhand.com>
|
2006-11-15 23:37:53 +00:00
|
|
|
* Emmanuele Bassi <ebassi@openedhand.com>
|
2007-05-16 11:32:50 +00:00
|
|
|
* Tomas Frydrych <tf@openedhand.com>
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2009-01-20 16:42:49 +00:00
|
|
|
* Copyright (C) 2006, 2007, 2008 OpenedHand
|
2010-03-01 12:56:10 +00:00
|
|
|
* Copyright (C) 2009, 2010 Intel Corp.
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2010-03-01 12:56:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:clutter-alpha
|
2010-06-30 13:58:47 +00:00
|
|
|
* @short_description: A class for calculating a value as a function of time
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2009-01-20 16:42:49 +00:00
|
|
|
* #ClutterAlpha is a class for calculating an floating point value
|
|
|
|
* dependent only on the position of a #ClutterTimeline.
|
2008-11-18 12:42:05 +00:00
|
|
|
*
|
2012-02-21 15:14:26 +00:00
|
|
|
* <warning>For newly written code, it is recommended to use the
|
|
|
|
* #ClutterTimeline:progress-mode property of #ClutterTimeline, or the
|
|
|
|
* clutter_timeline_set_progress_func() function instead of #ClutterAlpha.
|
|
|
|
* The #ClutterAlpha class will be deprecated in the future, and will not
|
|
|
|
* be available any more in the next major version of Clutter.</warning>
|
|
|
|
*
|
2008-11-18 12:42:05 +00:00
|
|
|
* A #ClutterAlpha binds a #ClutterTimeline to a progress function which
|
|
|
|
* translates the time T into an adimensional factor alpha. The factor can
|
|
|
|
* then be used to drive a #ClutterBehaviour, which will translate the
|
|
|
|
* alpha value into something meaningful for a #ClutterActor.
|
|
|
|
*
|
|
|
|
* You should provide a #ClutterTimeline and bind it to the #ClutterAlpha
|
2009-01-16 13:42:06 +00:00
|
|
|
* instance using clutter_alpha_set_timeline(). You should also set an
|
2009-03-27 14:28:08 +00:00
|
|
|
* "animation mode", either by using the #ClutterAnimationMode values that
|
2009-01-20 16:42:49 +00:00
|
|
|
* Clutter itself provides or by registering custom functions using
|
|
|
|
* clutter_alpha_register_func().
|
2009-01-16 13:42:06 +00:00
|
|
|
*
|
|
|
|
* Instead of a #ClutterAnimationMode you may provide a function returning
|
|
|
|
* the alpha value depending on the progress of the timeline, using
|
|
|
|
* clutter_alpha_set_func() or clutter_alpha_set_closure(). The alpha
|
|
|
|
* function will be executed each time a new frame in the #ClutterTimeline
|
|
|
|
* is reached.
|
2008-11-18 12:42:05 +00:00
|
|
|
*
|
|
|
|
* Since the alpha function is controlled by the timeline instance, you can
|
|
|
|
* pause, stop or resume the #ClutterAlpha from calling the alpha function by
|
|
|
|
* using the appropriate functions of the #ClutterTimeline object.
|
2006-11-17 18:45:31 +00:00
|
|
|
*
|
2009-01-20 16:42:49 +00:00
|
|
|
* #ClutterAlpha is used to "drive" a #ClutterBehaviour instance, and it
|
|
|
|
* is internally used by the #ClutterAnimation API.
|
2008-02-08 13:52:11 +00:00
|
|
|
*
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
* <refsect2 id="ClutterAlpha-script">
|
|
|
|
* <title>ClutterAlpha custom properties for #ClutterScript</title>
|
|
|
|
* <para>#ClutterAlpha defines a custom "function" property for
|
|
|
|
* #ClutterScript which allows to reference a custom alpha function
|
|
|
|
* available in the source code. Setting the "function" property
|
|
|
|
* is equivalent to calling clutter_alpha_set_func() with the
|
|
|
|
* specified function name. No user data or #GDestroyNotify is
|
|
|
|
* available to be passed.</para>
|
|
|
|
* <example id="ClutterAlpha-script-example">
|
|
|
|
* <title>Defining a ClutterAlpha in ClutterScript</title>
|
|
|
|
* <para>The following JSON fragment defines a #ClutterAlpha
|
2009-11-13 14:43:57 +00:00
|
|
|
* using a #ClutterTimeline with id "sine-timeline" and an alpha
|
2011-09-12 12:12:14 +00:00
|
|
|
* function called <function>my_sine_alpha</function>. The defined
|
|
|
|
* #ClutterAlpha instance can be reused in multiple #ClutterBehaviour
|
2009-11-13 14:43:57 +00:00
|
|
|
* definitions or for #ClutterAnimation definitions.</para>
|
2010-06-30 14:50:47 +00:00
|
|
|
* <programlisting><![CDATA[
|
|
|
|
* {
|
|
|
|
* "id" : "sine-alpha",
|
|
|
|
* "timeline" : {
|
|
|
|
* "id" : "sine-timeline",
|
|
|
|
* "duration" : 500,
|
|
|
|
* "loop" : true
|
|
|
|
* },
|
|
|
|
* "function" : "my_sine_alpha"
|
|
|
|
* }
|
|
|
|
* ]]></programlisting>
|
2009-10-21 16:44:44 +00:00
|
|
|
* </example>
|
2009-11-13 14:43:57 +00:00
|
|
|
* <para>For the way to define the #ClutterAlpha:mode property
|
|
|
|
* inside a ClutterScript fragment, see <link
|
|
|
|
* linkend="clutter-AnimationMode-Script">the corresponding section</link>
|
|
|
|
* in #ClutterAnimation.</para>
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
* </refsect2>
|
|
|
|
*
|
2012-04-25 16:13:29 +00:00
|
|
|
* #ClutterAlpha is available since Clutter 0.2.
|
|
|
|
*
|
|
|
|
* #ClutterAlpha is deprecated since Clutter 1.12; use #ClutterTimeline and the
|
|
|
|
* #ClutterTimeline:progress-mode property.
|
|
|
|
*
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2006-08-28 17:11:15 +00:00
|
|
|
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
#include <gmodule.h>
|
|
|
|
|
2012-04-27 11:38:19 +00:00
|
|
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
#include "clutter-alpha.h"
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
#include "clutter-debug.h"
|
|
|
|
#include "clutter-enum-types.h"
|
2011-07-12 11:32:18 +00:00
|
|
|
#include "clutter-easing.h"
|
2006-08-28 17:11:15 +00:00
|
|
|
#include "clutter-main.h"
|
|
|
|
#include "clutter-marshal.h"
|
2006-11-21 Emmanuele Bassi <ebassi@openedhand.com>
* configure.ac: Enable debug messages also when
--enable-debug is set to "minimum".
* clutter/Makefile.am:
* clutter/clutter-debug.h: Move all debugging macros inside
this private header; make all debug macros depend on the
CLUTTER_ENABLE_DEBUG compile time define, controlled by
the --enable-debug configure switch; add G_LOG_DOMAIN define.
* clutter/clutter-main.c: Clean up the debug stuff; add
command line argument parsing using GOption; the debug
messages now are triggered like this:
CLUTTER_DEBUG=section:section:... clutter-app
or like this:
clutter-app --clutter-debug=section:section:...
where "section" is one of the sections listed in clutter-main.c,
or "all", for all sections; each section is bound to a flag,
which can be used to define a domain when adding a debug note
using the CLUTTER_NOTE() macro; the old CLUTTER_DBG() macro is
just a wrapper around that, under the CLUTTER_DEBUG_MISC domain;
CLUTTER_NOTE() is used like this:
CLUTTER_NOTE (DOMAIN, log-function);
where log function is g_printerr(), g_message(), g_warning(),
g_critical() or directly g_log() - for instance:
CLUTTER_NOTE (PANGO, g_warning ("Cache miss: %d", glyph));
will print the warning only if the "pango" flag has been
set to the CLUTTER_DEBUG envvar or passed to the --clutter-debug
command line argument.
similar to CLUTTER_SHOW_FPS, there's also the --clutter-show-fps
command line switch; also, the --display and --screen command
line switches have been added: the first overrides the DISPLAY
envvar and the second controls the X screen used by Clutter to
get the root window on the display.
* clutter/clutter-main.h:
* clutter/clutter-main.c: Add extended support for GOption
in Clutter; use clutter_init_with_args() to let Clutter
parse your own command line arguments; use instead
clutter_get_option_group() to get the GOptionGroup used by
Clutter if you want to do the parsing yourself with
g_option_context_parse(). The init sequence has been verified,
updated and moved into common functions where possible.
* clutter/pango/pangoclutter-render.c:
* clutter/*.c: Include "clutter-debug.h" where needed; use
CLUTTER_NOTE() instead of CLUTTER_DBG().
* examples/super-oh.c: Use the new clutter_init_with_args()
function, and add a --num-hands command line switch to
the SuperOH example code controlling the number of hands at
runtime.
2006-11-21 21:27:53 +00:00
|
|
|
#include "clutter-private.h"
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
#include "clutter-scriptable.h"
|
2009-10-21 15:04:12 +00:00
|
|
|
#include "clutter-script-private.h"
|
2006-08-28 17:11:15 +00:00
|
|
|
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
G_DEFINE_TYPE_WITH_CODE (ClutterAlpha,
|
|
|
|
clutter_alpha,
|
|
|
|
G_TYPE_INITIALLY_UNOWNED,
|
|
|
|
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_SCRIPTABLE,
|
|
|
|
clutter_scriptable_iface_init));
|
2006-11-15 23:37:53 +00:00
|
|
|
|
2006-11-14 14:12:56 +00:00
|
|
|
struct _ClutterAlphaPrivate
|
2006-08-28 17:11:15 +00:00
|
|
|
{
|
|
|
|
ClutterTimeline *timeline;
|
2006-11-15 23:37:53 +00:00
|
|
|
guint timeline_new_frame_id;
|
|
|
|
|
2009-01-20 16:42:49 +00:00
|
|
|
gdouble alpha;
|
2008-04-18 15:03:30 +00:00
|
|
|
|
|
|
|
GClosure *closure;
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
ClutterAlphaFunc func;
|
|
|
|
gpointer user_data;
|
|
|
|
GDestroyNotify notify;
|
|
|
|
|
2009-01-16 13:42:06 +00:00
|
|
|
gulong mode;
|
2006-08-28 17:11:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_0,
|
2006-11-15 23:37:53 +00:00
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
PROP_TIMELINE,
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
PROP_ALPHA,
|
2010-06-21 09:20:32 +00:00
|
|
|
PROP_MODE,
|
|
|
|
|
|
|
|
PROP_LAST
|
2006-08-28 17:11:15 +00:00
|
|
|
};
|
|
|
|
|
2010-06-21 09:20:32 +00:00
|
|
|
static GParamSpec *obj_props[PROP_LAST];
|
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
static void
|
|
|
|
timeline_new_frame_cb (ClutterTimeline *timeline,
|
2011-01-24 11:49:04 +00:00
|
|
|
guint msecs,
|
2006-08-28 17:11:15 +00:00
|
|
|
ClutterAlpha *alpha)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
ClutterAlphaPrivate *priv = alpha->priv;
|
2006-08-28 17:11:15 +00:00
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
/* Update alpha value and notify */
|
2008-09-23 09:41:08 +00:00
|
|
|
priv->alpha = clutter_alpha_get_alpha (alpha);
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_ALPHA]);
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2010-02-11 15:07:38 +00:00
|
|
|
ClutterAlpha *alpha = CLUTTER_ALPHA (object);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_TIMELINE:
|
|
|
|
clutter_alpha_set_timeline (alpha, g_value_get_object (value));
|
|
|
|
break;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
case PROP_MODE:
|
2009-01-16 13:42:06 +00:00
|
|
|
clutter_alpha_set_mode (alpha, g_value_get_ulong (value));
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
break;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
2010-02-11 15:07:38 +00:00
|
|
|
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
|
2006-08-28 17:11:15 +00:00
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_TIMELINE:
|
|
|
|
g_value_set_object (value, priv->timeline);
|
|
|
|
break;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
case PROP_ALPHA:
|
2009-01-20 16:42:49 +00:00
|
|
|
g_value_set_double (value, priv->alpha);
|
2006-08-28 17:11:15 +00:00
|
|
|
break;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
case PROP_MODE:
|
2009-01-16 13:42:06 +00:00
|
|
|
g_value_set_ulong (value, priv->mode);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
break;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_finalize (GObject *object)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
ClutterAlphaPrivate *priv = CLUTTER_ALPHA (object)->priv;
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
if (priv->notify != NULL)
|
|
|
|
priv->notify (priv->user_data);
|
|
|
|
else if (priv->closure != NULL)
|
2008-09-23 09:41:08 +00:00
|
|
|
g_closure_unref (priv->closure);
|
2006-11-15 23:37:53 +00:00
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
G_OBJECT_CLASS (clutter_alpha_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_dispose (GObject *object)
|
|
|
|
{
|
2006-09-08 20:57:31 +00:00
|
|
|
ClutterAlpha *self = CLUTTER_ALPHA(object);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
|
|
|
clutter_alpha_set_timeline (self, NULL);
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (clutter_alpha_parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
static ClutterAlphaFunc
|
|
|
|
resolve_alpha_func (const gchar *name)
|
|
|
|
{
|
|
|
|
static GModule *module = NULL;
|
|
|
|
ClutterAlphaFunc func;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name);
|
|
|
|
|
|
|
|
if (G_UNLIKELY (module == NULL))
|
2009-11-06 14:04:36 +00:00
|
|
|
module = g_module_open (NULL, 0);
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
|
|
|
|
if (g_module_symbol (module, name, (gpointer) &func))
|
|
|
|
{
|
|
|
|
CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table",
|
|
|
|
name);
|
|
|
|
return func;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_set_custom_property (ClutterScriptable *scriptable,
|
|
|
|
ClutterScript *script,
|
|
|
|
const gchar *name,
|
|
|
|
const GValue *value)
|
|
|
|
{
|
|
|
|
if (strncmp (name, "function", 8) == 0)
|
|
|
|
{
|
|
|
|
g_assert (G_VALUE_HOLDS (value, G_TYPE_POINTER));
|
|
|
|
if (g_value_get_pointer (value) != NULL)
|
|
|
|
{
|
|
|
|
clutter_alpha_set_func (CLUTTER_ALPHA (scriptable),
|
|
|
|
g_value_get_pointer (value),
|
|
|
|
NULL, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_object_set_property (G_OBJECT (scriptable), name, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
clutter_alpha_parse_custom_node (ClutterScriptable *scriptable,
|
|
|
|
ClutterScript *script,
|
|
|
|
GValue *value,
|
|
|
|
const gchar *name,
|
|
|
|
JsonNode *node)
|
|
|
|
{
|
|
|
|
if (strncmp (name, "function", 8) == 0)
|
|
|
|
{
|
|
|
|
const gchar *func_name = json_node_get_string (node);
|
|
|
|
|
|
|
|
g_value_init (value, G_TYPE_POINTER);
|
|
|
|
g_value_set_pointer (value, resolve_alpha_func (func_name));
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-10-21 15:04:12 +00:00
|
|
|
/* we need to do this because we use gulong in place
|
|
|
|
* of ClutterAnimationMode for ClutterAlpha:mode
|
|
|
|
*/
|
|
|
|
if (strncmp (name, "mode", 4) == 0)
|
|
|
|
{
|
2010-02-08 15:45:43 +00:00
|
|
|
gulong mode;
|
2009-10-21 15:04:12 +00:00
|
|
|
|
2011-09-07 15:14:10 +00:00
|
|
|
mode = _clutter_script_resolve_animation_mode (node);
|
2009-10-21 15:04:12 +00:00
|
|
|
|
2010-02-08 15:45:43 +00:00
|
|
|
g_value_init (value, G_TYPE_ULONG);
|
|
|
|
g_value_set_ulong (value, mode);
|
2009-10-21 15:04:12 +00:00
|
|
|
|
2010-02-08 15:45:43 +00:00
|
|
|
return TRUE;
|
2009-10-21 15:04:12 +00:00
|
|
|
}
|
|
|
|
|
alpha: Allow setting the function in ClutterScript
When defining an Alpha in ClutterScript we should allow setting
the alpha function by using a custom property. This makes it
possible to have both:
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : { "timeline" : "timeline-1", "function" : "alpha_func" },
...
}
And:
{
"id" : "alpha-1",
"type" : "ClutterAlpha",
"timeline" : "timeline-1",
"function" : "alpha_func"
},
{
"id" : "behaviour-1",
"type" : "ClutterBehaviourDepth",
"alpha" : "alpha-1",
...
}
The latter allows defining a single alpha function for multiple
behaviours.
2009-10-21 14:29:25 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_scriptable_iface_init (ClutterScriptableIface *iface)
|
|
|
|
{
|
|
|
|
iface->parse_custom_node = clutter_alpha_parse_custom_node;
|
|
|
|
iface->set_custom_property = clutter_alpha_set_custom_property;
|
|
|
|
}
|
2006-08-28 17:11:15 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_class_init (ClutterAlphaClass *klass)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
|
|
|
object_class->set_property = clutter_alpha_set_property;
|
|
|
|
object_class->get_property = clutter_alpha_get_property;
|
|
|
|
object_class->finalize = clutter_alpha_finalize;
|
|
|
|
object_class->dispose = clutter_alpha_dispose;
|
|
|
|
|
|
|
|
g_type_class_add_private (klass, sizeof (ClutterAlphaPrivate));
|
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
/**
|
|
|
|
* ClutterAlpha:timeline:
|
|
|
|
*
|
|
|
|
* A #ClutterTimeline instance used to drive the alpha function.
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-11-15 23:37:53 +00:00
|
|
|
*/
|
2010-10-15 14:24:27 +00:00
|
|
|
obj_props[PROP_TIMELINE] =
|
|
|
|
g_param_spec_object ("timeline",
|
2010-06-03 11:57:50 +00:00
|
|
|
P_("Timeline"),
|
|
|
|
P_("Timeline used by the alpha"),
|
2009-01-20 16:42:49 +00:00
|
|
|
CLUTTER_TYPE_TIMELINE,
|
|
|
|
CLUTTER_PARAM_READWRITE);
|
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
/**
|
|
|
|
* ClutterAlpha:alpha:
|
|
|
|
*
|
2009-01-20 16:42:49 +00:00
|
|
|
* The alpha value as computed by the alpha function. The linear
|
|
|
|
* interval is 0.0 to 1.0, but the Alpha allows overshooting by
|
|
|
|
* one unit in each direction, so the valid interval is -1.0 to 2.0.
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
* Deprecated: 1.12
|
2006-11-15 23:37:53 +00:00
|
|
|
*/
|
2010-10-15 14:24:27 +00:00
|
|
|
obj_props[PROP_ALPHA] =
|
|
|
|
g_param_spec_double ("alpha",
|
2010-06-03 11:57:50 +00:00
|
|
|
P_("Alpha value"),
|
|
|
|
P_("Alpha value as computed by the alpha"),
|
2009-01-20 16:42:49 +00:00
|
|
|
-1.0, 2.0,
|
|
|
|
0.0,
|
|
|
|
CLUTTER_PARAM_READABLE);
|
|
|
|
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
/**
|
|
|
|
* ClutterAlpha:mode:
|
|
|
|
*
|
2009-01-16 13:42:06 +00:00
|
|
|
* The progress function logical id - either a value from the
|
|
|
|
* #ClutterAnimationMode enumeration or a value returned by
|
|
|
|
* clutter_alpha_register_func().
|
|
|
|
*
|
|
|
|
* If %CLUTTER_CUSTOM_MODE is used then the function set using
|
|
|
|
* clutter_alpha_set_closure() or clutter_alpha_set_func()
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
* will be used.
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
* Deprecated: 1.12
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*/
|
2010-10-15 14:24:27 +00:00
|
|
|
obj_props[PROP_MODE] =
|
|
|
|
g_param_spec_ulong ("mode",
|
2010-06-03 11:57:50 +00:00
|
|
|
P_("Mode"),
|
|
|
|
P_("Progress mode"),
|
2009-01-20 16:42:49 +00:00
|
|
|
0, G_MAXULONG,
|
|
|
|
CLUTTER_CUSTOM_MODE,
|
|
|
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
|
2010-10-15 14:24:27 +00:00
|
|
|
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_class_install_properties (object_class,
|
|
|
|
PROP_LAST,
|
|
|
|
obj_props);
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
clutter_alpha_init (ClutterAlpha *self)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
CLUTTER_TYPE_ALPHA,
|
|
|
|
ClutterAlphaPrivate);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
|
|
|
self->priv->mode = CLUTTER_CUSTOM_MODE;
|
2009-01-20 16:42:49 +00:00
|
|
|
self->priv->alpha = 0.0;
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2006-09-08 20:57:31 +00:00
|
|
|
* clutter_alpha_get_alpha:
|
2006-08-28 17:11:15 +00:00
|
|
|
* @alpha: A #ClutterAlpha
|
|
|
|
*
|
|
|
|
* Query the current alpha value.
|
|
|
|
*
|
2006-09-08 20:57:31 +00:00
|
|
|
* Return Value: The current alpha value for the alpha
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
2009-01-20 16:42:49 +00:00
|
|
|
gdouble
|
2006-09-08 20:57:31 +00:00
|
|
|
clutter_alpha_get_alpha (ClutterAlpha *alpha)
|
2006-08-28 17:11:15 +00:00
|
|
|
{
|
2008-09-23 09:41:08 +00:00
|
|
|
ClutterAlphaPrivate *priv;
|
2009-01-20 16:42:49 +00:00
|
|
|
gdouble retval = 0;
|
2008-09-23 09:41:08 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), 0);
|
|
|
|
|
|
|
|
priv = alpha->priv;
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
if (G_LIKELY (priv->func))
|
|
|
|
{
|
|
|
|
return priv->func (alpha, priv->user_data);
|
|
|
|
}
|
|
|
|
else if (priv->closure)
|
2008-09-23 09:41:08 +00:00
|
|
|
{
|
2012-03-17 16:38:06 +00:00
|
|
|
GValue params = G_VALUE_INIT;
|
|
|
|
GValue result_value = G_VALUE_INIT;
|
2008-09-23 09:41:08 +00:00
|
|
|
|
|
|
|
g_object_ref (alpha);
|
|
|
|
|
2009-01-20 16:42:49 +00:00
|
|
|
g_value_init (&result_value, G_TYPE_DOUBLE);
|
2008-09-23 09:41:08 +00:00
|
|
|
|
|
|
|
g_value_init (¶ms, CLUTTER_TYPE_ALPHA);
|
|
|
|
g_value_set_object (¶ms, alpha);
|
2011-07-12 11:32:18 +00:00
|
|
|
|
2009-01-20 16:42:49 +00:00
|
|
|
g_closure_invoke (priv->closure, &result_value, 1, ¶ms, NULL);
|
2008-09-23 09:41:08 +00:00
|
|
|
|
2009-01-20 16:42:49 +00:00
|
|
|
retval = g_value_get_double (&result_value);
|
2008-09-23 09:41:08 +00:00
|
|
|
|
|
|
|
g_value_unset (&result_value);
|
|
|
|
g_value_unset (¶ms);
|
|
|
|
|
|
|
|
g_object_unref (alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
/*
|
|
|
|
* clutter_alpha_set_closure_internal:
|
|
|
|
* @alpha: a #ClutterAlpha
|
|
|
|
* @closure: a #GClosure
|
|
|
|
*
|
|
|
|
* Sets the @closure for @alpha. This function does not
|
|
|
|
* set the #ClutterAlpha:mode property and does not emit
|
|
|
|
* the #GObject::notify signal for it.
|
|
|
|
*/
|
|
|
|
static inline void
|
|
|
|
clutter_alpha_set_closure_internal (ClutterAlpha *alpha,
|
|
|
|
GClosure *closure)
|
|
|
|
{
|
|
|
|
ClutterAlphaPrivate *priv = alpha->priv;
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
if (priv->notify != NULL)
|
|
|
|
priv->notify (priv->user_data);
|
|
|
|
else if (priv->closure != NULL)
|
2009-01-20 17:57:30 +00:00
|
|
|
g_closure_unref (priv->closure);
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
priv->func = NULL;
|
|
|
|
priv->user_data = NULL;
|
|
|
|
priv->notify = NULL;
|
|
|
|
|
|
|
|
if (closure == NULL)
|
|
|
|
return;
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
/* need to take ownership of the closure before sinking it */
|
|
|
|
priv->closure = g_closure_ref (closure);
|
|
|
|
g_closure_sink (closure);
|
|
|
|
|
|
|
|
/* set the marshaller */
|
|
|
|
if (G_CLOSURE_NEEDS_MARSHAL (closure))
|
|
|
|
{
|
2010-06-11 14:49:46 +00:00
|
|
|
GClosureMarshal marshal = _clutter_marshal_DOUBLE__VOID;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
g_closure_set_marshal (priv->closure, marshal);
|
2009-01-20 17:57:30 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-04-18 15:03:30 +00:00
|
|
|
/**
|
|
|
|
* clutter_alpha_set_closure:
|
|
|
|
* @alpha: A #ClutterAlpha
|
|
|
|
* @closure: A #GClosure
|
|
|
|
*
|
2009-01-16 14:53:42 +00:00
|
|
|
* Sets the #GClosure used to compute the alpha value at each
|
|
|
|
* frame of the #ClutterTimeline bound to @alpha.
|
2008-04-18 15:03:30 +00:00
|
|
|
*
|
|
|
|
* Since: 0.8
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2008-04-18 15:03:30 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
clutter_alpha_set_closure (ClutterAlpha *alpha,
|
|
|
|
GClosure *closure)
|
|
|
|
{
|
|
|
|
ClutterAlphaPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
|
|
|
g_return_if_fail (closure != NULL);
|
|
|
|
|
|
|
|
priv = alpha->priv;
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
clutter_alpha_set_closure_internal (alpha, closure);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
|
|
|
priv->mode = CLUTTER_CUSTOM_MODE;
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
2008-04-18 15:03:30 +00:00
|
|
|
}
|
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
/**
|
|
|
|
* clutter_alpha_set_func:
|
|
|
|
* @alpha: A #ClutterAlpha
|
2008-11-18 12:42:05 +00:00
|
|
|
* @func: A #ClutterAlphaFunc
|
2006-11-15 23:37:53 +00:00
|
|
|
* @data: user data to be passed to the alpha function, or %NULL
|
|
|
|
* @destroy: notify function used when disposing the alpha function
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2006-11-15 23:37:53 +00:00
|
|
|
* Sets the #ClutterAlphaFunc function used to compute
|
|
|
|
* the alpha value at each frame of the #ClutterTimeline
|
|
|
|
* bound to @alpha.
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
2009-01-16 14:53:42 +00:00
|
|
|
* This function will not register @func as a global alpha function.
|
|
|
|
*
|
2006-11-17 19:17:40 +00:00
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
|
|
|
void
|
2006-09-08 20:57:31 +00:00
|
|
|
clutter_alpha_set_func (ClutterAlpha *alpha,
|
2006-11-15 23:37:53 +00:00
|
|
|
ClutterAlphaFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify destroy)
|
2006-08-28 17:11:15 +00:00
|
|
|
{
|
2009-01-20 17:57:30 +00:00
|
|
|
ClutterAlphaPrivate *priv;
|
2006-11-15 23:37:53 +00:00
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
2008-09-23 09:41:08 +00:00
|
|
|
g_return_if_fail (func != NULL);
|
2009-01-20 17:57:30 +00:00
|
|
|
|
|
|
|
priv = alpha->priv;
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
if (priv->notify != NULL)
|
|
|
|
{
|
|
|
|
priv->notify (priv->user_data);
|
|
|
|
}
|
|
|
|
else if (priv->closure != NULL)
|
|
|
|
{
|
|
|
|
g_closure_unref (priv->closure);
|
|
|
|
priv->closure = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
priv->func = func;
|
|
|
|
priv->user_data = data;
|
|
|
|
priv->notify = destroy;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
|
|
|
priv->mode = CLUTTER_CUSTOM_MODE;
|
2011-07-16 10:07:24 +00:00
|
|
|
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_set_timeline:
|
|
|
|
* @alpha: A #ClutterAlpha
|
2006-09-08 20:57:31 +00:00
|
|
|
* @timeline: A #ClutterTimeline
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2006-09-08 20:57:31 +00:00
|
|
|
* Binds @alpha to @timeline.
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
|
|
|
void
|
2006-11-15 23:37:53 +00:00
|
|
|
clutter_alpha_set_timeline (ClutterAlpha *alpha,
|
2006-08-28 17:11:15 +00:00
|
|
|
ClutterTimeline *timeline)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
ClutterAlphaPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
|
|
|
g_return_if_fail (timeline == NULL || CLUTTER_IS_TIMELINE (timeline));
|
|
|
|
|
|
|
|
priv = alpha->priv;
|
|
|
|
|
2009-01-05 12:05:51 +00:00
|
|
|
if (priv->timeline == timeline)
|
|
|
|
return;
|
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
if (priv->timeline)
|
2006-08-28 17:11:15 +00:00
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
g_signal_handlers_disconnect_by_func (priv->timeline,
|
|
|
|
timeline_new_frame_cb,
|
|
|
|
alpha);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
g_object_unref (priv->timeline);
|
|
|
|
priv->timeline = NULL;
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (timeline)
|
|
|
|
{
|
2006-11-15 23:37:53 +00:00
|
|
|
priv->timeline = g_object_ref (timeline);
|
2006-08-28 17:11:15 +00:00
|
|
|
|
2006-11-15 23:37:53 +00:00
|
|
|
g_signal_connect (priv->timeline, "new-frame",
|
|
|
|
G_CALLBACK (timeline_new_frame_cb),
|
|
|
|
alpha);
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_TIMELINE]);
|
2006-08-28 17:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_get_timeline:
|
|
|
|
* @alpha: A #ClutterAlpha
|
|
|
|
*
|
2006-11-17 18:45:31 +00:00
|
|
|
* Gets the #ClutterTimeline bound to @alpha.
|
|
|
|
*
|
2009-02-17 00:25:20 +00:00
|
|
|
* Return value: (transfer none): a #ClutterTimeline instance
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
|
|
|
ClutterTimeline *
|
|
|
|
clutter_alpha_get_timeline (ClutterAlpha *alpha)
|
|
|
|
{
|
2006-11-14 14:12:56 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), NULL);
|
|
|
|
|
2006-08-28 17:11:15 +00:00
|
|
|
return alpha->priv->timeline;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_new:
|
2006-11-15 23:37:53 +00:00
|
|
|
*
|
|
|
|
* Creates a new #ClutterAlpha instance. You must set a function
|
|
|
|
* to compute the alpha value using clutter_alpha_set_func() and
|
|
|
|
* bind a #ClutterTimeline object to the #ClutterAlpha instance
|
|
|
|
* using clutter_alpha_set_timeline().
|
|
|
|
*
|
|
|
|
* You should use the newly created #ClutterAlpha instance inside
|
|
|
|
* a #ClutterBehaviour object.
|
|
|
|
*
|
|
|
|
* Return value: the newly created empty #ClutterAlpha instance.
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
|
|
|
* Since: 0.2
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-11-15 23:37:53 +00:00
|
|
|
*/
|
|
|
|
ClutterAlpha *
|
|
|
|
clutter_alpha_new (void)
|
|
|
|
{
|
|
|
|
return g_object_new (CLUTTER_TYPE_ALPHA, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_new_full:
|
2006-09-08 20:57:31 +00:00
|
|
|
* @timeline: #ClutterTimeline timeline
|
2009-01-16 13:42:06 +00:00
|
|
|
* @mode: animation mode
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2006-11-17 18:45:31 +00:00
|
|
|
* Creates a new #ClutterAlpha instance and sets the timeline
|
2009-01-16 13:42:06 +00:00
|
|
|
* and animation mode.
|
|
|
|
*
|
|
|
|
* See also clutter_alpha_set_timeline() and clutter_alpha_set_mode().
|
2006-08-28 17:11:15 +00:00
|
|
|
*
|
2006-11-17 18:45:31 +00:00
|
|
|
* Return Value: the newly created #ClutterAlpha
|
2006-11-17 19:17:40 +00:00
|
|
|
*
|
2009-01-16 14:53:42 +00:00
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2006-08-28 17:11:15 +00:00
|
|
|
*/
|
2006-11-15 23:37:53 +00:00
|
|
|
ClutterAlpha *
|
2009-01-16 13:42:06 +00:00
|
|
|
clutter_alpha_new_full (ClutterTimeline *timeline,
|
|
|
|
gulong mode)
|
2006-08-28 17:11:15 +00:00
|
|
|
{
|
2006-11-14 14:12:56 +00:00
|
|
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
2009-01-16 13:42:06 +00:00
|
|
|
g_return_val_if_fail (mode != CLUTTER_ANIMATION_LAST, NULL);
|
2006-11-15 23:37:53 +00:00
|
|
|
|
2009-01-16 13:42:06 +00:00
|
|
|
return g_object_new (CLUTTER_TYPE_ALPHA,
|
|
|
|
"timeline", timeline,
|
|
|
|
"mode", mode,
|
|
|
|
NULL);
|
2006-11-15 23:37:53 +00:00
|
|
|
}
|
|
|
|
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
/**
|
2009-01-16 13:42:06 +00:00
|
|
|
* clutter_alpha_new_with_func:
|
|
|
|
* @timeline: a #ClutterTimeline
|
|
|
|
* @func: a #ClutterAlphaFunc
|
|
|
|
* @data: data to pass to the function, or %NULL
|
|
|
|
* @destroy: function to call when removing the alpha function, or %NULL
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*
|
2009-01-16 13:42:06 +00:00
|
|
|
* Creates a new #ClutterAlpha instances and sets the timeline
|
|
|
|
* and the alpha function.
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*
|
2009-01-16 14:53:42 +00:00
|
|
|
* This function will not register @func as a global alpha function.
|
|
|
|
*
|
|
|
|
* See also clutter_alpha_set_timeline() and clutter_alpha_set_func().
|
|
|
|
*
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
* Return value: the newly created #ClutterAlpha
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*/
|
|
|
|
ClutterAlpha *
|
2009-01-16 13:42:06 +00:00
|
|
|
clutter_alpha_new_with_func (ClutterTimeline *timeline,
|
|
|
|
ClutterAlphaFunc func,
|
|
|
|
gpointer data,
|
|
|
|
GDestroyNotify destroy)
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
{
|
2009-01-16 13:42:06 +00:00
|
|
|
ClutterAlpha *retval;
|
|
|
|
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
|
|
|
g_return_val_if_fail (func != NULL, NULL);
|
|
|
|
|
|
|
|
retval = clutter_alpha_new ();
|
|
|
|
clutter_alpha_set_timeline (retval, timeline);
|
|
|
|
clutter_alpha_set_func (retval, func, data, destroy);
|
|
|
|
|
|
|
|
return retval;
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_get_mode:
|
|
|
|
* @alpha: a #ClutterAlpha
|
|
|
|
*
|
2009-03-27 14:28:08 +00:00
|
|
|
* Retrieves the #ClutterAnimationMode used by @alpha.
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*
|
|
|
|
* Return value: the animation mode
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*/
|
2009-01-16 13:42:06 +00:00
|
|
|
gulong
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
clutter_alpha_get_mode (ClutterAlpha *alpha)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (CLUTTER_IS_ALPHA (alpha), CLUTTER_CUSTOM_MODE);
|
|
|
|
|
|
|
|
return alpha->priv->mode;
|
|
|
|
}
|
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
typedef struct _AlphaData {
|
|
|
|
guint closure_set : 1;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
ClutterAlphaFunc func;
|
|
|
|
gpointer data;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
GClosure *closure;
|
|
|
|
} AlphaData;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
static GPtrArray *clutter_alphas = NULL;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
|
|
|
static gdouble
|
2011-07-12 11:32:18 +00:00
|
|
|
clutter_alpha_easing_func (ClutterAlpha *alpha,
|
|
|
|
gpointer data G_GNUC_UNUSED)
|
2009-01-20 17:57:30 +00:00
|
|
|
{
|
2011-07-12 11:32:18 +00:00
|
|
|
ClutterAlphaPrivate *priv = alpha->priv;
|
|
|
|
ClutterTimeline *timeline = priv->timeline;
|
|
|
|
gdouble t, d;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
if (G_UNLIKELY (priv->timeline == NULL))
|
2009-01-20 17:57:30 +00:00
|
|
|
return 0.0;
|
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
t = clutter_timeline_get_elapsed_time (timeline);
|
|
|
|
d = clutter_timeline_get_duration (timeline);
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2012-04-11 13:11:28 +00:00
|
|
|
return clutter_easing_for_mode (priv->mode, t, d);
|
2009-01-20 17:57:30 +00:00
|
|
|
}
|
|
|
|
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
/**
|
|
|
|
* clutter_alpha_set_mode:
|
|
|
|
* @alpha: a #ClutterAlpha
|
|
|
|
* @mode: a #ClutterAnimationMode
|
|
|
|
*
|
|
|
|
* Sets the progress function of @alpha using the symbolic value
|
2009-01-16 13:42:06 +00:00
|
|
|
* of @mode, as taken by the #ClutterAnimationMode enumeration or
|
|
|
|
* using the value returned by clutter_alpha_register_func().
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
*/
|
|
|
|
void
|
2009-01-16 13:42:06 +00:00
|
|
|
clutter_alpha_set_mode (ClutterAlpha *alpha,
|
|
|
|
gulong mode)
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
{
|
|
|
|
ClutterAlphaPrivate *priv;
|
|
|
|
|
|
|
|
g_return_if_fail (CLUTTER_IS_ALPHA (alpha));
|
2009-01-16 13:42:06 +00:00
|
|
|
g_return_if_fail (mode != CLUTTER_ANIMATION_LAST);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
|
|
|
priv = alpha->priv;
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
if (mode == CLUTTER_CUSTOM_MODE)
|
|
|
|
{
|
|
|
|
priv->mode = mode;
|
|
|
|
}
|
|
|
|
else if (mode < CLUTTER_ANIMATION_LAST)
|
2009-01-16 13:42:06 +00:00
|
|
|
{
|
2011-07-16 10:07:24 +00:00
|
|
|
if (priv->mode == mode)
|
|
|
|
return;
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2009-01-16 13:42:06 +00:00
|
|
|
/* sanity check to avoid getting an out of sync
|
|
|
|
* enum/function mapping
|
|
|
|
*/
|
2012-04-11 13:11:28 +00:00
|
|
|
g_assert (clutter_get_easing_func_for_mode (mode) != NULL);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
clutter_alpha_set_closure_internal (alpha, NULL);
|
|
|
|
|
2011-07-12 11:32:18 +00:00
|
|
|
priv->mode = mode;
|
|
|
|
|
|
|
|
CLUTTER_NOTE (ANIMATION, "New easing mode '%s'[%lu]\n",
|
2012-04-11 13:11:28 +00:00
|
|
|
clutter_get_easing_name_for_mode (priv->mode),
|
|
|
|
priv->mode);
|
2011-07-12 11:32:18 +00:00
|
|
|
|
|
|
|
priv->func = clutter_alpha_easing_func;
|
2011-07-16 10:07:24 +00:00
|
|
|
priv->user_data = NULL;
|
|
|
|
priv->notify = NULL;
|
2009-01-16 13:42:06 +00:00
|
|
|
}
|
|
|
|
else if (mode > CLUTTER_ANIMATION_LAST)
|
|
|
|
{
|
|
|
|
AlphaData *alpha_data = NULL;
|
|
|
|
gulong real_index = 0;
|
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
if (priv->mode == mode)
|
|
|
|
return;
|
|
|
|
|
2009-01-16 13:42:06 +00:00
|
|
|
if (G_UNLIKELY (clutter_alphas == NULL))
|
|
|
|
{
|
|
|
|
g_warning ("No alpha functions defined for ClutterAlpha to use. "
|
|
|
|
"Use clutter_alpha_register_func() to register an "
|
|
|
|
"alpha function.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
real_index = mode - CLUTTER_ANIMATION_LAST - 1;
|
|
|
|
|
|
|
|
alpha_data = g_ptr_array_index (clutter_alphas, real_index);
|
|
|
|
if (G_UNLIKELY (alpha_data == NULL))
|
|
|
|
{
|
|
|
|
g_warning ("No alpha function registered for mode %lu.",
|
|
|
|
mode);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (alpha_data->closure_set)
|
|
|
|
clutter_alpha_set_closure (alpha, alpha_data->closure);
|
|
|
|
else
|
2009-01-20 17:57:30 +00:00
|
|
|
{
|
2011-07-16 10:07:24 +00:00
|
|
|
clutter_alpha_set_closure_internal (alpha, NULL);
|
2009-01-20 17:57:30 +00:00
|
|
|
|
2011-07-16 10:07:24 +00:00
|
|
|
priv->func = alpha_data->func;
|
|
|
|
priv->user_data = alpha_data->data;
|
|
|
|
priv->notify = NULL;
|
2009-01-20 17:57:30 +00:00
|
|
|
}
|
2009-01-16 13:42:06 +00:00
|
|
|
|
|
|
|
priv->mode = mode;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
g_assert_not_reached ();
|
2009-01-05 12:47:10 +00:00
|
|
|
|
2011-03-03 11:35:46 +00:00
|
|
|
g_object_notify_by_pspec (G_OBJECT (alpha), obj_props[PROP_MODE]);
|
2008-11-17 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1014 - Clutter Animation API Improvements
* clutter/Makefile.am:
* clutter/clutter.h: Update the build
* clutter/clutter-types.h: Add AnimationMode, an enumeration
for easing functions.
* clutter/clutter-alpha.[ch]: Add the :mode property to
control the function bound to an Alpha instance using an
enumeration value. Also add six new alpha functions:
- ease-in, ease-out, ease-in-out
- sine-in, sine-out, sine-in-out
* clutter/clutter-deprecated.h: Deprecate the #defines for
the alpha functions. They will be replaced by entries in the
ClutterAnimationMode.
* clutter/clutter-interval.[ch]: Add ClutterInterval, an
object for defining, validating and computing an interval
between two values.
* clutter/clutter-animation.[ch]: Add ClutterAnimation, an
object responsible for animation the properties of a single
actor along an interval of values. ClutterAnimation memory
management is automatic. A simple wrapper method for
ClutterActor is provided:
clutter_actor_animate()
which will create, or update, an animation for the passed
actor.
* clutter/clutter-debug.h:
* clutter/clutter-main.c: Add a new 'animation' debug note.
* clutter/clutter-script.c: Clean up the alpha functions
whitelist, and add the new functions.
* doc/reference/clutter/Makefile.am:
* doc/reference/clutter/clutter-sections.txt: Update the
API reference.
* doc/reference/clutter/clutter-animation.xml: Renamed to
doc/reference/clutter/clutter-animation-tutorial.xml to
avoid clashes with the ClutterAnimation section.
* doc/reference/clutter/clutter-docs.sgml: Renamed to
doc/reference/clutter/clutter-docs.xml, as it was an XML
file and not a SGML file.
* tests/Makefile.am:
* tests/interactive/Makefile.am:
* tests/interactive/test-animation.c:
* tests/interactive/test-easing.c: Add two tests for the
new simple animation API and the easing functions.
* tests/interactive/test-actors.c:
* tests/interactive/test-behave.c:
* tests/interactive/test-depth.c:
* tests/interactive/test-effects.c:
* tests/interactive/test-layout.c:
* tests/interactive/test-multistage.c:
* tests/interactive/test-paint-wrapper.c:
* tests/interactive/test-rotate.c:
* tests/interactive/test-scale.c:
* tests/interactive/test-texture-quality.c:
* tests/interactive/test-threads.c:
* tests/interactive/test-viewport.c: Update interactive tests
to the deprecations and new alpha API.
2008-11-18 09:50:03 +00:00
|
|
|
}
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
static gulong
|
|
|
|
register_alpha_internal (AlphaData *alpha_data)
|
|
|
|
{
|
|
|
|
if (G_UNLIKELY (clutter_alphas == NULL))
|
|
|
|
clutter_alphas = g_ptr_array_new ();
|
|
|
|
|
|
|
|
g_ptr_array_add (clutter_alphas, alpha_data);
|
|
|
|
|
|
|
|
return clutter_alphas->len + CLUTTER_ANIMATION_LAST;
|
|
|
|
}
|
|
|
|
|
2007-11-23 13:11:10 +00:00
|
|
|
/**
|
2010-09-03 15:10:44 +00:00
|
|
|
* clutter_alpha_register_func: (skip)
|
2009-01-16 13:42:06 +00:00
|
|
|
* @func: a #ClutterAlphaFunc
|
|
|
|
* @data: user data to pass to @func, or %NULL
|
2007-11-23 13:11:10 +00:00
|
|
|
*
|
2009-01-16 13:42:06 +00:00
|
|
|
* Registers a global alpha function and returns its logical id
|
|
|
|
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
|
2007-11-23 13:11:10 +00:00
|
|
|
*
|
2009-01-16 13:42:06 +00:00
|
|
|
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
|
|
|
|
*
|
|
|
|
* Return value: the logical id of the alpha function
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2009-01-16 13:42:06 +00:00
|
|
|
*/
|
|
|
|
gulong
|
|
|
|
clutter_alpha_register_func (ClutterAlphaFunc func,
|
|
|
|
gpointer data)
|
|
|
|
{
|
|
|
|
AlphaData *alpha_data;
|
|
|
|
|
|
|
|
g_return_val_if_fail (func != NULL, 0);
|
|
|
|
|
|
|
|
alpha_data = g_slice_new (AlphaData);
|
|
|
|
alpha_data->closure_set = FALSE;
|
|
|
|
alpha_data->func = func;
|
|
|
|
alpha_data->data = data;
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
return register_alpha_internal (alpha_data);
|
2009-01-16 13:42:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* clutter_alpha_register_closure:
|
|
|
|
* @closure: a #GClosure
|
|
|
|
*
|
|
|
|
* #GClosure variant of clutter_alpha_register_func().
|
|
|
|
*
|
|
|
|
* Registers a global alpha function and returns its logical id
|
|
|
|
* to be used by clutter_alpha_set_mode() or by #ClutterAnimation.
|
|
|
|
*
|
|
|
|
* The logical id is always greater than %CLUTTER_ANIMATION_LAST.
|
|
|
|
*
|
2010-09-03 15:10:44 +00:00
|
|
|
* Rename to: clutter_alpha_register_func
|
2010-09-03 11:14:50 +00:00
|
|
|
*
|
2009-01-16 13:42:06 +00:00
|
|
|
* Return value: the logical id of the alpha function
|
|
|
|
*
|
|
|
|
* Since: 1.0
|
2012-04-25 16:13:29 +00:00
|
|
|
*
|
|
|
|
* Deprecated: 1.12
|
2007-11-23 13:11:10 +00:00
|
|
|
*/
|
2009-01-16 13:42:06 +00:00
|
|
|
gulong
|
|
|
|
clutter_alpha_register_closure (GClosure *closure)
|
|
|
|
{
|
2009-01-20 17:57:30 +00:00
|
|
|
AlphaData *alpha_data;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (closure != NULL, 0);
|
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
alpha_data = g_slice_new (AlphaData);
|
|
|
|
alpha_data->closure_set = TRUE;
|
|
|
|
alpha_data->closure = closure;
|
2009-01-16 13:42:06 +00:00
|
|
|
|
2009-01-20 17:57:30 +00:00
|
|
|
return register_alpha_internal (alpha_data);
|
2009-01-16 13:42:06 +00:00
|
|
|
}
|