diff options
Diffstat (limited to 'include/fitz')
-rw-r--r-- | include/fitz/base_cpudep.h | 26 | ||||
-rw-r--r-- | include/fitz/base_geom.h | 65 | ||||
-rw-r--r-- | include/fitz/base_hash.h | 20 | ||||
-rw-r--r-- | include/fitz/base_math.h | 29 | ||||
-rw-r--r-- | include/fitz/base_pixmap.h | 31 | ||||
-rw-r--r-- | include/fitz/base_runtime.h | 97 | ||||
-rw-r--r-- | include/fitz/base_sysdep.h | 97 | ||||
-rw-r--r-- | include/fitz/draw_misc.h | 83 | ||||
-rw-r--r-- | include/fitz/draw_path.h | 45 | ||||
-rw-r--r-- | include/fitz/stm_buffer.h | 41 | ||||
-rw-r--r-- | include/fitz/stm_crypt.h | 43 | ||||
-rw-r--r-- | include/fitz/stm_filter.h | 98 | ||||
-rw-r--r-- | include/fitz/stm_object.h | 134 | ||||
-rw-r--r-- | include/fitz/stm_stream.h | 113 | ||||
-rw-r--r-- | include/fitz/wld_color.h | 40 | ||||
-rw-r--r-- | include/fitz/wld_font.h | 49 | ||||
-rw-r--r-- | include/fitz/wld_image.h | 16 | ||||
-rw-r--r-- | include/fitz/wld_path.h | 84 | ||||
-rw-r--r-- | include/fitz/wld_shade.h | 29 | ||||
-rw-r--r-- | include/fitz/wld_text.h | 45 | ||||
-rw-r--r-- | include/fitz/wld_tree.h | 173 |
21 files changed, 0 insertions, 1358 deletions
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); - |