CtkLayerActor

CtkLayerActor — Class to easily stack images (with masks applied to them) on top of each other

Synopsis

                    CtkLayerActor;
                    CtkLayerActorClass;
                    CtkLayerActorPrivate;
ClutterActor *      ctk_layer_actor_new                 (guint width,
                                                         guint height);
guint               ctk_layer_actor_get_width           (CtkLayerActor *self);
void                ctk_layer_actor_set_width           (CtkLayerActor *self,
                                                         guint width);
guint               ctk_layer_actor_get_height          (CtkLayerActor *self);
void                ctk_layer_actor_set_height          (CtkLayerActor *self,
                                                         guint height);
guint               ctk_layer_actor_get_num_layers      (CtkLayerActor *self);
void                ctk_layer_actor_add_layer           (CtkLayerActor *self,
                                                         CtkLayer *layer);
CtkLayer *          ctk_layer_actor_get_layer           (CtkLayerActor *self,
                                                         guint index);
void                ctk_layer_actor_flatten             (CtkLayerActor *self);
gboolean            ctk_layer_actor_is_flattened        (CtkLayerActor *self);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ClutterActor
               +----CtkActor
                     +----CtkLayerActor

Implemented Interfaces

CtkLayerActor implements ClutterScriptable and CtkFocusable.

Properties

  "flattened"                gboolean              : Read
  "height"                   guint                 : Read / Write
  "num-layers"               guint                 : Read
  "width"                    guint                 : Read / Write

Description

CtkLayerActor allows to stack multiple images (with a mask applied) on top of each other. It's like a layered image in gimp using normal alpha- blending for the various layers. Each layer has to have the same size as the actor itself. This restriction is meant to keep things simple for the moment. In the future this can be loosened, should the need arise.

Details

CtkLayerActor

typedef struct _CtkLayerActor CtkLayerActor;


CtkLayerActorClass

typedef struct {
  CtkActorClass parent_class;
} CtkLayerActorClass;


CtkLayerActorPrivate

typedef struct _CtkLayerActorPrivate CtkLayerActorPrivate;


ctk_layer_actor_new ()

ClutterActor *      ctk_layer_actor_new                 (guint width,
                                                         guint height);

Creates a new CtkLayerActor, which can hold multiple layers (image/mask) to form a composited actor.

width :

a guint

height :

a guint

Returns :

a ClutterActor or NULL in case of an error

ctk_layer_actor_get_width ()

guint               ctk_layer_actor_get_width           (CtkLayerActor *self);

Get the width of self.

self :

a CtkLayerActor

Returns :

a guint, the width of self

ctk_layer_actor_set_width ()

void                ctk_layer_actor_set_width           (CtkLayerActor *self,
                                                         guint width);

Set the width of self. Do that before passing the first layer. Remember width and height of self and any layer added to it have to match exactly!

self :

a CtkLayerActor

width :

a guint

ctk_layer_actor_get_height ()

guint               ctk_layer_actor_get_height          (CtkLayerActor *self);

Get the height of self.

self :

a CtkLayerActor

Returns :

a guint, the height of self

ctk_layer_actor_set_height ()

void                ctk_layer_actor_set_height          (CtkLayerActor *self,
                                                         guint height);

Set the height of self. Do that before passing the first layer. Remember width and height of self and any layer added to it have to match exactly!

self :

a CtkLayerActor

height :

a guint

ctk_layer_actor_get_num_layers ()

guint               ctk_layer_actor_get_num_layers      (CtkLayerActor *self);

Get the number of layers in self. If self has been flattend before this will return 1.

self :

a CtkLayerActor

Returns :

a guint holding the number of layers in self (enabled and non-enabled layers)

ctk_layer_actor_add_layer ()

void                ctk_layer_actor_add_layer           (CtkLayerActor *self,
                                                         CtkLayer *layer);

Add layer to self. If layer or self are NULL nothing happens. Remember that height and width of layer have to exactly match those of self!

self :

a CtkLayerActor

layer :

a CtkLayer

ctk_layer_actor_get_layer ()

CtkLayer *          ctk_layer_actor_get_layer           (CtkLayerActor *self,
                                                         guint index);

Grab the pointer to of a layer indicated by index. Don't unref the returned pointer!

self :

a CtkLayerActor

index :

a guint indicating, which layer (counting starts at 0) to grab

Returns :

a CtkLayer or NULL, if index passed in was out-of-bound or self was invalid

ctk_layer_actor_flatten ()

void                ctk_layer_actor_flatten             (CtkLayerActor *self);

Collapse all (enabled) layers of a layer-actor into one single layer with a full mask. Afterwards the self will consist of only one layer. All other layers will be freed and removed. This is an optimization you can do to speed up the rendering of self. Usually one layer means on pass, thus keeping the number of layers to a minimum improves performance.

This operation cannot be undone.

Currently not implemented. Calling this does nothing.

self :

a CtkLayerActor

ctk_layer_actor_is_flattened ()

gboolean            ctk_layer_actor_is_flattened        (CtkLayerActor *self);

Check if the layer-actor is flattened already, meaning all enabled layers were collapsed into a single layer with a full mask. A flattened layer-actor will consist of only one single layer.

self :

a CtkLayerActor

Returns :

a gboolean, TRUE if self is flattened, FALSE if not or in an error-case

Property Details

The "flattened" property

  "flattened"                gboolean              : Read

Flag indicating if layer-actor is flattened.

Default value: FALSE


The "height" property

  "height"                   guint                 : Read / Write

Height of layer-actor in pixels.

Default value: 0


The "num-layers" property

  "num-layers"               guint                 : Read

Number of layers used in layer-actor.

Default value: 0


The "width" property

  "width"                    guint                 : Read / Write

Width of layer-actor in pixels.

Default value: 0

See Also

CtkLayerinclude ctk-layer-actor.h