Clutter.Image¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Clutter.Image(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The
Clutter.Image
structure contains private data and should only be accessed using the provided API.New in version 1.10.
- classmethod new()¶
- Returns:
the newly created
Clutter.Image
instance. UseGObject.Object.unref
() when done.- Return type:
Creates a new
Clutter.Image
instance.New in version 1.10.
- set_area(data, pixel_format, rect, row_stride)¶
- Parameters:
data (
bytes
) – the image data, as an array of bytespixel_format (
Cogl.PixelFormat
) – the Cogl pixel format of the image datarect (
cairo.RectangleInt
) – a rectangle indicating the area that should be setrow_stride (
int
) – the length of each row inside data
- Raises:
- Returns:
True
if the image data was successfully loaded, andFalse
otherwise.- Return type:
Sets the image data to be display by self, using rect to indicate the position and size of the image data to be set.
If the self does not have any image data set when this function is called, a new texture will be created with the size of the width and height of the rectangle, i.e. calling this function on a newly created
Clutter.Image
will be the equivalent of callingClutter.Image.set_data
().If the image data was successfully loaded, the self will be invalidated.
In case of error, the error value will be set, and this function will return
False
.The image data is copied in texture memory.
New in version 1.10.
- set_bytes(data, pixel_format, width, height, row_stride)¶
- Parameters:
data (
GLib.Bytes
) – the image data, as aGLib.Bytes
pixel_format (
Cogl.PixelFormat
) – the Cogl pixel format of the image datawidth (
int
) – the width of the image dataheight (
int
) – the height of the image datarow_stride (
int
) – the length of each row inside data
- Raises:
- Returns:
True
if the image data was successfully loaded, andFalse
otherwise.- Return type:
Sets the image data stored inside a
GLib.Bytes
to be displayed by self.If the image data was successfully loaded, the self will be invalidated.
In case of error, the error value will be set, and this function will return
False
.The image data contained inside the
GLib.Bytes
is copied in texture memory, and no additional reference is acquired on the data.New in version 1.12.
- set_data(data, pixel_format, width, height, row_stride)¶
- Parameters:
data (
bytes
) – the image data, as an array of bytespixel_format (
Cogl.PixelFormat
) – the Cogl pixel format of the image datawidth (
int
) – the width of the image dataheight (
int
) – the height of the image datarow_stride (
int
) – the length of each row inside data
- Raises:
- Returns:
True
if the image data was successfully loaded, andFalse
otherwise.- Return type:
Sets the image data to be displayed by self.
If the image data was successfully loaded, the self will be invalidated.
In case of error, the error value will be set, and this function will return
False
.The image data is copied in texture memory.
The image data is expected to be a linear array of RGBA or RGB pixel data; how to retrieve that data is left to platform specific image loaders. For instance, if you use the GdkPixbuf library:
ClutterContent *image = clutter_image_new (); GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, NULL); clutter_image_set_data (CLUTTER_IMAGE (image), gdk_pixbuf_get_pixels (pixbuf), gdk_pixbuf_get_has_alpha (pixbuf) ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), gdk_pixbuf_get_rowstride (pixbuf), &error); g_object_unref (pixbuf);
New in version 1.10.