Next: , Previous: ClutterChildMeta, Up: Top

17 ClutterCairoTexture

Texture with Cairo integration

17.1 Overview

<clutter-cairo-texture> is a <clutter-texture> that displays the contents of a Cairo context. The <clutter-cairo-texture> actor will create a Cairo image surface which will then be uploaded to a GL texture when needed.

Since <clutter-cairo-texture> 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.

In order to use a <clutter-cairo-texture> you should connect to the <"draw"> signal; the signal is emitted each time the <clutter-cairo-texture> has been told to invalidate its contents, by using clutter-cairo-texture-invalidate-rectangle or its sister function, clutter-cairo-texture-invalidate.

Each callback to the <"draw"> signal will receive a <cairo-t> context which can be used for drawing; the Cairo context is owned by the <clutter-cairo-texture> and should not be destroyed explicitly.


<clutter-cairo-texture> is available since Clutter 1.0.

17.2 Usage

— Function: clutter-cairo-texture-new (width unsigned-int) (height unsigned-int) ⇒  (ret <clutter-actor>)

Creates a new <clutter-cairo-texture> actor, with a surface of width by height pixels.

the width of the surface
the height of the surface
the newly created <clutter-cairo-texture> actor

Since 1.0

— Function: clutter-cairo-texture-invalidate (self <clutter-cairo-texture>)
— Method: invalidate

Invalidates the whole surface of a <clutter-cairo-texture>.

This function will cause the <"draw"> signal to be emitted.

See also: clutter-cairo-texture-invalidate-rectangle

a <clutter-cairo-texture>

Since 1.8

— Function: clutter-cairo-texture-clear (self <clutter-cairo-texture>)
— Method: clear

Clears self's internal drawing surface, so that the next upload will replace the previous contents of the <clutter-cairo-texture> rather than adding to it.

Calling this function from within a <"draw"> signal handler will clear the invalidated area.

a <clutter-cairo-texture>

Since 1.0

— Function: clutter-cairo-set-source-color (cr cairo-t) (color <clutter-color>)

Utility function for setting the source color of cr using a <clutter-color>. This function is the equivalent of:

            cairo_set_source_rgba (cr,
                                   color->red / 255.0,
                                   color->green / 255.0,
                                   color->blue / 255.0,
                                   color->alpha / 255.0);
a Cairo context
a <clutter-color>

Since 1.0