Clutter.CairoTexture

g Atk.ImplementorIface Atk.ImplementorIface Clutter.Actor Clutter.Actor Atk.ImplementorIface->Clutter.Actor Clutter.Texture Clutter.Texture Clutter.Actor->Clutter.Texture Clutter.Animatable Clutter.Animatable Clutter.Animatable->Clutter.Actor Clutter.CairoTexture Clutter.CairoTexture Clutter.Container Clutter.Container Clutter.Container->Clutter.Actor Clutter.Scriptable Clutter.Scriptable Clutter.Scriptable->Clutter.Actor Clutter.Texture->Clutter.CairoTexture GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface GObject.GInterface->Clutter.Animatable GObject.GInterface->Clutter.Container GObject.GInterface->Clutter.Scriptable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Clutter.Actor GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:None

Methods

Inherited:Clutter.Texture (28), Clutter.Actor (238), GObject.Object (37), Clutter.Animatable (5), Clutter.Container (17), Clutter.Scriptable (4)
Structs:GObject.ObjectClass (5)
class new (width, height)
  clear ()
  create ()
  create_region (x_offset, y_offset, width, height)
  get_auto_resize ()
  get_surface_size ()
  invalidate ()
  invalidate_rectangle (rect)
  set_auto_resize (value)
  set_surface_size (width, height)

Properties

Inherited:Clutter.Texture (12), Clutter.Actor (82)
Name Type Flags Short Description
auto-resize bool d/r/w Whether the surface should match the allocation deprecated
surface-height int d/r/w The height of the Cairo surface deprecated
surface-width int d/r/w The width of the Cairo surface deprecated

Signals

Inherited:Clutter.Texture (3), Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name Short Description
create-surface The ::create-surface signal is emitted when a Clutter.CairoTexture news its surface (re)created, which happens either when the Cairo context is created with Clutter.CairoTexture.create() or Clutter.CairoTexture.create_region(), or when the surface is resized through Clutter.CairoTexture.set_surface_size(). deprecated
draw The ::draw signal is emitted each time a Clutter.CairoTexture has been invalidated. deprecated

Fields

Inherited:Clutter.Texture (3), Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name Type Access Description
parent_instance Clutter.Texture r  

Class Details

class Clutter.CairoTexture(**kwargs)
Bases:Clutter.Texture
Abstract:No
Structure:Clutter.CairoTextureClass

The Clutter.CairoTexture struct contains only private data.

New in version 1.0.

Deprecated since version 1.12: Use Clutter.Canvas instead

classmethod new(width, height)
Parameters:
  • width (int) – the width of the surface
  • height (int) – the height of the surface
Returns:

the newly created Clutter.CairoTexture actor

Return type:

Clutter.Actor

Creates a new Clutter.CairoTexture actor, with a surface of width by height pixels.

New in version 1.0.

Deprecated since version 1.12: Use Clutter.Canvas instead

clear()

Clears self’s internal drawing surface, so that the next upload will replace the previous contents of the Clutter.CairoTexture rather than adding to it.

Calling this function from within a Clutter.CairoTexture ::draw signal handler will clear the invalidated area.

New in version 1.0.

Deprecated since version 1.12: Use Clutter.Canvas instead

create()
Returns:a newly created Cairo context. Use cairo_destroy() to upload the contents of the context when done drawing
Return type:cairo.Context

Creates a new Cairo context for the cairo texture. It is similar to using Clutter.CairoTexture.create_region() with x_offset and y_offset of 0, width equal to the cairo texture surface width and height equal to the cairo texture surface height.

Do not call this function within the paint virtual function or from a callback to the Clutter.Actor ::paint signal.

New in version 1.0.

Deprecated since version 1.8: Use the Clutter.CairoTexture ::draw signal and the Clutter.CairoTexture.invalidate() function to obtain a Cairo context for 2D drawing.

create_region(x_offset, y_offset, width, height)
Parameters:
  • x_offset (int) – offset of the region on the X axis
  • y_offset (int) – offset of the region on the Y axis
  • width (int) – width of the region, or -1 for the full surface width
  • height (int) – height of the region, or -1 for the full surface height
Returns:

a newly created Cairo context. Use cairo_destroy() to upload the contents of the context when done drawing

Return type:

cairo.Context

Creates a new Cairo context that will updat the region defined by x_offset, y_offset, width and height.

Do not call this function within the paint virtual function or from a callback to the Clutter.Actor ::paint signal.

New in version 1.0.

Deprecated since version 1.8: Use the Clutter.CairoTexture ::draw signal and Clutter.CairoTexture.invalidate_rectangle() to obtain a clipped Cairo context for 2D drawing.

get_auto_resize()
Returns:True if the Clutter.CairoTexture should track the allocation, and False otherwise
Return type:bool

