Pixdata#
Deprecated since version 2.32:
GdkPixdatashould not be used any more.GResourceshould be used to save the original compressed images inside the program’s binary
- class Pixdata(*args, **kwargs)#
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 named gdk-pixbuf-csource, which
can be used to convert image files into GdkPixdata structures suitable
for inclusion in C sources. To convert the GdkPixdata structures back
into a GdkPixbuf, use gdk_pixbuf_from_pixdata().
Methods#
- class Pixdata
- deserialize(stream: list[int]) bool#
Deserializes (reconstruct) a
Pixdatastructure from a byte stream.The byte stream consists of a straightforward writeout of the
GdkPixdatafields in network byte order, plus thepixel_databytes the structure points to.The
pixdatacontents are reconstructed byte by byte and are checked for validity.This function may fail with
GDK_PIXBUF_ERROR_CORRUPT_IMAGEorGDK_PIXBUF_ERROR_UNKNOWN_TYPE.Deprecated since version 2.32: Use
GResourceinstead.- Parameters:
stream – stream of bytes containing a serialized
Pixdatastructure.
- serialize() list[int]#
Serializes a
Pixdatastructure into a byte stream. The byte stream consists of a straightforward writeout of thePixdatafields in network byte order, plus thepixel_databytes the structure points to.Deprecated since version 2.32: Use
Resourceinstead.
- to_csource(name: str, dump_type: PixdataDumpType) String#
Generates C source code suitable for compiling images directly into programs.
GdkPixbuf ships with a program called
gdk-pixbuf-csource, which offers a command line interface to this function.Deprecated since version 2.32: Use
Resourceinstead.- Parameters:
name – used for naming generated data structures or macros
dump_type – the kind of C source to be generated
Fields#
- class Pixdata
- height#
Height of the image in pixels
- length#
- Less than 1 to disable length checks, otherwise
GDK_PIXDATA_HEADER_LENGTHplus the length ofpixel_data
- magic#
- Magic number. A valid
GdkPixdatastructure must have GDK_PIXBUF_MAGIC_NUMBERhere
- Magic number. A valid
- pixdata_type#
- Information about colorspace, sample width and
encoding, in a
GdkPixdataType
- pixel_data#
widthxheightpixels, encoded according to
pixdata_typeandrowstride
- rowstride#
Distance in bytes between rows
- width#
Width of the image in pixels