Clutter.Canvas
Description: Reference for Clutter.Canvas

### Class

# ClutterCanvas

#### Description [src]

    class Clutter.Canvas : GObject.Object {
      /* No available fields */
    }

Content for 2D painting

The `ClutterCanvas` class is a `ClutterContent` implementation that allows drawing using the Cairo API on a 2D surface.

In order to draw on a `ClutterCanvas`, you should connect a handler to the `ClutterCanvas::draw` signal; the signal will receive a #cairo_t context that can be used to draw. `ClutterCanvas` will emit the `ClutterCanvas::draw` signal when invalidated using clutter_content_invalidate().

See canvas.c for an example of how to use `ClutterCanvas`..

#### Ancestors

- GObject

#### Implements

- ClutterContent

#### Functions

###### clutter_canvas_new

Creates a new instance of `ClutterCanvas`.

#### Instance methods

###### clutter_canvas_get_scale_factor

Gets the scale factor of the `canvas`.

###### clutter_canvas_set_scale_factor

Sets the scaling factor of the `canvas`, and invalidates the content.

###### clutter_canvas_set_size

Sets the size of the `canvas`, and invalidates the content.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

##### Methods inherited from ClutterContent (3)

###### clutter_content_get_preferred_size

Retrieves the natural size of the `content`, if any.

###### clutter_content_invalidate

Invalidates a `ClutterContent`.

###### clutter_content_invalidate_size

Signals that `content`‘s size changed. Attached actors with request mode set to `CLUTTER_REQUEST_CONTENT_SIZE` will have a relayout queued.

#### Properties

###### Clutter.Canvas:height

The height of the canvas.

###### Clutter.Canvas:scale-factor

The height of the canvas.

###### Clutter.Canvas:width

The width of the canvas.

#### Signals

###### Clutter.Canvas::draw

The `ClutterCanvas::draw` signal is emitted each time a canvas is invalidated.

##### Signals inherited from GObject (1)

###### GObject.Object::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

##### Signals inherited from ClutterContent (2)

###### Clutter.Content::attached

This signal is emitted each time a `ClutterContent` implementation is assigned to a `ClutterActor`.

###### Clutter.Content::detached

This signal is emitted each time a `ClutterContent` implementation is removed from a `ClutterActor`.

#### Class structure

    struct ClutterCanvasClass {
      gboolean (* draw) (
        ClutterCanvas* canvas,
        cairo_t* cr,
        int width,
        int height
      );

    }

###### Class members

`draw` |
    gboolean (* draw) (
        ClutterCanvas* canvas,
        cairo_t* cr,
        int width,
        int height
      )
| No description available.

#### Virtual methods

###### Clutter.CanvasClass.draw

No description available.