1
/* $Xorg: paths.h,v 1.3 2000/08/17 19:46:31 cpqbld Exp $ */
2
/* Copyright International Business Machines, Corp. 1991
4
* Copyright Lexmark International, Inc. 1991
7
* License to use, copy, modify, and distribute this software and its
8
* documentation for any purpose and without fee is hereby granted,
9
* provided that the above copyright notice appear in all copies and that
10
* both that copyright notice and this permission notice appear in
11
* supporting documentation, and that the name of IBM or Lexmark not be
12
* used in advertising or publicity pertaining to distribution of the
13
* software without specific, written prior permission.
15
* IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
16
* ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
17
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
18
* AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE RISK AS TO THE
19
* QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
20
* OR MAINTAIN, BELONGS TO THE LICENSEE. SHOULD ANY PORTION OF THE
21
* SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
22
* ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION. IN NO EVENT SHALL
23
* IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
24
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
25
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
26
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
29
/* $XFree86: xc/lib/font/Type1/paths.h,v 1.3 1999/08/22 08:58:53 dawes Exp $ */
33
#define Loc(S,x,y) t1_Loc(S,(double)x,(double)y)
34
#define ILoc(S,x,y) t1_ILoc(S,x,y)
35
#define Line(P) t1_Line(P)
36
#define Join(p1,p2) t1_Join(p1,p2)
37
#define ClosePath(p) t1_ClosePath(p,0)
38
#define CloseLastSubPath(p) t1_ClosePath(p,1)
39
#define Conic(B,C,s) t1_Conic(B,C,(double)s)
40
#define RoundConic(M,C,r) t1_RoundConic(M,C,(double)r)
41
#define ArcP3(S,P2,P3) t1_ArcP3(S,P2,P3)
42
#define ArcCA(S,C,d) t1_ArcCA(S,C,(double)d)
43
#define Bezier(B,C,D) t1_Bezier(B,C,D)
44
#define Hint(S,r,w,o,h,a,d,l) t1_Hint(S,r,w,o,h,a,d,l)
45
#define Reverse(p) t1_Reverse(p)
46
#define ReverseSubPaths(p) t1_ReverseSubPaths(p)
47
#define AddLoc(p1,p2) t1_Join(p1,p2)
48
#define SubLoc(p1,p2) t1_SubLoc(p1,p2)
49
#define DropSegment(p) t1_DropSegment(p)
50
#define HeadSegment(p) t1_HeadSegment(p)
51
#define QueryLoc(P,S,x,y) t1_QueryLoc(P,S,x,y)
52
#define QueryPath(p,t,B,C,D,r) t1_QueryPath(p,t,B,C,D,r)
53
#define QueryBounds(p,S,x1,y1,x2,y2) t1_QueryBounds(p,S,x1,y1,x2,y2)
56
/* create a location object (or "move" segment) */
57
extern struct segment *t1_Loc ( struct XYspace *S, double x, double y );
58
/* integer argument version of same */
59
extern struct segment *t1_ILoc ( struct XYspace *S, int x, int y );
60
/* straight line path segment */
61
extern struct segment *t1_Line ( struct segment *P );
62
/* join two paths or regions together */
63
extern struct segment *t1_Join ( struct segment *p1, struct segment *p2 );
64
/* close a path or path set */
65
extern struct segment *t1_ClosePath ( struct segment *p0, int lastonly );
67
struct conicsegment *t1_Conic(); /* conic curve path segment */
69
struct conicsegment *t1_RoundConic(); /* ditto, specified another way */
70
struct conicsegment *t1_ArcP3(); /* circular path segment with three points */
71
struct conicsegment *t1_ArcCA(); /* ditto, with center point and angle */
73
/* Bezier third order curve path segment */
74
extern struct beziersegment *t1_Bezier ( struct segment *B, struct segment *C,
76
/* Query location; return its (x,y) */
77
extern void t1_QueryLoc ( struct segment *P, struct XYspace *S, double *xP,
82
#define CopyPath(p) t1_CopyPath(p)
83
#define KillPath(p) t1_KillPath(p)
84
#define PathTransform(p,m) t1_PathXform(p,m)
85
#define PathDelta(p,pt) t1_PathDelta(p,pt)
86
#define BoundingBox(h,w) t1_BoundingBox(h,w)
87
#define PathSegment(t,x,y) t1_PathSegment(t,(fractpel)x,(fractpel)y)
88
#define JoinSegment(b,t,x,y,a) t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a)
89
#define Hypoteneuse(dx,dy) t1_Hypoteneuse(dx,dy)
91
/* duplicate a path */
92
extern struct segment *t1_CopyPath ( struct segment *p0 );
94
extern void t1_KillPath ( struct segment *p );
95
/* transform a path arbitrarily */
96
extern struct segment *t1_PathXform ( struct segment *p0, struct XYspace *S );
97
/* calculate the ending point of a path */
98
extern void t1_PathDelta ( struct segment *p, struct fractpoint *pt );
99
/* produce a MOVE or LINE segment */
100
extern struct segment *t1_PathSegment ( int type, fractpel x, fractpel y );
101
/* join a MOVE or LINE segment to a path */
102
extern struct segment *t1_JoinSegment ( struct segment *before, int type, fractpel x, fractpel y, struct segment *after );
107
#define ConsumePath(p) MAKECONSUME(p,KillPath(p))
108
#define UniquePath(p) MAKEUNIQUE(p,CopyPath(p))
114
XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
115
unsigned char size; /* size of the structure */
116
unsigned char context; /* index to device context */
117
struct segment *link; /* pointer to next structure in linked list */
118
struct segment *last; /* pointer to last structure in list */
119
struct fractpoint dest; /* relative ending location of path segment */
122
#define ISCLOSED(flag) ((flag)&0x80) /* subpath is closed */
123
#define LASTCLOSED(flag) ((flag)&0x40) /* last segment in closed subpath */
126
NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the
127
subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE)
130
We define the ISPATHANCHOR predicate to test that a path handle
131
passed by the user is valid:
134
#define ISPATHANCHOR(p) (ISPATHTYPE(p->type)&&p->last!=NULL)
137
For performance reasons, a user's "location" object is identical to
138
a path whose only segment is a move segment. We define a predicate
139
to test for this case. See also :hdref refid=location..
142
#define ISLOCATION(p) ((p)->type == MOVETYPE && (p)->link == NULL)
147
struct conicsegment {
148
XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
149
/* type = CONICTYPE */
150
unsigned char size; /* as with any 'segment' type */
151
unsigned char context; /* as with any 'segment' type */
152
struct segment *link; /* as with any 'segment' type */
153
struct segment *last; /* as with any 'segment' type */
154
struct fractpoint dest; /* Ending point (C point) */
155
struct fractpoint M; /* "midpoint" of conic explained above */
156
float roundness; /* explained above */
161
struct beziersegment {
162
XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
163
/* type = BEZIERTYPE */
164
unsigned char size; /* as with any 'segment' type */
165
unsigned char context; /* as with any 'segment' type */
166
struct segment *link; /* as with any 'segment' type */
167
struct segment *last; /* as with any 'segment' type */
168
struct fractpoint dest; /* ending point (D) */
169
struct fractpoint B; /* control point B */
170
struct fractpoint C; /* control point C */
177
XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
178
/* type = HINTTYPE */
179
unsigned char size; /* size of the structure */
180
unsigned char context; /* device context */
181
struct segment *link; /* pointer to next structure in linked list */
182
struct segment *last; /* pointer to last structure in list */
183
struct fractpoint dest; /* ALWAYS 0,0 */
184
struct fractpoint ref;
185
struct fractpoint width;
197
CONCAT links the 'p2' path chain on the end of the 'p1' chain. (This macro
198
is also used by the STROKES module.)
200
#define CONCAT(p1, p2) { \
201
p1->last->link = p2; /* link p2 on end of p1 */ \
202
p1->last = p2->last; /* last of new is last of p2 */ \
203
p2->last = NULL; } /* only first segment has non-NULL "last" */