xref: /plan9/sys/src/cmd/gs/src/gspath.h (revision ff8c3af2f44d95267f67219afa20ba82ff6cf7e4)
1 /* Copyright (C) 1989, 1995, 1996, 1997, 1998, 1999 Aladdin Enterprises.  All rights reserved.
2 
3   This file is part of AFPL Ghostscript.
4 
5   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
6   distributor accepts any responsibility for the consequences of using it, or
7   for whether it serves any particular purpose or works at all, unless he or
8   she says so in writing.  Refer to the Aladdin Free Public License (the
9   "License") for full details.
10 
11   Every copy of AFPL Ghostscript must include a copy of the License, normally
12   in a plain ASCII text file named PUBLIC.  The License grants you the right
13   to copy, modify and redistribute AFPL Ghostscript, but only under certain
14   conditions described in the License.  Among other things, the License
15   requires that the copyright notice and this notice be preserved on all
16   copies.
17 */
18 
19 /*$Id: gspath.h,v 1.2 2000/09/19 19:00:31 lpd Exp $ */
20 /* Graphics state path procedures */
21 /* Requires gsstate.h */
22 
23 #ifndef gspath_INCLUDED
24 #  define gspath_INCLUDED
25 
26 #include "gspenum.h"
27 
28 /* Path constructors */
29 int gs_newpath(P1(gs_state *)),
30     gs_moveto(P3(gs_state *, floatp, floatp)),
31     gs_rmoveto(P3(gs_state *, floatp, floatp)),
32     gs_lineto(P3(gs_state *, floatp, floatp)),
33     gs_rlineto(P3(gs_state *, floatp, floatp)),
34     gs_arc(P6(gs_state *, floatp, floatp, floatp, floatp, floatp)),
35     gs_arcn(P6(gs_state *, floatp, floatp, floatp, floatp, floatp)),
36     /*
37      * Because of an obscure bug in the IBM RS/6000 compiler, one (but not
38      * both) bool argument(s) for gs_arc_add must come before the floatp
39      * arguments.
40      */
41     gs_arc_add(P8(gs_state *, bool, floatp, floatp, floatp, floatp, floatp, bool)),
42     gs_arcto(P7(gs_state *, floatp, floatp, floatp, floatp, floatp, float[4])),
43     gs_curveto(P7(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp)),
44     gs_rcurveto(P7(gs_state *, floatp, floatp, floatp, floatp, floatp, floatp)),
45     gs_closepath(P1(gs_state *));
46 
47 /* Imager-level procedures */
48 #ifndef gs_imager_state_DEFINED
49 #  define gs_imager_state_DEFINED
50 typedef struct gs_imager_state_s gs_imager_state;
51 #endif
52 #ifndef gx_path_DEFINED
53 #  define gx_path_DEFINED
54 typedef struct gx_path_s gx_path;
55 #endif
56 int gs_imager_arc_add(P9(gx_path * ppath, gs_imager_state * pis,
57 			 bool clockwise, floatp axc, floatp ayc,
58 			 floatp arad, floatp aang1, floatp aang2,
59 			 bool add_line));
60 
61 #define gs_arc_add_inline(pgs, cw, axc, ayc, arad, aa1, aa2, add)\
62   gs_imager_arc_add((pgs)->path, (gs_imager_state *)(pgs),\
63 		    cw, axc, ayc, arad, aa1, aa2, add)
64 
65 /* Add the current path to the path in the previous graphics state. */
66 int gs_upmergepath(P1(gs_state *));
67 
68 /* Path accessors and transformers */
69 int gs_currentpoint(P2(gs_state *, gs_point *)),
70       gs_upathbbox(P3(gs_state *, gs_rect *, bool)),
71       gs_dashpath(P1(gs_state *)),
72       gs_flattenpath(P1(gs_state *)),
73       gs_reversepath(P1(gs_state *)),
74       gs_strokepath(P1(gs_state *));
75 
76 /* The extra argument for gs_upathbbox controls whether to include */
77 /* a trailing moveto in the bounding box. */
78 #define gs_pathbbox(pgs, prect)\
79   gs_upathbbox(pgs, prect, false)
80 
81 /* Path enumeration */
82 
83 /* This interface conditionally makes a copy of the path. */
84 gs_path_enum *
85              gs_path_enum_alloc(P2(gs_memory_t *, client_name_t));
86 int gs_path_enum_copy_init(P3(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(P2(gs_path_enum *, gs_point[3]));  /* 0 when done */
91 void gs_path_enum_cleanup(P1(gs_path_enum *));
92 
93 /* Clipping */
94 int gs_clippath(P1(gs_state *)),
95     gs_initclip(P1(gs_state *)),
96     gs_clip(P1(gs_state *)),
97     gs_eoclip(P1(gs_state *));
98 
99 #endif /* gspath_INCLUDED */
100