diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-10-05 07:23:36 +0200 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-10-05 07:23:36 +0200 |
commit | 7ad0eac4b8c81c5123ef5a62b23ba2895dd997c8 (patch) | |
tree | 09d5530e86be7e7b9da37dff2668e31d18a78fb5 /include/fitz | |
parent | 00905a4e2b959ccc3b79381acbf1d3b8e5319e8e (diff) | |
download | mupdf-7ad0eac4b8c81c5123ef5a62b23ba2895dd997c8.tar.xz |
refactor and rename node types
Diffstat (limited to 'include/fitz')
-rw-r--r-- | include/fitz/image.h | 17 | ||||
-rw-r--r-- | include/fitz/path.h | 32 | ||||
-rw-r--r-- | include/fitz/render.h | 8 | ||||
-rw-r--r-- | include/fitz/scanconv.h | 6 | ||||
-rw-r--r-- | include/fitz/text.h | 10 | ||||
-rw-r--r-- | include/fitz/tree.h | 134 |
6 files changed, 99 insertions, 108 deletions
diff --git a/include/fitz/image.h b/include/fitz/image.h deleted file mode 100644 index 7f6038ce..00000000 --- a/include/fitz/image.h +++ /dev/null @@ -1,17 +0,0 @@ -enum -{ - FZ_CSGRAY, - FZ_CSRGB, - FZ_CSCMYK -}; - -struct fz_image_s -{ - fz_node super; - int w, h, n, bpc; - int cs; - unsigned char *data; -}; - -fz_error *fz_newimage(fz_node **nodep, int w, int h, int n, int bpc, int cs); - diff --git a/include/fitz/path.h b/include/fitz/path.h index 536ca281..1c8a05a8 100644 --- a/include/fitz/path.h +++ b/include/fitz/path.h @@ -28,29 +28,31 @@ union fz_pathel_s float v; }; -struct fz_path_s +struct fz_pathnode_s { fz_node super; fz_pathkind paint; - fz_stroke *stroke; fz_dash *dash; + int linecap; + int linejoin; + float linewidth; + float miterlimit; int len, cap; fz_pathel *els; }; -fz_error *fz_newpath(fz_path **pathp); -fz_error *fz_clonepath(fz_path **pathp, fz_path *oldpath); -fz_error *fz_moveto(fz_path*, float x, float y); -fz_error *fz_lineto(fz_path*, float x, float y); -fz_error *fz_curveto(fz_path*, float, float, float, float, float, float); -fz_error *fz_curvetov(fz_path*, float, float, float, float); -fz_error *fz_curvetoy(fz_path*, float, float, float, float); -fz_error *fz_closepath(fz_path*); -fz_error *fz_endpath(fz_path*, fz_pathkind paint, fz_stroke *stroke, fz_dash *dash); -void fz_freepath(fz_path *path); - -fz_rect fz_boundpath(fz_path *node, fz_matrix ctm); -void fz_debugpath(fz_path *node); +fz_error *fz_newpathnode(fz_pathnode **pathp); +fz_error *fz_clonepath(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); fz_error *fz_newdash(fz_dash **dashp, float phase, int len, float *array); void fz_freedash(fz_dash *dash); diff --git a/include/fitz/render.h b/include/fitz/render.h index d237e872..4024bfec 100644 --- a/include/fitz/render.h +++ b/include/fitz/render.h @@ -3,9 +3,9 @@ typedef struct fz_renderer_s fz_renderer; fz_error *fz_newrenderer(fz_renderer **gcp); void fz_freerenderer(fz_renderer *gc); -fz_error *fz_renderover(fz_renderer *gc, fz_over *over, fz_matrix ctm, fz_pixmap *out); -fz_error *fz_rendermask(fz_renderer *gc, fz_mask *mask, fz_matrix ctm, fz_pixmap *out); -fz_error *fz_rendertransform(fz_renderer *gc, fz_transform *xform, fz_matrix ctm, fz_pixmap *out); -fz_error *fz_rendertext(fz_renderer *gc, fz_text *text, fz_matrix ctm, fz_pixmap *out); +fz_error *fz_renderover(fz_renderer *gc, fz_overnode *over, fz_matrix ctm, fz_pixmap *out); +fz_error *fz_rendermask(fz_renderer *gc, fz_masknode *mask, fz_matrix ctm, fz_pixmap *out); +fz_error *fz_rendertransform(fz_renderer *gc, fz_transformnode *xform, fz_matrix ctm, fz_pixmap *out); +fz_error *fz_rendertext(fz_renderer *gc, fz_textnode *text, fz_matrix ctm, fz_pixmap *out); fz_error *fz_rendernode(fz_renderer *gc, fz_node *node, fz_matrix ctm, fz_pixmap *out); diff --git a/include/fitz/scanconv.h b/include/fitz/scanconv.h index f391a387..0e073127 100644 --- a/include/fitz/scanconv.h +++ b/include/fitz/scanconv.h @@ -40,7 +40,7 @@ void fz_freeael(fz_ael *ael); fz_error *fz_scanconvert(fz_gel *gel, fz_ael *ael, int eofill); -fz_error *fz_fillpath(fz_gel *gel, fz_path *path, fz_matrix ctm, float flatness); -fz_error *fz_strokepath(fz_gel *gel, fz_path *path, fz_matrix ctm, float flatness); -fz_error *fz_dashpath(fz_gel *gel, fz_path *path, fz_matrix ctm, float flatness); +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); +fz_error *fz_dashpath(fz_gel *gel, fz_pathnode *path, fz_matrix ctm, float flatness); diff --git a/include/fitz/text.h b/include/fitz/text.h index 41a08c45..c28d96c7 100644 --- a/include/fitz/text.h +++ b/include/fitz/text.h @@ -1,4 +1,3 @@ -typedef struct fz_textbuilder_s fz_textbuilder; typedef struct fz_textel_s fz_textel; struct fz_textel_s @@ -7,7 +6,7 @@ struct fz_textel_s int g; }; -struct fz_text_s +struct fz_textnode_s { fz_node super; fz_font *font; @@ -16,8 +15,7 @@ struct fz_text_s fz_textel *els; }; -fz_error *fz_newtext(fz_text **textp, fz_font *face); -fz_error *fz_addtext(fz_text *text, int g, float x, float y); -fz_error *fz_endtext(fz_text *text); -void fz_freetext(fz_text *text); +fz_error *fz_newtextnode(fz_textnode **textp, fz_font *face); +fz_error *fz_addtext(fz_textnode *text, int g, float x, float y); +fz_error *fz_endtext(fz_textnode *text); diff --git a/include/fitz/tree.h b/include/fitz/tree.h index 080e55bf..4d6eb952 100644 --- a/include/fitz/tree.h +++ b/include/fitz/tree.h @@ -1,21 +1,38 @@ typedef struct fz_tree_s fz_tree; typedef struct fz_node_s fz_node; +struct fz_tree_s +{ + int refcount; + 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_insertnode(fz_node *parent, fz_node *child); + +/* node types */ + typedef enum fz_nodekind_e fz_nodekind; typedef enum fz_blendkind_e fz_blendkind; -typedef struct fz_transform_s fz_transform; -typedef struct fz_over_s fz_over; -typedef struct fz_mask_s fz_mask; -typedef struct fz_blend_s fz_blend; -typedef struct fz_path_s fz_path; -typedef struct fz_text_s fz_text; -typedef struct fz_solid_s fz_solid; -typedef struct fz_image_s fz_image; -typedef struct fz_shade_s fz_shade; -typedef struct fz_form_s fz_form; -typedef struct fz_meta_s fz_meta; -typedef struct fz_halftone_s fz_halftone; +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_colornode_s fz_colornode; +typedef struct fz_imagenode_s fz_imagenode; +typedef struct fz_shadenode_s fz_shadenode; +typedef struct fz_linknode_s fz_linknode; +typedef struct fz_metanode_s fz_metanode; enum fz_nodekind_e { @@ -25,12 +42,11 @@ enum fz_nodekind_e FZ_NBLEND, FZ_NPATH, FZ_NTEXT, - FZ_NSOLID, + FZ_NCOLOR, FZ_NIMAGE, FZ_NSHADE, - FZ_NFORM, - FZ_NMETA, - FZ_NHALFTONE + FZ_NLINK, + FZ_NMETA }; enum fz_blendkind_e @@ -56,75 +72,65 @@ enum fz_blendkind_e FZ_BLUMINOSITY, FZ_BOVERPRINT, -}; - -struct fz_tree_s -{ - fz_node *root; - fz_node *head; + FZ_BRASTEROP, }; struct fz_node_s { fz_nodekind kind; fz_node *parent; + fz_node *child; fz_node *next; }; -struct fz_meta_s +struct fz_transformnode_s { fz_node super; - fz_node *child; - fz_obj *info; + fz_matrix m; }; -struct fz_over_s +struct fz_overnode_s { fz_node super; - fz_node *child; }; -struct fz_mask_s +struct fz_masknode_s { fz_node super; - fz_node *child; }; -struct fz_blend_s +struct fz_blendnode_s { fz_node super; - fz_node *child; fz_blendkind mode; int isolated; int knockout; }; -struct fz_transform_s +struct fz_colornode_s { fz_node super; - fz_node *child; - fz_matrix m; + float r, g, b; }; -struct fz_form_s +struct fz_linknode_s { fz_node super; fz_tree *tree; }; -struct fz_solid_s +struct fz_metanode_s { fz_node super; - float r, g, b; + fz_obj *info; }; -/* tree operations */ -fz_error *fz_newtree(fz_tree **treep); -void fz_freetree(fz_tree *tree); -fz_rect fz_boundtree(fz_tree *tree, fz_matrix ctm); - -void fz_debugtree(fz_tree *tree); -void fz_insertnode(fz_node *node, fz_node *child); +struct fz_imagenode_s +{ + fz_node super; + int w, h, n, a; + // XXX fz_image *image; +}; /* common to all nodes */ void fz_initnode(fz_node *node, fz_nodekind kind); @@ -132,25 +138,27 @@ fz_rect fz_boundnode(fz_node *node, fz_matrix ctm); void fz_freenode(fz_node *node); /* branch nodes */ -fz_error *fz_newmeta(fz_node **nodep, fz_obj *info); -fz_error *fz_newover(fz_node **nodep); -fz_error *fz_newmask(fz_node **nodep); -fz_error *fz_newblend(fz_node **nodep, fz_blendkind b, int k, int i); -fz_error *fz_newtransform(fz_node **nodep, fz_matrix m); - -int fz_ismeta(fz_node *node); -int fz_isover(fz_node *node); -int fz_ismask(fz_node *node); -int fz_isblend(fz_node *node); -int fz_istransform(fz_node *node); +fz_error *fz_newmetanode(fz_node **nodep, fz_obj *info); +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); +int fz_ismetanode(fz_node *node); /* leaf nodes */ -fz_error *fz_newform(fz_node **nodep, fz_tree *subtree); -fz_error *fz_newsolid(fz_node **nodep, float r, float g, float b); - -int fz_isform(fz_node *node); -int fz_issolid(fz_node *node); -int fz_ispath(fz_node *node); -int fz_istext(fz_node *node); -int fz_isimage(fz_node *node); +fz_error *fz_newlinknode(fz_node **nodep, fz_tree *subtree); +fz_error *fz_newcolornode(fz_node **nodep, float r, float g, float b); +fz_error *fz_newimagenode(fz_node **nodep, int w, int h, int n, int a); + +int fz_islinknode(fz_node *node); +int fz_iscolornode(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); |