Texture.from_actor
Description:
[ Version ( deprecated = true , deprecated_since = "1.8" , since = "0.6" ) ]
public Texture.from_actor (Actor actor)
Warning: Texture.from_actor is deprecated since 1.8.
Creates a new Texture object with its source a prexisting actor (and associated children).
Use the OffscreenEffect and ShaderEffect directly on the intended Actor to replace the functionality of this function.
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 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 ClutterTexture 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 calling Texture.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 set_from_file) will destroy the offscreen texture data and end redirection. - get_data with the handle returned by get_cogl_texture can be used to read the offscreen texture pixels into a pixbuf.
Parameters:
actor |
A source Actor |
Returns:
A newly created Texture object, or |