Next: , Previous: Key Bindings, Up: Top


18 ClutterCanvas

Content for 2D painting

18.1 Overview

The <clutter-canvas> class is a <clutter-content> implementation that allows drawing using the Cairo API on a 2D surface.

In order to draw on a <clutter-canvas>, you should connect a handler to the <"draw"> signal; the signal will receive a <cairo-t> context that can be used to draw. <clutter-canvas> will emit the <"draw"> signal when invalidated using clutter-content-invalidate.

     

<clutter-canvas> is available since Clutter 1.10.

18.2 Usage

— Function: clutter-canvas-new ⇒  (ret <clutter-content>)

Creates a new instance of <clutter-canvas>.

You should call clutter-canvas-set-size to set the size of the canvas.

You should call clutter-content-invalidate every time you wish to draw the contents of the canvas.

ret
The newly allocated instance of <clutter-canvas>. Use g-object-unref when done.

Since 1.10

— Function: clutter-canvas-set-size (self <clutter-canvas>) (width int) (height int)
— Method: set-size

Sets the size of the canvas.

This function will cause the canvas to be invalidated.

canvas
a <clutter-canvas>
width
the width of the canvas, in pixels
height
the height of the canvas, in pixels

Since 1.10