GdkPixbuf* gdk_pixbuf_new_from_inline ( gint data_length, const guint8* data, gboolean copy_pixels, GError** error )
GdkPixbuf from a flat representation that is suitable for
storing as inline data in a program.
This is useful if you want to ship a program with images, but don’t want to depend on any external files.
GdkPixbuf ships with a program called
gdk-pixbuf-csource, which allows
for conversion of
GdkPixbufs into such a inline representation.
In almost all cases, you should pass the
--raw option to
gdk-pixbuf-csource. A sample invocation would be:
gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
For the typical case where the inline pixbuf is read-only static data,
you don’t need to copy the pixel data unless you intend to write to
it, so you can pass
copy_pixels. If you pass
gdk-pixbuf-csource, a copy will be made even if
so using this option is generally a bad idea.
If you create a pixbuf from const inline data compiled into your program, it’s probably safe to ignore errors and disable length checks, since things will always succeed:
pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
For non-const inline data, you could get out of memory. For untrusted inline data located at runtime, you could have corrupt inline data in addition.
Deprecated since: 2.32
Length in bytes of the
dataargument or -1 to disable length checks.
Type: An array of
Byte data containing a serialized
The length of the array is specified in the
The data is owned by the caller of the function.
Whether to copy the pixel data, or use direct pointers
datafor the resulting pixbuf.
The return location for a recoverable error.
The argument can be
If the return location is not
NULL, then you must initialize it to a
The argument will left initialized to
NULLby the constructor if there are no errors.
In case of error, the argument will be set to a newly allocated
GError; the caller will take ownership of the data, and be responsible for freeing it.
A newly-created pixbuf.
|The caller of the function takes ownership of the data, and is responsible for freeing it.|