Callbacks

PixbufDestroyNotify (pixels, *data)

PixbufModuleFillInfoFunc (info)

PixbufModuleFillVtableFunc (module)

PixbufModuleIncrementLoadFunc (context, buf)

PixbufModuleLoadAnimationFunc (f)

PixbufModuleLoadFunc (f)

PixbufModuleLoadXpmDataFunc (data)

PixbufModulePreparedFunc (pixbuf, anim, *user_data)

PixbufModuleSaveFunc (f, pixbuf, param_keys, param_values)

PixbufModuleSaveOptionSupportedFunc (option_key)

PixbufModuleSizeFunc (width, height, *user_data)

PixbufModuleStopLoadFunc (context)

PixbufModuleUpdatedFunc (pixbuf, x, y, width, height, *user_data)

PixbufSaveFunc (buf, *data)

Details

GdkPixbuf.PixbufDestroyNotify(pixels, *data)
Parameters:
  • pixels (bytes) – The pixel array of the pixbuf that is being finalized.

  • data (object or None) – User closure data.

A function of this type is responsible for freeing the pixel array of a pixbuf.

The GdkPixbuf.Pixbuf.new_from_data() function lets you pass in a pre-allocated pixel array so that a pixbuf can be created from it; in this case you will need to pass in a function of type GdkPixbufDestroyNotify so that the pixel data can be freed when the pixbuf is finalized.

GdkPixbuf.PixbufModuleFillInfoFunc(info)
Parameters:

info (GdkPixbuf.PixbufFormat) – a GdkPixbuf.PixbufFormat.

Defines the type of the function used to fill a GdkPixbuf.PixbufFormat structure with information about a module.

New in version 2.2.

GdkPixbuf.PixbufModuleFillVtableFunc(module)
Parameters:

module (GdkPixbuf.PixbufModule) – a GdkPixbuf.PixbufModule.

Defines the type of the function used to set the vtable of a GdkPixbuf.PixbufModule when it is loaded.

New in version 2.2.

GdkPixbuf.PixbufModuleIncrementLoadFunc(context, buf)
Parameters:
  • context (object or None) – the state object created by [callback`GdkPixbuf`.PixbufModuleBeginLoadFunc]

  • buf (bytes) – the data to load

Returns:

TRUE if the incremental load was successful

Return type:

bool

Incrementally loads a buffer into the image data.

GdkPixbuf.PixbufModuleLoadAnimationFunc(f)
Parameters:

f (object or None) – the file stream from which the image should be loaded

Returns:

a newly created GdkPixbufAnimation for the contents of the file

Return type:

GdkPixbuf.PixbufAnimation

Loads a file from a standard C file stream into a new GdkPixbufAnimation.

In case of error, this function should return NULL and set the error argument.

GdkPixbuf.PixbufModuleLoadFunc(f)
Parameters:

f (object or None) – the file stream from which the image should be loaded

Returns:

a newly created GdkPixbuf for the contents of the file

Return type:

GdkPixbuf.Pixbuf

Loads a file from a standard C file stream into a new GdkPixbuf.

In case of error, this function should return NULL and set the error argument.

GdkPixbuf.PixbufModuleLoadXpmDataFunc(data)
Parameters:

data ([str]) – the XPM data

Returns:

a newly created GdkPixbuf for the XPM data

Return type:

GdkPixbuf.Pixbuf

Loads XPM data into a new GdkPixbuf.

GdkPixbuf.PixbufModulePreparedFunc(pixbuf, anim, *user_data)
Parameters:

Defines the type of the function that gets called once the initial setup of pixbuf is done.

GdkPixbuf.PixbufLoader uses a function of this type to emit the “‘area_prepared [GdkPixbufLoader-area-prepared]’” signal.

New in version 2.2.

GdkPixbuf.PixbufModuleSaveFunc(f, pixbuf, param_keys, param_values)
Parameters:
  • f (object or None) – the file stream into which the image should be saved

  • pixbuf (GdkPixbuf.Pixbuf) – the image to save

  • param_keys ([str] or None) – parameter keys to save

  • param_values ([str] or None) – parameter values to save

Returns:

TRUE on success; in case of failure, FALSE is returned and the error is set

Return type:

bool

Saves a GdkPixbuf into a standard C file stream.

The optional param_keys and param_values arrays contain the keys and values (in the same order) for attributes to be saved alongside the image data.

GdkPixbuf.PixbufModuleSaveOptionSupportedFunc(option_key)
Parameters:

option_key (str) – the option key to check

Returns:

TRUE if the option is supported

Return type:

bool

Checks whether the given option_key is supported when saving.

GdkPixbuf.PixbufModuleSizeFunc(width, height, *user_data)
Parameters:
  • width (int) – pointer to a location containing the current image width

  • height (int) – pointer to a location containing the current image height

  • user_data (object or None) – the loader.

Defines the type of the function that gets called once the size of the loaded image is known.

The function is expected to set width and height to the desired size to which the image should be scaled. If a module has no efficient way to achieve the desired scaling during the loading of the image, it may either ignore the size request, or only approximate it - gdk-pixbuf will then perform the required scaling on the completely loaded image.

If the function sets width or height to zero, the module should interpret this as a hint that it will be closed soon and shouldn’t allocate further resources. This convention is used to implement GdkPixbuf.Pixbuf.get_file_info() efficiently.

New in version 2.2.

GdkPixbuf.PixbufModuleStopLoadFunc(context)
Parameters:

context (object or None) – the state object created by [callback`GdkPixbuf`.PixbufModuleBeginLoadFunc]

Returns:

TRUE if the loading operation was successful

Return type:

bool

Finalizes the image loading state.

This function is called on success and error states.

GdkPixbuf.PixbufModuleUpdatedFunc(pixbuf, x, y, width, height, *user_data)
Parameters:
  • pixbuf (GdkPixbuf.Pixbuf) – the GdkPixbuf.Pixbuf that is currently being loaded.

  • x (int) – the X origin of the updated area.

  • y (int) – the Y origin of the updated area.

  • width (int) – the width of the updated area.

  • height (int) – the height of the updated area.

  • user_data (object or None) – the loader.

Defines the type of the function that gets called every time a region of pixbuf is updated.

GdkPixbuf.PixbufLoader uses a function of this type to emit the “‘area_updated [GdkPixbufLoader-area-updated]’” signal.

New in version 2.2.

GdkPixbuf.PixbufSaveFunc(buf, *data)
Parameters:
  • buf (bytes) – bytes to be written.

  • data (object or None) – user data passed to gdk_pixbuf_save_to_callback().

Returns:

TRUE if successful, FALSE otherwise

error:

A location to return an error.

Return type:

(bool, error: GLib.Error)

Save functions used by [method`GdkPixbuf`.Pixbuf.save_to_callback].

This function is called once for each block of bytes that is “written” by gdk_pixbuf_save_to_callback().

If successful it should return TRUE; if an error occurs it should set error and return FALSE, in which case gdk_pixbuf_save_to_callback() will fail with the same error.

New in version 2.4.