GdkPixdata.Pixdata¶
Fields¶
Name |
Type |
Access |
Description |
---|---|---|---|
height |
r/w |
Height of the image in pixels |
|
length |
r/w |
less than 1 to disable length checks, otherwise |
|
magic |
r/w |
magic number. A valid |
|
pixdata_type |
r/w |
information about colorspace, sample width and encoding, in a |
|
pixel_data |
r/w |
|
|
rowstride |
r/w |
Distance in bytes between rows |
|
width |
r/w |
Width of the image in pixels |
Methods¶
|
|
|
|
|
Details¶
- class GdkPixdata.Pixdata¶
A pixel buffer suitable for serialization and streaming.
Using
GdkPixdata
, images can be compiled into an application, making it unnecessary to refer to external image files at runtime.GdkPixbuf
includes a utility namedgdk-pixbuf-csource
, which can be used to convert image files intoGdkPixdata
structures suitable for inclusion in C sources. To convert theGdkPixdata
structures back into aGdkPixbuf
, usegdk_pixbuf_from_pixdata()
.Deprecated since version 2.32:
GdkPixdata
should not be used any more.GResource
should be used to save the original compressed images inside the program’s binary- deserialize(stream)[source]¶
- Parameters:
stream (
bytes
) – stream of bytes containing a serializedGdkPixdata.Pixdata
structure.- Raises:
- Returns:
Upon successful deserialization
TRUE
is returned,FALSE
otherwise.- Return type:
Deserializes (reconstruct) a
GdkPixdata.Pixdata
structure from a byte stream.The byte stream consists of a straightforward writeout of the
GdkPixdata
fields in network byte order, plus thepixel_data
bytes the structure points to.The
pixdata
contents are reconstructed byte by byte and are checked for validity.This function may fail with
GDK_PIXBUF_ERROR_CORRUPT_IMAGE
orGDK_PIXBUF_ERROR_UNKNOWN_TYPE
.Deprecated since version 2.32: Use
GResource
instead.
- serialize()[source]¶
- Returns:
A newly-allocated string containing the serialized
GdkPixdata.Pixdata
structure.- Return type:
Serializes a
GdkPixdata.Pixdata
structure into a byte stream. The byte stream consists of a straightforward writeout of theGdkPixdata.Pixdata
fields in network byte order, plus the pixel_data bytes the structure points to.Deprecated since version 2.32: Use
Gio.Resource
instead.
- to_csource(name, dump_type)[source]¶
- Parameters:
name (
str
) – used for naming generated data structures or macrosdump_type (
GdkPixdata.PixdataDumpType
) – the kind of C source to be generated
- Returns:
a newly-allocated string buffer containing the C source form of
pixdata
.- Return type:
Generates C source code suitable for compiling images directly into programs.
GdkPixbuf.Pixbuf
ships with a program calledgdk-pixbuf-csource
, which offers a command line interface to this function.Deprecated since version 2.32: Use
Gio.Resource
instead.