xref: /plan9/sys/src/cmd/gs/src/gspath.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1989, 1995, 1996, 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
2 
3   This software is provided AS-IS with no warranty, either express or
4   implied.
5 
6   This software is distributed under license and may not be copied,
7   modified or distributed except as expressly authorized under the terms
8   of the license contained in the file LICENSE in this distribution.
9 
10   For more information about licensing, please refer to
11   http://www.ghostscript.com/licensing/. For information on
12   commercial licensing, go to http://www.artifex.com/licensing/ or
13   contact Artifex Software, Inc., 101 Lucas Valley Road #110,
14   San Rafael, CA  94903, U.S.A., +1(415)492-9861.
15 */
16 
17 /* $Id: gspath.h,v 1.7 2004/05/11 10:41:55 igor Exp $ */
18 /* Graphics state path procedures */
19 /* Requires gsstate.h */
20 
21 #ifndef gspath_INCLUDED
22 #  define gspath_INCLUDED
23 
24 #include "gspenum.h"
25 
26 /* Path constructors */
27 int gs_newpath(gs_state *),
28     gs_moveto(gs_state *, floatp, floatp),
29     gs_rmoveto(gs_state *, floatp, floatp),
30     gs_lineto(gs_state *, floatp, floatp),
31     gs_rlineto(gs_state *, floatp, floatp),
32     gs_arc(gs_state *, floatp, floatp, floatp, floatp, floatp),
33     gs_arcn(gs_state *, floatp, floatp, floatp, floatp, floatp),
34     /*
35      * Because of an obscure bug in the IBM RS/6000 compiler, one (but not
36      * both) bool argument(s) for gs_arc_add must come before the floatp
37      * arguments.
38      */
39     gs_arc_add(gs_state *, bool, floatp, floatp, floatp, floatp, floatp, bool),
40     gs_arcto(gs_state *, floatp, floatp, floatp, floatp, floatp, float[4]),
41     gs_curveto(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp),
42     gs_rcurveto(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp),
43     gs_closepath(gs_state *);
44 
45 #ifndef gs_imager_state_DEFINED
46 #  define gs_imager_state_DEFINED
47 typedef struct gs_imager_state_s gs_imager_state;
48 #endif
49 #ifndef gx_path_DEFINED
50 #  define gx_path_DEFINED
51 typedef struct gx_path_s gx_path;
52 #endif
53 #ifndef gs_matrix_fixed_DEFINED
54 #define gs_matrix_fixed_DEFINED
55 typedef struct gs_matrix_fixed_s gs_matrix_fixed;
56 #endif
57 
58 /* Imager-level procedures */
59 int gs_imager_arc_add(gx_path * ppath, gs_imager_state * pis,
60 		      bool clockwise, floatp axc, floatp ayc,
61 		      floatp arad, floatp aang1, floatp aang2,
62 		      bool add_line);
63 void make_quadrant_arc(gs_point *p, const gs_point *c,
64 	const gs_point *p0, const gs_point *p1, double r);
65 
66 /* Add the current path to the path in the previous graphics state. */
67 int gs_upmergepath(gs_state *);
68 
69 /* Path accessors and transformers */
70 int gs_currentpoint(gs_state *, gs_point *),
71       gs_upathbbox(gs_state *, gs_rect *, bool),
72       gs_dashpath(gs_state *),
73       gs_flattenpath(gs_state *),
74       gs_reversepath(gs_state *),
75       gs_strokepath(gs_state *);
76 
77 /* The extra argument for gs_upathbbox controls whether to include */
78 /* a trailing moveto in the bounding box. */
79 #define gs_pathbbox(pgs, prect)\
80   gs_upathbbox(pgs, prect, false)
81 
82 /* Path enumeration */
83 
84 /* This interface conditionally makes a copy of the path. */
85 gs_path_enum *gs_path_enum_alloc(gs_memory_t *, client_name_t);
86 int gs_path_enum_copy_init(gs_path_enum *, const gs_state *, bool);
87 
88 #define gs_path_enum_init(penum, pgs)\
89   gs_path_enum_copy_init(penum, pgs, true)
90 int gs_path_enum_next(gs_path_enum *, gs_point[3]);  /* 0 when done */
91 void gs_path_enum_cleanup(gs_path_enum *);
92 
93 /* Clipping */
94 int gs_clippath(gs_state *),
95     gs_initclip(gs_state *),
96     gs_clip(gs_state *),
97     gs_eoclip(gs_state *);
98 
99 #endif /* gspath_INCLUDED */
100