Cogl.Bitmap¶
- Subclasses:
None
Methods¶
- Inherited:
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
Virtual Methods¶
None
Fields¶
None
Class Details¶
- class Cogl.Bitmap¶
- Bases:
- Abstract:
No
- classmethod get_size_from_file(filename)¶
- Parameters:
filename (
str) – the file to check- Returns:
Trueif the image was successfully parsed- Return type:
Parses an image file enough to extract the width and height of the bitmap.
New in version 1.0.
- classmethod new_for_data(context, width, height, format, rowstride, data)¶
- Parameters:
context (
Cogl.Context) – ACogl.Contextwidth (
int) – The width of the bitmap.height (
int) – The height of the bitmap.format (
Cogl.PixelFormat) – The format of the pixel data.rowstride (
int) – The rowstride of the bitmap (the number of bytes from the start of one row of the bitmap to the next).data (
int) – A pointer to the data. The bitmap will take ownership of this data.
- Returns:
A new
Cogl.Bitmap.- Return type:
Creates a bitmap using some existing data. The data is not copied so the application must keep the buffer alive for the lifetime of the
Cogl.Bitmap. This can be used for example withCogl.Framebuffer.read_pixels_into_bitmap() to read data directly into an application buffer with the specified rowstride.New in version 1.10.
- classmethod new_from_buffer(buffer, format, width, height, rowstride, offset)¶
- Parameters:
buffer (
object) – A #CoglBuffer containing image dataformat (
Cogl.PixelFormat) – TheCogl.PixelFormatdefining the format of the image data in the given buffer.width (
int) – The width of the image data in the given buffer.height (
int) – The height of the image data in the given buffer.rowstride (
int) – The rowstride in bytes of the image data in the given buffer.offset (
int) – The offset into the given buffer to the first pixel that should be considered part of theCogl.Bitmap.
- Returns:
a
Cogl.Bitmapencapsulating the given buffer.- Return type:
Wraps some image data that has been uploaded into a #CoglBuffer as a
Cogl.Bitmap. The data is not copied in this process.New in version 1.8.
- classmethod new_from_file(filename)¶
- Parameters:
filename (
str) – the file to load.- Raises:
- Returns:
a
Cogl.Bitmapto the new loaded image data, orNoneif loading the image failed.- Return type:
Loads an image file from disk. This function can be safely called from within a thread.
New in version 1.0.
- classmethod new_with_size(context, width, height, format)¶
- Parameters:
context (
Cogl.Context) – ACogl.Contextwidth (
int) – width of the bitmap in pixelsheight (
int) – height of the bitmap in pixelsformat (
Cogl.PixelFormat) – the format of the pixels the array will store
- Returns:
a
Cogl.PixelBufferrepresenting the newly created array orNoneon failure- Return type:
Creates a new
Cogl.Bitmapwith the given width, height and format. The initial contents of the bitmap are undefined.The data for the bitmap will be stored in a newly created
Cogl.PixelBuffer. You can get a pointer to the pixel buffer usingCogl.Bitmap.get_buffer(). The #CoglBuffer API can then be used to fill the bitmap with data.Cogl will try its best to provide a hardware array you can map, write into and effectively do a zero copy upload when creating a texture from it with cogl_texture_new_from_bitmap(). For various reasons, such arrays are likely to have a stride larger than width * bytes_per_pixel. The user must take the stride into account when writing into it. The stride can be retrieved with
Cogl.Bitmap.get_rowstride().New in version 1.10.
- get_buffer()¶
- Returns:
the
Cogl.PixelBufferthat this buffer uses for storage. Note that if the bitmap was created withCogl.Bitmap.new_from_file() then it will not actually be using a pixel buffer and this function will returnNone.- Return type:
New in version 1.10.
- get_format()¶
- Returns:
the
Cogl.PixelFormatthat the data for the bitmap is in.- Return type:
New in version 1.10.
- get_rowstride()¶
- Returns:
the rowstride of the bitmap. This is the number of bytes between the address of start of one row to the address of the next row in the image.
- Return type:
New in version 1.10.