### Class

# Clutter Canvas

since: 13

#### Description [src]

    class Clutter.Canvas : GObject.Object
      implements Clutter.Content {
      /* 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`..

Available since: 13

#### Ancestors

- GObject

#### Implements

- ClutterContent

#### Functions

###### clutter_canvas_new

Creates a new instance of `ClutterCanvas`.

since: 13

#### Instance methods

###### clutter_canvas_get_scale_factor

Gets the scale factor of the `canvas`.

since: 13

###### clutter_canvas_set_scale_factor

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

since: 13

###### clutter_canvas_set_size

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

since: 13

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

since: 13

###### clutter_content_invalidate

Invalidates a `ClutterContent`.

since: 13

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

since: 13

#### Properties

###### Clutter.Canvas:height

The height of the canvas.

since: 13

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

The height of the canvas.

since: 13

###### Clutter.Canvas:width

The width of the canvas.

since: 13

#### Signals

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

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

since: 13

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

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

since: 2.0

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

###### ClutterContent::attached

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

since: 13

###### ClutterContent::detached

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

since: 13

#### Class structure

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

    }

The `ClutterCanvasClass` structure contains private data.

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

since: 13