Pixbuf
Creates a new GdkPixbuf
structure and allocates a buffer for it.
If the allocation of the buffer failed, this function will return NULL
.
The buffer has an optimal rowstride. Note that the buffer is not cleared; you will have to fill it completely yourself.
Return
A newly-created pixel buffer
Parameters
Color space for image
Whether the image should have transparency information
Number of bits per color sample
Width of image in pixels, must be 0
Height of image in pixels, must be 0
Creates a new #GdkPixbuf out of in-memory readonly image data.
Currently only RGB images with 8 bits per sample are supported.
This is the GBytes
variant of gdk_pixbuf_new_from_data(), useful for language bindings.
Return
A newly-created pixbuf
Since
2.32
Parameters
Image data in 8-bit/sample packed format inside a #GBytes
Colorspace for the image data
Whether the data has an opacity channel
Number of bits per sample
Width of the image in pixels, must be 0
Height of the image in pixels, must be 0
Distance in bytes between row starts
Creates a new pixbuf by loading an image from a file.
The file format is detected automatically.
If NULL
is returned, then @error will be set. Possible errors are:
the file could not be opened
there is no loader for the file's format
there is not enough memory to allocate the image buffer
the image buffer contains invalid data
The error domains are GDK_PIXBUF_ERROR
and G_FILE_ERROR
.
Return
A newly-created pixbuf
Parameters
Name of file to load, in the GLib file name encoding
Creates a new pixbuf by loading an image from a file.
The file format is detected automatically.
If NULL
is returned, then @error will be set. Possible errors are:
the file could not be opened
there is no loader for the file's format
there is not enough memory to allocate the image buffer
the image buffer contains invalid data
The error domains are GDK_PIXBUF_ERROR
and G_FILE_ERROR
.
The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.
When preserving the aspect ratio, a width
of -1 will cause the image to be scaled to the exact given height, and a height
of -1 will cause the image to be scaled to the exact given width. When not preserving aspect ratio, a width
or height
of -1 means to not scale the image at all in that dimension. Negative values for width
and height
are allowed since 2.8.
Return
A newly-created pixbuf
Since
2.6
Parameters
Name of file to load, in the GLib file name encoding
The width the image should have or -1 to not constrain the width
The height the image should have or -1 to not constrain the height
TRUE
to preserve the image's aspect ratio
Creates a new pixbuf by loading an image from a file.
The file format is detected automatically.
If NULL
is returned, then @error will be set. Possible errors are:
the file could not be opened
there is no loader for the file's format
there is not enough memory to allocate the image buffer
the image buffer contains invalid data
The error domains are GDK_PIXBUF_ERROR
and G_FILE_ERROR
.
The image will be scaled to fit in the requested size, preserving the image's aspect ratio. Note that the returned pixbuf may be smaller than width
x height
, if the aspect ratio requires it. To load and image at the requested size, regardless of aspect ratio, use ctor@GdkPixbuf.Pixbuf.new_from_file_at_scale.
Return
A newly-created pixbuf
Since
2.4
Parameters
Name of file to load, in the GLib file name encoding
The width the image should have or -1 to not constrain the width
The height the image should have or -1 to not constrain the height
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically.
If NULL
is returned, then error
will be set.
The cancellable
can be used to abort the operation from another thread. If the operation was cancelled, the error G_IO_ERROR_CANCELLED
will be returned. Other possible errors are in the GDK_PIXBUF_ERROR
and G_IO_ERROR
domains.
The stream is not closed.
Return
A newly-created pixbuf
Since
2.14
Parameters
a GInputStream
to load the pixbuf from
optional GCancellable
object, NULL
to ignore
Creates a new pixbuf by loading an image from an input stream.
The file format is detected automatically. If NULL
is returned, then
Return
A newly-created pixbuf
Since
2.14
Parameters
a GInputStream
to load the pixbuf from
The width the image should have or -1 to not constrain the width
The height the image should have or -1 to not constrain the height
TRUE
to preserve the image's aspect ratio
optional GCancellable
object, NULL
to ignore
Finishes an asynchronous pixbuf creation operation started with gdk_pixbuf_new_from_stream_async().
Return
the newly created pixbuf
Since
2.24
Parameters
a GAsyncResult
Creates a new pixbuf by parsing XPM data in memory.
This data is commonly the result of including an XPM file into a program's C source.
Return
A newly-created pixbuf
Parameters
Pointer to inline XPM data.