From 06bf2ddaefa5874d55358b80bc4bf03563784199 Mon Sep 17 00:00:00 2001 From: Tomas Frydrych Date: Wed, 16 May 2007 13:53:39 +0000 Subject: [PATCH] added clutter_sine_half_func() --- ChangeLog | 7 ++++++ clutter/clutter-alpha.c | 34 ++++++++++++++++++++++++++++++ clutter/clutter-alpha.h | 3 +++ doc/reference/clutter-sections.txt | 2 ++ 4 files changed, 46 insertions(+) diff --git a/ChangeLog b/ChangeLog index 8ba46d3c5..95d98e058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-16 Tomas Frydrych + + * clutter/clutter-alpha.h: + * clutter/clutter-alpha.c: + * doc/reference/clutter-sections.txt: + Added clutter_sine_half(). + 2007-05-16 Tomas Frydrych * clutter/clutter-alpha.h: diff --git a/clutter/clutter-alpha.c b/clutter/clutter-alpha.c index adadf6b74..4a17cb150 100644 --- a/clutter/clutter-alpha.c +++ b/clutter/clutter-alpha.c @@ -666,6 +666,40 @@ clutter_sine_dec_func (ClutterAlpha *alpha, return CFX_INT (sine); } +/** + * clutter_sine_half_func: + * @alpha: a #ClutterAlpha + * @dummy: unused argument + * + * Convenience alpha function for a sine wave over interval <0, pi>. + * You can use this function as the alpha function for + * clutter_alpha_set_func(). + * + * Return value: an alpha value. + * + * Since: 0.4 + */ +guint32 +clutter_sine_half_func (ClutterAlpha *alpha, + gpointer dummy) +{ + ClutterTimeline * timeline; + gint frame; + gint n_frames; + ClutterAngle x; + ClutterFixed sine; + + timeline = clutter_alpha_get_timeline (alpha); + frame = clutter_timeline_get_current_frame (timeline); + n_frames = clutter_timeline_get_n_frames (timeline); + + x = 512 * frame / n_frames; + + sine = clutter_sini (x) * CLUTTER_ALPHA_MAX_ALPHA; + + return CFX_INT (sine); +} + /** * clutter_square_func: * @alpha: a #ClutterAlpha diff --git a/clutter/clutter-alpha.h b/clutter/clutter-alpha.h index fb4d40e01..ac1c14e1a 100644 --- a/clutter/clutter-alpha.h +++ b/clutter/clutter-alpha.h @@ -108,6 +108,7 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha); #define CLUTTER_ALPHA_SINE clutter_sine_func #define CLUTTER_ALPHA_SINE_INC clutter_sine_inc_func #define CLUTTER_ALPHA_SINE_DEC clutter_sine_dec_func +#define CLUTTER_ALPHA_SINE_HALF clutter_sine_half_func #define CLUTTER_ALPHA_SQUARE clutter_square_func #define CLUTTER_ALPHA_SMOOTHSTEP clutter_smoothstep_func @@ -137,6 +138,8 @@ guint32 clutter_sine_inc_func (ClutterAlpha *alpha, gpointer dummy); guint32 clutter_sine_dec_func (ClutterAlpha *alpha, gpointer dummy); +guint32 clutter_sine_half_func (ClutterAlpha *alpha, + gpointer dummy); guint32 clutter_square_func (ClutterAlpha *alpha, gpointer dummy); guint32 clutter_smoothstep_func (ClutterAlpha *alpha, diff --git a/doc/reference/clutter-sections.txt b/doc/reference/clutter-sections.txt index 1621337e8..fae4b6979 100644 --- a/doc/reference/clutter-sections.txt +++ b/doc/reference/clutter-sections.txt @@ -116,6 +116,8 @@ CLUTTER_ALPHA_SINE_INC clutter_sine_inc_func CLUTTER_ALPHA_SINE_DEC clutter_sine_dec_func +CLUTTER_ALPHA_SINE_HALF +clutter_sine_half_func CLUTTER_ALPHA_SQUARE clutter_square_func CLUTTER_ALPHA_SMOOTHSTEP