Clutter.OffscreenEffect
Description: Reference for Clutter.OffscreenEffect

### Class

# ClutterOffscreenEffect

#### Description [src]

    abstract class Clutter.OffscreenEffect : Clutter.Effect
    {
      /* No available fields */
    }

Base class for effects using offscreen buffers

`ClutterOffscreenEffect` is an abstract class that can be used by `ClutterEffect` sub-classes requiring access to an offscreen buffer.

Some effects, like the fragment shader based effects, can only use GL textures, and in order to apply those effects to any kind of actor they require that all drawing operations are applied to an offscreen framebuffer that gets redirected to a texture.

`ClutterOffscreenEffect` provides all the heavy-lifting for creating the offscreen framebuffer, the redirection and the final paint of the texture on the desired stage.

## Implementing a ClutterOffscreenEffect

Creating a sub-class of `ClutterOffscreenEffect` requires, in case of overriding the `ClutterEffect` virtual functions, to chain up to the `ClutterOffscreenEffect`‘s implementation.

On top of the `ClutterEffect`‘s virtual functions, `ClutterOffscreenEffect` also provides a `Clutter.OffscreenEffectClass.paint_target` function, which encapsulates the effective painting of the texture that contains the result of the offscreen redirection.

The size of the target pipeline is defined to be as big as the transformed size of the `ClutterActor` using the offscreen effect. Sub-classes of `ClutterOffscreenEffect` can change the texture creation code to provide bigger textures by overriding the `Clutter.OffscreenEffectClass.create_texture` virtual function; no chain up to the `ClutterOffscreenEffect` implementation is required in this case.

## Paint nodes

`ClutterOffscreenEffect` generates the following paint node tree:

    Effect
     ├─────────┐
    Layer   Pipeline
     │
    Actor

When the actor contents are cached, the generated paint node tree looks like this:

    Effect
     │
    Pipeline

In both cases, the “Pipeline” node is created with the return value of `Clutter.OffscreenEffectClass.create_pipeline`.

#### Ancestors

- ClutterEffect
- ClutterActorMeta
- GInitiallyUnowned
- GObject

#### Descendants

- ClutterBlurEffect
- ClutterBrightnessContrastEffect
- ClutterColorizeEffect
- ClutterDeformEffect
- ClutterDesaturateEffect
- ClutterShaderEffect

#### Instance methods

###### clutter_offscreen_effect_create_texture

Calls the `Clutter.OffscreenEffectClass.create_texture` virtual function of the `effect`.

###### clutter_offscreen_effect_get_pipeline

Retrieves the pipeline used as a render target for the offscreen buffer created by `effect`.

###### clutter_offscreen_effect_get_target_size

Retrieves the size of the offscreen buffer used by `effect` to paint the actor to which it has been applied.

###### clutter_offscreen_effect_get_texture

Retrieves the texture used as a render target for the offscreen buffer created by `effect`.

###### clutter_offscreen_effect_paint_target

Calls the `Clutter.OffscreenEffectClass.paint_target` virtual function of the `effect`.

##### Methods inherited from ClutterEffect (1)

###### clutter_effect_queue_repaint

Queues a repaint of the effect. The effect can detect when the ‘paint’ method is called as a result of this function because it will not have the `CLUTTER_EFFECT_PAINT_ACTOR_DIRTY` flag set. In that case the effect is free to assume that the actor has not changed its appearance since the last time it was painted so it doesn’t need to call `clutter_actor_continue_paint()` if it can draw a cached image. This is mostly intended for effects that are using a %CoglOffscreen to redirect the actor (such as %ClutterOffscreenEffect). In that case the effect can save a bit of rendering time by painting the cached texture without causing the entire actor to be painted.

##### Methods inherited from ClutterActorMeta (5)

###### clutter_actor_meta_get_actor

Retrieves a pointer to the `ClutterActor` that owns `meta`.

###### clutter_actor_meta_get_enabled

Retrieves whether `meta` is enabled.

###### clutter_actor_meta_get_name

Retrieves the name set using `clutter_actor_meta_set_name()`.

###### clutter_actor_meta_set_enabled

Sets whether `meta` should be enabled or not.

###### clutter_actor_meta_set_name

Sets the name of `meta`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

##### Properties inherited from ClutterActorMeta (3)

###### Clutter.ActorMeta:actor

The `ClutterActor` attached to the `ClutterActorMeta` instance.

###### Clutter.ActorMeta:enabled

Whether or not the `ClutterActorMeta` is enabled.

###### Clutter.ActorMeta:name

The unique name to access the `ClutterActorMeta`.

#### Signals

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ClutterOffscreenEffectClass {
      CoglTexture* (* create_texture) (
        ClutterOffscreenEffect* effect,
        CoglContext* cogl_context,
        gfloat width,
        gfloat height
      );
      CoglPipeline* (* create_pipeline) (
        ClutterOffscreenEffect* effect,
        CoglTexture* texture
      );
      void (* paint_target) (
        ClutterOffscreenEffect* effect,
        ClutterPaintNode* node,
        ClutterPaintContext* paint_context
      );

    }

The `ClutterOffscreenEffectClass` structure contains only private data.

###### Class members

`create_texture: CoglTexture* (* create_texture) ( ClutterOffscreenEffect* effect, CoglContext* cogl_context, gfloat width, gfloat height )`

  Virtual function.

`create_pipeline: CoglPipeline* (* create_pipeline) ( ClutterOffscreenEffect* effect, CoglTexture* texture )`

  No description available.

`paint_target: void (* paint_target) ( ClutterOffscreenEffect* effect, ClutterPaintNode* node, ClutterPaintContext* paint_context )`

  Virtual function.

#### Virtual methods

###### Clutter.OffscreenEffectClass.create_pipeline

No description available.

###### Clutter.OffscreenEffectClass.create_texture

Calls the `Clutter.OffscreenEffectClass.create_texture` virtual function of the `effect`.

###### Clutter.OffscreenEffectClass.paint_target

Calls the `Clutter.OffscreenEffectClass.paint_target` virtual function of the `effect`.