2007-01-30 Emmanuele Bassi <ebassi@openedhand.com>

* clutter/clutter-alpha.h:
	* clutter/clutter-alpha.c: Add the square waveform
	function clutter_square_func() to the precooked
	alpha functions.
This commit is contained in:
Emmanuele Bassi 2007-01-30 16:51:49 +00:00
parent 244cacd14b
commit 9661bd50b8
3 changed files with 38 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2007-01-30 Emmanuele Bassi <ebassi@openedhand.com>
* 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 <mallum@openedhand.com> 2007-01-23 Matthew Allum <mallum@openedhand.com>
* Makefile.am: * Makefile.am:

View File

@ -626,3 +626,31 @@ clutter_sine_inc_func (ClutterAlpha *alpha,
return sincx1024_func (alpha, 81, CFX_ONE); return sincx1024_func (alpha, 81, CFX_ONE);
#endif #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;
}

View File

@ -104,6 +104,7 @@ ClutterTimeline *clutter_alpha_get_timeline (ClutterAlpha *alpha);
#define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func #define CLUTTER_ALPHA_RAMP_DEC clutter_ramp_dec_func
#define CLUTTER_ALPHA_RAMP clutter_ramp_func #define CLUTTER_ALPHA_RAMP clutter_ramp_func
#define CLUTTER_ALPHA_SINE clutter_sine_func #define CLUTTER_ALPHA_SINE clutter_sine_func
#define CLUTTER_ALPHA_SQUARE clutter_square_func
guint32 clutter_ramp_inc_func (ClutterAlpha *alpha, guint32 clutter_ramp_inc_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
@ -113,6 +114,8 @@ guint32 clutter_ramp_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
guint32 clutter_sine_func (ClutterAlpha *alpha, guint32 clutter_sine_func (ClutterAlpha *alpha,
gpointer dummy); gpointer dummy);
guint32 clutter_square_func (ClutterAlpha *alpha,
gpointer dummy);
G_END_DECLS G_END_DECLS