---
name: "Clutter::CairoTexture"
section: "3pm"
platform: "linux"
package: "libclutter-perl"
version: "1.002-1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/Clutter::CairoTexture"
---

# Clutter::CairoTexture(3pm)

Texture with Cairo integration

## NAME

Clutter::CairoTexture - Texture with Cairo integration

## 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.

## HIERARCHY

```
  Glib::Object
  +----Glib::InitiallyUnowned
       +----Clutter::Actor
            +----Clutter::Texture
                 +----Clutter::CairoTexture
```

## INTERFACES

```
  Glib::Object::_Unregistered::ClutterScriptable
```

## METHODS

### actor = Clutter::CairoTexture-\>new ($width, $height)

- •

  `$width` (integer)

- •

  `$height` (integer)

### $texture-\>clear

### scalar = $texture-\>create\_context

### scalar = $texture-\>create\_context\_for\_region ($x\_offset, $y\_offset, $width, $height)

- •

  `$x_offset` (integer)

- •

  `$y_offset` (integer)

- •

  `$width` (integer)

- •

  `$height` (integer)

### list = $texture-\>get\_surface\_size

### $texture-\>set\_surface\_size ($width, $height)

- •

  `$width` (integer)

- •

  `$height` (integer)

## PROPERTIES

- 'surface-height' (Glib::UInt : readable / writable / private)

  Surface Height

- 'surface-width' (Glib::UInt : readable / writable / private)

  Surface Width

Clutter::Texture, Cairo

## COPYRIGHT

Copyright (C) 2006, 2007, 2008  OpenedHand Ltd

Copyright (C) 2009  Intel Corporation

This module is free software; you can redistribute it and/or modify it under the terms of either:

- •

  the GNU Lesser General Public Library version 2.1; or

- •

  the Artistic License, version 2.0.

See Clutter for the full copyright notice.
