Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A 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
)
Synopsis
- newtype PixbufModule = PixbufModule (ManagedPtr PixbufModule)
- newZeroPixbufModule :: MonadIO m => m PixbufModule
- clearPixbufModuleInfo :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleInfo :: MonadIO m => PixbufModule -> m (Maybe PixbufFormat)
- setPixbufModuleInfo :: MonadIO m => PixbufModule -> Ptr PixbufFormat -> m ()
- clearPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleSaveOptionSupportedFunc)
- setPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleSaveOptionSupportedFunc -> m ()
- clearPixbufModuleLoad :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleLoad :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadFunc)
- setPixbufModuleLoad :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadFunc -> m ()
- clearPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadAnimationFunc)
- setPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadAnimationFunc -> m ()
- clearPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleIncrementLoadFunc)
- setPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleIncrementLoadFunc -> m ()
- clearPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadXpmDataFunc)
- setPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadXpmDataFunc -> m ()
- clearPixbufModuleModule :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleModule :: MonadIO m => PixbufModule -> m (Maybe Module)
- setPixbufModuleModule :: MonadIO m => PixbufModule -> Ptr Module -> m ()
- clearPixbufModuleModuleName :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleModuleName :: MonadIO m => PixbufModule -> m (Maybe Text)
- setPixbufModuleModuleName :: MonadIO m => PixbufModule -> CString -> m ()
- clearPixbufModuleModulePath :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleModulePath :: MonadIO m => PixbufModule -> m (Maybe Text)
- setPixbufModuleModulePath :: MonadIO m => PixbufModule -> CString -> m ()
- clearPixbufModuleSave :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleSave :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleSaveFunc)
- setPixbufModuleSave :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleSaveFunc -> m ()
- clearPixbufModuleStopLoad :: MonadIO m => PixbufModule -> m ()
- getPixbufModuleStopLoad :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleStopLoadFunc)
- setPixbufModuleStopLoad :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleStopLoadFunc -> m ()
Exported types
newtype PixbufModule Source #
Memory-managed wrapper type.
PixbufModule (ManagedPtr PixbufModule) |
Instances
Eq PixbufModule Source # | |
Defined in GI.GdkPixbuf.Structs.PixbufModule (==) :: PixbufModule -> PixbufModule -> Bool # (/=) :: PixbufModule -> PixbufModule -> Bool # | |
BoxedPtr PixbufModule Source # | |
Defined in GI.GdkPixbuf.Structs.PixbufModule boxedPtrCopy :: PixbufModule -> IO PixbufModule boxedPtrFree :: PixbufModule -> IO () | |
CallocPtr PixbufModule Source # | |
Defined in GI.GdkPixbuf.Structs.PixbufModule boxedPtrCalloc :: IO (Ptr PixbufModule) | |
ManagedPtrNewtype PixbufModule Source # | |
Defined in GI.GdkPixbuf.Structs.PixbufModule toManagedPtr :: PixbufModule -> ManagedPtr PixbufModule | |
tag ~ 'AttrSet => Constructible PixbufModule tag Source # | |
Defined in GI.GdkPixbuf.Structs.PixbufModule new :: MonadIO m => (ManagedPtr PixbufModule -> PixbufModule) -> [AttrOp PixbufModule tag] -> m PixbufModule |
newZeroPixbufModule :: MonadIO m => m PixbufModule Source #
Construct a PixbufModule
struct initialized to zero.
Methods
Properties
info
a GdkPixbufFormat
holding information about the module.
clearPixbufModuleInfo :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “info
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#info
getPixbufModuleInfo :: MonadIO m => PixbufModule -> m (Maybe PixbufFormat) Source #
Get the value of the “info
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #info
setPixbufModuleInfo :: MonadIO m => PixbufModule -> Ptr PixbufFormat -> m () Source #
Set the value of the “info
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #info:=
value ]
isSaveOptionSupported
returns whether a save option key is supported by the module
clearPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “is_save_option_supported
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#isSaveOptionSupported
getPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleSaveOptionSupportedFunc) Source #
Get the value of the “is_save_option_supported
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #isSaveOptionSupported
setPixbufModuleIsSaveOptionSupported :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleSaveOptionSupportedFunc -> m () Source #
Set the value of the “is_save_option_supported
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #isSaveOptionSupported:=
value ]
load
loads an image from a file.
clearPixbufModuleLoad :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “load
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#load
getPixbufModuleLoad :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadFunc) Source #
Get the value of the “load
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #load
setPixbufModuleLoad :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadFunc -> m () Source #
Set the value of the “load
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #load:=
value ]
loadAnimation
loads an animation from a file.
clearPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “load_animation
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#loadAnimation
getPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadAnimationFunc) Source #
Get the value of the “load_animation
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #loadAnimation
setPixbufModuleLoadAnimation :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadAnimationFunc -> m () Source #
Set the value of the “load_animation
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #loadAnimation:=
value ]
loadIncrement
continues an incremental load.
clearPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “load_increment
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#loadIncrement
getPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleIncrementLoadFunc) Source #
Get the value of the “load_increment
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #loadIncrement
setPixbufModuleLoadIncrement :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleIncrementLoadFunc -> m () Source #
Set the value of the “load_increment
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #loadIncrement:=
value ]
loadXpmData
loads an image from data in memory.
clearPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “load_xpm_data
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#loadXpmData
getPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleLoadXpmDataFunc) Source #
Get the value of the “load_xpm_data
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #loadXpmData
setPixbufModuleLoadXpmData :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleLoadXpmDataFunc -> m () Source #
Set the value of the “load_xpm_data
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #loadXpmData:=
value ]
module
the loaded GModule
.
clearPixbufModuleModule :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “module
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#module
getPixbufModuleModule :: MonadIO m => PixbufModule -> m (Maybe Module) Source #
Get the value of the “module
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #module
setPixbufModuleModule :: MonadIO m => PixbufModule -> Ptr Module -> m () Source #
Set the value of the “module
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #module:=
value ]
moduleName
the name of the module, usually the same as the usual file extension for images of this type, eg. "xpm", "jpeg" or "png".
clearPixbufModuleModuleName :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “module_name
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#moduleName
getPixbufModuleModuleName :: MonadIO m => PixbufModule -> m (Maybe Text) Source #
Get the value of the “module_name
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #moduleName
setPixbufModuleModuleName :: MonadIO m => PixbufModule -> CString -> m () Source #
Set the value of the “module_name
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #moduleName:=
value ]
modulePath
the path from which the module is loaded.
clearPixbufModuleModulePath :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “module_path
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#modulePath
getPixbufModuleModulePath :: MonadIO m => PixbufModule -> m (Maybe Text) Source #
Get the value of the “module_path
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #modulePath
setPixbufModuleModulePath :: MonadIO m => PixbufModule -> CString -> m () Source #
Set the value of the “module_path
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #modulePath:=
value ]
save
saves a GdkPixbuf
to a file.
clearPixbufModuleSave :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “save
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#save
getPixbufModuleSave :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleSaveFunc) Source #
Get the value of the “save
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #save
setPixbufModuleSave :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleSaveFunc -> m () Source #
Set the value of the “save
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #save:=
value ]
stopLoad
stops an incremental load.
clearPixbufModuleStopLoad :: MonadIO m => PixbufModule -> m () Source #
Set the value of the “stop_load
” field to Nothing
.
When overloading is enabled, this is equivalent to
clear
#stopLoad
getPixbufModuleStopLoad :: MonadIO m => PixbufModule -> m (Maybe PixbufModuleStopLoadFunc) Source #
Get the value of the “stop_load
” field.
When overloading is enabled, this is equivalent to
get
pixbufModule #stopLoad
setPixbufModuleStopLoad :: MonadIO m => PixbufModule -> FunPtr C_PixbufModuleStopLoadFunc -> m () Source #
Set the value of the “stop_load
” field.
When overloading is enabled, this is equivalent to
set
pixbufModule [ #stopLoad:=
value ]