From 9661bd50b8518598ff738e5104ca7fd1a58a3b68 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 30 Jan 2007 16:51:49 +0000 Subject: [PATCH] 2007-01-30 Emmanuele Bassi * clutter/clutter-alpha.h: * clutter/clutter-alpha.c: Add the square waveform function clutter_square_func() to the precooked alpha functions. --- ChangeLog | 7 +++++++ clutter/clutter-alpha.c | 28 ++++++++++++++++++++++++++++ clutter/clutter-alpha.h | 3 +++ 3 files changed, 38 insertions(+) diff --git a/ChangeLog b/ChangeLog index d7ad4e983..3d9ee67f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-01-30 Emmanuele Bassi + + * clutter/clutter-alpha.h: + * clutter/clutter-alpha.c: Add the square waveform + function clutter_square_func() to the precooked + alpha functions. + 2007-01-23 Matthew Allum * Makefile.am: diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c index c4c272131..f900eebe6 100644 --- a/clutter/clutter-alpha.c +++ b/clutter/clutter-alpha.c @@ -626,3 +626,31 @@ clutter_sine_inc_func (ClutterAlpha *alpha, return sincx1024_func (alpha, 81, CFX_ONE); #endif } + +/** + * clutter_square_func: + * @alpha: a #ClutterAlpha + * @dummy: unused argument + * + * Convenience alpha function for a square wave. You can use this + * function as the alpha function for clutter_alpha_set_func(). + * + * Return value: an alpha value + * + * Since: 0.4 + */ +guint32 +clutter_square_func (ClutterAlpha *alpha, + gpointer dummy) +{ + ClutterTimeline *timeline; + gint current_frame_num, n_frames; + + timeline = clutter_alpha_get_timeline (alpha); + + current_frame_num = clutter_timeline_get_current_frame (timeline); + n_frames = clutter_timeline_get_n_frames (timeline); + + return (current_frame_num > (n_frames / 2)) ? CLUTTER_ALPHA_MAX_ALPHA + : 0; +} diff --git a/clutter/clutter-alpha.h b/clutter/clutter-alpha.h index c216b6bec..b4d732c2d 100644 --- a/clutter/clutter-alpha.h +++ b/clutter/clutter-alpha.h @@ -104,6 +104,7 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha); #define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func #define CLUTTER_ALPHA_RAMP clutter_ramp_func #define CLUTTER_ALPHA_SINE clutter_sine_func +#define CLUTTER_ALPHA_SQUARE clutter_square_func guint32 clutter_ramp_inc_func (ClutterAlpha *alpha, gpointer dummy); @@ -113,6 +114,8 @@ guint32 clutter_ramp_func (ClutterAlpha *alpha, gpointer dummy); guint32 clutter_sine_func (ClutterAlpha *alpha, gpointer dummy); +guint32 clutter_square_func (ClutterAlpha *alpha, + gpointer dummy); G_END_DECLS