| Top |
| void | (*abydos_plugin_info_func_t) () |
| void | (*abydos_plugin_progress_func_t) () |
| #define | ABYDOS_PLUGIN_INFO_HAS() |
| #define | ABYDOS_PLUGIN_PAGE_INFO_HAS() |
| abydos_plugin_interface_t * | (*abydos_plugin_func_t) () |
To create a image loading plugin for abydos you must implement a function called "Abydos0" which returns a pointer to an abydos_plugin_interface_t. Which in turn must be filled with points to some functions.
These functions are mandatory:
get_mime_types
new
free
And at least one way to load an image. More than one can be provided. But implementing one by calling another is pointless since abydos knows how to do that anyway. One of these are mandatory:
progressive_begin, progressive_feed and progressive_end
create_from_data
create_from_file
And at least one way to get an image. Both can be provided. But implementing one by calling the other is pointless since abydos knows how to do that anyway. One of these are mandatory:
render
get_image_surface
If the plugin supports variants it also needs to implement:
get_variant_size
If the plugin supports animation it also needs to implement:
get_duration
The rest of the functions are optional.
void
(*abydos_plugin_info_func_t) (void *userdata);
The plugin should call this function as soon as the abydos_plugin_info_t is filled.
void (*abydos_plugin_progress_func_t) (void *userdata,cairo_rectangle_int_t *rect);
The plugin should call this function as soon as there is something new that could be rendered.
userdata |
The userdata passed to |
|
rect |
An area containing the latest update or NULL. |
#define ABYDOS_PLUGIN_INFO_HAS(info,member) (offsetof(abydos_plugin_info_t,member)<(info)->version)
Macro to check if the version of the abydos_plugin_info_t info
has member
.
#define ABYDOS_PLUGIN_PAGE_INFO_HAS(info,member) (offsetof(abydos_plugin_page_info_t,member)<(info)->version)
Macro to check if the version of the abydos_plugin_page_info_t info
has member
.
abydos_plugin_interface_t *
(*abydos_plugin_func_t) (void);
Prototype for a function each plugin should export as Abydos0.
typedef struct _abydos_plugin_handle_t abydos_plugin_handle_t;
A pointer to an object provided by a plugin.
typedef struct {
int version;
const char *error;
int width;
int height;
double pixel_ratio;
/* multi page */
int page_count;
/* layers */
int layer_count;
/* variants */
int variant_count;
/* animation */
int frame_count;
/* flags */
cairo_bool_t scalable_size;
cairo_bool_t scalable_time;
cairo_bool_t threadsafe;
/* 0.2 */
int default_page;
int default_frame;
cairo_bool_t threadsafe_render;
} abydos_plugin_info_t;
Info to fill in by a plugin.
Version of the structure. Use ABYDOS_PLUGIN_INFO_HAS to check if a member is available. |
||
Error message which can be set by the plugin. If the text is dynamically allocated the plugin must keep track of the message and free it then the plugin handle or the plugin itself is destroyed. |
||
Width of the image in pixels. This must be set by the plugin. |
||
Height of the image in pixels. This must be set by the plugin. |
||
Aspect ratio of a pixel. This can be set by the plugin if it's different from the default of 1.0. |
||
Number of pages. This may be set by the plugin if it's
different from the default of 1. In that case the plugin
may also provide |
||
Number of layers. This may be set by the plugin if it's
different from the default of 1. In that case the plugin
may also provide |
||
Number of variants. This may be set by the plugin if it's
different from the default of 1. In that case the plugin
must also provide |
||
Number of frames. This may be set by the plugin if it's
animated and has a discreet number of frames. In that case
the plugin may also |
||
cairo_bool_t |
The plugin can set this flag if the render size can be scaled up. Which is typical for vector graphics. |
|
cairo_bool_t |
The plugin can set this if a frame can be rendered at an arbitrary time (not just discreet frames). Which is typical for vector animation. |
|
cairo_bool_t |
Completely thread safe. The plugin can set this if all calls are completely thread safe. By default at most one call to the plugin will be made at a time. |
|
Can be set by the plugin if some other page than the first page is most representative. |
||
Can be set by the plugin if some other frame than the first frame is most representative. |
||
cairo_bool_t |
At least |
#define ABYDOS_PLUGIN_INFO_VERSION sizeof(abydos_plugin_info_t)
The compile time version of abydos_plugin_info_t.
typedef struct {
int version;
int width;
int height;
double pixel_ratio;
/* layers */
int layer_count;
/* variants */
int variant_count;
/* animation */
int frame_count;
int default_frame;
/* flags */
cairo_bool_t scalable_size;
cairo_bool_t scalable_time;
} abydos_plugin_page_info_t;
Info about a page, to be filled in by a plugin.
Version of the structure. Use ABYDOS_PLUGIN_PAGE_INFO_HAS to check if a member is available. |
||
Width of the page in pixels. Only needs to be set if it differs from the image. |
||
Height of the image in pixels. Only needs to be set if it differs from the image. |
||
Aspect ratio of a pixel. This can be set by the plugin if it's different from the image. |
||
Number of layers. This may be set by the plugin if it's
different from the default of 1. In that case the plugin
may also provide |
||
Number of variants. This may be set by the plugin if it's
different from the default of 1. In that case the plugin
must also provide |
||
Number of frames. This may be set by the plugin if it's animated and has a discreet number of frames. In that case the plugin may also provide get_duration` (in abydos_plugin_interface_t). If the animation doesn't have a descreet number of frames scalable_time can be set. |
||
Can be set by the plugin if some other frame than the first frame is most representative. |
||
cairo_bool_t |
The plugin can set this flag if the render size can be scaled up. Which is typical for vector graphics. |
|
cairo_bool_t |
The plugin can set this if a frame can be rendered at an arbitrary time (not just discreet frames). Which is typical for vector animation. |
#define ABYDOS_PLUGIN_PAGE_INFO_VERSION sizeof(abydos_plugin_page_info_t)
The compile time version of abydos_plugin_page_info_t.
typedef struct {
int version;
void(*done)(void);
const char **(*get_mime_types)(void);
abydos_plugin_handle_t *(*create)(const char *mime_type,abydos_plugin_info_t *);
void(*destroy)(abydos_plugin_handle_t *);
void(*progressive_begin)(abydos_plugin_handle_t *,abydos_plugin_info_func_t,abydos_plugin_progress_func_t,void *);
int(*progressive_feed)(abydos_plugin_handle_t *,const char *data,size_t len);
int(*progressive_end)(abydos_plugin_handle_t *);
int (*from_data)(abydos_plugin_handle_t *,const char *data, size_t len);
int (*from_file)(abydos_plugin_handle_t *,const char *filename);
void(*render)(abydos_plugin_handle_t *, cairo_t *cr,int page,cairo_bool_t *visible_layers,int prefered_variant,double time,int frame);
cairo_surface_t *(*get_image_surface)(abydos_plugin_handle_t *,int page,cairo_bool_t *visible_layers,int prefered_variant,double time,int frame);
void(*get_layer_visibility_OLD)(abydos_plugin_handle_t *,cairo_bool_t *visibility);
int(*get_variant_size_OLD)(abydos_plugin_handle_t *,abydos_size_t *size);
void(*get_duration_OLD)(abydos_plugin_handle_t *,double *frame_duration);
void(*get_page_info)(abydos_plugin_handle_t *, int page, abydos_plugin_page_info_t *);
void(*get_layer_visibility)(abydos_plugin_handle_t *,int page, cairo_bool_t *visibility);
void(*get_variant_size)(abydos_plugin_handle_t *,int page, abydos_size_t *size);
void(*get_duration)(abydos_plugin_handle_t *,int page, double *frame_duration);
} abydos_plugin_interface_t;
Each plugin must provide this function then called through the exported
function called Abydos0.
Version of this structure supported by the plugin. Must always
be set to |
||
Function to be called before the plugin is unloaded. (optional) |
||
Function to get supported MIME types. If must return a NULL terminated array. |
||
Function to create a new instance of |
||
Function to free all resources associated with the abydos_handle_t. May be called before or after the image has been loaded as well as in the middle of a progressive load. |
||
If the plugin implements progressive loading this function will be called before the data stream begins. |
||
Called one or more times to progressively feed image data. |
||
Called after the progressive feed ands. |
||
Decode an image from data in memory. |
||
Decode an image from a file. |
||
Function to render the image using cairo. The arguments passed
to the function has already been checked by abydos and are
valid. The arguments |
||
Function to get an image surface for the image (according to the supplied arguments). Usually just return a reference to an internal image surface created during the load stage. |
||
Depricated (only present for ABI compatibility). |
||
Depricated (only present for ABI compatibility). |
||
Depricated (only present for ABI compatibility). |
||
If the number of pages is set to more than one and this function is provided it is called for each page to let the plugin set any page specific information. |
||
If the number of layers is set to more than one and this function is provided it will be called to let the plugin set (the default) visibility for each layer. |
||
If the number of variants is set to more than one and this function is provided it will be called to let the plugin specify the size of each variant. |
||
If the number of frames is set to more than one or scalable time is enabled and this function is set it will be called to let the plugin set the duration of each frame. |
#define ABYDOS_PLUGIN_INTERFACE_VERSION sizeof(abydos_plugin_interface_t)
The compile time version of abydos_plugin_interface_t.