Commit e2c32a07 authored by Moritz Lipp's avatar Moritz Lipp
Browse files

Implement zathura_page_get_annotations

parent e70a07e0
......@@ -308,7 +308,8 @@ zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathu
return plugin->functions.page_image_get_cairo(page, page->data, image, error);
}
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error)
char*
zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error)
{
if (page == NULL || page->document == NULL ) {
if (error) {
......@@ -328,6 +329,32 @@ char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle,
return plugin->functions.page_get_text(page, page->data, rectangle, error);
}
girara_list_t*
zathura_page_get_annotations(zathura_page_t* page, zathura_error_t* error)
{
if (page == NULL || page->document == NULL ) {
if (error) {
*error = ZATHURA_ERROR_INVALID_ARGUMENTS;
}
return NULL;
}
zathura_plugin_t* plugin = zathura_document_get_plugin(page->document);
if (plugin->functions.page_get_annotations == NULL) {
if (error) {
*error = ZATHURA_ERROR_NOT_IMPLEMENTED;
}
return NULL;
}
girara_list_t* result = plugin->functions.page_get_annotations(page, page->data, error);
if (result != NULL) {
girara_list_set_free_function(result, (girara_free_function_t) zathura_annotation_free);
}
return result;
}
zathura_error_t
zathura_page_render(zathura_page_t* page, cairo_t* cairo, bool printing)
{
......
......@@ -192,6 +192,16 @@ cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_imag
*/
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_error_t* error);
/**
* Returns a list of annotations (see \ref zathura_annotation_t)
*
* @param page Page
* @param error Set to an error value (see \ref zathura_error_t) if an
* error occured
* @return List of annotations or NULL if an error occured
*/
girara_list_t* zathura_page_get_annotations(zathura_page_t* page, zathura_error_t* error);
/**
* Render page
*
......
......@@ -141,6 +141,11 @@ typedef cairo_surface_t* (*zathura_plugin_page_image_get_cairo_t)(zathura_page_t
*/
typedef char* (*zathura_plugin_page_get_text_t)(zathura_page_t* page, void* data, zathura_rectangle_t rectangle, zathura_error_t* error);
/**
* Get list of annotations
*/
typedef girara_list_t* (*zathura_plugin_page_get_annotations_t)(zathura_page_t* page, void* data, zathura_error_t* error);
/**
* Renders the page
*/
......@@ -229,6 +234,11 @@ struct zathura_plugin_functions_s
*/
zathura_plugin_page_get_text_t page_get_text;
/**
* Get list of annotations
*/
zathura_plugin_page_get_annotations_t page_get_annotations;
/**
* Renders the page
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment