docs: Add example of setting background color with ClutterEffect
Add example of a simple background color effect applied via pre_paint() implementation in a ClutterEffect subclass. This is a simple effect with an incomplete GObject implementation (no properties, setters or getters) to make it as easy to follow as possible.
This commit is contained in:
42
doc/cookbook/examples/cb-background-effect.h
Normal file
42
doc/cookbook/examples/cb-background-effect.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef __CB_BACKGROUND_EFFECT_H__
|
||||
#define __CB_BACKGROUND_EFFECT_H__
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
GType cb_background_effect_get_type (void);
|
||||
|
||||
#define CB_TYPE_BACKGROUND_EFFECT (cb_background_effect_get_type ())
|
||||
#define CB_BACKGROUND_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
|
||||
CB_TYPE_BACKGROUND_EFFECT, \
|
||||
CbBackgroundEffect))
|
||||
#define CB_IS_BACKGROUND_EFFECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
|
||||
CB_TYPE_BACKGROUND_EFFECT))
|
||||
#define CB_BACKGROUND_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
|
||||
CB_TYPE_BACKGROUND_EFFECT, \
|
||||
CbBackgroundEffectClass))
|
||||
#define CB_IS_BACKGROUND_EFFECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
|
||||
CB_TYPE_BACKGROUND_EFFECT))
|
||||
#define CB_BACKGROUND_EFFECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
|
||||
CB_TYPE_BACKGROUND_EFFECT, \
|
||||
CbBackgroundEffectClass))
|
||||
|
||||
typedef struct _CbBackgroundEffectPrivate CbBackgroundEffectPrivate;
|
||||
typedef struct _CbBackgroundEffect CbBackgroundEffect;
|
||||
typedef struct _CbBackgroundEffectClass CbBackgroundEffectClass;
|
||||
|
||||
/* object */
|
||||
struct _CbBackgroundEffect
|
||||
{
|
||||
ClutterEffect parent_instance;
|
||||
CbBackgroundEffectPrivate *priv;
|
||||
};
|
||||
|
||||
/* class */
|
||||
struct _CbBackgroundEffectClass
|
||||
{
|
||||
ClutterEffectClass parent_class;
|
||||
};
|
||||
|
||||
ClutterEffect *cb_background_effect_new ();
|
||||
|
||||
#endif /* __CB_BACKGROUND_EFFECT_H__ */
|
Reference in New Issue
Block a user