Retrieves the value set using Clutter.CairoTexture.set_auto_resize().

New in version 1.8.

Deprecated since version 1.12: Use Clutter.Canvas instead

get_surface_size()
Returns:
width:return location for the surface width, or None
height:return location for the surface height, or None
Return type:(width: int, height: int)

Retrieves the surface width and height for self.

New in version 1.0.

Deprecated since version 1.12: Use Clutter.Canvas instead

invalidate()

Invalidates the whole surface of a Clutter.CairoTexture.

This function will cause the Clutter.CairoTexture ::draw signal to be emitted.

See also: Clutter.CairoTexture.invalidate_rectangle()

New in version 1.8.

Deprecated since version 1.12: Use Clutter.Canvas instead

invalidate_rectangle(rect)
Parameters:rect (cairo.RectangleInt or None) – a rectangle with the area to invalida, or None to perform an unbounded invalidation

Invalidates a rectangular region of a Clutter.CairoTexture.

The invalidation will cause the Clutter.CairoTexture ::draw signal to be emitted.

See also: Clutter.CairoTexture.invalidate()

New in version 1.8.

Deprecated since version 1.12: Use Clutter.Canvas instead

set_auto_resize(value)
Parameters:value (bool) – True if the Clutter.CairoTexture should bind the surface size to the allocation

Sets whether the Clutter.CairoTexture should ensure that the backing Cairo surface used matches the allocation assigned to the actor. If the allocation changes, the contents of the Clutter.CairoTexture will also be invalidated automatically.

New in version 1.8.

Deprecated since version 1.12: Use Clutter.Canvas instead

set_surface_size(width, height)
Parameters:
  • width (int) – the new width of the surface
  • height (int) – the new height of the surface

Resizes the Cairo surface used by self to width and height.

This function will not invalidate the contents of the Cairo texture: you will have to explicitly call either Clutter.CairoTexture.invalidate_rectangle() or Clutter.CairoTexture.invalidate().

New in version 1.0.

Deprecated since version 1.12: Use Clutter.Canvas instead

do_create_surface(width, height) virtual
Parameters:
  • width (int) –
  • height (int) –
Return type:

cairo.Surface

do_draw(cr) virtual
Parameters:cr (cairo.Context) –
Return type:bool

Signal Details

Clutter.CairoTexture.signals.create_surface(cairo_texture, width, height)
Signal Name:

create-surface

Flags:

RUN_LAST, NO_RECURSE

Parameters:
  • cairo_texture (Clutter.CairoTexture) – The object which received the signal
  • width (int) – the width of the surface to create
  • height (int) – the height of the surface to create
Returns:

the newly created cairo.Surface for the texture

Return type:

cairo.Surface

The ::create-surface signal is emitted when a Clutter.CairoTexture news its surface (re)created, which happens either when the Cairo context is created with Clutter.CairoTexture.create() or Clutter.CairoTexture.create_region(), or when the surface is resized through Clutter.CairoTexture.set_surface_size().

The first signal handler that returns a non-None, valid surface will stop any further signal emission, and the returned surface will be the one used.

New in version 1.6.

Deprecated since version 1.12.

Clutter.CairoTexture.signals.draw(cairo_texture, cr)
Signal Name:

draw

Flags:

RUN_LAST, NO_RECURSE

Parameters:
Returns:

True if the signal emission should stop, and False to continue

Return type:

bool

The ::draw signal is emitted each time a Clutter.CairoTexture has been invalidated.

The passed Cairo context passed will be clipped to the invalidated area.

It is safe to connect multiple callbacks to this signals; the state of the Cairo context passed to each callback is automatically saved and restored, so it’s not necessary to call cairo.Context.save() and cairo.Context.restore().

New in version 1.8.

Deprecated since version 1.12.

Property Details

Clutter.CairoTexture.props.auto_resize
Name:auto-resize
Type:bool
Default Value:False
Flags:DEPRECATED, READABLE, WRITABLE

Controls whether the Clutter.CairoTexture should automatically resize the Cairo surface whenever the actor’s allocation changes. If :auto-resize is set to True the surface contents will also be invalidated automatically.

New in version 1.8.

Deprecated since version 1.12.

Clutter.CairoTexture.props.surface_height
Name:surface-height
Type:int
Default Value:0
Flags:DEPRECATED, READABLE, WRITABLE

The height of the Cairo surface used by the Clutter.CairoTexture actor, in pixels.

New in version 1.0.

Deprecated since version 1.12.

Clutter.CairoTexture.props.surface_width
Name:surface-width
Type:int
Default Value:0
Flags:DEPRECATED, READABLE, WRITABLE

The width of the Cairo surface used by the Clutter.CairoTexture actor, in pixels.

New in version 1.0.

Deprecated since version 1.12.