diff options
Diffstat (limited to 'include')
34 files changed, 0 insertions, 2246 deletions
diff --git a/include/fitz-base.h b/include/fitz-base.h deleted file mode 100644 index 8c13cd5e..00000000 --- a/include/fitz-base.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef _FITZ_BASE_H_ -#error "fitz-base.h must only be included once" -#endif -#define _FITZ_BASE_H_ - -#include "fitz/base_sysdep.h" -#include "fitz/base_cpudep.h" -#include "fitz/base_runtime.h" -#include "fitz/base_math.h" -#include "fitz/base_geom.h" -#include "fitz/base_hash.h" -#include "fitz/base_pixmap.h" - diff --git a/include/fitz-draw.h b/include/fitz-draw.h deleted file mode 100644 index ceef524a..00000000 --- a/include/fitz-draw.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Rasterizer - */ - -#ifdef _FITZ_DRAW_H_ -#error "fitz-draw.h must only be included once" -#endif -#define _FITZ_DRAW_H_ - -#ifndef _FITZ_BASE_H_ -#error "fitz-base.h must be included before fitz-draw.h" -#endif - -#ifndef _FITZ_WORLD_H_ -#error "fitz-world.h must be included before fitz-draw.h" -#endif - -#include "fitz/draw_path.h" -#include "fitz/draw_misc.h" - diff --git a/include/fitz-stream.h b/include/fitz-stream.h deleted file mode 100644 index bd210f24..00000000 --- a/include/fitz-stream.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Streams and dynamic objects - */ - -#ifdef _FITZ_STREAM_H_ -#error "fitz-stream.h must only be included once" -#endif -#define _FITZ_STREAM_H_ - -#ifndef _FITZ_BASE_H_ -#error "fitz-base.h must be included before fitz-stream.h" -#endif - -#include "fitz/stm_crypt.h" -#include "fitz/stm_object.h" -#include "fitz/stm_buffer.h" -#include "fitz/stm_filter.h" -#include "fitz/stm_stream.h" - diff --git a/include/fitz-world.h b/include/fitz-world.h deleted file mode 100644 index ddf9a445..00000000 --- a/include/fitz-world.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * The World -- fitz resources and trees - */ - -#ifdef _FITZ_WORLD_H_ -#error "fitz-world.h must only be included once" -#endif -#define _FITZ_WORLD_H_ - -#ifndef _FITZ_BASE_H_ -#error "fitz-base.h must be included before fitz-world.h" -#endif - -#include "fitz/wld_font.h" -#include "fitz/wld_color.h" -#include "fitz/wld_image.h" -#include "fitz/wld_shade.h" - -#include "fitz/wld_tree.h" -#include "fitz/wld_path.h" -#include "fitz/wld_text.h" - diff --git a/include/fitz.h b/include/fitz.h deleted file mode 100644 index f9705740..00000000 --- a/include/fitz.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _FITZ_H_ -#define _FITZ_H_ - -#include "fitz-base.h" -#include "fitz-stream.h" -#include "fitz-world.h" -#include "fitz-draw.h" - -#endif diff --git a/include/fitz/base_cpudep.h b/include/fitz/base_cpudep.h deleted file mode 100644 index 261c3c79..00000000 --- a/include/fitz/base_cpudep.h +++ /dev/null @@ -1,26 +0,0 @@ -#if defined(ARCH_X86) || defined(ARCH_X86_64) -# define HAVE_CPUDEP -# define HAVE_MMX (1<<0) -# define HAVE_MMXEXT (1<<1) -# define HAVE_SSE (1<<2) -# define HAVE_SSE2 (1<<3) -# define HAVE_SSE3 (1<<4) -# define HAVE_3DNOW (1<<5) -# define HAVE_AMD64 (1<<6) - -#elif defined (ARCH_PPC) -# define HAVE_CPUDEP -# define HAVE_ALTIVEC (1<<7) - -#elif defined (ARCH_SPARC) -# define HAVE_CPUDEP -# define HAVE_VIS (1<<8) - -#endif - -/* call this before using fitz */ -extern void fz_cpudetect(); - -/* treat as constant! */ -extern unsigned fz_cpuflags; - diff --git a/include/fitz/base_geom.h b/include/fitz/base_geom.h deleted file mode 100644 index 13290007..00000000 --- a/include/fitz/base_geom.h +++ /dev/null @@ -1,65 +0,0 @@ -typedef struct fz_matrix_s fz_matrix; -typedef struct fz_point_s fz_point; -typedef struct fz_rect_s fz_rect; -typedef struct fz_ipoint_s fz_ipoint; -typedef struct fz_irect_s fz_irect; - -extern fz_rect fz_emptyrect; -extern fz_rect fz_infiniterect; - -#define fz_isemptyrect(r) ((r).x0 == (r).x1) -#define fz_isinfiniterect(r) ((r).x0 > (r).x1) - -/* - / a b 0 \ - | c d 0 | - \ e f 1 / -*/ -struct fz_matrix_s -{ - float a, b, c, d, e, f; -}; - -struct fz_point_s -{ - float x, y; -}; - -struct fz_rect_s -{ - float x0, y0; - float x1, y1; -}; - -struct fz_ipoint_s -{ - int x, y; -}; - -struct fz_irect_s -{ - int x0, y0; - int x1, y1; -}; - -void fz_invert3x3(float *dst, float *m); - -fz_matrix fz_concat(fz_matrix one, fz_matrix two); -fz_matrix fz_identity(void); -fz_matrix fz_scale(float sx, float sy); -fz_matrix fz_rotate(float theta); -fz_matrix fz_translate(float tx, float ty); -fz_matrix fz_invertmatrix(fz_matrix m); -int fz_isrectilinear(fz_matrix m); -float fz_matrixexpansion(fz_matrix m); - -fz_rect fz_intersectrects(fz_rect a, fz_rect b); -fz_rect fz_mergerects(fz_rect a, fz_rect b); - -fz_irect fz_roundrect(fz_rect r); -fz_irect fz_intersectirects(fz_irect a, fz_irect b); -fz_irect fz_mergeirects(fz_irect a, fz_irect b); - -fz_point fz_transformpoint(fz_matrix m, fz_point p); -fz_rect fz_transformaabb(fz_matrix m, fz_rect r); - diff --git a/include/fitz/base_hash.h b/include/fitz/base_hash.h deleted file mode 100644 index 5d2ec1b5..00000000 --- a/include/fitz/base_hash.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Generic hash-table with fixed-length keys. - */ - -typedef struct fz_hashtable_s fz_hashtable; - -fz_error *fz_newhash(fz_hashtable **tablep, int initialsize, int keylen); -fz_error *fz_resizehash(fz_hashtable *table, int newsize); -void fz_debughash(fz_hashtable *table); -void fz_emptyhash(fz_hashtable *table); -void fz_drophash(fz_hashtable *table); - -void *fz_hashfind(fz_hashtable *table, void *key); -fz_error *fz_hashinsert(fz_hashtable *table, void *key, void *val); -fz_error *fz_hashremove(fz_hashtable *table, void *key); - -int fz_hashlen(fz_hashtable *table); -void *fz_hashgetkey(fz_hashtable *table, int idx); -void *fz_hashgetval(fz_hashtable *table, int idx); - diff --git a/include/fitz/base_math.h b/include/fitz/base_math.h deleted file mode 100644 index 4dee81fc..00000000 --- a/include/fitz/base_math.h +++ /dev/null @@ -1,29 +0,0 @@ -/* multiply 8-bit fixpoint (0..1) so that 0*0==0 and 255*255==255 */ -#define fz_mul255(a,b) (((a) * ((b) + 1)) >> 8) -#define fz_floor(x) floor(x) -#define fz_ceil(x) ceil(x) - -/* divide and floor towards -inf */ -static inline int fz_idiv(int a, int b) -{ - return a < 0 ? (a - b + 1) / b : a / b; -} - -/* from python */ -static inline void fz_idivmod(int x, int y, int *d, int *m) -{ - int xdivy = x / y; - int xmody = x - xdivy * y; - /* If the signs of x and y differ, and the remainder is non-0, - * C89 doesn't define whether xdivy is now the floor or the - * ceiling of the infinitely precise quotient. We want the floor, - * and we have it iff the remainder's sign matches y's. - */ - if (xmody && ((y ^ xmody) < 0)) { - xmody += y; - xdivy --; - } - *d = xdivy; - *m = xmody; -} - diff --git a/include/fitz/base_pixmap.h b/include/fitz/base_pixmap.h deleted file mode 100644 index dab22c45..00000000 --- a/include/fitz/base_pixmap.h +++ /dev/null @@ -1,31 +0,0 @@ -/* TODO: move this into draw module */ -/* -pixmaps have n components per pixel. the first is always alpha. -premultiplied alpha when rendering, but non-premultiplied for colorspace -conversions and rescaling. -*/ - -typedef struct fz_pixmap_s fz_pixmap; -typedef unsigned char fz_sample; - -struct fz_pixmap_s -{ - int x, y, w, h, n; - fz_sample *samples; -}; - -fz_error *fz_newpixmapwithrect(fz_pixmap **mapp, fz_irect bbox, int n); -fz_error *fz_newpixmap(fz_pixmap **mapp, int x, int y, int w, int h, int n); -fz_error *fz_newpixmapcopy(fz_pixmap **pixp, fz_pixmap *old); - -void fz_debugpixmap(fz_pixmap *map, char *prefix); -void fz_clearpixmap(fz_pixmap *map); -void fz_droppixmap(fz_pixmap *map); - -fz_error *fz_scalepixmap(fz_pixmap **dstp, fz_pixmap *src, int xdenom, int ydenom); - -/* needed for tiled rendering */ -fz_error *fz_newscaledpixmap(fz_pixmap **dstp, int w, int h, int n, int xdenom, int ydenom); -fz_error *fz_scalepixmaptile(fz_pixmap *dstp, int xoffs, int yoffs, - fz_pixmap *tile, int xdenom, int ydenom); - diff --git a/include/fitz/base_runtime.h b/include/fitz/base_runtime.h deleted file mode 100644 index 4bd5cc91..00000000 --- a/include/fitz/base_runtime.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Base Fitz runtime. - * Contains: errors, memory manager, utf-8 strings, "standard" macros - */ - -#ifndef __printflike -#if __GNUC__ > 2 || __GNUC__ == 2 && __GNUC_MINOR__ >= 7 -#define __printflike(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf__, fmtarg, firstvararg))) -#else -#define __printflike(fmtarg, firstvararg) -#endif -#endif - -#ifndef nil -#define nil ((void*)0) -#endif - -#ifndef offsetof -#define offsetof(s, m) (unsigned long)(&(((s*)0)->m)) -#endif - -#ifndef nelem -#define nelem(x) (sizeof(x)/sizeof((x)[0])) -#endif - -#ifndef ABS -#define ABS(x) ( (x) < 0 ? -(x) : (x) ) -#endif - -#ifndef MAX -#define MAX(a,b) ( (a) > (b) ? (a) : (b) ) -#endif - -#ifndef MIN -#define MIN(a,b) ( (a) < (b) ? (a) : (b) ) -#endif - -#ifndef CLAMP -#define CLAMP(x,a,b) ( (x) > (b) ? (b) : ( (x) < (a) ? (a) : (x) ) ) -#endif - -#define MAX4(a,b,c,d) MAX(MAX(a,b), MAX(c,d)) -#define MIN4(a,b,c,d) MIN(MIN(a,b), MIN(c,d)) - -#define STRIDE(n, bcp) (((bpc) * (n) + 7) / 8) - -/* plan9 stuff for utf-8 and path munging */ -int chartorune(int *rune, char *str); -int runetochar(char *str, int *rune); -int runelen(long c); -int runenlen(int *r, int nrune); -int fullrune(char *str, int n); -char *cleanname(char *name); - -typedef struct fz_error_s fz_error; - -struct fz_error_s -{ - char msg[184]; - char file[32]; - char func[32]; - int line; - fz_error *cause; -}; - -#define fz_outofmem (&fz_koutofmem) -extern fz_error fz_koutofmem; - -void fz_printerror(fz_error *eo); -void fz_droperror(fz_error *eo); -void fz_warn(char *fmt, ...) __printflike(1,2); - -#define fz_throw(...) fz_throwimp(nil, __func__, __FILE__, __LINE__, __VA_ARGS__) -#define fz_rethrow(cause, ...) fz_throwimp(cause, __func__, __FILE__, __LINE__, __VA_ARGS__) -#define fz_okay ((fz_error*)0) - -fz_error *fz_throwimp(fz_error *cause, const char *func, const char *file, int line, char *fmt, ...) __printflike(5, 6); - -typedef struct fz_memorycontext_s fz_memorycontext; - -struct fz_memorycontext_s -{ - void * (*malloc)(fz_memorycontext *, int); - void * (*realloc)(fz_memorycontext *, void *, int); - void (*free)(fz_memorycontext *, void *); -}; - -fz_memorycontext *fz_currentmemorycontext(void); -void fz_setmemorycontext(fz_memorycontext *memorycontext); - -void *fz_malloc(int n); -void *fz_realloc(void *p, int n); -void fz_free(void *p); - -char *fz_strdup(char *s); - diff --git a/include/fitz/base_sysdep.h b/include/fitz/base_sysdep.h deleted file mode 100644 index 7fd4094d..00000000 --- a/include/fitz/base_sysdep.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Include the basic standard libc headers. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stddef.h> -#include <string.h> -#include <assert.h> -#include <stdarg.h> - -#include <limits.h> /* INT_MIN, MAX ... */ -#include <float.h> /* DBL_EPSILON */ -#include <math.h> - -#include <errno.h> -#include <fcntl.h> /* O_RDONLY & co */ - -/* Stupid macros that don't exist everywhere */ - -#ifndef O_BINARY -#define O_BINARY 0 -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -#ifndef M_SQRT2 -#define M_SQRT2 1.41421356237309504880 -#endif - -/* Some useful semi-standard functions */ - -#ifdef NEED_STRLCPY -extern int strlcpy(char *dst, const char *src, int n); -extern int strlcat(char *dst, const char *src, int n); -#endif - -#ifdef NEED_STRSEP -extern char *strsep(char **stringp, const char *delim); -#endif - -#ifdef NEED_GETOPT -extern int getopt(int nargc, char * const * nargv, const char *ostr); -extern int opterr, optind, optopt; -extern char *optarg; -#endif - -/* - * MSVC section - */ - -#ifdef MSVC - -#include <io.h> - -extern int gettimeofday(struct timeval *tv, struct timezone *tz); - -#define FZ_FLEX 1 -#define restrict - -#ifdef _MSC_VER -#define inline __inline -#else -#define inline __inline__ -#endif - -#define __func__ __FUNCTION__ - -#if _MSC_VER < 1500 -#define vsnprintf _vsnprintf -#endif - -#ifndef isnan -#define isnan _isnan -#endif - -#ifndef va_copy -#define va_copy(a,b) (a) = (b) -#endif - -#ifndef R_OK -#define R_OK 4 -#endif - -/* - * C99 section - */ - -#else - -#include <unistd.h> -#define FZ_FLEX - -#endif - diff --git a/include/fitz/draw_misc.h b/include/fitz/draw_misc.h deleted file mode 100644 index 3eeefcfb..00000000 --- a/include/fitz/draw_misc.h +++ /dev/null @@ -1,83 +0,0 @@ -typedef struct fz_renderer_s fz_renderer; - -#define FZ_BYTE unsigned char - -#define FZ_PSRC \ - unsigned char *src, int srcw, int srch -#define FZ_PDST \ - unsigned char *dst0, int dstw -#define FZ_PCTM \ - int u0, int v0, int fa, int fb, int fc, int fd, int w0, int h - -/* - * Function pointers -- they can be replaced by cpu-optimized versions - */ - -extern void (*fz_duff_non)(FZ_BYTE*,int,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_nimcn)(FZ_BYTE*,int,int,FZ_BYTE*,int,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_nimon)(FZ_BYTE*,int,int,FZ_BYTE*,int,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_1o1)(FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_4o4)(FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_1i1c1)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_4i1c4)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_1i1o1)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_duff_4i1o4)(FZ_BYTE*,int,FZ_BYTE*,int,FZ_BYTE*,int,int,int); - -extern void (*fz_path_1c1)(FZ_BYTE*,unsigned char,int,FZ_BYTE*); -extern void (*fz_path_1o1)(FZ_BYTE*,unsigned char,int,FZ_BYTE*); -extern void (*fz_path_w4i1o4)(FZ_BYTE*,FZ_BYTE*,unsigned char,int,FZ_BYTE*); - -extern void (*fz_text_1c1)(FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_text_1o1)(FZ_BYTE*,int,FZ_BYTE*,int,int,int); -extern void (*fz_text_w4i1o4)(FZ_BYTE*,FZ_BYTE*,int,FZ_BYTE*,int,int,int); - -extern void (*fz_img_ncn)(FZ_PSRC, int sn, FZ_PDST, FZ_PCTM); -extern void (*fz_img_1c1)(FZ_PSRC, FZ_PDST, FZ_PCTM); -extern void (*fz_img_4c4)(FZ_PSRC, FZ_PDST, FZ_PCTM); -extern void (*fz_img_1o1)(FZ_PSRC, FZ_PDST, FZ_PCTM); -extern void (*fz_img_4o4)(FZ_PSRC, FZ_PDST, FZ_PCTM); -extern void (*fz_img_w4i1o4)(FZ_BYTE*,FZ_PSRC,FZ_PDST,FZ_PCTM); - -extern void (*fz_decodetile)(fz_pixmap *pix, int skip, float *decode); -extern void (*fz_loadtile1)(FZ_BYTE*, int sw, FZ_BYTE*, int dw, int w, int h, int pad); -extern void (*fz_loadtile2)(FZ_BYTE*, int sw, FZ_BYTE*, int dw, int w, int h, int pad); -extern void (*fz_loadtile4)(FZ_BYTE*, int sw, FZ_BYTE*, int dw, int w, int h, int pad); -extern void (*fz_loadtile8)(FZ_BYTE*, int sw, FZ_BYTE*, int dw, int w, int h, int pad); - -extern void (*fz_srown)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom, int n); -extern void (*fz_srow1)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_srow2)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_srow4)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_srow5)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); - -extern void (*fz_scoln)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom, int n); -extern void (*fz_scol1)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_scol2)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_scol4)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); -extern void (*fz_scol5)(FZ_BYTE *src, FZ_BYTE *dst, int w, int denom); - -#undef FZ_BYTE - -struct fz_renderer_s -{ - int maskonly; - fz_colorspace *model; - fz_glyphcache *cache; - fz_gel *gel; - fz_ael *ael; - - fz_irect clip; - fz_pixmap *dest; - fz_pixmap *over; - unsigned char argb[7]; /* alpha, a*r, a*g, a*b, r, g, b */ - int flag; -}; - -extern void fz_accelerate(); - -fz_error *fz_newrenderer(fz_renderer **gcp, fz_colorspace *pcm, int maskonly, int gcmem); -void fz_droprenderer(fz_renderer *gc); -fz_error *fz_rendertree(fz_pixmap **out, fz_renderer *gc, fz_tree *tree, fz_matrix ctm, fz_irect bbox, int white); -fz_error *fz_rendertreeover(fz_renderer *gc, fz_pixmap *dest, fz_tree *tree, fz_matrix ctm); - - diff --git a/include/fitz/draw_path.h b/include/fitz/draw_path.h deleted file mode 100644 index 8ca7f6e1..00000000 --- a/include/fitz/draw_path.h +++ /dev/null @@ -1,45 +0,0 @@ -typedef struct fz_edge_s fz_edge; -typedef struct fz_gel_s fz_gel; -typedef struct fz_ael_s fz_ael; - -struct fz_edge_s -{ - int x, e, h, y; - int adjup, adjdown; - int xmove; - int xdir, ydir; /* -1 or +1 */ -}; - -struct fz_gel_s -{ - fz_irect clip; - fz_irect bbox; - int cap; - int len; - fz_edge *edges; -}; - -struct fz_ael_s -{ - int cap; - int len; - fz_edge **edges; -}; - -fz_error *fz_newgel(fz_gel **gelp); -fz_error *fz_insertgel(fz_gel *gel, float x0, float y0, float x1, float y1); -fz_irect fz_boundgel(fz_gel *gel); -void fz_resetgel(fz_gel *gel, fz_irect clip); -void fz_sortgel(fz_gel *gel); -void fz_dropgel(fz_gel *gel); - -fz_error *fz_newael(fz_ael **aelp); -void fz_dropael(fz_ael *ael); - -fz_error *fz_scanconvert(fz_gel *gel, fz_ael *ael, int eofill, - fz_irect clip, fz_pixmap *pix, unsigned char *argb, int over); - -fz_error *fz_fillpath(fz_gel *gel, fz_pathnode *path, fz_matrix ctm, float flatness); -fz_error *fz_strokepath(fz_gel *gel, fz_pathnode *path, fz_matrix ctm, float flatness, float linewidth); -fz_error *fz_dashpath(fz_gel *gel, fz_pathnode *path, fz_matrix ctm, float flatness, float linewidth); - diff --git a/include/fitz/stm_buffer.h b/include/fitz/stm_buffer.h deleted file mode 100644 index 1a6f34ad..00000000 --- a/include/fitz/stm_buffer.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Data buffers for streams and filters. - * - * bp is the pointer to the allocated memory - * rp is read-position (*in->rp++ to read data) - * wp is write-position (*out->wp++ to write data) - * ep is the sentinel - * - * Only the data between rp and wp is valid data. - * - * Writers set eof to true at the end. - * Readers look at eof. - * - * A buffer owns the memory it has allocated, unless ownsdata is false, - * in which case the creator of the buffer owns it. - */ - -typedef struct fz_buffer_s fz_buffer; - -#define FZ_BUFSIZE (8 * 1024) - -struct fz_buffer_s -{ - int refs; - int ownsdata; - unsigned char *bp; - unsigned char *rp; - unsigned char *wp; - unsigned char *ep; - int eof; -}; - -fz_error *fz_newbuffer(fz_buffer **bufp, int size); -fz_error *fz_newbufferwithmemory(fz_buffer **bufp, unsigned char *data, int size); - -fz_error *fz_rewindbuffer(fz_buffer *buf); -fz_error *fz_growbuffer(fz_buffer *buf); - -fz_buffer *fz_keepbuffer(fz_buffer *buf); -void fz_dropbuffer(fz_buffer *buf); - diff --git a/include/fitz/stm_crypt.h b/include/fitz/stm_crypt.h deleted file mode 100644 index 9c3679af..00000000 --- a/include/fitz/stm_crypt.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Basic crypto functions. - * Independent of the rest of fitz. - * For further encapsulation in filters, or not. - */ - -/* crc-32 checksum */ - -unsigned long fz_crc32(unsigned long crc, unsigned char *buf, int len); - -/* md5 digests */ - -typedef struct fz_md5_s fz_md5; - -struct fz_md5_s -{ - unsigned long state[4]; - unsigned long count[2]; - unsigned char buffer[64]; -}; - -void fz_md5init(fz_md5 *state); -void fz_md5update(fz_md5 *state, const unsigned char *input, const unsigned inlen); -void fz_md5final(fz_md5 *state, unsigned char digest[16]); - -/* arc4 crypto */ - -typedef struct fz_arc4_s fz_arc4; - -struct fz_arc4_s -{ - unsigned x; - unsigned y; - unsigned char state[256]; -}; - -void fz_arc4init(fz_arc4 *state, const unsigned char *key, const unsigned len); -unsigned char fz_arc4next(fz_arc4 *state); -void fz_arc4encrypt(fz_arc4 *state, unsigned char *dest, const unsigned char *src, const unsigned len); - -/* TODO: sha1 */ -/* TODO: aes */ - diff --git a/include/fitz/stm_filter.h b/include/fitz/stm_filter.h deleted file mode 100644 index 1ef52658..00000000 --- a/include/fitz/stm_filter.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Data filters for encryption, compression and decompression. - * - * A filter has one method, process, that takes an input and an output buffer. - * - * It returns one of three statuses: - * ioneedin -- input buffer exhausted, please give me more data (wp-rp) - * ioneedout -- output buffer exhausted, please provide more space (ep-wp) - * iodone -- finished, please never call me again. ever! - * or... - * any other error object -- oops, something blew up. - * - * To make using the filter easier, three variables are updated: - * produced -- if we actually produced any new data - * consumed -- like above - * count -- number of bytes produced in total since the beginning - * done -- remember if we've ever returned fz_iodone - * - * Most filters take fz_obj as a way to specify parameters. - * In most cases, this is a dictionary that contains the same keys - * that the corresponding PDF filter would expect. - * - * The pipeline filter is special, and needs some care when chaining - * and unchaining new filters. - */ - -typedef struct fz_filter_s fz_filter; - -#define fz_ioneedin (&fz_kioneedin) -#define fz_ioneedout (&fz_kioneedout) -#define fz_iodone (&fz_kiodone) - -extern fz_error fz_kioneedin; -extern fz_error fz_kioneedout; -extern fz_error fz_kiodone; - -/* - * Evil looking macro to create an initialize a filter struct. - */ - -#define FZ_NEWFILTER(TYPE,VAR,NAME) \ - fz_error * fz_process ## NAME (fz_filter*,fz_buffer*,fz_buffer*); \ - void fz_drop ## NAME (fz_filter*); \ - TYPE *VAR; \ - *fp = fz_malloc(sizeof(TYPE)); \ - if (!*fp) return fz_throw("outofmem: %s filter struct", #NAME); \ - (*fp)->refs = 1; \ - (*fp)->process = fz_process ## NAME ; \ - (*fp)->drop = fz_drop ## NAME ; \ - (*fp)->consumed = 0; \ - (*fp)->produced = 0; \ - (*fp)->count = 0; \ - (*fp)->done = 0; \ - VAR = (TYPE*) *fp - -struct fz_filter_s -{ - int refs; - fz_error* (*process)(fz_filter *filter, fz_buffer *in, fz_buffer *out); - void (*drop)(fz_filter *filter); - int consumed; - int produced; - int count; - int done; -}; - -fz_error *fz_process(fz_filter *f, fz_buffer *in, fz_buffer *out); -fz_filter *fz_keepfilter(fz_filter *f); -void fz_dropfilter(fz_filter *f); - -fz_error *fz_newpipeline(fz_filter **fp, fz_filter *head, fz_filter *tail); -fz_error *fz_chainpipeline(fz_filter **fp, fz_filter *head, fz_filter *tail, fz_buffer *buf); -void fz_unchainpipeline(fz_filter *pipe, fz_filter **oldfp, fz_buffer **oldbp); - -/* stop and reverse! special case needed for postscript only */ -void fz_pushbackahxd(fz_filter *filter, fz_buffer *in, fz_buffer *out, int n); - -fz_error *fz_newnullfilter(fz_filter **fp, int len); -fz_error *fz_newarc4filter(fz_filter **fp, unsigned char *key, unsigned keylen); -fz_error *fz_newa85d(fz_filter **filterp, fz_obj *param); -fz_error *fz_newa85e(fz_filter **filterp, fz_obj *param); -fz_error *fz_newahxd(fz_filter **filterp, fz_obj *param); -fz_error *fz_newahxe(fz_filter **filterp, fz_obj *param); -fz_error *fz_newrld(fz_filter **filterp, fz_obj *param); -fz_error *fz_newrle(fz_filter **filterp, fz_obj *param); -fz_error *fz_newdctd(fz_filter **filterp, fz_obj *param); -fz_error *fz_newdcte(fz_filter **filterp, fz_obj *param); -fz_error *fz_newfaxd(fz_filter **filterp, fz_obj *param); -fz_error *fz_newfaxe(fz_filter **filterp, fz_obj *param); -fz_error *fz_newflated(fz_filter **filterp, fz_obj *param); -fz_error *fz_newflatee(fz_filter **filterp, fz_obj *param); -fz_error *fz_newlzwd(fz_filter **filterp, fz_obj *param); -fz_error *fz_newlzwe(fz_filter **filterp, fz_obj *param); -fz_error *fz_newpredictd(fz_filter **filterp, fz_obj *param); -fz_error *fz_newpredicte(fz_filter **filterp, fz_obj *param); -fz_error *fz_newjbig2d(fz_filter **filterp, fz_obj *param); -fz_error *fz_newjpxd(fz_filter **filterp, fz_obj *param); - diff --git a/include/fitz/stm_object.h b/include/fitz/stm_object.h deleted file mode 100644 index 74a8e1cf..00000000 --- a/include/fitz/stm_object.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Dynamic objects. - * The same type of objects as found in PDF and PostScript. - * Used by the filter library and the mupdf parser. - */ - -typedef struct fz_obj_s fz_obj; -typedef struct fz_keyval_s fz_keyval; - -typedef enum fz_objkind_e -{ - FZ_NULL, - FZ_BOOL, - FZ_INT, - FZ_REAL, - FZ_STRING, - FZ_NAME, - FZ_ARRAY, - FZ_DICT, - FZ_INDIRECT, - FZ_POINTER -} fz_objkind; - -struct fz_keyval_s -{ - fz_obj *k; - fz_obj *v; -}; - -struct fz_obj_s -{ - unsigned short refs; - char kind; /* fz_objkind takes 4 bytes :( */ - union - { - int b; - int i; - float f; - struct { - unsigned short len; - char buf[1]; - } s; - char n[1]; - struct { - int len; - int cap; - fz_obj **items; - } a; - struct { - char sorted; - int len; - int cap; - fz_keyval *items; - } d; - struct { - int oid; - int gid; - } r; - void *p; - } u; -}; - -fz_error *fz_newnull(fz_obj **op); -fz_error *fz_newbool(fz_obj **op, int b); -fz_error *fz_newint(fz_obj **op, int i); -fz_error *fz_newreal(fz_obj **op, float f); -fz_error *fz_newname(fz_obj **op, char *str); -fz_error *fz_newstring(fz_obj **op, char *str, int len); -fz_error *fz_newindirect(fz_obj **op, int oid, int gid); -fz_error *fz_newpointer(fz_obj **op, void *p); - -fz_error *fz_newarray(fz_obj **op, int initialcap); -fz_error *fz_newdict(fz_obj **op, int initialcap); -fz_error *fz_copyarray(fz_obj **op, fz_obj *array); -fz_error *fz_copydict(fz_obj **op, fz_obj *dict); -fz_error *fz_deepcopyarray(fz_obj **op, fz_obj *array); -fz_error *fz_deepcopydict(fz_obj **op, fz_obj *dict); - -fz_obj *fz_keepobj(fz_obj *obj); -void fz_dropobj(fz_obj *obj); - -/* type queries */ -int fz_isnull(fz_obj *obj); -int fz_isbool(fz_obj *obj); -int fz_isint(fz_obj *obj); -int fz_isreal(fz_obj *obj); -int fz_isname(fz_obj *obj); -int fz_isstring(fz_obj *obj); -int fz_isarray(fz_obj *obj); -int fz_isdict(fz_obj *obj); -int fz_isindirect(fz_obj *obj); -int fz_ispointer(fz_obj *obj); - -int fz_objcmp(fz_obj *a, fz_obj *b); - -/* silent failure, no error reporting */ -int fz_tobool(fz_obj *obj); -int fz_toint(fz_obj *obj); -float fz_toreal(fz_obj *obj); -char *fz_toname(fz_obj *obj); -char *fz_tostrbuf(fz_obj *obj); -int fz_tostrlen(fz_obj *obj); -int fz_tonum(fz_obj *obj); -int fz_togen(fz_obj *obj); -void *fz_topointer(fz_obj *obj); - -fz_error *fz_newnamefromstring(fz_obj **op, fz_obj *str); - -int fz_arraylen(fz_obj *array); -fz_obj *fz_arrayget(fz_obj *array, int i); -fz_error *fz_arrayput(fz_obj *array, int i, fz_obj *obj); -fz_error *fz_arraypush(fz_obj *array, fz_obj *obj); - -int fz_dictlen(fz_obj *dict); -fz_obj *fz_dictgetkey(fz_obj *dict, int idx); -fz_obj *fz_dictgetval(fz_obj *dict, int idx); -fz_obj *fz_dictget(fz_obj *dict, fz_obj *key); -fz_obj *fz_dictgets(fz_obj *dict, char *key); -fz_obj *fz_dictgetsa(fz_obj *dict, char *key, char *abbrev); -fz_error *fz_dictput(fz_obj *dict, fz_obj *key, fz_obj *val); -fz_error *fz_dictputs(fz_obj *dict, char *key, fz_obj *val); -fz_error *fz_dictdel(fz_obj *dict, fz_obj *key); -fz_error *fz_dictdels(fz_obj *dict, char *key); -void fz_sortdict(fz_obj *dict); - -int fz_sprintobj(char *s, int n, fz_obj *obj, int tight); -void fz_debugobj(fz_obj *obj); - -fz_error *fz_parseobj(fz_obj **objp, char *s); -fz_error *fz_packobj(fz_obj **objp, char *fmt, ...); -fz_error *fz_unpackobj(fz_obj *obj, char *fmt, ...); - -char *fz_objkindstr(fz_obj *obj); - diff --git a/include/fitz/stm_stream.h b/include/fitz/stm_stream.h deleted file mode 100644 index 5f11c1d2..00000000 --- a/include/fitz/stm_stream.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Stream API for Fitz. - * Read and write data to and from files, memory buffers and filters. - */ - -typedef struct fz_stream_s fz_stream; - -enum { FZ_SFILE, FZ_SBUFFER, FZ_SFILTER }; -enum { FZ_SREAD, FZ_SWRITE }; - -struct fz_stream_s -{ - int refs; - int kind; - int mode; - int dead; - fz_buffer *buffer; - fz_filter *filter; - fz_stream *chain; - fz_error *error; /* delayed error from readbyte and peekbyte */ - int file; -}; - -/* - * Various stream creation functions. - */ - -/* open() and creat() & co */ -fz_error *fz_openrfile(fz_stream **stmp, char *filename); -fz_error *fz_openwfile(fz_stream **stmp, char *filename); -fz_error *fz_openafile(fz_stream **stmp, char *filename); - -/* write to memory buffers! */ -fz_error *fz_openrmemory(fz_stream **stmp, unsigned char *mem, int len); -fz_error *fz_openrbuffer(fz_stream **stmp, fz_buffer *buf); -fz_error *fz_openwbuffer(fz_stream **stmp, fz_buffer *buf); - -/* almost like fork() exec() pipe() */ -fz_error *fz_openrfilter(fz_stream **stmp, fz_filter *flt, fz_stream *chain); -fz_error *fz_openwfilter(fz_stream **stmp, fz_filter *flt, fz_stream *chain); - -/* - * Functions that are common to both input and output streams. - */ - -fz_stream *fz_keepstream(fz_stream *stm); -void fz_dropstream(fz_stream *stm); - -int fz_tell(fz_stream *stm); -fz_error * fz_seek(fz_stream *stm, int offset, int whence); - -/* - * Input stream functions. - */ - -int fz_rtell(fz_stream *stm); -fz_error * fz_rseek(fz_stream *stm, int offset, int whence); - -fz_error * fz_readimp(fz_stream *stm); -fz_error * fz_read(int *np, fz_stream *stm, unsigned char *buf, int len); -fz_error * fz_readall(fz_buffer **bufp, fz_stream *stm, int sizehint); -fz_error * fz_readline(fz_stream *stm, char *buf, int max); - -/* - * Error handling when reading with readbyte/peekbyte is non-standard. - * The cause of an error is stuck into the stream struct, - * and EOF is returned. Not good, but any other way is too painful. - * So we have to be careful to check the error status eventually. - */ - -fz_error *fz_readerror(fz_stream *stm); -int fz_readbytex(fz_stream *stm); -int fz_peekbytex(fz_stream *stm); - -#ifdef DEBUG - -#define fz_readbyte fz_readbytex -#define fz_peekbyte fz_peekbytex - -#else - -static inline int fz_readbyte(fz_stream *stm) -{ - fz_buffer *buf = stm->buffer; - if (buf->rp < buf->wp) - return *buf->rp++; - return fz_readbytex(stm); -} - -static inline int fz_peekbyte(fz_stream *stm) -{ - fz_buffer *buf = stm->buffer; - if (buf->rp < buf->wp) - return *buf->rp; - return fz_peekbytex(stm); -} - -#endif - -/* - * Output stream functions. - */ - -int fz_wtell(fz_stream *stm); -fz_error * fz_wseek(fz_stream *stm, int offset, int whence); - -fz_error * fz_write(fz_stream *stm, unsigned char *buf, int n); -fz_error * fz_flush(fz_stream *stm); - -fz_error * fz_printstr(fz_stream *stm, char *s); -fz_error * fz_printobj(fz_stream *stm, fz_obj *obj, int tight); -fz_error * fz_print(fz_stream *stm, char *fmt, ...); - diff --git a/include/fitz/wld_color.h b/include/fitz/wld_color.h deleted file mode 100644 index f6fae48c..00000000 --- a/include/fitz/wld_color.h +++ /dev/null @@ -1,40 +0,0 @@ -typedef struct fz_colorspace_s fz_colorspace; -typedef struct fz_colorcube_s fz_colorcube; -typedef struct fz_colorcube1_s fz_colorcube1; -typedef struct fz_colorcube3_s fz_colorcube3; -typedef struct fz_colorcube4_s fz_colorcube4; - -enum { FZ_MAXCOLORS = 32 }; - -struct fz_colorspace_s -{ - int refs; - char name[16]; - int n; - void (*convpixmap)(fz_colorspace *ss, fz_pixmap *sp, fz_colorspace *ds, fz_pixmap *dp); - void (*convcolor)(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv); - void (*toxyz)(fz_colorspace *, float *src, float *xyz); - void (*fromxyz)(fz_colorspace *, float *xyz, float *dst); - void (*drop)(fz_colorspace *); -}; - -struct fz_colorcube1_s { unsigned char v[17]; }; -struct fz_colorcube3_s { unsigned char v[17][17][17]; }; -struct fz_colorcube4_s { unsigned char v[17][17][17][17]; }; - -struct fz_colorcube_s -{ - fz_colorspace *src; - fz_colorspace *dst; - void **subcube; /* dst->n * colorcube(src->n) */ -}; - -fz_colorspace *fz_keepcolorspace(fz_colorspace *cs); -void fz_dropcolorspace(fz_colorspace *cs); - -void fz_convertcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv); -void fz_convertpixmap(fz_colorspace *srcs, fz_pixmap *srcv, fz_colorspace *dsts, fz_pixmap *dstv); - -void fz_stdconvcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv); -void fz_stdconvpixmap(fz_colorspace *srcs, fz_pixmap *srcv, fz_colorspace *dsts, fz_pixmap *dstv); - diff --git a/include/fitz/wld_font.h b/include/fitz/wld_font.h deleted file mode 100644 index 705a706a..00000000 --- a/include/fitz/wld_font.h +++ /dev/null @@ -1,49 +0,0 @@ -typedef struct fz_font_s fz_font; -typedef struct fz_glyph_s fz_glyph; -typedef struct fz_glyphcache_s fz_glyphcache; - -char *ft_errorstring(int err); - -struct fz_font_s -{ - int refs; - char name[32]; - - void *ftface; /* has an FT_Face if used */ - int ftsubstitute; /* ... substitute metrics */ - int fthint; /* ... force hinting for DynaLab fonts */ - - struct fz_tree_s **t3procs; /* has 256 entries if used */ - fz_matrix t3matrix; - - fz_irect bbox; - -}; - -struct fz_glyph_s -{ - int x, y, w, h; - unsigned char *samples; -}; - -fz_error * fz_newfreetypefont(fz_font **fontp, char *name, int substitute); -fz_error * fz_loadfreetypefontfile(fz_font *font, char *path, int index); -fz_error * fz_loadfreetypefontbuffer(fz_font *font, unsigned char *data, int len, int index); -fz_error * fz_newtype3font(fz_font **fontp, char *name, fz_matrix matrix, void **procs); - -fz_error * fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index); -fz_error * fz_newfontfromfile(fz_font **fontp, char *path, int index); - -fz_font * fz_keepfont(fz_font *font); -void fz_dropfont(fz_font *font); - -void fz_debugfont(fz_font *font); -void fz_setfontbbox(fz_font *font, int xmin, int ymin, int xmax, int ymax); - -fz_error * fz_renderftglyph(fz_glyph *glyph, fz_font *font, int cid, fz_matrix trm); -fz_error * fz_rendert3glyph(fz_glyph *glyph, fz_font *font, int cid, fz_matrix trm); -fz_error * fz_newglyphcache(fz_glyphcache **arenap, int slots, int size); -fz_error * fz_renderglyph(fz_glyphcache*, fz_glyph*, fz_font*, int, fz_matrix); -void fz_debugglyphcache(fz_glyphcache *); -void fz_dropglyphcache(fz_glyphcache *); - diff --git a/include/fitz/wld_image.h b/include/fitz/wld_image.h deleted file mode 100644 index 89d180ba..00000000 --- a/include/fitz/wld_image.h +++ /dev/null @@ -1,16 +0,0 @@ -typedef struct fz_image_s fz_image; - -/* loadtile will fill a pixmap with the pixel samples. non-premultiplied alpha. */ - -struct fz_image_s -{ - int refs; - fz_error* (*loadtile)(fz_image*,fz_pixmap*); - void (*drop)(fz_image*); - fz_colorspace *cs; - int w, h, n, a; -}; - -fz_image *fz_keepimage(fz_image *img); -void fz_dropimage(fz_image *img); - diff --git a/include/fitz/wld_path.h b/include/fitz/wld_path.h deleted file mode 100644 index 74f04fc2..00000000 --- a/include/fitz/wld_path.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Vector path nodes in the display tree. - * They can be stroked and dashed, or be filled. - * They have a fill rule (nonzero or evenodd). - * - * When rendering, they are flattened, stroked and dashed straight - * into the Global Edge List. - * - * TODO flatten, stroke and dash into another path - * TODO set operations on flat paths (union, intersect, difference) - * TODO decide whether dashing should be part of the tree and renderer, - * or if it is something the client has to do (with a util function). - */ - -typedef struct fz_stroke_s fz_stroke; -typedef struct fz_dash_s fz_dash; -typedef union fz_pathel_s fz_pathel; - -typedef enum fz_pathkind_e -{ - FZ_STROKE, - FZ_FILL, - FZ_EOFILL -} fz_pathkind; - -typedef enum fz_pathelkind_e -{ - FZ_MOVETO, - FZ_LINETO, - FZ_CURVETO, - FZ_CLOSEPATH -} fz_pathelkind; - -struct fz_stroke_s -{ - int linecap; - int linejoin; - float linewidth; - float miterlimit; -}; - -struct fz_dash_s -{ - int len; - float phase; - float array[FZ_FLEX]; -}; - -union fz_pathel_s -{ - fz_pathelkind k; - float v; -}; - -struct fz_pathnode_s -{ - fz_node super; - fz_pathkind paint; - fz_dash *dash; - int linecap; - int linejoin; - float linewidth; - float miterlimit; - int len, cap; - fz_pathel *els; -}; - -fz_error *fz_newpathnode(fz_pathnode **pathp); -fz_error *fz_clonepathnode(fz_pathnode **pathp, fz_pathnode *oldpath); -fz_error *fz_moveto(fz_pathnode*, float x, float y); -fz_error *fz_lineto(fz_pathnode*, float x, float y); -fz_error *fz_curveto(fz_pathnode*, float, float, float, float, float, float); -fz_error *fz_curvetov(fz_pathnode*, float, float, float, float); -fz_error *fz_curvetoy(fz_pathnode*, float, float, float, float); -fz_error *fz_closepath(fz_pathnode*); -fz_error *fz_endpath(fz_pathnode*, fz_pathkind paint, fz_stroke *stroke, fz_dash *dash); - -fz_rect fz_boundpathnode(fz_pathnode *node, fz_matrix ctm); -void fz_debugpathnode(fz_pathnode *node, int indent); -void fz_printpathnode(fz_pathnode *node, int indent); - -fz_error *fz_newdash(fz_dash **dashp, float phase, int len, float *array); -void fz_dropdash(fz_dash *dash); - diff --git a/include/fitz/wld_shade.h b/include/fitz/wld_shade.h deleted file mode 100644 index 1b7c81c5..00000000 --- a/include/fitz/wld_shade.h +++ /dev/null @@ -1,29 +0,0 @@ -typedef struct fz_shade_s fz_shade; - -struct fz_shade_s -{ - int refs; - - fz_rect bbox; /* can be fz_infiniterect */ - fz_colorspace *cs; - - /* used by build.c -- not used in drawshade.c */ - fz_matrix matrix; /* matrix from pattern dict */ - int usebackground; /* background color for fills but not 'sh' */ - float background[FZ_MAXCOLORS]; - - int usefunction; - float function[256][FZ_MAXCOLORS]; - - int meshlen; - int meshcap; - float *mesh; /* [x y t] or [x y c1 ... cn] * 3 * meshlen */ -}; - - -fz_shade *fz_keepshade(fz_shade *shade); -void fz_dropshade(fz_shade *shade); - -fz_rect fz_boundshade(fz_shade *shade, fz_matrix ctm); -fz_error *fz_rendershade(fz_shade *shade, fz_matrix ctm, fz_colorspace *dsts, fz_pixmap *dstp); - diff --git a/include/fitz/wld_text.h b/include/fitz/wld_text.h deleted file mode 100644 index d9e5c980..00000000 --- a/include/fitz/wld_text.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Fitz display tree text node. - * - * The text node is an optimization to reference glyphs in a font resource - * and specifying an individual transform matrix for each one. - * - * The trm field contains the a, b, c and d coefficients. - * The e and f coefficients come from the individual elements, - * together they form the transform matrix for the glyph. - * - * Glyphs are referenced by glyph ID. - * The Unicode text equivalent is kept in a separate array - * with indexes into the glyph array. - * - -TODO the unicode textels - -struct fz_textgid_s { float e, f; int gid; }; -struct fz_textucs_s { int idx; int ucs; }; - - */ - -typedef struct fz_textel_s fz_textel; - -struct fz_textel_s -{ - float x, y; - int gid; - int ucs; -}; - -struct fz_textnode_s -{ - fz_node super; - fz_font *font; - fz_matrix trm; - int len, cap; - fz_textel *els; -}; - -fz_error *fz_newtextnode(fz_textnode **textp, fz_font *face); -fz_error *fz_clonetextnode(fz_textnode **textp, fz_textnode *oldtext); -fz_error *fz_addtext(fz_textnode *text, int gid, int ucs, float x, float y); -fz_error *fz_endtext(fz_textnode *text); - diff --git a/include/fitz/wld_tree.h b/include/fitz/wld_tree.h deleted file mode 100644 index 5b8c877b..00000000 --- a/include/fitz/wld_tree.h +++ /dev/null @@ -1,173 +0,0 @@ -/* - * The display tree is at the center of attention in Fitz. - * The tree and most of its minor nodes. - * Paths and text nodes are found elsewhere. - */ - -typedef struct fz_tree_s fz_tree; -typedef struct fz_node_s fz_node; - -struct fz_tree_s -{ - int refs; - fz_node *root; - fz_node *head; -}; - -/* tree operations */ -fz_error *fz_newtree(fz_tree **treep); -fz_tree *fz_keeptree(fz_tree *tree); -void fz_droptree(fz_tree *tree); - -fz_rect fz_boundtree(fz_tree *tree, fz_matrix ctm); -void fz_debugtree(fz_tree *tree); -void fz_insertnodefirst(fz_node *parent, fz_node *child); -void fz_insertnodelast(fz_node *parent, fz_node *child); -void fz_insertnodeafter(fz_node *prev, fz_node *child); -void fz_removenode(fz_node *child); - -fz_error *fz_optimizetree(fz_tree *tree); - -/* node types */ - -typedef struct fz_transformnode_s fz_transformnode; -typedef struct fz_overnode_s fz_overnode; -typedef struct fz_masknode_s fz_masknode; -typedef struct fz_blendnode_s fz_blendnode; -typedef struct fz_pathnode_s fz_pathnode; -typedef struct fz_textnode_s fz_textnode; -typedef struct fz_solidnode_s fz_solidnode; -typedef struct fz_imagenode_s fz_imagenode; -typedef struct fz_shadenode_s fz_shadenode; -typedef struct fz_linknode_s fz_linknode; - -typedef enum fz_nodekind_e -{ - FZ_NTRANSFORM, - FZ_NOVER, - FZ_NMASK, - FZ_NBLEND, - FZ_NPATH, - FZ_NTEXT, - FZ_NCOLOR, - FZ_NIMAGE, - FZ_NSHADE, - FZ_NLINK, -} fz_nodekind; - -typedef enum fz_blendkind_e -{ - /* PDF 1.4 -- standard separable */ - FZ_BNORMAL, - FZ_BMULTIPLY, - FZ_BSCREEN, - FZ_BOVERLAY, - FZ_BDARKEN, - FZ_BLIGHTEN, - FZ_BCOLORDODGE, - FZ_BCOLORBURN, - FZ_BHARDLIGHT, - FZ_BSOFTLIGHT, - FZ_BDIFFERENCE, - FZ_BEXCLUSION, - - /* PDF 1.4 -- standard non-separable */ - FZ_BHUE, - FZ_BSATURATION, - FZ_BCOLOR, - FZ_BLUMINOSITY, - - FZ_BOVERPRINT, - FZ_BRASTEROP -} fz_blendkind; - -struct fz_node_s -{ - fz_nodekind kind; - fz_node *parent; - fz_node *first; - fz_node *last; - fz_node *next; -}; - -struct fz_transformnode_s -{ - fz_node super; - fz_matrix m; -}; - -struct fz_overnode_s -{ - fz_node super; -}; - -struct fz_masknode_s -{ - fz_node super; -}; - -struct fz_blendnode_s -{ - fz_node super; - fz_colorspace *cs; - fz_blendkind mode; - int isolated; - int knockout; -}; - -struct fz_solidnode_s -{ - fz_node super; - fz_colorspace *cs; - int n; - float a; - float samples[FZ_FLEX]; -}; - -struct fz_linknode_s -{ - fz_node super; - fz_tree *tree; -}; - -struct fz_imagenode_s -{ - fz_node super; - fz_image *image; -}; - -struct fz_shadenode_s -{ - fz_node super; - fz_shade *shade; -}; - -/* common to all nodes */ -void fz_initnode(fz_node *node, fz_nodekind kind); -fz_rect fz_boundnode(fz_node *node, fz_matrix ctm); -void fz_dropnode(fz_node *node); - -/* branch nodes */ -fz_error *fz_newovernode(fz_node **nodep); -fz_error *fz_newmasknode(fz_node **nodep); -fz_error *fz_newblendnode(fz_node **nodep, fz_blendkind b, int k, int i); -fz_error *fz_newtransformnode(fz_node **nodep, fz_matrix m); - -int fz_istransformnode(fz_node *node); -int fz_isovernode(fz_node *node); -int fz_ismasknode(fz_node *node); -int fz_isblendnode(fz_node *node); - -/* leaf nodes */ -fz_error *fz_newlinknode(fz_node **nodep, fz_tree *subtree); -fz_error *fz_newsolidnode(fz_node **nodep, float a, fz_colorspace *cs, int n, float *v); -fz_error *fz_newimagenode(fz_node **nodep, fz_image *image); -fz_error *fz_newshadenode(fz_node **nodep, fz_shade *shade); - -int fz_islinknode(fz_node *node); -int fz_issolidnode(fz_node *node); -int fz_ispathnode(fz_node *node); -int fz_istextnode(fz_node *node); -int fz_isimagenode(fz_node *node); -int fz_isshadenode(fz_node *node); - diff --git a/include/mupdf.h b/include/mupdf.h deleted file mode 100644 index 07acde71..00000000 --- a/include/mupdf.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef _MUPDF_H_ -#define _MUPDF_H_ - -#ifndef _FITZ_H_ -#error "fitz.h must be included before mupdf.h" -#endif - -void pdf_logxref(char *fmt, ...); -void pdf_logrsrc(char *fmt, ...); -void pdf_logfont(char *fmt, ...); -void pdf_logimage(char *fmt, ...); -void pdf_logshade(char *fmt, ...); -void pdf_logpage(char *fmt, ...); - -#include "mupdf/syntax.h" -#include "mupdf/xref.h" -#include "mupdf/rsrc.h" -#include "mupdf/content.h" -#include "mupdf/annot.h" -#include "mupdf/page.h" - -#endif diff --git a/include/mupdf/annot.h b/include/mupdf/annot.h deleted file mode 100644 index c667fcce..00000000 --- a/include/mupdf/annot.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Interactive features - */ - -typedef struct pdf_link_s pdf_link; -typedef struct pdf_comment_s pdf_comment; -typedef struct pdf_widget_s pdf_widget; -typedef struct pdf_outline_s pdf_outline; - -struct pdf_link_s -{ - fz_rect rect; - fz_obj *dest; - pdf_link *next; -}; - -typedef enum pdf_commentkind_e -{ - PDF_CTEXT, - PDF_CFREETEXT, - PDF_CLINE, - PDF_CSQUARE, - PDF_CCIRCLE, - PDF_CPOLYGON, - PDF_CPOLYLINE, - PDF_CMARKUP, - PDF_CCARET, - PDF_CSTAMP, - PDF_CINK -} pdf_commentkind; - -struct pdf_comment_s -{ - pdf_commentkind kind; - fz_rect rect; - fz_rect popup; - fz_obj *contents; - pdf_comment *next; -}; - -struct pdf_outline_s -{ - char *title; - pdf_link *link; - pdf_outline *child; - pdf_outline *next; -}; - -fz_error *pdf_loadnametree(fz_obj **dictp, pdf_xref *xref, fz_obj *root); -fz_error *pdf_loadnametrees(pdf_xref *xref); - -fz_error *pdf_newlink(pdf_link**, fz_rect rect, fz_obj *dest); -fz_error *pdf_loadlink(pdf_link **linkp, pdf_xref *xref, fz_obj *dict); -void pdf_droplink(pdf_link *link); - -fz_error *pdf_loadoutline(pdf_outline **outlinep, pdf_xref *xref); -void pdf_debugoutline(pdf_outline *outline, int level); -void pdf_dropoutline(pdf_outline *outline); - -fz_error *pdf_loadannots(pdf_comment **, pdf_link **, pdf_xref *, fz_obj *annots); - diff --git a/include/mupdf/content.h b/include/mupdf/content.h deleted file mode 100644 index a77a7296..00000000 --- a/include/mupdf/content.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * content stream parsing - */ - -typedef struct pdf_material_s pdf_material; -typedef struct pdf_gstate_s pdf_gstate; -typedef struct pdf_csi_s pdf_csi; - -enum -{ - PDF_MFILL, - PDF_MSTROKE -}; - -enum -{ - PDF_MNONE, - PDF_MCOLOR, - PDF_MLAB, - PDF_MINDEXED, - PDF_MPATTERN, - PDF_MSHADE -}; - -struct pdf_material_s -{ - int kind; - fz_colorspace *cs; - pdf_indexed *indexed; - pdf_pattern *pattern; - fz_shade *shade; - float alpha; - float v[32]; -}; - -struct pdf_gstate_s -{ - /* path stroking */ - float linewidth; - int linecap; - int linejoin; - float miterlimit; - float dashphase; - int dashlen; - float dashlist[32]; - - /* materials */ - pdf_material stroke; - pdf_material fill; - fz_blendkind blendmode; - - /* text state */ - float charspace; - float wordspace; - float scale; - float leading; - pdf_fontdesc *font; - float size; - int render; - float rise; - - /* tree construction state */ - fz_node *head; -}; - -struct pdf_csi_s -{ - pdf_gstate gstate[32]; - int gtop; - fz_obj *stack[32]; - int top; - int xbalance; - fz_obj *array; - - /* path object state */ - fz_pathnode *path; - int clip; - int clipevenodd; - - /* text object state */ - fz_node *textclip; - fz_textnode *text; - fz_matrix tlm; - fz_matrix tm; - int textmode; - - fz_tree *tree; -}; - -/* build.c */ -void pdf_initgstate(pdf_gstate *gs); -fz_error *pdf_setcolorspace(pdf_csi *csi, int what, fz_colorspace *cs); -fz_error *pdf_setcolor(pdf_csi *csi, int what, float *v); -fz_error *pdf_setpattern(pdf_csi *csi, int what, pdf_pattern *pat, float *v); -fz_error *pdf_setshade(pdf_csi *csi, int what, fz_shade *shade); - -fz_error *pdf_buildstrokepath(pdf_gstate *gs, fz_pathnode *path); -fz_error *pdf_buildfillpath(pdf_gstate *gs, fz_pathnode *path, int evenodd); -fz_error *pdf_addfillshape(pdf_gstate *gs, fz_node *shape); -fz_error *pdf_addstrokeshape(pdf_gstate *gs, fz_node *shape); -fz_error *pdf_addclipmask(pdf_gstate *gs, fz_node *shape); -fz_error *pdf_addtransform(pdf_gstate *gs, fz_node *transform); -fz_error *pdf_addshade(pdf_gstate *gs, fz_shade *shade); -fz_error *pdf_showpath(pdf_csi*, int close, int fill, int stroke, int evenodd); -fz_error *pdf_showtext(pdf_csi*, fz_obj *text); -fz_error *pdf_flushtext(pdf_csi*); -fz_error *pdf_showimage(pdf_csi*, pdf_image *img); - -/* interpret.c */ -fz_error *pdf_newcsi(pdf_csi **csip, int maskonly); -fz_error *pdf_runcsi(pdf_csi *, pdf_xref *xref, fz_obj *rdb, fz_stream *); -void pdf_dropcsi(pdf_csi *csi); - diff --git a/include/mupdf/page.h b/include/mupdf/page.h deleted file mode 100644 index 85065765..00000000 --- a/include/mupdf/page.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Page tree, pages and related objects - */ - -typedef struct pdf_pagetree_s pdf_pagetree; -typedef struct pdf_page_s pdf_page; -typedef struct pdf_textline_s pdf_textline; -typedef struct pdf_textchar_s pdf_textchar; - -struct pdf_pagetree_s -{ - int count; - int cursor; - fz_obj **pref; - fz_obj **pobj; -}; - -struct pdf_page_s -{ - fz_rect mediabox; - int rotate; - fz_obj *resources; - fz_tree *tree; - pdf_comment *comments; - pdf_link *links; -}; - -struct pdf_textchar_s -{ - fz_irect bbox; - int c; -}; - -struct pdf_textline_s -{ - int len, cap; - pdf_textchar *text; - pdf_textline *next; -}; - -/* pagetree.c */ -fz_error *pdf_loadpagetree(pdf_pagetree **pp, pdf_xref *xref); -int pdf_getpagecount(pdf_pagetree *pages); -fz_obj *pdf_getpageobject(pdf_pagetree *pages, int p); -fz_obj *pdf_getpagereference(pdf_pagetree *pages, int p); -void pdf_debugpagetree(pdf_pagetree *pages); -void pdf_droppagetree(pdf_pagetree *pages); - -/* page.c */ -fz_error *pdf_loadpage(pdf_page **pagep, pdf_xref *xref, fz_obj *ref); -void pdf_droppage(pdf_page *page); - -/* unicode.c */ -fz_error *pdf_loadtextfromtree(pdf_textline **linep, fz_tree *tree, fz_matrix ctm); -void pdf_debugtextline(pdf_textline *line); -fz_error *pdf_newtextline(pdf_textline **linep); -void pdf_droptextline(pdf_textline *line); - diff --git a/include/mupdf/rsrc.h b/include/mupdf/rsrc.h deleted file mode 100644 index f4e7717c..00000000 --- a/include/mupdf/rsrc.h +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Resource store - */ - -typedef struct pdf_store_s pdf_store; - -typedef enum pdf_itemkind_e -{ - PDF_KCOLORSPACE, - PDF_KFUNCTION, - PDF_KXOBJECT, - PDF_KIMAGE, - PDF_KPATTERN, - PDF_KSHADE, - PDF_KCMAP, - PDF_KFONT -} pdf_itemkind; - -fz_error *pdf_newstore(pdf_store **storep); -void pdf_emptystore(pdf_store *store); -void pdf_dropstore(pdf_store *store); - -fz_error *pdf_storeitem(pdf_store *store, pdf_itemkind tag, fz_obj *key, void *val); -void *pdf_finditem(pdf_store *store, pdf_itemkind tag, fz_obj *key); -fz_error *pdf_removeitem(pdf_store *store, pdf_itemkind tag, fz_obj *key); - -fz_error *pdf_loadresources(fz_obj **rdb, pdf_xref *xref, fz_obj *orig); - -/* - * Functions - */ - -typedef struct pdf_function_s pdf_function; - -fz_error *pdf_loadfunction(pdf_function **func, pdf_xref *xref, fz_obj *ref); -fz_error *pdf_evalfunction(pdf_function *func, float *in, int inlen, float *out, int outlen); -pdf_function *pdf_keepfunction(pdf_function *func); -void pdf_dropfunction(pdf_function *func); - -/* - * ColorSpace - */ - -typedef struct pdf_indexed_s pdf_indexed; - -struct pdf_indexed_s -{ - fz_colorspace super; /* hmmm... */ - fz_colorspace *base; - int high; - unsigned char *lookup; -}; - -extern fz_colorspace *pdf_devicegray; -extern fz_colorspace *pdf_devicergb; -extern fz_colorspace *pdf_devicecmyk; -extern fz_colorspace *pdf_devicelab; -extern fz_colorspace *pdf_devicepattern; - -void pdf_convcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv); -void pdf_convpixmap(fz_colorspace *ss, fz_pixmap *sp, fz_colorspace *ds, fz_pixmap *dp); - -fz_error *pdf_loadcolorspace(fz_colorspace **csp, pdf_xref *xref, fz_obj *obj); - -/* - * Pattern - */ - -typedef struct pdf_pattern_s pdf_pattern; - -struct pdf_pattern_s -{ - int refs; - int ismask; - float xstep; - float ystep; - fz_matrix matrix; - fz_rect bbox; - fz_tree *tree; -}; - -fz_error *pdf_loadpattern(pdf_pattern **patp, pdf_xref *xref, fz_obj *obj, fz_obj *ref); -pdf_pattern *pdf_keeppattern(pdf_pattern *pat); -void pdf_droppattern(pdf_pattern *pat); - -/* - * Shading - */ - -void pdf_setmeshvalue(float *mesh, int i, float x, float y, float t); -fz_error *pdf_loadshadefunction(fz_shade *shade, pdf_xref *xref, fz_obj *dict, float t0, float t1); -fz_error *pdf_loadtype1shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype2shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype3shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype4shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype5shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype6shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadtype7shade(fz_shade *, pdf_xref *, fz_obj *dict, fz_obj *ref); -fz_error *pdf_loadshade(fz_shade **shadep, pdf_xref *xref, fz_obj *obj, fz_obj *ref); - -/* - * XObject - */ - -typedef struct pdf_xobject_s pdf_xobject; - -struct pdf_xobject_s -{ - int refs; - fz_matrix matrix; - fz_rect bbox; - int isolated; - int knockout; - fz_obj *resources; - fz_buffer *contents; -}; - -fz_error *pdf_loadxobject(pdf_xobject **xobjp, pdf_xref *xref, fz_obj *obj, fz_obj *ref); -pdf_xobject *pdf_keepxobject(pdf_xobject *xobj); -void pdf_dropxobject(pdf_xobject *xobj); - -/* - * Image - */ - -typedef struct pdf_image_s pdf_image; - -struct pdf_image_s -{ - fz_image super; - fz_image *mask; /* explicit mask with subimage */ - int usecolorkey; /* explicit color-keyed masking */ - int colorkey[FZ_MAXCOLORS * 2]; - pdf_indexed *indexed; - float decode[32]; - int bpc; - int stride; - fz_buffer *samples; -}; - -fz_error *pdf_loadinlineimage(pdf_image **imgp, pdf_xref *xref, fz_obj *rdb, fz_obj *dict, fz_stream *file); -fz_error *pdf_loadimage(pdf_image **imgp, pdf_xref *xref, fz_obj *obj, fz_obj *ref); -fz_error *pdf_loadtile(fz_image *image, fz_pixmap *tile); - -/* - * CMap - */ - -typedef struct pdf_cmap_s pdf_cmap; -typedef struct pdf_range_s pdf_range; - -enum { PDF_CMAP_SINGLE, PDF_CMAP_RANGE, PDF_CMAP_TABLE, PDF_CMAP_MULTI }; - -struct pdf_range_s -{ - int low; - int high; - int flag; /* what kind of lookup is this (single, range, table, multi) */ - int offset; /* either range-delta or table-index */ -}; - -struct pdf_cmap_s -{ - int refs; - char cmapname[32]; - - char usecmapname[32]; - pdf_cmap *usecmap; - - int wmode; - - int ncspace; - struct { - int n; - unsigned lo; - unsigned hi; - } cspace[40]; - - int rlen, rcap; - pdf_range *ranges; - - int tlen, tcap; - int *table; -}; - -extern pdf_cmap *pdf_cmaptable[]; /* list of builtin system cmaps */ - -fz_error *pdf_newcmap(pdf_cmap **cmapp); -pdf_cmap *pdf_keepcmap(pdf_cmap *cmap); -void pdf_dropcmap(pdf_cmap *cmap); - -void pdf_debugcmap(pdf_cmap *cmap); -int pdf_getwmode(pdf_cmap *cmap); -pdf_cmap *pdf_getusecmap(pdf_cmap *cmap); -void pdf_setwmode(pdf_cmap *cmap, int wmode); -void pdf_setusecmap(pdf_cmap *cmap, pdf_cmap *usecmap); - -fz_error *pdf_addcodespace(pdf_cmap *cmap, unsigned lo, unsigned hi, int n); -fz_error *pdf_maprangetotable(pdf_cmap *cmap, int low, int *map, int len); -fz_error *pdf_maprangetorange(pdf_cmap *cmap, int srclo, int srchi, int dstlo); -fz_error *pdf_maponetomany(pdf_cmap *cmap, int one, int *many, int len); -fz_error *pdf_sortcmap(pdf_cmap *cmap); - -int pdf_lookupcmap(pdf_cmap *cmap, int cpt); -unsigned char *pdf_decodecmap(pdf_cmap *cmap, unsigned char *s, int *cpt); - -fz_error *pdf_parsecmap(pdf_cmap **cmapp, fz_stream *file); -fz_error *pdf_loadembeddedcmap(pdf_cmap **cmapp, pdf_xref *xref, fz_obj *ref); -fz_error *pdf_loadsystemcmap(pdf_cmap **cmapp, char *name); -fz_error *pdf_newidentitycmap(pdf_cmap **cmapp, int wmode, int bytes); - -/* - * Font - */ - -void pdf_loadencoding(char **estrings, char *encoding); -int pdf_lookupagl(char *name, int *ucsbuf, int ucscap); - -extern const unsigned short pdf_docencoding[256]; -extern const char * const pdf_macroman[256]; -extern const char * const pdf_macexpert[256]; -extern const char * const pdf_winansi[256]; -extern const char * const pdf_standard[256]; -extern const char * const pdf_expert[256]; -extern const char * const pdf_symbol[256]; -extern const char * const pdf_zapfdingbats[256]; - -typedef struct pdf_hmtx_s pdf_hmtx; -typedef struct pdf_vmtx_s pdf_vmtx; -typedef struct pdf_fontdesc_s pdf_fontdesc; - -struct pdf_hmtx_s -{ - unsigned short lo; - unsigned short hi; - int w; /* type3 fonts can be big! */ -}; - -struct pdf_vmtx_s -{ - unsigned short lo; - unsigned short hi; - short x; - short y; - short w; -}; - -struct pdf_fontdesc_s -{ - int refs; - - fz_font *font; - - /* FontDescriptor */ - int flags; - float italicangle; - float ascent; - float descent; - float capheight; - float xheight; - float missingwidth; - - /* Encoding (CMap) */ - pdf_cmap *encoding; - pdf_cmap *tottfcmap; - int ncidtogid; - unsigned short *cidtogid; - - /* ToUnicode */ - pdf_cmap *tounicode; - int ncidtoucs; - unsigned short *cidtoucs; - - /* Metrics (given in the PDF file) */ - int wmode; - - int nhmtx, hmtxcap; - pdf_hmtx dhmtx; - pdf_hmtx *hmtx; - - int nvmtx, vmtxcap; - pdf_vmtx dvmtx; - pdf_vmtx *vmtx; -}; - -/* fontmtx.c */ -void pdf_setfontwmode(pdf_fontdesc *font, int wmode); -void pdf_setdefaulthmtx(pdf_fontdesc *font, int w); -void pdf_setdefaultvmtx(pdf_fontdesc *font, int y, int w); -fz_error *pdf_addhmtx(pdf_fontdesc *font, int lo, int hi, int w); -fz_error *pdf_addvmtx(pdf_fontdesc *font, int lo, int hi, int x, int y, int w); -fz_error *pdf_endhmtx(pdf_fontdesc *font); -fz_error *pdf_endvmtx(pdf_fontdesc *font); -pdf_hmtx pdf_gethmtx(pdf_fontdesc *font, int cid); -pdf_vmtx pdf_getvmtx(pdf_fontdesc *font, int cid); - -/* unicode.c */ -fz_error *pdf_loadtounicode(pdf_fontdesc *font, pdf_xref *xref, char **strings, char *collection, fz_obj *cmapstm); - -/* fontfile.c */ -fz_error *pdf_loadbuiltinfont(pdf_fontdesc *font, char *basefont); -fz_error *pdf_loadembeddedfont(pdf_fontdesc *font, pdf_xref *xref, fz_obj *stmref); -fz_error *pdf_loadsystemfont(pdf_fontdesc *font, char *basefont, char *collection); -fz_error *pdf_loadsubstitutefont(pdf_fontdesc *font, int fdflags, char *collection); - -/* type3.c */ -fz_error *pdf_loadtype3font(pdf_fontdesc **fontp, pdf_xref *xref, fz_obj *obj, fz_obj *ref); - -/* font.c */ -int pdf_fontcidtogid(pdf_fontdesc *fontdesc, int cid); -fz_error *pdf_loadfontdescriptor(pdf_fontdesc *font, pdf_xref *xref, fz_obj *desc, char *collection); -fz_error *pdf_loadfont(pdf_fontdesc **fontp, pdf_xref *xref, fz_obj *obj, fz_obj *ref); -pdf_fontdesc * pdf_newfontdesc(void); -pdf_fontdesc * pdf_keepfont(pdf_fontdesc *fontdesc); -void pdf_dropfont(pdf_fontdesc *font); -void pdf_debugfont(pdf_fontdesc *fontdesc); - diff --git a/include/mupdf/syntax.h b/include/mupdf/syntax.h deleted file mode 100644 index 236ba5ec..00000000 --- a/include/mupdf/syntax.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * tokenizer and low-level object parser - */ - -typedef enum pdf_token_e -{ - PDF_TERROR, PDF_TEOF, - PDF_TOARRAY, PDF_TCARRAY, - PDF_TODICT, PDF_TCDICT, - PDF_TOBRACE, PDF_TCBRACE, - PDF_TNAME, PDF_TINT, PDF_TREAL, PDF_TSTRING, PDF_TKEYWORD, - PDF_TR, PDF_TTRUE, PDF_TFALSE, PDF_TNULL, - PDF_TOBJ, PDF_TENDOBJ, - PDF_TSTREAM, PDF_TENDSTREAM, - PDF_TXREF, PDF_TTRAILER, PDF_TSTARTXREF, - PDF_NTOKENS -} pdf_token_e; - -/* lex.c */ -fz_error *pdf_lex(pdf_token_e *tok, fz_stream *f, char *buf, int n, int *len); - -/* parse.c */ -fz_error *pdf_parsearray(fz_obj **op, fz_stream *f, char *buf, int cap); -fz_error *pdf_parsedict(fz_obj **op, fz_stream *f, char *buf, int cap); -fz_error *pdf_parsestmobj(fz_obj **op, fz_stream *f, char *buf, int cap); -fz_error *pdf_parseindobj(fz_obj **op, fz_stream *f, char *buf, int cap, int *oid, int *gid, int *stmofs); - -fz_rect pdf_torect(fz_obj *array); -fz_matrix pdf_tomatrix(fz_obj *array); -fz_error *pdf_toutf8(char **dstp, fz_obj *src); -fz_error *pdf_toucs2(unsigned short **dstp, fz_obj *src); - -/* - * Encryption - */ - -/* Permission flag bits */ -#define PDF_PERM_PRINT (1<<2) -#define PDF_PERM_CHANGE (1<<3) -#define PDF_PERM_COPY (1<<4) -#define PDF_PERM_NOTES (1<<5) -#define PDF_PERM_FILL_FORM (1<<8) -#define PDF_PERM_ACCESSIBILITY (1<<9) -#define PDF_PERM_ASSEMBLE (1<<10) -#define PDF_PERM_HIGH_RES_PRINT (1<<11) -#define PDF_DEFAULT_PERM_FLAGS 0xfffc - -typedef struct pdf_crypt_s pdf_crypt; - -struct pdf_crypt_s -{ - unsigned char o[32]; - unsigned char u[32]; - unsigned int p; - int v; - int r; - int len; - char *handler; - char *stmmethod; - int stmlength; - char *strmethod; - int strlength; - int encryptedmeta; - - fz_obj *encrypt; - fz_obj *id; - - unsigned char key[16]; - int keylen; -}; - -/* crypt.c */ -fz_error *pdf_newdecrypt(pdf_crypt **cp, fz_obj *enc, fz_obj *id); -fz_error *pdf_newencrypt(pdf_crypt **cp, char *userpw, char *ownerpw, int p, int n, fz_obj *id); - -int pdf_setpassword(pdf_crypt *crypt, char *pw); -int pdf_setuserpassword(pdf_crypt *crypt, char *pw, int pwlen); -int pdf_setownerpassword(pdf_crypt *crypt, char *pw, int pwlen); - -fz_error *pdf_cryptstream(fz_filter **fp, pdf_crypt *crypt, int oid, int gid); -void pdf_cryptobj(pdf_crypt *crypt, fz_obj *obj, int oid, int gid); -void pdf_dropcrypt(pdf_crypt *crypt); - diff --git a/include/mupdf/xref.h b/include/mupdf/xref.h deleted file mode 100644 index 23b7e135..00000000 --- a/include/mupdf/xref.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * xref and object / stream api - */ - -typedef struct pdf_xrefentry_s pdf_xrefentry; -typedef struct pdf_xref_s pdf_xref; - -struct pdf_xref_s -{ - fz_stream *file; - int version; - int startxref; - pdf_crypt *crypt; - - fz_obj *trailer; /* TODO split this into root/info/encrypt/id */ - fz_obj *root; /* resolved catalog dict */ - fz_obj *info; /* resolved info dict */ - fz_obj *dests; /* flattened dests nametree */ - - int len; - int cap; - pdf_xrefentry *table; - - struct pdf_store_s *store; - struct pdf_pagetree_s *pages; - struct pdf_outline_s *outlines; -}; - -struct pdf_xrefentry_s -{ - unsigned int ofs; /* file offset / objstm object number */ - unsigned short gen; /* generation / objstm index */ - char type; /* 0=unset (f)ree i(n)use (o)bjstm (d)elete (a)dd */ - char mark; /* for garbage collection etc */ - fz_buffer *stmbuf; /* in-memory stream */ - int stmofs; /* on-disk stream */ - fz_obj *obj; /* stored/cached object */ -}; - -fz_error *pdf_newxref(pdf_xref **); -fz_error *pdf_repairxref(pdf_xref *, char *filename); -fz_error *pdf_loadxref(pdf_xref *, char *filename); -fz_error *pdf_initxref(pdf_xref *); - -fz_error *pdf_openpdf(pdf_xref **, char *filename); -fz_error *pdf_updatexref(pdf_xref *, char *filename); -fz_error *pdf_savexref(pdf_xref *, char *filename, pdf_crypt *encrypt); - -void pdf_debugxref(pdf_xref *); -void pdf_flushxref(pdf_xref *, int force); -void pdf_closexref(pdf_xref *); - -fz_error *pdf_allocobject(pdf_xref *, int *oidp, int *genp); -fz_error *pdf_deleteobject(pdf_xref *, int oid, int gen); -fz_error *pdf_updateobject(pdf_xref *, int oid, int gen, fz_obj *obj); -fz_error *pdf_updatestream(pdf_xref *, int oid, int gen, fz_buffer *stm); - -fz_error *pdf_cacheobject(pdf_xref *, int oid, int gen); -fz_error *pdf_loadobject(fz_obj **objp, pdf_xref *, int oid, int gen); -fz_error *pdf_loadindirect(fz_obj **objp, pdf_xref *, fz_obj *ref); -fz_error *pdf_resolve(fz_obj **reforobj, pdf_xref *); - -int pdf_isstream(pdf_xref *xref, int oid, int gen); -fz_error *pdf_buildinlinefilter(fz_filter **filterp, fz_obj *stmobj); -fz_error *pdf_loadrawstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen); -fz_error *pdf_loadstream(fz_buffer **bufp, pdf_xref *xref, int oid, int gen); -fz_error *pdf_openrawstream(fz_stream **stmp, pdf_xref *, int oid, int gen); -fz_error *pdf_openstream(fz_stream **stmp, pdf_xref *, int oid, int gen); - -fz_error *pdf_garbagecollect(pdf_xref *xref); -fz_error *pdf_transplant(pdf_xref *dst, pdf_xref *src, fz_obj **newp, fz_obj *old); - -/* private */ -fz_error *pdf_loadobjstm(pdf_xref *xref, int oid, int gen, char *buf, int cap); -fz_error *pdf_decryptxref(pdf_xref *xref); - diff --git a/include/pdfapp.h b/include/pdfapp.h deleted file mode 100644 index 9f03505e..00000000 --- a/include/pdfapp.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Utility object for handling a pdf application / view - * Takes care of PDF loading and displaying and navigation, - * uses a number of callbacks to the GUI app. - */ - -typedef struct pdfapp_s pdfapp_t; - -enum { ARROW, HAND, WAIT }; - -extern void winwarn(pdfapp_t*, char *s); -extern void winerror(pdfapp_t*, fz_error *error); -extern void wintitle(pdfapp_t*, char *title); -extern void winresize(pdfapp_t*, int w, int h); -extern void winconvert(pdfapp_t*, fz_pixmap *image); -extern void winrepaint(pdfapp_t*); -extern char* winpassword(pdfapp_t*, char *filename); -extern void winopenuri(pdfapp_t*, char *s); -extern void wincursor(pdfapp_t*, int curs); -extern void windocopy(pdfapp_t*); - -struct pdfapp_s -{ - /* current document params */ - char *filename; - char *doctitle; - pdf_xref *xref; - pdf_outline *outline; - pdf_pagetree *pages; - fz_renderer *rast; - - /* current view params */ - float zoom; - int rotate; - fz_pixmap *image; - - /* current page params */ - int pageno; - pdf_page *page; - - /* snapback history */ - int hist[256]; - int histlen; - - /* window system sizes */ - int winw, winh; - int scrw, scrh; - int shrinkwrap; - - /* event handling state */ - char number[256]; - int numberlen; - - int ispanning; - int panx, pany; - - int iscopying; - int selx, sely; - fz_irect selr; - - /* client context storage */ - void *userdata; -}; - -void pdfapp_init(pdfapp_t *app); -void pdfapp_open(pdfapp_t *app, char *filename); -void pdfapp_close(pdfapp_t *app); - -char *pdfapp_usage(pdfapp_t *app); - -void pdfapp_onkey(pdfapp_t *app, int c); -void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int state); -void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen); -void pdfapp_onresize(pdfapp_t *app, int w, int h); - |