ClutterAlpha

ClutterAlpha — A class for calculating an alpha value as a function of time.

Synopsis




                    ClutterAlpha;
                    ClutterAlphaClass;
ClutterAlpha*       clutter_alpha_new                   (void);
ClutterAlpha*       clutter_alpha_new_full              (ClutterTimeline *timeline,
                                                         ClutterAlphaFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);
guint32             clutter_alpha_get_alpha             (ClutterAlpha *alpha);
#define             CLUTTER_ALPHA_MAX_ALPHA
guint32             (*ClutterAlphaFunc)                 (ClutterAlpha *alpha,
                                                         gpointer user_data);
void                clutter_alpha_set_func              (ClutterAlpha *alpha,
                                                         ClutterAlphaFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);
void                clutter_alpha_set_timeline          (ClutterAlpha *alpha,
                                                         ClutterTimeline *timeline);
ClutterTimeline*    clutter_alpha_get_timeline          (ClutterAlpha *alpha);
#define             CLUTTER_ALPHA_RAMP_INC
guint32             clutter_ramp_inc_func               (ClutterAlpha *alpha,
                                                         gpointer dummy);
#define             CLUTTER_ALPHA_RAMP_DEC
guint32             clutter_ramp_dec_func               (ClutterAlpha *alpha,
                                                         gpointer dummy);
#define             CLUTTER_ALPHA_RAMP
guint32             clutter_ramp_func                   (ClutterAlpha *alpha,
                                                         gpointer dummy);
#define             CLUTTER_ALPHA_SINE
guint32             clutter_sine_func                   (ClutterAlpha *alpha,
                                                         gpointer dummy);


Object Hierarchy


  GObject
   +----ClutterAlpha

Properties


  "alpha"                    guint                 : Read
  "timeline"                 ClutterTimeline       : Read / Write

Description

ClutterAlpha is a class for calculating an integer value between 0 and CLUTTER_ALPHA_MAX_ALPHA as a function of time. You should provide a ClutterTimeline and bind it to the ClutterAlpha object; you should also provide a function returning the alpha value depending on the position inside the timeline; this function will be executed each time a new frame in the ClutterTimeline is reached. Since the alpha function is controlled by the timeline instance, you can pause or stop the ClutterAlpha from calling the alpha function by controlling the ClutterTimeline object.

ClutterAlpha is used to "drive" a ClutterBehaviour instance.

Details

ClutterAlpha

typedef struct _ClutterAlpha ClutterAlpha;

The ClutterAlpha structure contains only private data and should not be accessed directly.


ClutterAlphaClass

typedef struct {
  GInitiallyUnownedClass parent_class;
  
  void (*_clutter_alpha_1) (void);
  void (*_clutter_alpha_2) (void);
  void (*_clutter_alpha_3) (void);
  void (*_clutter_alpha_4) (void);
  void (*_clutter_alpha_5) (void);
} ClutterAlphaClass;


clutter_alpha_new ()

ClutterAlpha*       clutter_alpha_new                   (void);

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.

Returns : the newly created empty ClutterAlpha instance.

Since 0.2


clutter_alpha_new_full ()

ClutterAlpha*       clutter_alpha_new_full              (ClutterTimeline *timeline,
                                                         ClutterAlphaFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);

Creates a new ClutterAlpha instance and sets the timeline and alpha function.

timeline : ClutterTimeline timeline
func : ClutterAlphaFunc alpha function
data : data to be passed to the alpha function
destroy : notify to be called when removing the alpha function
Returns : the newly created ClutterAlpha

Since 0.2


clutter_alpha_get_alpha ()

guint32             clutter_alpha_get_alpha             (ClutterAlpha *alpha);

Query the current alpha value.

alpha : A ClutterAlpha
Returns : The current alpha value for the alpha

Since 0.2


CLUTTER_ALPHA_MAX_ALPHA

#define CLUTTER_ALPHA_MAX_ALPHA 0xffff

Maximum value of the alpha function. You should use this value to scale the computed alpha value.


