Clutter.Image¶
Subclasses: | None |
---|
Methods¶
Inherited: | GObject.Object (37), Clutter.Content (2) |
---|---|
Structs: | GObject.ObjectClass (5) |
class | new () |
set_area (data, pixel_format, rect, row_stride) |
|
set_bytes (data, pixel_format, width, height, row_stride) |
|
set_data (data, pixel_format, width, height, row_stride) |
Virtual Methods¶
Inherited: | GObject.Object (7), Clutter.Content (5) |
---|
Properties¶
None
Signals¶
Inherited: | GObject.Object (1), Clutter.Content (2) |
---|
Fields¶
Inherited: | GObject.Object (1), Clutter.Content (2) |
---|
Name | Type | Access | Description |
---|---|---|---|
parent_instance | GObject.Object |
r |
Class Details¶
-
class
Clutter.
Image
(**kwargs)¶ Bases: GObject.Object
,Clutter.Content
Abstract: No Structure: Clutter.ImageClass
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: Clutter.Content
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 bytes - pixel_format (
Cogl.PixelFormat
) – the Cogl pixel format of the image data - rect (
cairo.RectangleInt
) – a rectangle indicating the area that should be set - row_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.
- data (
-
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 data - width (
int
) – the width of the image data - height (
int
) – the height of the image data - row_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.
- data (
-
set_data
(data, pixel_format, width, height, row_stride)¶ Parameters: - data (
bytes
) – the image data, as an array of bytes - pixel_format (
Cogl.PixelFormat
) – the Cogl pixel format of the image data - width (
int
) – the width of the image data - height (
int
) – the height of the image data - row_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.
- data (
-
classmethod