Callbacks¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- GdkPixbuf.PixbufDestroyNotify(pixels, *data)¶
- Parameters:
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 typeGdkPixbufDestroyNotify
so that the pixel data can be freed when the pixbuf is finalized.
- GdkPixbuf.PixbufModuleFillInfoFunc(info)¶
- Parameters:
info (
GdkPixbuf.PixbufFormat
) – aGdkPixbuf.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
) – aGdkPixbuf.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:
- Returns:
TRUE
if the incremental load was successful- Return type:
Incrementally loads a buffer into the image data.
- GdkPixbuf.PixbufModuleLoadAnimationFunc(f)¶
- Parameters:
f (
object
orNone
) – the file stream from which the image should be loaded- Returns:
a newly created
GdkPixbufAnimation
for the contents of the file- Return type:
Loads a file from a standard C file stream into a new
GdkPixbufAnimation
.In case of error, this function should return
NULL
and set theerror
argument.
- GdkPixbuf.PixbufModuleLoadFunc(f)¶
- Parameters:
f (
object
orNone
) – the file stream from which the image should be loaded- Returns:
a newly created
GdkPixbuf
for the contents of the file- Return type:
Loads a file from a standard C file stream into a new
GdkPixbuf
.In case of error, this function should return
NULL
and set theerror
argument.
- GdkPixbuf.PixbufModuleLoadXpmDataFunc(data)¶
- Parameters:
data ([
str
]) – the XPM data- Returns:
a newly created
GdkPixbuf
for the XPM data- Return type:
Loads XPM data into a new
GdkPixbuf
.
- GdkPixbuf.PixbufModulePreparedFunc(pixbuf, anim, *user_data)¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf
) – theGdkPixbuf.Pixbuf
that is currently being loaded.anim (
GdkPixbuf.PixbufAnimation
) – if an animation is being loaded, theGdkPixbuf.PixbufAnimation
, elseNone
.
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:
- Returns:
TRUE
on success; in case of failure,FALSE
is returned and theerror
is set- Return type:
Saves a
GdkPixbuf
into a standard C file stream.The optional
param_keys
andparam_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:
Checks whether the given
option_key
is supported when saving.
- GdkPixbuf.PixbufModuleSizeFunc(width, height, *user_data)¶
- Parameters:
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
orNone
) – the state object created by [callback`GdkPixbuf`.PixbufModuleBeginLoadFunc]- Returns:
TRUE
if the loading operation was successful- Return type:
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
) – theGdkPixbuf.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.
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:
- 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 seterror
and returnFALSE
, in which casegdk_pixbuf_save_to_callback()
will fail with the same error.New in version 2.4.