Class PixbufModule
- All Implemented Interfaces:
Proxy
GdkPixbufModule
contains the necessary functions to load and save
images in a certain file format.
If GdkPixbuf
has been compiled with GModule
support, it can be extended
by modules which can load (and perhaps also save) new image and animation
formats.
Implementing modules
The GdkPixbuf
interfaces needed for implementing modules are contained in
gdk-pixbuf-io.h
(and gdk-pixbuf-animation.h
if the module supports
animations). They are not covered by the same stability guarantees as the
regular GdkPixbuf API. To underline this fact, they are protected by the
GDK_PIXBUF_ENABLE_BACKEND
pre-processor symbol.
Each loadable module must contain a GdkPixbufModuleFillVtableFunc
function
named fill_vtable
, which will get called when the module
is loaded and must set the function pointers of the GdkPixbufModule
.
In order to make format-checking work before actually loading the modules
(which may require calling dlopen
to load image libraries), modules export
their signatures (and other information) via the fill_info
function. An
external utility, gdk-pixbuf-query-loaders
, uses this to create a text
file containing a list of all available loaders and their signatures.
This file is then read at runtime by GdkPixbuf
to obtain the list of
available loaders and their signatures.
Modules may only implement a subset of the functionality available via
GdkPixbufModule
. If a particular functionality is not implemented, the
fill_vtable
function will simply not set the corresponding
function pointers of the GdkPixbufModule
structure. If a module supports
incremental loading (i.e. provides begin_load
, stop_load
and
load_increment
), it doesn't have to implement load
, since GdkPixbuf
can supply a generic load
implementation wrapping the incremental loading.
Installing modules
Installing a module is a two-step process:
- copy the module file(s) to the loader directory (normally
$libdir/gdk-pixbuf-2.0/$version/loaders
, unless overridden by the environment variableGDK_PIXBUF_MODULEDIR
) - call
gdk-pixbuf-query-loaders
to update the module file (normally$libdir/gdk-pixbuf-2.0/$version/loaders.cache
, unless overridden by the environment variableGDK_PIXBUF_MODULE_FILE
)
-
Constructor Summary
ConstructorDescriptionAllocate a new PixbufModule.PixbufModule
(Arena arena) Allocate a new PixbufModule.PixbufModule
(MemorySegment address) Create a PixbufModule proxy instance for the provided memory address.PixbufModule
(String moduleName, String modulePath, PixbufFormat info, PixbufModuleLoadFunc load, PixbufModuleLoadXpmDataFunc loadXpmData, PixbufModuleBeginLoadFunc beginLoad, PixbufModuleStopLoadFunc stopLoad, PixbufModuleIncrementLoadFunc loadIncrement, PixbufModuleLoadAnimationFunc loadAnimation, PixbufModuleSaveFunc save, PixbufModuleSaveCallbackFunc saveToCallback, PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported) Allocate a new PixbufModule with the fields set to the provided values.PixbufModule
(String moduleName, String modulePath, PixbufFormat info, PixbufModuleLoadFunc load, PixbufModuleLoadXpmDataFunc loadXpmData, PixbufModuleBeginLoadFunc beginLoad, PixbufModuleStopLoadFunc stopLoad, PixbufModuleIncrementLoadFunc loadIncrement, PixbufModuleLoadAnimationFunc loadAnimation, PixbufModuleSaveFunc save, PixbufModuleSaveCallbackFunc saveToCallback, PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported, Arena arena) Allocate a new PixbufModule with the fields set to the provided values. -
Method Summary
Modifier and TypeMethodDescriptionstatic MemoryLayout
The memory layout of the native struct.Read the value of the fieldbegin_load
.readInfo()
Read the value of the fieldinfo
.Read the value of the fieldis_save_option_supported
.readLoad()
Read the value of the fieldload
.Read the value of the fieldload_animation
.Read the value of the fieldload_increment
.Read the value of the fieldload_xpm_data
.Read the value of the fieldmodule_name
.Read the value of the fieldmodule_path
.readSave()
Read the value of the fieldsave
.Read the value of the fieldsave_to_callback
.Read the value of the fieldstop_load
.void
writeBeginLoad
(PixbufModuleBeginLoadFunc beginLoad, Arena _arena) Write a value in the fieldbegin_load
.void
writeInfo
(PixbufFormat info) Write a value in the fieldinfo
.void
writeIsSaveOptionSupported
(PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported, Arena _arena) Write a value in the fieldis_save_option_supported
.void
writeLoad
(PixbufModuleLoadFunc load, Arena _arena) Write a value in the fieldload
.void
writeLoadAnimation
(PixbufModuleLoadAnimationFunc loadAnimation, Arena _arena) Write a value in the fieldload_animation
.void
writeLoadIncrement
(PixbufModuleIncrementLoadFunc loadIncrement, Arena _arena) Write a value in the fieldload_increment
.void
writeLoadXpmData
(PixbufModuleLoadXpmDataFunc loadXpmData, Arena _arena) Write a value in the fieldload_xpm_data
.void
writeModuleName
(String moduleName, Arena _arena) Write a value in the fieldmodule_name
.void
writeModulePath
(String modulePath, Arena _arena) Write a value in the fieldmodule_path
.void
writeSave
(PixbufModuleSaveFunc save, Arena _arena) Write a value in the fieldsave
.void
writeSaveToCallback
(PixbufModuleSaveCallbackFunc saveToCallback, Arena _arena) Write a value in the fieldsave_to_callback
.void
writeStopLoad
(PixbufModuleStopLoadFunc stopLoad, Arena _arena) Write a value in the fieldstop_load
.Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PixbufModule
Create a PixbufModule proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
PixbufModule
Allocate a new PixbufModule.- Parameters:
arena
- to control the memory allocation scope
-
PixbufModule
public PixbufModule()Allocate a new PixbufModule. The memory is allocated withArena.ofAuto()
. -
PixbufModule
public PixbufModule(String moduleName, String modulePath, PixbufFormat info, PixbufModuleLoadFunc load, PixbufModuleLoadXpmDataFunc loadXpmData, PixbufModuleBeginLoadFunc beginLoad, PixbufModuleStopLoadFunc stopLoad, PixbufModuleIncrementLoadFunc loadIncrement, PixbufModuleLoadAnimationFunc loadAnimation, PixbufModuleSaveFunc save, PixbufModuleSaveCallbackFunc saveToCallback, PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported, Arena arena) Allocate a new PixbufModule with the fields set to the provided values.- Parameters:
moduleName
- value for the fieldmoduleName
modulePath
- value for the fieldmodulePath
info
- value for the fieldinfo
load
- value for the fieldload
loadXpmData
- value for the fieldloadXpmData
beginLoad
- value for the fieldbeginLoad
stopLoad
- value for the fieldstopLoad
loadIncrement
- value for the fieldloadIncrement
loadAnimation
- value for the fieldloadAnimation
save
- value for the fieldsave
saveToCallback
- value for the fieldsaveToCallback
isSaveOptionSupported
- value for the fieldisSaveOptionSupported
arena
- to control the memory allocation scope
-
PixbufModule
public PixbufModule(String moduleName, String modulePath, PixbufFormat info, PixbufModuleLoadFunc load, PixbufModuleLoadXpmDataFunc loadXpmData, PixbufModuleBeginLoadFunc beginLoad, PixbufModuleStopLoadFunc stopLoad, PixbufModuleIncrementLoadFunc loadIncrement, PixbufModuleLoadAnimationFunc loadAnimation, PixbufModuleSaveFunc save, PixbufModuleSaveCallbackFunc saveToCallback, PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported) Allocate a new PixbufModule with the fields set to the provided values. The memory is allocated withArena.ofAuto()
.- Parameters:
moduleName
- value for the fieldmoduleName
modulePath
- value for the fieldmodulePath
info
- value for the fieldinfo
load
- value for the fieldload
loadXpmData
- value for the fieldloadXpmData
beginLoad
- value for the fieldbeginLoad
stopLoad
- value for the fieldstopLoad
loadIncrement
- value for the fieldloadIncrement
loadAnimation
- value for the fieldloadAnimation
save
- value for the fieldsave
saveToCallback
- value for the fieldsaveToCallback
isSaveOptionSupported
- value for the fieldisSaveOptionSupported
-
-
Method Details
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
readModuleName
Read the value of the fieldmodule_name
.- Returns:
- The value of the field
module_name
-
writeModuleName
-
readModulePath
Read the value of the fieldmodule_path
.- Returns:
- The value of the field
module_path
-
writeModulePath
-
readInfo
Read the value of the fieldinfo
.- Returns:
- The value of the field
info
-
writeInfo
Write a value in the fieldinfo
.- Parameters:
info
- The new value for the fieldinfo
-
readLoad
Read the value of the fieldload
.- Returns:
- The value of the field
load
-
writeLoad
Write a value in the fieldload
.- Parameters:
load
- The new value for the fieldload
_arena
- to control the memory allocation scope
-
readLoadXpmData
Read the value of the fieldload_xpm_data
.- Returns:
- The value of the field
load_xpm_data
-
writeLoadXpmData
Write a value in the fieldload_xpm_data
.- Parameters:
loadXpmData
- The new value for the fieldload_xpm_data
_arena
- to control the memory allocation scope
-
readBeginLoad
Read the value of the fieldbegin_load
.- Returns:
- The value of the field
begin_load
-
writeBeginLoad
Write a value in the fieldbegin_load
.- Parameters:
beginLoad
- The new value for the fieldbegin_load
_arena
- to control the memory allocation scope
-
readStopLoad
Read the value of the fieldstop_load
.- Returns:
- The value of the field
stop_load
-
writeStopLoad
Write a value in the fieldstop_load
.- Parameters:
stopLoad
- The new value for the fieldstop_load
_arena
- to control the memory allocation scope
-
readLoadIncrement
Read the value of the fieldload_increment
.- Returns:
- The value of the field
load_increment
-
writeLoadIncrement
Write a value in the fieldload_increment
.- Parameters:
loadIncrement
- The new value for the fieldload_increment
_arena
- to control the memory allocation scope
-
readLoadAnimation
Read the value of the fieldload_animation
.- Returns:
- The value of the field
load_animation
-
writeLoadAnimation
Write a value in the fieldload_animation
.- Parameters:
loadAnimation
- The new value for the fieldload_animation
_arena
- to control the memory allocation scope
-
readSave
Read the value of the fieldsave
.- Returns:
- The value of the field
save
-
writeSave
Write a value in the fieldsave
.- Parameters:
save
- The new value for the fieldsave
_arena
- to control the memory allocation scope
-
readSaveToCallback
Read the value of the fieldsave_to_callback
.- Returns:
- The value of the field
save_to_callback
-
writeSaveToCallback
Write a value in the fieldsave_to_callback
.- Parameters:
saveToCallback
- The new value for the fieldsave_to_callback
_arena
- to control the memory allocation scope
-
readIsSaveOptionSupported
Read the value of the fieldis_save_option_supported
.- Returns:
- The value of the field
is_save_option_supported
-
writeIsSaveOptionSupported
public void writeIsSaveOptionSupported(PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported, Arena _arena) Write a value in the fieldis_save_option_supported
.- Parameters:
isSaveOptionSupported
- The new value for the fieldis_save_option_supported
_arena
- to control the memory allocation scope
-