mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-02-27 10:54:39 +01:00
Add images_get and image_save functions
This commit is contained in:
parent
f8f4345540
commit
419376f761
2 changed files with 69 additions and 1 deletions
31
document.c
31
document.c
|
@ -521,6 +521,37 @@ zathura_page_form_fields_free(girara_list_t* UNUSED(list))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
girara_list_t*
|
||||||
|
zathura_page_images_get(zathura_page_t* page)
|
||||||
|
{
|
||||||
|
if (page == NULL || page->document == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (page->document->functions.page_images_get == NULL) {
|
||||||
|
girara_error("%s not implemented", __FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return page->document->functions.page_images_get(page);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char* file)
|
||||||
|
{
|
||||||
|
if (page == NULL || page->document == NULL || image == NULL || file == NULL) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (page->document->functions.page_image_save == NULL) {
|
||||||
|
girara_error("%s not implemented", __FUNCTION__);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return page->document->functions.page_image_save(page, image, file);
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
zathura_page_render(zathura_page_t* page, cairo_t* cairo)
|
zathura_page_render(zathura_page_t* page, cairo_t* cairo)
|
||||||
{
|
{
|
||||||
|
|
39
document.h
39
document.h
|
@ -87,6 +87,15 @@ typedef struct zathura_rectangle_s
|
||||||
double y2; /**< Y coordinate of point 2 */
|
double y2; /**< Y coordinate of point 2 */
|
||||||
} zathura_rectangle_t;
|
} zathura_rectangle_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Image structure
|
||||||
|
*/
|
||||||
|
typedef struct zathura_image_s
|
||||||
|
{
|
||||||
|
zathura_rectangle_t position; /**< Coordinates of the image */
|
||||||
|
void* data; /**< Custom data of the plugin */
|
||||||
|
} zathura_image_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Possible link types
|
* Possible link types
|
||||||
*/
|
*/
|
||||||
|
@ -225,6 +234,16 @@ struct zathura_document_s
|
||||||
*/
|
*/
|
||||||
girara_list_t* (*page_form_fields_get)(zathura_page_t* page);
|
girara_list_t* (*page_form_fields_get)(zathura_page_t* page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of images
|
||||||
|
*/
|
||||||
|
girara_list_t* (*page_images_get)(zathura_page_t* page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save image to a file
|
||||||
|
*/
|
||||||
|
bool (*page_image_save)(zathura_page_t* page, zathura_image_t* image, const char* file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the page
|
* Renders the page
|
||||||
*/
|
*/
|
||||||
|
@ -305,7 +324,7 @@ girara_tree_node_t* zathura_document_index_generate(zathura_document_t* document
|
||||||
girara_list_t* zathura_document_attachments_get(zathura_document_t* document);
|
girara_list_t* zathura_document_attachments_get(zathura_document_t* document);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free document attachments
|
* Save document attachment
|
||||||
*
|
*
|
||||||
* @param document The document objects
|
* @param document The document objects
|
||||||
* @param attachment name of the attachment
|
* @param attachment name of the attachment
|
||||||
|
@ -381,6 +400,24 @@ girara_list_t* zathura_page_form_fields_get(zathura_page_t* page);
|
||||||
*/
|
*/
|
||||||
bool zathura_page_form_fields_free(girara_list_t* list);
|
bool zathura_page_form_fields_free(girara_list_t* list);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of images
|
||||||
|
*
|
||||||
|
* @param page Page
|
||||||
|
* @return List of images
|
||||||
|
*/
|
||||||
|
girara_list_t* zathura_page_images_get(zathura_page_t* page);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save image
|
||||||
|
*
|
||||||
|
* @param page Page
|
||||||
|
* @param image The image
|
||||||
|
* @param file Path to the file
|
||||||
|
* @return true if no error occured
|
||||||
|
*/
|
||||||
|
bool zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char* file);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render page
|
* Render page
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue