mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-29 01:14:56 +01:00
Replace image_save with image_get_cairo
This commit is contained in:
parent
95c8510118
commit
3facd5beb0
3 changed files with 21 additions and 15 deletions
10
commands.c
10
commands.c
|
@ -332,14 +332,20 @@ cmd_export(girara_session_t* session, girara_list_t* argument_list)
|
|||
}
|
||||
|
||||
const char* attachment_name = girara_list_nth(argument_list, 0);
|
||||
const char* file_name = girara_list_nth(argument_list, 1);
|
||||
const char* file_name = girara_list_nth(argument_list, 1);
|
||||
|
||||
if (file_name == NULL || attachment_name == NULL) {
|
||||
return false;
|
||||
}
|
||||
char* file_name2 = girara_fix_path(file_name);
|
||||
if (!zathura_document_attachment_save(zathura->document, attachment_name, file_name)) {
|
||||
|
||||
if (zathura_document_attachment_save(zathura->document, attachment_name, file_name) == false) {
|
||||
girara_notify(session, GIRARA_ERROR, "Couldn't write attachment '%s' to '%s'.", attachment_name, file_name);
|
||||
} else {
|
||||
girara_notify(session, GIRARA_INFO, "Wrote attachment '%s' to '%s'.", attachment_name, file_name2);
|
||||
}
|
||||
|
||||
g_free(file_name2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
10
document.c
10
document.c
|
@ -610,19 +610,19 @@ zathura_page_images_get(zathura_page_t* page, zathura_plugin_error_t* error)
|
|||
return page->document->functions.page_images_get(page, error);
|
||||
}
|
||||
|
||||
zathura_plugin_error_t
|
||||
zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char* file)
|
||||
cairo_surface_t*
|
||||
zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error)
|
||||
{
|
||||
if (page == NULL || page->document == NULL || image == NULL || file == NULL) {
|
||||
if (page == NULL || page->document == NULL || image == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (page->document->functions.page_image_save == NULL) {
|
||||
if (page->document->functions.page_image_get_cairo == NULL) {
|
||||
girara_error("%s not implemented", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
return page->document->functions.page_image_save(page, image, file);
|
||||
return page->document->functions.page_image_get_cairo(page, image, error);
|
||||
}
|
||||
|
||||
char* zathura_page_get_text(zathura_page_t* page, zathura_rectangle_t rectangle, zathura_plugin_error_t* error)
|
||||
|
|
16
document.h
16
document.h
|
@ -271,9 +271,9 @@ struct zathura_document_s
|
|||
girara_list_t* (*page_images_get)(zathura_page_t* page, zathura_plugin_error_t* error);
|
||||
|
||||
/**
|
||||
* Save image to a file
|
||||
* Get the image
|
||||
*/
|
||||
zathura_plugin_error_t (*page_image_save)(zathura_page_t* page, zathura_image_t* image, const char* file);
|
||||
cairo_surface_t* (*page_image_get_cairo)(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
|
||||
|
||||
/**
|
||||
* Get text for selection
|
||||
|
@ -477,15 +477,15 @@ zathura_plugin_error_t zathura_page_form_fields_free(girara_list_t* list);
|
|||
girara_list_t* zathura_page_images_get(zathura_page_t* page, zathura_plugin_error_t* error);
|
||||
|
||||
/**
|
||||
* Save image
|
||||
* Get image
|
||||
*
|
||||
* @param page Page
|
||||
* @param image The image
|
||||
* @param file Path to the file
|
||||
* @return ZATHURA_PLUGIN_ERROR_OK when no error occured, otherwise see
|
||||
* zathura_plugin_error_t
|
||||
* @param image Image identifier
|
||||
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
|
||||
* error occured
|
||||
* @return The cairo image surface or NULL if an error occured
|
||||
*/
|
||||
zathura_plugin_error_t zathura_page_image_save(zathura_page_t* page, zathura_image_t* image, const char* file);
|
||||
cairo_surface_t* zathura_page_image_get_cairo(zathura_page_t* page, zathura_image_t* image, zathura_plugin_error_t* error);
|
||||
|
||||
/**
|
||||
* Get text for selection
|
||||
|
|
Loading…
Reference in a new issue