Emmanuele Bassi > Clutter > xs/ClutterCairoTexture.xs

Download:
Clutter-1.002.tar.gz

Annotate this POD

CPAN RT

New  2
Open  2
View Bugs
Report a bug
Source  

SYNOPSIS ^

    my $texture = Clutter::CairoTexture->new(64, 64);
    my $cr = $texture->create_context();

    # use Cairo API to draw on the Cairo::Context

    # destroys the Context and uploads the contents to the
    # CairoTexture; alternatively, you can let $cr go out
    # of scope
    $cr = undef;

DESCRIPTION ^

Clutter::CairoTexture is a Clutter::Texture that displays the contents of a Cairo::Context. The Clutter::CairoTexture actor will create a Cairo image surface which will then be uploaded to a GL texture when needed.

Clutter::CairoTexture will provide a Cairo::Context by using the Clutter::CairoTexture::create_context() and the Clutter::CairoTexture::create_context_for_region() methods; you can use the Cairo API to draw on the context and then destroy the context when done.

As soon as the context is destroyed, the contents of the surface will be uploaded into the Clutter::CairoTexture actor.

Although a new Cairo::Context is created each time you call the create_context() or the create_context_for_region() methods, the CairoTexture will use the same image surface. You can call Clutter::CairoTexturr::clear() to erase the contents between calls.

Warning: Note that you should never use the code above inside the Clutter::Actor::PAINT or Clutter::Actor::PICK virtual functions or signal handlers because it will lead to performance degradation.

Clutter::Texture, Cairo