mutter/clutter/clutter/clutter-flatten-effect.h

74 lines
2.8 KiB
C
Raw Normal View History

clutter-actor: Add an 'offscreen-redirect' property This adds a property which can be used to redirect the actor through an FBO before painting so that it becomes flattened in an image. The image can be used as a cache to avoid having to repaint the actor if something unrelated in the scene changes. It can also be used to implement correct opacity even if the actor has overlapping primitives. The property is an enum that takes three values: CLUTTER_OFFSCREEN_REDIRECT_NEVER: The default behaviour which is to never flatten the actor. CLUTTER_OFFSCREEN_REDIRECT_ALWAYS: The actor is always redirected through an FBO. CLUTTER_OFFSCREEN_REDIRECT_ONLY_FOR_OPACITY: The actor is only redirected through an FBO if the paint opacity is not 255. This value would be used if the actor wants correct opacity. It will avoid the overhead of using an FBO whenever the actor is fully opaque. The property is implemented by installing a ClutterFlattenEffect. ClutterFlattenEffect is a new internal class which subclasses ClutterOffscreen to redirect the painting to an FBO. When ClutterOffscreen paints, the effect sets an opacity override on the actor so that the image will always contain the actor at full opacity. The opacity is then applied to the resulting image before painting it to the stage. This means the actor does not need to be redrawn while the opacity is being animated. The effect has a high internal priority so that it will always occur before any other effects and it gets hidden from the application.
2011-02-28 10:05:51 -05:00
/*
* Clutter.
*
* An OpenGL based 'interactive canvas' library.
*
* Copyright (C) 2011 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
* Authors:
* Neil Roberts <neil@linux.intel.com>
*/
#ifndef __CLUTTER_FLATTEN_EFFECT_H__
#define __CLUTTER_FLATTEN_EFFECT_H__
#include <clutter/clutter-offscreen-effect.h>
G_BEGIN_DECLS
#define CLUTTER_TYPE_FLATTEN_EFFECT \
(_clutter_flatten_effect_get_type())
#define CLUTTER_FLATTEN_EFFECT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
CLUTTER_TYPE_FLATTEN_EFFECT, \
ClutterFlattenEffect))
#define CLUTTER_FLATTEN_EFFECT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST ((klass), \
CLUTTER_TYPE_FLATTEN_EFFECT, \
ClutterFlattenEffectClass))
#define CLUTTER_IS_FLATTEN_EFFECT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
CLUTTER_TYPE_FLATTEN_EFFECT))
#define CLUTTER_IS_FLATTEN_EFFECT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE ((klass), \
CLUTTER_TYPE_FLATTEN_EFFECT))
#define CLUTTER_FLATTEN_EFFECT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), \
CLUTTER_FLATTEN_EFFECT, \
ClutterFlattenEffectClass))
typedef struct _ClutterFlattenEffect ClutterFlattenEffect;
typedef struct _ClutterFlattenEffectClass ClutterFlattenEffectClass;
typedef struct _ClutterFlattenEffectPrivate ClutterFlattenEffectPrivate;
struct _ClutterFlattenEffectClass
{
ClutterOffscreenEffectClass parent_class;
};
struct _ClutterFlattenEffect
{
ClutterOffscreenEffect parent;
};
GType _clutter_flatten_effect_get_type (void) G_GNUC_CONST;
ClutterEffect *_clutter_flatten_effect_new (void);
G_END_DECLS
#endif /* __CLUTTER_FLATTEN_EFFECT_H__ */