Timelines no longer work in terms of a frame rate and a number of
frames but instead just have a duration in milliseconds. This better
matches the working of the master clock where if any timelines are
running it will redraw as fast as possible rather than limiting to the
lowest rated timeline.
Most applications will just create animations and expect them to
finish in a certain amount of time without caring about how many
frames are drawn. If a frame is going to be drawn it might as well
update all of the animations to some fraction of the total animation
rather than rounding to the nearest whole frame.
The 'frame_num' parameter of the new-frame signal is now 'msecs' which
is a number of milliseconds progressed along the
timeline. Applications should use clutter_timeline_get_progress
instead of the frame number.
Markers can now only be attached at a time value. The position is
stored in milliseconds rather than at a frame number.
test-timeline-smoothness and test-timeline-dup-frames have been
removed because they no longer make sense.
Bug 1561 - Bad code in clutter-alpha.c
The implementation of the easing modes equations followed closely
the JavaScript and ActionScript counterparts. Obviously, JS and AS
are not C-compatible, so later versions of gcc (4.4.0 for instance)
would complain about uninitialized variables and such. The code is
also obfuscated and hard to debug/understand.
For these reasons, the implementation should be unobfuscated and
sanitized.
Add annotations such as (transfer-none) (out) (element-type ClutterActor),
and so forth to the doc comments as appropriate.
The annotations added here are a combination of the annotations previously
in gir-repository for Clutter and annotations found in a review of all
return values with that were being parsed with a transfer of "full".
http://bugzilla.openedhand.com/show_bug.cgi?id=1452
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
The ClutterAlpha API reference page should also list the
easing modes Clutter provides by default, by showing the
curves used by each entry in the AnimationMode enumeration.
We can also remove the incomplete graph showing the old
alpha functions.
Instead of using our own homegrown alpha functions, we should
use the easing functions also shared by other animation frameworks,
like jQuery and Tween, in the interests of code portability.
The easing functions have been defined by Robert Penner and
are divided into three categories:
In Out InOut
Each category has a particular curve:
Quadratic
Cubic
Quartic
Quintic
Sinusoidal
Exponential
Circular
In addition, there are "physical" curves:
Elastic
Back (overshooting cubic)
Bounce (exponentially decaying parabolic)
Finally, the Linear curve is also provided as a reference.
The functions are private, and are meant to be used only
through their logical id as provided by the AnimationMode
enumeration.
The tests should be updated as well to match the new
easing functions.
The current Alpha value is an unsigned integer that can be used
implicitly as a fixed point value. This makes writing an alpha
function overshooting below and above the current range basically
impossible without complicating an already complex code, and
creating weird corner cases.
For this reason, the Alpha value should be defined as a floating
point normalized value, spanning a range between 0.0 and 1.0; in
order to allow overshooting, the valid range is extended one unit
below and one unit above, thus making it -1.0 .. 2.0.
This commit updates the various users of the ClutterAlpha API
and the tests cases.
This commit also removes all the current alpha functions exposed
in the public API.
Both clutter_alpha_new_with_func() and clutter_alpha_set_func()
will not register a global alpha function, so we need to update
the documentation to explicitly say so.
In order to unify alpha functions and animation modes in ClutterAlpha
we should be able to register alpha functions and get a logical id
for them; the logical id will then be available to be used by
clutter_alpha_set_mode().
The registration requires API changes in ClutterAlpha constructors
and methods. It also provides the chance to shift ClutterAlpha
towards the use of animations modes only, and to alpha functions
as a convenience API for language bindings alone.
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha
The following functions are fixed:
clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture
They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.
* clutter/clutter-alpha.h:
* clutter/clutter-alpha.c:
(clutter_alpha_set_mode): Use a lookup table to find the alpha
function given the animation mode.
(clutter_exp_in_func),
(clutter_exp_out_func),
(clutter_exp_in_out_func): Add new exponential functions.
* clutter/clutter-script.c: Update the lookup table with the
new animation modes; match "linear" to the ramp-inc alpha
function.
* clutter/clutter-types.h: Add new AnimationMode values.
* tests/interactive/test-easing.c: Update the easing functions
test.
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.
Bug 1209 - Move fixed point API in COGL
* clutter/cogl/cogl-fixed.h:
* clutter/cogl/cogl.h.in:
* clutter/cogl/common/Makefile.am:
* clutter/cogl/common/cogl-fixed.c: Add fixed point API, modelled
after the ClutterFixed. The CoglFixed API supercedes the ClutterFixed
one and avoids the dependency of COGL on Clutter's own API.
* clutter/cogl/common/cogl-clip-stack.c:
* clutter/cogl/common/cogl-primitives.c:
* clutter/cogl/common/cogl-primitives.h: Update internal usage of
ClutterFixed to CoglFixed.
* clutter/cogl/gl/Makefile.am:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gl/cogl.c: Ditto, in the GL implementation of the
COGL API.
* clutter/cogl/gles/Makefile.am:
* clutter/cogl/gles/cogl-fbo.c:
* clutter/cogl/gles/cogl-gles2-wrapper.c:
* clutter/cogl/gles/cogl-primitives.c:
* clutter/cogl/gles/cogl-texture.c:
* clutter/cogl/gles/cogl.c: Ditto, in the GLES implementation of
the COGL API.
* clutter/pango/pangoclutter-glyph-cache.c:
* clutter/pango/pangoclutter-glyph-cache.h: Ditto, in the Pango
renderer glyphs cache.
* clutter/clutter-fixed.c:
* clutter/clutter-fixed.h: ClutterFixed and related API becomes
a simple transition API for bindings and public Clutter API.
* clutter/clutter-actor.c:
* clutter/clutter-alpha.c:
* clutter/clutter-backend.c:
* clutter/clutter-behaviour-depth.c:
* clutter/clutter-behaviour-ellipse.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-behaviour-rotate.c:
* clutter/clutter-behaviour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-color.c:
* clutter/clutter-entry.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c:
* clutter/clutter-timeline.c:
* clutter/clutter-units.h: Move from the internal usage of
ClutterFixed to CoglFixed.
* doc/reference/clutter/clutter-sections.txt:
* doc/reference/cogl/cogl-docs.sgml:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/test-cogl-tex-tile.c:
* tests/test-project.c: Fix tests after the API change
* README: Add release notes.
* clutter/clutter-alpha.c:
(clutter_alpha_get_alpha): Do not return the cached value but
just compute the current alpha value. The use case is pretty
much straightforward: stop a timeline, advance it, and retrieve
the alpha value before starting the timeline to adjust an
animation dependent on the alpha. Caching the alpha value is
not needed because the behaviours will always pass the alpha
value inside the ::alpha-notify virtual function anyway, so
there is no need for them to call clutter_alpha_get_alpha().
This change makes it also possible to reliably unit-test
ClutterAlpha.
(timeline_new_frame_cb): Call clutter_alpha_get_alpha().
* clutter/cogl/gl/cogl.c (set_clip_plane):
* clutter/clutter-alpha.c (sinc_func): Use G_PI instead of M_PI
because M_PI isn't defined in MSVC without a special
#define. Thanks to Haakon Sporsheim
Bug #884 - Add clutter_alpha_set_closure
* clutter/clutter-alpha.[ch]: Add clutter_alpha_set_closure(),
a GClosure variant of clutter_alpha_set_func(), and reimplement
the latter as a special case of the former. (#884, Xan López)
* clutter/clutter-behaviour-path.c: Reference the newly
added image showing the effects of different alpha functions
on the same path behaviour.
* configure.ac: Find out the prefix of some of the libraries
we depend upon, so that gtk-doc can fix the references for us.
When computing the increasing smoothstep alpha value use the right type
for the results, to avoid overflowing the [0, 0xffff] range of the alpha
value.
Also use the right format when printing out the opacity and alpha values
in the opacity behaviour.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
Add new set_width/height API calls.
Tweak scaling by reseting matrix.
Make set_opactiy() take parent opacity into account.
Fix clipping.
* clutter/clutter-alpha.c:
Add more sine functionality.
* clutter/clutter-behaviour-opacity.c:
Dont make a copy of all applied actors but use a foreach()
* clutter/clutter-behaviour-scale.c:
Give correct limits to propertys.
Tweak gravity a little more.
Update docs.
:
* clutter/clutter-behaviour.c: (clutter_behaviour_remove):
Minor warning text change.
* clutter/clutter-feature.c: (clutter_feature_wait_for_vblank):
Minor dri ioctl tweak.
* clutter/clutter-label.c:
* clutter/clutter-label.h:
Add new label_full api call.
* clutter/clutter-private.h: Add our own READABLE,
WRITABLE and READWRITE paramspec flags, declaring the
string components of the properties GParamSpec as static;
this should shave off some bytes in the memory footprint
and avoid relocations.
* clutter/clutter-actor.c:
* clutter/clutter-behaviour.c:
* clutter/clutter-behaviour-opacity.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-behavuour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-label.c:
* clutter/clutter-rectangle.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c:
* clutter/clutter-timeline.c: Use the CLUTTER_PARAM_*
macros we just added.
* clutter/clutter-behaviour-scale.c: Add properties for
the scale begin, scale end and gravity parameters.
* clutter/clutter-behaviour-path.h: Mark the ClutterKnot
memory management functions as public (for the bindings),
since we use the slice allocator for copying knots around;
add a clutter_knot_equal() function.
* clutter/clutter-behaviour-path.c:
(node_distance): Use clutter_knot_equal() as a fast path
to avoid the sqrt() in case the nodes we are using are
at the same position.
(path_total_length): Additional check on the existence
of the next node.
* examples/behave.c: Do not leak the ClutterBehaviour
objects around.
* clutter/clutter-actor.c:
* clutter/clutter-alpha.c:
* clutter/clutter-behaviour-opacity.c:
* clutter/clutter-behaviour-scale.c:
* clutter/clutter-clone-texture.c:
* clutter/clutter-feature.c:
* clutter/clutter-label.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c:
* clutter/clutter-texture.c
* clutter/clutter-timeline.c:
* clutter/clutter-debug.h:
Make CLUTTER_NOTE() just take a string rather than a func.
Add more default context to output.
* configure.ac:
Fix flag and add more help docs for --ebable-debug option.
* 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.
* clutter/clutter-behaviour-path.h:
* clutter/clutter-behaviour-path.c: Add "since" strings; add
a "knot" property which can be used to append a knot to the path;
fix apidoc.
* clutter/clutter-alpha.c: Add "since" strings.
* clutter/clutter-feature.c: Add apidoc.
* clutter/clutter-behaviour-opacity.c: Add the "opacity-start"
and "opacity-end" properties; rewrite constructor to use them.
* clutter/clutter-behaviour-path.h:
* clutter/clutter-behaviour-path.c: Add a "knot-reached" signal,
which is emitted when the path reaches a node in the nodes list;
flesh out the documentation a bit; sync the parameters names
so that gtk-doc doesn't complain about missing stuff.
* clutter/clutter-behaviour.h:
* clutter/clutter-behaviour.c: Add the alpha value to the
ClutterBehaviour::alpha_notify vfunc, so you don't have to
get the value from the alpha inside the behaviour implementations;
add more documentation.
* clutter/clutter-alpha.c: Flesh out the description.
* clutter/clutter-actor.h: Update the header.
* clutter/clutter-behaviour-opacity.c:
* clutter/clutter-behaviour-scale.c: Update docs.