-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from hwhw/master
FFI-based MuPDF API
- Loading branch information
Showing
17 changed files
with
1,845 additions
and
1,384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,185 @@ | ||
#include <mupdf/fitz.h> | ||
#include "wrap-mupdf.h" | ||
|
||
#include "ffi-cdecl.h" | ||
#include "ffi-cdecl-luajit.h" | ||
|
||
cdecl_const(FZ_PAGE_BLOCK_TEXT) | ||
|
||
/* math */ | ||
cdecl_struct(fz_point_s) | ||
cdecl_type(fz_point) | ||
|
||
cdecl_struct(fz_rect_s) | ||
cdecl_type(fz_rect) | ||
cdecl_const(fz_unit_rect) | ||
cdecl_const(fz_empty_rect) | ||
cdecl_const(fz_infinite_rect) | ||
cdecl_func(fz_intersect_rect) | ||
cdecl_func(fz_union_rect) | ||
|
||
cdecl_struct(fz_irect_s) | ||
cdecl_type(fz_irect) | ||
cdecl_const(fz_empty_irect) | ||
cdecl_const(fz_infinite_irect) | ||
cdecl_func(fz_intersect_irect) | ||
|
||
cdecl_func(fz_irect_from_rect) | ||
cdecl_func(fz_round_rect) | ||
|
||
cdecl_struct(fz_matrix_s) | ||
cdecl_type(fz_matrix) | ||
cdecl_const(fz_identity) | ||
cdecl_func(fz_concat) | ||
cdecl_func(fz_scale) | ||
cdecl_func(fz_pre_scale) | ||
cdecl_func(fz_rotate) | ||
cdecl_func(fz_pre_rotate) | ||
cdecl_func(fz_translate) | ||
cdecl_func(fz_pre_translate) | ||
|
||
cdecl_func(fz_transform_rect) | ||
|
||
/* context */ | ||
cdecl_type(fz_alloc_context) | ||
cdecl_type(fz_colorspace) | ||
cdecl_type(fz_context) | ||
cdecl_type(fz_colorspace) | ||
cdecl_type(fz_store_free_fn) | ||
cdecl_func(fz_new_context_imp) | ||
cdecl_func(fz_free_context) | ||
cdecl_func(fz_register_document_handlers) | ||
|
||
/* images */ | ||
cdecl_struct(fz_image_s) | ||
cdecl_type(fz_image) | ||
cdecl_func(fz_new_image_from_data) // compat, use wrapper instead: | ||
cdecl_func(mupdf_new_image_from_data) | ||
cdecl_func(fz_new_pixmap_from_image) // compat, use wrapper instead: | ||
cdecl_func(mupdf_new_pixmap_from_image) | ||
cdecl_func(fz_keep_image) | ||
cdecl_func(fz_drop_image) | ||
|
||
/* misc/assorted */ | ||
cdecl_struct(fz_storable_s) | ||
cdecl_type(fz_storable) | ||
|
||
cdecl_func(fz_load_png) | ||
cdecl_func(fz_runetochar) | ||
|
||
/* document */ | ||
cdecl_struct(fz_document_s) | ||
cdecl_type(fz_document) | ||
cdecl_struct(fz_page_s) | ||
cdecl_type(fz_page) | ||
|
||
cdecl_func(mupdf_open_document) | ||
cdecl_func(fz_needs_password) | ||
cdecl_func(fz_authenticate_password) | ||
cdecl_func(fz_close_document) | ||
cdecl_func(mupdf_count_pages) | ||
|
||
/* page */ | ||
cdecl_func(mupdf_load_page) | ||
cdecl_func(fz_bound_page) | ||
cdecl_func(fz_free_page) | ||
|
||
/* links */ | ||
cdecl_enum(fz_link_kind_e) | ||
cdecl_struct(fz_link_dest_s) | ||
cdecl_type(fz_link_dest) | ||
cdecl_struct(fz_link_s) | ||
cdecl_type(fz_link) | ||
cdecl_func(mupdf_load_links) | ||
cdecl_func(fz_drop_link) | ||
|
||
/* outline */ | ||
cdecl_struct(fz_outline_s) | ||
cdecl_type(fz_outline) | ||
cdecl_func(mupdf_load_outline) | ||
cdecl_func(fz_free_outline) | ||
|
||
/* structured text */ | ||
cdecl_struct(fz_text_style_s) | ||
cdecl_type(fz_text_style) | ||
|
||
cdecl_struct(fz_text_char_s) | ||
cdecl_type(fz_text_char) | ||
|
||
cdecl_struct(fz_text_span_s) | ||
cdecl_type(fz_text_span) | ||
|
||
cdecl_struct(fz_text_line_s) | ||
cdecl_type(fz_text_line) | ||
|
||
cdecl_struct(fz_text_sheet_s) | ||
cdecl_type(fz_text_sheet) | ||
cdecl_func(mupdf_new_text_sheet) | ||
cdecl_func(fz_free_text_sheet) | ||
|
||
cdecl_struct(fz_text_page_s) | ||
cdecl_type(fz_text_page) | ||
cdecl_func(mupdf_new_text_page) | ||
cdecl_func(fz_free_text_page) | ||
|
||
cdecl_struct(fz_page_block_s) | ||
cdecl_type(fz_page_block) | ||
|
||
cdecl_struct(fz_text_block_s) | ||
cdecl_type(fz_text_block) | ||
|
||
cdecl_func(fz_text_char_bbox) | ||
|
||
/* pixmaps */ | ||
cdecl_struct(fz_pixmap_s) | ||
cdecl_type(fz_pixmap) | ||
|
||
cdecl_func(fz_new_context_imp) | ||
cdecl_func(fz_new_pixmap) | ||
cdecl_func(mupdf_new_pixmap) | ||
cdecl_func(fz_new_pixmap) // compat | ||
cdecl_func(mupdf_new_pixmap_with_bbox) | ||
cdecl_func(mupdf_new_pixmap_with_data) | ||
cdecl_func(mupdf_new_pixmap_with_bbox_and_data) | ||
cdecl_func(fz_convert_pixmap) | ||
cdecl_func(fz_keep_pixmap) | ||
cdecl_func(fz_drop_pixmap) | ||
cdecl_func(fz_clear_pixmap_with_value) | ||
cdecl_func(fz_gamma_pixmap) | ||
cdecl_func(fz_pixmap_width) | ||
cdecl_func(fz_pixmap_height) | ||
cdecl_func(fz_pixmap_components) | ||
cdecl_func(fz_pixmap_samples) | ||
|
||
cdecl_func(fz_device_gray) | ||
cdecl_func(fz_free_context) | ||
cdecl_func(fz_device_rgb) | ||
|
||
cdecl_func(fz_load_png) | ||
/* device, rendering */ | ||
cdecl_func(mupdf_new_draw_device) | ||
cdecl_func(mupdf_new_text_device) | ||
cdecl_func(mupdf_new_bbox_device) | ||
cdecl_func(mupdf_run_page) | ||
cdecl_func(fz_free_device) | ||
|
||
/* pdf specifics */ | ||
cdecl_struct(pdf_hotspot_s) | ||
cdecl_type(pdf_hotspot) | ||
cdecl_struct(pdf_lexbuf_s) | ||
cdecl_type(pdf_lexbuf) | ||
cdecl_struct(pdf_lexbuf_large_s) | ||
cdecl_type(pdf_lexbuf_large) | ||
cdecl_struct(pdf_annot_s) | ||
cdecl_type(pdf_annot) | ||
cdecl_struct(pdf_document_s) | ||
cdecl_type(pdf_document) | ||
cdecl_func(pdf_specifics) | ||
cdecl_func(mupdf_pdf_create_annot) | ||
cdecl_func(mupdf_pdf_set_markup_annot_quadpoints) | ||
cdecl_func(mupdf_pdf_set_markup_appearance) | ||
|
||
/* saving documents */ | ||
cdecl_struct(fz_write_options_s) | ||
cdecl_type(fz_write_options) | ||
cdecl_func(mupdf_write_document) | ||
|
||
/* the following is for our own wrapper lib: */ | ||
cdecl_func(mupdf_get_my_alloc_context) | ||
cdecl_func(mupdf_get_cache_size) | ||
cdecl_func(mupdf_error_code) | ||
cdecl_func(mupdf_error_message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#include <pthread.h> | ||
|
||
#include "ffi-cdecl.h" | ||
#include "ffi-cdecl-luajit.h" | ||
|
||
cdecl_type(pthread_t) | ||
|
||
cdecl_type(pthread_attr_t) | ||
cdecl_union(pthread_attr_t) | ||
|
||
cdecl_func(pthread_attr_init) | ||
cdecl_func(pthread_attr_setdetachstate) | ||
cdecl_func(pthread_attr_destroy) | ||
|
||
cdecl_const(PTHREAD_CREATE_DETACHED) | ||
|
||
cdecl_func(pthread_create) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.