Function
Purplegdk_pixbuf_new_from_file_at_size
Declaration [src]
GdkPixbuf*
purple_gdk_pixbuf_new_from_file_at_size (
const char* filename,
int width,
int height
)
Description [src]
Helper function that calls gdk_pixbuf_new_from_file_at_size()
and checks
both the return code and the GError and returns NULL if either one failed.
The gdk-pixbuf documentation implies that it is sufficient to check
the return value of gdk_pixbuf_new_from_file_at_size()
to determine
whether the image was able to be loaded. However, this is not the case
with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
cases a GdkPixbuf object is returned that will cause some operations
(like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
infinite loop.
This function shouldn’t be necessary once Pidgin requires a version of gdk-pixbuf where the aforementioned bug is fixed. However, it might be nice to keep this function around for the debug message that it logs.
Parameters
filename |
const char* |
Name of file to load, in the GLib file name encoding. |
|
The data is owned by the caller of the function. | |
The value is a NUL terminated UTF-8 string. | |
width |
int |
The width the image should have or -1 to not constrain the width. |
|
height |
int |
The height the image should have or -1 to not constrain the height. |
Return value
Returns: | GdkPixbuf |
The GdkPixbuf if successful. Otherwise NULL is returned and a warning is logged. |
|
The caller of the function takes ownership of the data, and is responsible for freeing it. |