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-loadersto update the module file (normally$libdir/gdk-pixbuf-2.0/$version/loaders.cache, unless overridden by the environment variableGDK_PIXBUF_MODULE_FILE)
-
Constructor Summary
ConstructorsConstructorDescriptionAllocate 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 MemoryLayoutThe memory layout of the native struct.@Nullable PixbufModuleBeginLoadFuncRead the value of the fieldbegin_load.readInfo()Read the value of the fieldinfo.@Nullable PixbufModuleSaveOptionSupportedFuncRead the value of the fieldis_save_option_supported.@Nullable PixbufModuleLoadFuncreadLoad()Read the value of the fieldload.@Nullable PixbufModuleLoadAnimationFuncRead the value of the fieldload_animation.@Nullable PixbufModuleIncrementLoadFuncRead the value of the fieldload_increment.@Nullable PixbufModuleLoadXpmDataFuncRead the value of the fieldload_xpm_data.Read the value of the fieldmodule_name.Read the value of the fieldmodule_path.@Nullable PixbufModuleSaveFuncreadSave()Read the value of the fieldsave.@Nullable PixbufModuleSaveCallbackFuncRead the value of the fieldsave_to_callback.@Nullable PixbufModuleStopLoadFuncRead the value of the fieldstop_load.voidwriteBeginLoad(@Nullable PixbufModuleBeginLoadFunc beginLoad, Arena _arena) Write a value in the fieldbegin_load.voidwriteInfo(PixbufFormat info) Write a value in the fieldinfo.voidwriteIsSaveOptionSupported(@Nullable PixbufModuleSaveOptionSupportedFunc isSaveOptionSupported, Arena _arena) Write a value in the fieldis_save_option_supported.voidwriteLoad(@Nullable PixbufModuleLoadFunc load, Arena _arena) Write a value in the fieldload.voidwriteLoadAnimation(@Nullable PixbufModuleLoadAnimationFunc loadAnimation, Arena _arena) Write a value in the fieldload_animation.voidwriteLoadIncrement(@Nullable PixbufModuleIncrementLoadFunc loadIncrement, Arena _arena) Write a value in the fieldload_increment.voidwriteLoadXpmData(@Nullable PixbufModuleLoadXpmDataFunc loadXpmData, Arena _arena) Write a value in the fieldload_xpm_data.voidwriteModuleName(String moduleName, Arena _arena) Write a value in the fieldmodule_name.voidwriteModulePath(String modulePath, Arena _arena) Write a value in the fieldmodule_path.voidwriteSave(@Nullable PixbufModuleSaveFunc save, Arena _arena) Write a value in the fieldsave.voidwriteSaveToCallback(@Nullable PixbufModuleSaveCallbackFunc saveToCallback, Arena _arena) Write a value in the fieldsave_to_callback.voidwriteStopLoad(@Nullable PixbufModuleStopLoadFunc stopLoad, Arena _arena) Write a value in the fieldstop_load.Methods inherited from class org.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 fieldmoduleNamemodulePath- value for the fieldmodulePathinfo- value for the fieldinfoload- value for the fieldloadloadXpmData- value for the fieldloadXpmDatabeginLoad- value for the fieldbeginLoadstopLoad- value for the fieldstopLoadloadIncrement- value for the fieldloadIncrementloadAnimation- value for the fieldloadAnimationsave- value for the fieldsavesaveToCallback- value for the fieldsaveToCallbackisSaveOptionSupported- value for the fieldisSaveOptionSupportedarena- 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 fieldmoduleNamemodulePath- value for the fieldmodulePathinfo- value for the fieldinfoload- value for the fieldloadloadXpmData- value for the fieldloadXpmDatabeginLoad- value for the fieldbeginLoadstopLoad- value for the fieldstopLoadloadIncrement- value for the fieldloadIncrementloadAnimation- value for the fieldloadAnimationsave- value for the fieldsavesaveToCallback- value for the fieldsaveToCallbackisSaveOptionSupported- 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
public void writeSaveToCallback(@Nullable PixbufModuleSaveCallbackFunc saveToCallback, Arena _arena) 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(@Nullable 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
-