ClutterCairoTexture

ClutterCairoTexture — Texture with Cairo integration

Synopsis

                    ClutterCairoTexture;
                    ClutterCairoTextureClass;
ClutterActor*       clutter_cairo_texture_new           (guint width,
                                                         guint height);
void                clutter_cairo_texture_set_surface_size
                                                        (ClutterCairoTexture *self,
                                                         guint width,
                                                         guint height);
void                clutter_cairo_texture_get_surface_size
                                                        (ClutterCairoTexture *self,
                                                         guint *width,
                                                         guint *height);

cairo_t*            clutter_cairo_texture_create        (ClutterCairoTexture *self);
cairo_t*            clutter_cairo_texture_create_region (ClutterCairoTexture *self,
                                                         gint x_offset,
                                                         gint y_offset,
                                                         gint width,
                                                         gint height);

void                clutter_cairo_set_source_color      (cairo_t *cr,
                                                         const ClutterColor *color);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----ClutterActor
               +----ClutterTexture
                     +----ClutterCairoTexture

Implemented Interfaces

ClutterCairoTexture implements ClutterScriptable.

Properties

  "surface-height"           guint                 : Read / Write
  "surface-width"            guint                 : Read / Write

Description

ClutterCairoTexture is a ClutterTexture that displays the contents of a Cairo context. The ClutterCairoTexture actor will create a Cairo image surface which will then be uploaded to a GL texture when needed.

ClutterCairoTexture will provide a cairo_t context by using the clutter_cairo_texture_create() and clutter_cairo_texture_create_region() functions; you can use the Cairo API to draw on the context and then call cairo_destroy() when done.

As soon as the context is destroyed with cairo_destroy(), the contents of the surface will be uploaded into the ClutterCairoTexture actor:

  cairo_t *cr;

  cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (texture));

  /* draw on the context */

  cairo_destroy (cr);

Warning

Note that you should never use the code above inside the "paint" or "pick" virtual functions or signal handlers because it will lead to performance degradation.

Note

Since ClutterCairoTexture uses a Cairo image surface internally all the drawing operations will be performed in software and not using hardware acceleration. This can lead to performance degradation if the contents of the texture change frequently.

ClutterCairoTexture is available since Clutter 1.0.

Details

ClutterCairoTexture

typedef struct _ClutterCairoTexture ClutterCairoTexture;

The ClutterCairoTexture struct contains only private data.

Since 1.0


ClutterCairoTextureClass

typedef struct {
} ClutterCairoTextureClass;

The ClutterCairoTextureClass struct contains only private data.

Since 1.0


clutter_cairo_texture_new ()

ClutterActor*       clutter_cairo_texture_new           (guint width,
                                                         guint height);

Creates a new ClutterCairoTexture actor, with a surface of width by height pixels.

width :

height :

Returns :

Since 1.0


clutter_cairo_texture_set_surface_size ()

void                clutter_cairo_texture_set_surface_size
                                                        (ClutterCairoTexture *self,
                                                         guint width,
                                                         guint height);

Resizes the Cairo surface used by self to width and height.

self :

width :

height :

Since 1.0


clutter_cairo_texture_get_surface_size ()

void                clutter_cairo_texture_get_surface_size
                                                        (ClutterCairoTexture *self,
                                                         guint *width,
                                                         guint *height);

Retrieves the surface width and height for self.

self :

width :

height :

Since 1.0


clutter_cairo_texture_create ()

cairo_t*            clutter_cairo_texture_create        (ClutterCairoTexture *self);

Creates a new Cairo context for the cairo texture. It is similar to using clutter_cairo_texture_create_region() with x_offset and y_offset of 0, width equal to the cairo texture surface width and height equal to the cairo texture surface height.

Warning

Do not call this function within the paint virtual function or from a callback to the "paint" signal.

self :

Returns :

Since 1.0


clutter_cairo_texture_create_region ()

cairo_t*            clutter_cairo_texture_create_region (ClutterCairoTexture *self,
                                                         gint x_offset,
                                                         gint y_offset,
                                                         gint width,
                                                         gint height);

Creates a new Cairo context that will updat the region defined by x_offset, y_offset, width and height.

Warning

Do not call this function within the paint virtual function or from a callback to the "paint" signal.

self :

x_offset :

y_offset :

width :

height :

Returns :

Since 1.0


clutter_cairo_set_source_color ()

void                clutter_cairo_set_source_color      (cairo_t *cr,
                                                         const ClutterColor *color);

Utility function for setting the source color of cr using a ClutterColor.

cr :

color :

Since 1.0

Property Details

The "surface-height" property

  "surface-height"           guint                 : Read / Write

The height of the Cairo surface used by the ClutterCairoTexture actor, in pixels.

Default value: 0

Since 1.0


The "surface-width" property

  "surface-width"            guint                 : Read / Write

The width of the Cairo surface used by the ClutterCairoTexture actor, in pixels.

Default value: 0

Since 1.0