ClutterAlphaFunc ()

guint32             (*ClutterAlphaFunc)                 (ClutterAlpha *alpha,
                                                         gpointer user_data);

The alpha function is a function of time. You should provide a function transforming the current position in the timeline.

alpha : a ClutterAlpha
user_data : optional user defined data passed to the function
Returns : a value between 0 and CLUTTER_ALPHA_MAX_ALPHA

clutter_alpha_set_func ()

void                clutter_alpha_set_func              (ClutterAlpha *alpha,
                                                         ClutterAlphaFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);

Sets the ClutterAlphaFunc function used to compute the alpha value at each frame of the ClutterTimeline bound to alpha.

alpha : A ClutterAlpha
func : A ClutterAlphaAlphaFunc
data : user data to be passed to the alpha function, or NULL
destroy : notify function used when disposing the alpha function

Since 0.2


clutter_alpha_set_timeline ()

void                clutter_alpha_set_timeline          (ClutterAlpha *alpha,
                                                         ClutterTimeline *timeline);

Binds alpha to timeline.

alpha : A ClutterAlpha
timeline : A ClutterTimeline

Since 0.2


clutter_alpha_get_timeline ()

ClutterTimeline*    clutter_alpha_get_timeline          (ClutterAlpha *alpha);

Gets the ClutterTimeline bound to alpha.

alpha : A ClutterAlpha
Returns : a ClutterTimeline instance

Since 0.2


CLUTTER_ALPHA_RAMP_INC

#define CLUTTER_ALPHA_RAMP_INC  clutter_ramp_inc_func

Symbolic name for passing clutter_ramp_inc_func().


clutter_ramp_inc_func ()

guint32             clutter_ramp_inc_func               (ClutterAlpha *alpha,
                                                         gpointer dummy);

Convenience alpha function for a monotonic increasing ramp. You can use this function as the alpha function for clutter_alpha_set_func().

alpha : a ClutterAlpha
dummy : unused argument
Returns : an alpha value.

Since 0.2


CLUTTER_ALPHA_RAMP_DEC

#define CLUTTER_ALPHA_RAMP_DEC  clutter_ramp_dec_func

Symbolic name for passing clutter_ramp_dec_func().


clutter_ramp_dec_func ()

guint32             clutter_ramp_dec_func               (ClutterAlpha *alpha,
                                                         gpointer dummy);

Convenience alpha function for a monotonic decreasing ramp. You can use this function as the alpha function for clutter_alpha_set_func().

alpha : a ClutterAlpha
dummy : unused argument
Returns : an alpha value.

Since 0.2


CLUTTER_ALPHA_RAMP

#define CLUTTER_ALPHA_RAMP      clutter_ramp_func

Symbolic name for passing clutter_ramp_func().


clutter_ramp_func ()

guint32             clutter_ramp_func                   (ClutterAlpha *alpha,
                                                         gpointer dummy);

Convenience alpha function for a full ramp function (increase for half the time, decrease for the remaining half). You can use this function as the alpha function for clutter_alpha_set_func().

alpha : a ClutterAlpha
dummy : unused argument
Returns : an alpha value.

Since 0.2


CLUTTER_ALPHA_SINE

#define CLUTTER_ALPHA_SINE      clutter_sine_func

Symbolic name for passing clutter_sine_func().


clutter_sine_func ()

guint32             clutter_sine_func                   (ClutterAlpha *alpha,
                                                         gpointer dummy);

Convenience alpha function for a sine wave. You can use this function as the alpha function for clutter_alpha_set_func().

alpha : a ClutterAlpha
dummy : unused argument
Returns : an alpha value.

Since 0.2

Property Details

The "alpha" property

  "alpha"                    guint                 : Read

The alpha value as computed by the alpha function.

Allowed values: <= 65535

Default value: 0

Since 0.2


The "timeline" property

  "timeline"                 ClutterTimeline       : Read / Write

A ClutterTimeline instance used to drive the alpha function.

Since 0.2

See Also

ClutterBehaviour, ClutterTimeline