Next: , Previous: ClutterTextBuffer, Up: Top


68 ClutterTexture

An actor for displaying and manipulating images.

68.1 Overview

<clutter-texture> is a base class for displaying and manipulating pixel buffer type data.

The clutter-texture-set-from-rgb-data and clutter-texture-set-from-file functions are used to copy image data into texture memory and subsequently realize the texture.

Note: a ClutterTexture will scale its contents to fit the bounding box requested using clutter-actor-set-size. To display an area of a texture without scaling, you should set the clip area using clutter-actor-set-clip.

68.2 Usage

— Function: clutter-texture-new ⇒  (ret <clutter-actor>)

Creates a new empty <clutter-texture> object.

ret
A newly created <clutter-texture> object.
— Function: clutter-texture-new-from-file (filename mchars) ⇒  (ret <clutter-actor>)

Creates a new ClutterTexture actor to display the image contained a file. If the image failed to load then NULL is returned and error is set.

filename
The name of an image file to load.
error
Return locatoin for an error.
ret
A newly created <clutter-texture> object or NULL on error.

Since 0.8

— Function: clutter-texture-set-from-file (self <clutter-texture>) (filename mchars) ⇒  (ret bool)
— Method: set-from-file

Sets the <clutter-texture> image data from an image file. In case of failure, ‘#f’ is returned and error is set.

If <"load-async"> is set to ‘#t’, this function will return as soon as possible, and the actual image loading from disk will be performed asynchronously. <"size-change"> will be emitten when the size of the texture is available and <"load-finished"> will be emitted when the image has been loaded or if an error occurred.

texture
A <clutter-texture>
filename
The filename of the image in GLib file name encoding
error
Return location for a <g-error>, or ‘#f
ret
#t’ if the image was successfully loaded and set

Since 0.8

— Function: clutter-texture-get-base-size (self <clutter-texture>) ⇒  (width int) (height int)
— Method: get-base-size

Gets the size in pixels of the untransformed underlying image

texture
a <clutter-texture>
width
return location for the width, or ‘#f’.
height
return location for the height, or ‘#f’.
— Function: clutter-texture-get-max-tile-waste (self <clutter-texture>) ⇒  (ret int)
— Method: get-max-tile-waste

Gets the maximum waste that will be used when creating a texture or -1 if slicing is disabled.

texture
A <clutter-texture>
ret
The maximum waste or -1 if the texture waste is unlimited.

Since 0.8

— Function: clutter-texture-set-filter-quality (self <clutter-texture>) (filter_quality <clutter-texture-quality>)
— Method: set-filter-quality

Sets the filter quality when scaling a texture. The quality is an enumeration currently the following values are supported: ‘CLUTTER_TEXTURE_QUALITY_LOW’ which is fast but only uses nearest neighbour interpolation. ‘CLUTTER_TEXTURE_QUALITY_MEDIUM’ which is computationally a bit more expensive (bilinear interpolation), and ‘CLUTTER_TEXTURE_QUALITY_HIGH’ which uses extra texture memory resources to improve scaled down rendering as well (by using mipmaps). The default value is ‘CLUTTER_TEXTURE_QUALITY_MEDIUM’.

texture
a <clutter-texture>
filter-quality
new filter quality value

Since 0.8

— Function: clutter-texture-get-sync-size (self <clutter-texture>) ⇒  (ret bool)
— Method: get-sync-size

Retrieves the value set with clutter-texture-set-sync-size

texture
a <clutter-texture>
ret
#t’ if the <clutter-texture> should have the same preferred size of the underlying image data

Since 1.0

— Function: clutter-texture-set-sync-size (self <clutter-texture>) (sync_size bool)
— Method: set-sync-size

Sets whether texture should have the same preferred size as the underlying image data.

texture
a <clutter-texture>
sync-size
#t’ if the texture should have the same size of the underlying image data

Since 1.0

— Function: clutter-texture-get-repeat (self <clutter-texture>) ⇒  (repeat_x bool) (repeat_y bool)
— Method: get-repeat

Retrieves the horizontal and vertical repeat values set using clutter-texture-set-repeat

texture
a <clutter-texture>
repeat-x
return location for the horizontal repeat.
repeat-y
return location for the vertical repeat.

Since 1.0

— Function: clutter-texture-set-repeat (self <clutter-texture>) (repeat_x bool) (repeat_y bool)
— Method: set-repeat

Sets whether the texture should repeat horizontally or vertically when the actor size is bigger than the image size

texture
a <clutter-texture>
repeat-x
#t’ if the texture should repeat horizontally
repeat-y
#t’ if the texture should repeat vertically

Since 1.0

— Function: clutter-texture-get-load-async (self <clutter-texture>) ⇒  (ret bool)
— Method: get-load-async

Retrieves the value set using clutter-texture-set-load-async

texture
a <clutter-texture>
ret
#t’ if the <clutter-texture> should load the data from disk asynchronously

Since 1.0

— Function: clutter-texture-set-load-async (self <clutter-texture>) (load_async bool)
— Method: set-load-async

Sets whether texture should use a worker thread to load the data from disk asynchronously. Setting load-async to ‘#t’ will make clutter-texture-set-from-file return immediately.

See the <"load-async"> property documentation, and clutter-texture-set-load-data-async.

texture
a <clutter-texture>
load-async
#t’ if the texture should asynchronously load data from a filename

Since 1.0

— Function: clutter-texture-get-load-data-async (self <clutter-texture>) ⇒  (ret bool)
— Method: get-load-data-async

Retrieves the value set by clutter-texture-set-load-data-async

texture
a <clutter-texture>
ret
#t’ if the <clutter-texture> should load the image data from a file asynchronously

Since 1.0

— Function: clutter-texture-set-load-data-async (self <clutter-texture>) (load_async bool)
— Method: set-load-data-async

Sets whether texture should use a worker thread to load the data from disk asynchronously. Setting load-async to ‘#t’ will make clutter-texture-set-from-file block until the <clutter-texture> has determined the width and height of the image data.

See the <"load-async"> property documentation, and clutter-texture-set-load-async.

texture
a <clutter-texture>
load-async
#t’ if the texture should asynchronously load data from a filename

Since 1.0

— Function: clutter-texture-get-pick-with-alpha (self <clutter-texture>) ⇒  (ret bool)
— Method: get-pick-with-alpha

Retrieves the value set by clutter-texture-set-load-data-async

texture
a <clutter-texture>
ret
#t’ if the <clutter-texture> should define its shape using the alpha channel when picking.

Since 1.4

— Function: clutter-texture-set-pick-with-alpha (self <clutter-texture>) (pick_with_alpha bool)
— Method: set-pick-with-alpha

Sets whether texture should have it's shape defined by the alpha channel when picking.

Be aware that this is a bit more costly than the default picking due to the texture lookup, extra test against the alpha value and the fact that it will also interrupt the batching of geometry done internally.

Also there is currently no control over the threshold used to determine what value of alpha is considered pickable, and so only fully opaque parts of the texture will react to picking.

texture
a <clutter-texture>
pick-with-alpha
#t’ if the alpha channel should affect the picking shape

Since 1.4