Clutter.Texture¶
- Subclasses:
Methods¶
- Inherited:
Clutter.Actor (238), GObject.Object (37), Clutter.Animatable (5), Clutter.Container (17), Clutter.Scriptable (4)
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Clutter.Actor (35), GObject.Object (7), Clutter.Animatable (5), Clutter.Container (13), Clutter.Scriptable (4)
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Forces the underlying texture to be singular and not made of smaller space saving individual textures |
||
r/w |
The path of the file containing the image data |
||
r/w/c |
Rendering quality used when drawing the texture |
||
r/w |
Keep the aspect ratio of the texture when requesting the preferred width or height |
||
w |
Load files inside a thread to avoid blocking when loading images from disk |
||
w |
Decode image data files inside a thread to reduce blocking when loading images from disk |
||
r/w |
Shape actor with alpha channel when picking |
||
r |
The Cogl pixel format to use |
||
r/w |
Repeat the contents rather than scaling them horizontally |
||
r/w |
Repeat the contents rather than scaling them vertically |
||
r/w |
Auto sync size of actor to underlying pixbuf dimensions |
||
r |
Maximum waste area of a sliced texture |
Signals¶
- Inherited:
Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name |
Short Description |
---|---|
The |
|
The |
|
The |
Fields¶
- Inherited:
Clutter.Actor (26), GObject.Object (1), Clutter.Container (3)
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Clutter.Texture(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Clutter.Texture
structure contains only private data and should be accessed using the provided APINew in version 0.2.
- classmethod new()¶
- Returns:
A newly created
Clutter.Texture
object.- Return type:
Creates a new empty
Clutter.Texture
object.Deprecated since version 1.12: Use
Clutter.Image
instead
- classmethod new_from_actor(actor)¶
- Parameters:
actor (
Clutter.Actor
) – A sourceClutter.Actor
- Returns:
A newly created
Clutter.Texture
object, orNone
on failure.- Return type:
Creates a new
Clutter.Texture
object with its source a prexisting actor (and associated children). The textures content will contain ‘live’ redirected output of the actors scene.Note this function is intented as a utility call for uniformly applying shaders to groups and other potential visual effects. It requires that the
Clutter.FeatureFlags.OFFSCREEN
feature is supported by the current backend and the target system.Some tips on usage:
The source actor must be visible
The source actor must have a parent in order for it to be allocated a size from the layouting mechanism. If the source actor does not have a parent when this function is called then the
Clutter.Texture
will adopt it and allocate it at its preferred size. Using this you can clone an actor that is otherwise not displayed. Because of this feature if you do intend to display the source actor then you must make sure that the actor is parented before callingClutter.Texture.new_from_actor
() or that you unparent it before adding it to a container.When getting the image for the clone texture, Clutter will attempt to render the source actor exactly as it would appear if it was rendered on screen. The source actor’s parent transformations are taken into account. Therefore if your source actor is rotated along the X or Y axes so that it has some depth, the texture will appear differently depending on the on-screen location of the source actor. While painting the source actor, Clutter will set up a temporary asymmetric perspective matrix as the projection matrix so that the source actor will be projected as if a small section of the screen was being viewed. Before version 0.8.2, an orthogonal identity projection was used which meant that the source actor would be clipped if any part of it was not on the zero Z-plane.
Avoid reparenting the source with the created texture.
A group can be padded with a transparent rectangle as to provide a border to contents for shader output (blurring text for example).
The texture will automatically resize to contain a further transformed source. However, this involves overhead and can be avoided by placing the source actor in a bounding group sized large enough to contain any child tranformations.
Uploading pixel data to the texture (e.g by using
Clutter.Texture.set_from_file
()) will destroy the offscreen texture data and end redirection.Cogl.Texture.get_data
() with the handle returned byClutter.Texture.get_cogl_texture
() can be used to read the offscreen texture pixels into a pixbuf.
New in version 0.6.
Deprecated since version 1.8: Use the
Clutter.OffscreenEffect
andClutter.ShaderEffect
directly on the intendedClutter.Actor
to replace the functionality of this function.
- classmethod new_from_file(filename)¶
- Parameters:
filename (
str
) – The name of an image file to load.- Raises:
- Returns:
A newly created
Clutter.Texture
object orNone
on error.- Return type:
Creates a new
Clutter.Texture
actor to display the image contained a file. If the image failed to load thenNone
is returned and error is set.New in version 0.8.
Deprecated since version 1.12: No direct replacement is available. Use
Clutter.Image
and platform-specific image loading API, like GdkPixbuf, instead
- get_base_size()¶
- Returns:
- Return type:
Gets the size in pixels of the untransformed underlying image
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Content.get_preferred_size
() instead
- get_cogl_material()¶
- Returns:
a handle for a
Cogl.Material
. The material is owned by theClutter.Texture
and it should not be unreferenced- Return type:
Returns a handle to the underlying COGL material used for drawing the actor.
New in version 1.0.
Deprecated since version 1.12: No replacement is available; it’s not advisable to modify the Cogl pipeline of an actor. Use a
Clutter.Content
implementation and modify the pipeline during the paint sequence
- get_cogl_texture()¶
- Returns:
a #CoglHandle for the texture. The returned handle is owned by the
Clutter.Texture
and it should not be unreferenced- Return type:
Retrieves the handle to the underlying COGL texture used for drawing the actor. No extra reference is taken so if you need to keep the handle then you should call
Cogl.handle_ref
() on it.The texture handle returned is the first layer of the material handle used by the
Clutter.Texture
. If you need to access the other layers you should useClutter.Texture.get_cogl_material
() instead and use theCogl.Material
API.New in version 0.8.
Deprecated since version 1.12: No replacement available; it’s not advisable to modify the Cogl pipeline of an actor. Use a
Clutter.Content
implementation and set up the pipeline during the paint sequence instead.
- get_filter_quality()¶
- Returns:
The filter quality value.
- Return type:
Gets the filter quality used when scaling a texture.
New in version 0.8.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.get_content_scaling_filters
() instead
- get_keep_aspect_ratio()¶
- Returns:
True
if theClutter.Texture
should maintain the aspect ratio of the underlying image- Return type:
Retrieves the value set using
Clutter.Texture.set_keep_aspect_ratio
()New in version 1.0.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.get_content_gravity
() instead
- get_load_async()¶
- Returns:
True
if theClutter.Texture
should load the data from disk asynchronously- Return type:
Retrieves the value set using
Clutter.Texture.set_load_async
()New in version 1.0.
Deprecated since version 1.12: There is no direct replacement for this function
- get_load_data_async()¶
- Returns:
True
if theClutter.Texture
should load the image data from a file asynchronously- Return type:
Retrieves the value set by
Clutter.Texture.set_load_data_async
()New in version 1.0.
Deprecated since version 1.12: There is no direct replacement for this function
- get_max_tile_waste()¶
- Returns:
The maximum waste or -1 if the texture waste is unlimited.
- Return type:
Gets the maximum waste that will be used when creating a texture or -1 if slicing is disabled.
New in version 0.8.
Deprecated since version 1.12: No replacement is available
- get_pick_with_alpha()¶
- Returns:
True
if theClutter.Texture
should define its shape using the alpha channel when picking.- Return type:
Retrieves the value set by
Clutter.Texture.set_load_data_async
()New in version 1.4.
Deprecated since version 1.12: There is no direct replacement for this function
- get_pixel_format()¶
- Returns:
a
Cogl.PixelFormat
value- Return type:
Retrieves the pixel format used by self. This is equivalent to:
handle = clutter_texture_get_pixel_format (texture); if (handle != COGL_INVALID_HANDLE) format = cogl_texture_get_format (handle);
New in version 1.0.
Deprecated since version 1.12: There is no direct replacement for this function
- get_repeat()¶
- Returns:
- repeat_x:
return location for the horizontal repeat
- repeat_y:
return location for the vertical repeat
- Return type:
Retrieves the horizontal and vertical repeat values set using
Clutter.Texture.set_repeat
()New in version 1.0.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.get_content_repeat
() instead
- get_sync_size()¶
- Returns:
True
if theClutter.Texture
should have the same preferred size of the underlying image data- Return type:
Retrieves the value set with
Clutter.Texture.set_sync_size
()New in version 1.0.
Deprecated since version 1.12: There is no direct replacement
- set_area_from_rgb_data(data, has_alpha, x, y, width, height, rowstride, bpp, flags)¶
- Parameters:
data (
bytes
) – Image data in RGB type colorspace.has_alpha (
bool
) – Set toTrue
if image data has an alpha channel.x (
int
) – X coordinate of upper left corner of region to update.y (
int
) – Y coordinate of upper left corner of region to update.width (
int
) – Width in pixels of region to update.height (
int
) – Height in pixels of region to update.rowstride (
int
) – Distance in bytes between row starts on source buffer.bpp (
int
) – bytes per pixel (Currently only 3 and 4 supported, depending on has_alpha)flags (
Clutter.TextureFlags
) –Clutter.TextureFlags
- Raises:
- Returns:
- Return type:
Updates a sub-region of the pixel data in a
Clutter.Texture
.New in version 0.6.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Image.set_area
() instead
- set_cogl_material(cogl_material)¶
- Parameters:
cogl_material (
object
) – A CoglHandle for a material
Replaces the underlying Cogl material drawn by this actor with cogl_material. A reference to the material is taken so if the handle is no longer needed it should be deref’d with
Cogl.handle_unref
. Texture data is attached to the material so calling this function also replaces the Cogl texture.Clutter.Texture
requires that the material have a texture layer so you should set one on the material before calling this function.New in version 0.8.
Deprecated since version 1.12: No replacement is available; it’s not advisable to modify the Cogl pipeline of an actor. Use a
Clutter.Content
implementation and modify the pipeline during the paint sequence
- set_cogl_texture(cogl_tex)¶
- Parameters:
cogl_tex (
object
) – A CoglHandle for a texture
Replaces the underlying COGL texture drawn by this actor with cogl_tex. A reference to the texture is taken so if the handle is no longer needed it should be deref’d with
Cogl.handle_unref
.New in version 0.8.
Deprecated since version 1.12: No replacement available; it’s not advisable to modify the Cogl pipeline of an actor. Use a
Clutter.Content
implementation and set up the pipeline during the paint sequence instead.
- set_filter_quality(filter_quality)¶
- Parameters:
filter_quality (
Clutter.TextureQuality
) – new filter quality value
Sets the filter quality when scaling a texture. The quality is an enumeration currently the following values are supported:
Clutter.TextureQuality.LOW
which is fast but only uses nearest neighbour interpolation.Clutter.TextureQuality.MEDIUM
which is computationally a bit more expensive (bilinear interpolation), andClutter.TextureQuality.HIGH
which uses extra texture memory resources to improve scaled down rendering as well (by using mipmaps). The default value isClutter.TextureQuality.MEDIUM
.New in version 0.8.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.set_content_scaling_filters
() instead
- set_from_file(filename)¶
- Parameters:
filename (
str
) – The filename of the image in GLib file name encoding- Raises:
- Returns:
True
if the image was successfully loaded and set- Return type:
Sets the
Clutter.Texture
image data from an image file. In case of failure,False
is returned and error is set.If
Clutter.Texture
:load-async
is set toTrue
, this function will return as soon as possible, and the actual image loading from disk will be performed asynchronously.Clutter.Texture
::size-change
will be emitten when the size of the texture is available andClutter.Texture
::load-finished
will be emitted when the image has been loaded or if an error occurred.New in version 0.8.
Deprecated since version 1.12: Use
Clutter.Image
and platform-specific image loading API, like GdkPixbuf, instead
- set_from_rgb_data(data, has_alpha, width, height, rowstride, bpp, flags)¶
- Parameters:
data (
bytes
) – image data in RGBA type colorspace.has_alpha (
bool
) – set toTrue
if image data has an alpha channel.width (
int
) – width in pixels of image data.height (
int
) – height in pixels of image datarowstride (
int
) – distance in bytes between row starts.bpp (
int
) – bytes per pixel (currently only 3 and 4 supported, depending on the value of has_alpha)flags (
Clutter.TextureFlags
) –Clutter.TextureFlags
- Raises:
- Returns:
- Return type:
Sets
Clutter.Texture
image data.New in version 0.4.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Image.set_data
() instead
- set_from_yuv_data(data, width, height, flags)¶
- Parameters:
data (
bytes
) – Image data in YUV type colorspace.width (
int
) – Width in pixels of image data.height (
int
) – Height in pixels of image dataflags (
Clutter.TextureFlags
) –Clutter.TextureFlags
- Raises:
- Returns:
True
if the texture was successfully updated- Return type:
Sets a
Clutter.Texture
from YUV image data. If an error occurred,False
is returned and error is set.The YUV support depends on the driver; the format supported by the few drivers exposing this capability are not really useful.
The proper way to convert image data in any YUV colorspace to any RGB colorspace is to use a fragment shader associated with the
Clutter.Texture
material.New in version 0.4.
Deprecated since version 1.10: Use a custom
Clutter.Content
implementation and set up the Cogl pipeline using aClutter.PipelineNode
with a fragment shader instead.
- set_keep_aspect_ratio(keep_aspect)¶
-
Sets whether self should have a preferred size maintaining the aspect ratio of the underlying image
New in version 1.0.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.set_content_gravity
() withClutter.ContentGravity.RESIZE_ASPECT
instead
- set_load_async(load_async)¶
-
Sets whether self should use a worker thread to load the data from disk asynchronously. Setting load_async to
True
will makeClutter.Texture.set_from_file
() return immediately.See the
Clutter.Texture
:load-async
property documentation, andClutter.Texture.set_load_data_async
().New in version 1.0.
Deprecated since version 1.12: There is no direct replacement for this function. Use
Clutter.Image
and platform-specific API for loading image data asynchronously, like GdkPixbuf
- set_load_data_async(load_async)¶
-
Sets whether self should use a worker thread to load the data from disk asynchronously. Setting load_async to
True
will makeClutter.Texture.set_from_file
() block until theClutter.Texture
has determined the width and height of the image data.See the
Clutter.Texture
:load-async
property documentation, andClutter.Texture.set_load_async
().New in version 1.0.
Deprecated since version 1.12: There is no direct replacement for this function. Use
Clutter.Image
and platform-specific API for loading image data asynchronously, like GdkPixbuf
- set_pick_with_alpha(pick_with_alpha)¶
-
Sets whether self 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.
New in version 1.4.
Deprecated since version 1.12: There is no direct replacement for this function
- set_repeat(repeat_x, repeat_y)¶
- Parameters:
Sets whether the self should repeat horizontally or vertically when the actor size is bigger than the image size
New in version 1.0.
Deprecated since version 1.12: Use
Clutter.Image
andClutter.Actor.set_content_repeat
() instead
- set_sync_size(sync_size)¶
- Parameters:
sync_size (
bool
) –True
if the texture should have the same size of the underlying image data
Sets whether self should have the same preferred size as the underlying image data.
New in version 1.0.
Deprecated since version 1.12: No replacement is available. A
Clutter.Actor
usingClutter.Image
with aClutter.RequestMode.CONTENT_SIZE
request mode will automatically bind the preferred size of the content to the preferred size of the actor
- do_load_finished(error) virtual¶
- Parameters:
error (
GLib.Error
) –
- do_pixbuf_change() virtual¶
Signal Details¶
- Clutter.Texture.signals.load_finished(texture, error)¶
- Signal Name:
load-finished
- Flags:
- Parameters:
texture (
Clutter.Texture
) – The object which received the signalerror (
GLib.Error
) – A set error, orNone
The
::load-finished
signal is emitted when a texture load has completed. If there was an error during loading, error will be set, otherwise it will beNone
New in version 1.0.
Deprecated since version 1.12: No replacement is available
- Clutter.Texture.signals.pixbuf_change(texture)¶
- Signal Name:
pixbuf-change
- Flags:
- Parameters:
texture (
Clutter.Texture
) – The object which received the signal
The
::pixbuf-change
signal is emitted each time the pixbuf used by texture changes.Deprecated since version 1.12: No replacement is available
- Clutter.Texture.signals.size_change(texture, width, height)¶
- Signal Name:
size-change
- Flags:
- Parameters:
texture (
Clutter.Texture
) – The object which received the signalwidth (
int
) – the width of the new textureheight (
int
) – the height of the new texture
The
::size-change
signal is emitted each time the size of the pixbuf used by texture changes. The new size is given as argument to the callback.Deprecated since version 1.12: No replacement is available
Property Details¶
- Clutter.Texture.props.disable_slicing¶
- Name:
disable-slicing
- Type:
- Default Value:
- Flags:
Forces the underlying texture to be singular and not made of smaller space saving individual textures
- Clutter.Texture.props.filename¶
-
The path of the file containing the image data to be displayed by the texture.
This property is unset when using the clutter_texture_set_from_*_data() family of functions.
Deprecated since version 1.12: Use
Clutter.Image
and platform-specific image loading API, like GdkPixbuf
- Clutter.Texture.props.filter_quality¶
- Name:
filter-quality
- Type:
- Default Value:
- Flags:
Rendering quality used when drawing the texture
- Clutter.Texture.props.keep_aspect_ratio¶
-
Keep the aspect ratio of the texture when requesting the preferred width or height
- Clutter.Texture.props.load_async¶
-
Tries to load a texture from a filename by using a local thread to perform the read operations. The initially created texture has dimensions 0x0 when the true size becomes available the
Clutter.Texture
::size-change
signal is emitted and when the image has completed loading theClutter.Texture
::load-finished
signal is emitted.Threading is only enabled if g_thread_init() has been called prior to
Clutter.init
(), otherwiseClutter.Texture
will use the main loop to load the image.The upload of the texture data on the GL pipeline is not asynchronous, as it must be performed from within the same thread that called
Clutter.main
().New in version 1.0.
Deprecated since version 1.12: Use platform-specific image loading API, like GdkPixbuf
- Clutter.Texture.props.load_data_async¶
-
Like
Clutter.Texture
:load-async
but loads the width and height synchronously causing some blocking.New in version 1.0.
Deprecated since version 1.12: Use platform-specific image loading API, like GdkPixbuf
- Clutter.Texture.props.pick_with_alpha¶
-
Shape actor with alpha channel when picking
- Clutter.Texture.props.pixel_format¶
- Name:
pixel-format
- Type:
- Default Value:
- Flags:
The Cogl pixel format to use
- Clutter.Texture.props.repeat_x¶
-
Repeat the contents rather than scaling them horizontally
- Clutter.Texture.props.repeat_y¶
-
Repeat the contents rather than scaling them vertically
- Clutter.Texture.props.sync_size¶
-
Auto sync size of actor to underlying pixbuf dimensions