w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

regions.h
Go to the documentation of this file.
1 /* $XConsortium: regions.h,v 1.2 91/10/10 11:19:06 rws Exp $ */
2 /* Copyright International Business Machines, Corp. 1991
3  * All Rights Reserved
4  * Copyright Lexmark International, Inc. 1991
5  * All Rights Reserved
6  *
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.
14  *
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
27  * THIS SOFTWARE.
28  */
29 /*SHARED*/
30 
31 struct region {
32  XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
33  /* type = REGIONTYPE */
34  struct fractpoint origin; /* beginning handle: X,Y origin of region */
35  struct fractpoint ending; /* ending handle: X,Y change after painting region */
36  pel xmin,ymin; /* minimum X,Y of region */
37  pel xmax,ymax; /* mat1_mum X,Y of region */
38  struct edgelist *anchor; /* list of edges that bound the region */
39  struct picture *thresholded; /* region defined by thresholded picture*/
40 /*
41 Note that the ending handle and the bounding box values are stored
42 relative to 'origin'.
43 
44 The above elements describe a region. The following elements are
45 scratchpad areas used while the region is being built:
46 */
47  fractpel lastdy; /* direction of last segment */
48  fractpel firstx,firsty; /* starting point of current edge */
49  fractpel edgexmin,edgexmax; /* x extent of current edge */
50  struct edgelist *lastedge,*firstedge; /* last and first edges in subpath */
51  pel *edge; /* pointer to array of X values for edge */
52  fractpel edgeYstop; /* Y value where 'edges' array ends */
54  fractpel, fractpel, int); /* function to use when
55  building a new edge */
56  struct strokeinfo *strokeinfo; /* scratchpad info during stroking only */
57 } ;
58 /*
59 The ISCOMPLEMENT flag indicates the region is reversed--it is the
60 "outside" of the nominal region.
61 */
62 #define ISCOMPLEMENT(flag) ((flag)&0x80)
63 /*
64 The ISJUMBLED flag indicates the region is not sorted top-to-bottom.
65 */
66 #define ISJUMBLED(flag) ((flag)&0x40)
67 /*
68 The ISINFINITE flag allows a quick check for an INFINITE region, which
69 is frequently intersected.
70 */
71 #define ISINFINITE(flag) ((flag)&0x20)
72 
73 /*END SHARED*/
74 /*SHARED*/
75 
76 #define ISRECTANGULAR(flag) ((flag)&0x08)
77 
78 /*END SHARED*/
79 /*SHARED*/
80 
81 #define EmptyRegion t1_EmptyRegion
82 
83 /*END SHARED*/
84 /*SHARED*/
85 
86 struct edgelist {
87  XOBJ_COMMON /* xobject common data define 3-26-91 PNM */
88  /* type = EDGETYPE */
89  struct edgelist *link; /* pointer to next in linked list */
90  struct edgelist *subpath; /* informational link for "same subpath" */
91  pel xmin,xmax; /* range of edge in X */
92  pel ymin,ymax; /* range of edge in Y */
93  pel *xvalues; /* pointer to ymax-ymin X values */
94 } ;
95 /*
96 The end of the list is marked by either "link" being NULL, or by
97 ymin == ymax. See :hdref refid=discard.. We define the VALIDEDGE
98 predicate to test for the opposite of these conditions:
99 */
100 
101 #define VALIDEDGE(p) ((p)!=NULL&&(p)->ymin<(p)->ymax)
102 
103 /*END SHARED*/
104 /*SHARED*/
105 
106 #define Interior(p,rule) t1_Interior(p,rule)
107 #define Union(a1,a2) t1_Union(a1,a2)
108 #define Intersect(a1,a2) t1_Intersect(a1,a2)
109 #define Complement(area) t1_Complement(area)
110 #define Overlap(a1,a2) t1_OverLap(a1,a2)
111 
112 struct region *t1_Interior(struct segment *, int);
113  /* returns the interior of a closed path */
114 struct region *t1_Union(); /* set union of paths or regions */
115 struct region *t1_Intersect(); /* set intersection of regions */
116 struct region *t1_Complement(); /* complement of a region */
117 int t1_Overlap(); /* returns a Boolean; TRUE if regions overlap */
118 
119 #define T1_INFINITY t1_Infinity
120 
121 /*END SHARED*/
122 /*SHARED*/
123 
124 #define ChangeDirection(type,R,x,y,dy) t1_ChangeDirection(type,R,x,y,dy)
125 
127  /* called when we change direction in Y */
128 #define CD_FIRST -1 /* enumeration of ChangeDirection type */
129 #define CD_CONTINUE 0 /* enumeration of ChangeDirection type */
130 #define CD_LAST 1 /* enumeration of ChangeDirection type */
131 
132 #define MoreWorkArea(R,x1,y1,x2,y2) t1_MoreWorkArea(R,x1,y1,x2,y2)
133 #define KillRegion(area) t1_KillRegion(area)
134 #define CopyRegion(area) t1_CopyRegion(area)
135 #define RegionBounds(r) t1_RegionBounds(r)
136 #define CoerceRegion(p) t1_CoerceRegion(p)
137 #define MoveEdges(R,dx,dy) t1_MoveEdges(R,dx,dy)
138 #define UnJumble(R) t1_UnJumble(R)
139 
141  fractpel); /* get longer edge list for stepping */
142 struct region *t1_CopyRegion(struct region *); /* duplicate a region */
143 void t1_KillRegion(struct region *); /* destroy a region */
144 struct segment *t1_RegionBounds(struct region *);
145  /* returns bounding box of a region */
146 struct region *t1_CoerceRegion(); /* force text to become a true region */
148  /* moves the edge values in a region */
149 void t1_UnJumble(struct region *);
150  /* sort the edges and reset the jumbled flag */
151 
152 /*END SHARED*/
153 /*SHARED*/
154 
155 #define GOING_TO(R, x1, y1, x2, y2, dy) { \
156  if (dy < 0) { \
157  if (R->lastdy >= 0) \
158  ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
159  if (y2 < R->edgeYstop) \
160  MoreWorkArea(R, x1, y1, x2, y2); \
161  } \
162  else if (dy > 0) { \
163  if (R->lastdy <= 0) \
164  ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
165  if (y2 > R->edgeYstop) \
166  MoreWorkArea(R, x1, y1, x2, y2); \
167  } \
168  else /* dy == 0 */ ChangeDirection(CD_CONTINUE, R, x1, y1, dy); \
169  if (x2 < R->edgexmin) R->edgexmin = x2; \
170  else if (x2 > R->edgexmax) R->edgexmax = x2; \
171 }
172 
173 
174 #define MINPEL (-1<<(8*sizeof(pel)-1)) /* smallest value fitting in a pel */
175 #define MAXPEL ((1<<(8*sizeof(pel)-1))-1)/* largest value fitting in a pel */
176 
177 /*
178 The "Unique"-type macro is different (unique?) for regions, because some
179 regions structures are shared among several objects, and might have
180 to be made unique for that reason (i.e., references > 1).
181 */
182 
183 #define ConsumeRegion(R) MAKECONSUME(R,KillRegion(R))
184 #define UniqueRegion(R) MAKEUNIQUE(R,CopyRegion(R))
185 
186 
187 /*END SHARED*/
188 /*SHARED*/
189 
190 #define ISDOWN(f) ((f)&0x80)
191 
192 #define ISAMBIGUOUS(f) ((f)&0x40)
193 
194 /*END SHARED*/
195 /*SHARED*/
196 
197 /*
198 Interior() rule enumerations:
199 */
200 #define WINDINGRULE -2
201 #define EVENODDRULE -3
202 
203 #define CONTINUITY 0x80 /* can be added to above rules; e.g. WINDINGRULE+CONTINUITY */
204 
205 /*END SHARED*/
static void
Definition: fpif.c:118
#define XOBJ_COMMON
Definition: objects.h:132
void t1_MoreWorkArea(struct region *, fractpel, fractpel, fractpel, fractpel)
Definition: regions.c:1459
void t1_MoveEdges(struct region *, fractpel, fractpel)
struct region * t1_Intersect()
struct region * t1_CopyRegion(struct region *)
int t1_Overlap()
void t1_ChangeDirection(int, struct region *, fractpel, fractpel, fractpel)
struct segment * t1_RegionBounds(struct region *)
void t1_KillRegion(struct region *)
struct region * t1_Complement()
struct region * t1_Interior(struct segment *, int)
struct region * t1_Union()
struct region * t1_CoerceRegion()
void t1_UnJumble(struct region *)
Definition: regions.c:1422
SHORT pel
Definition: spaces.h:36
int32_t fractpel
Definition: spaces.h:37
pel ymin
Definition: regions.h:92
struct edgelist * subpath
Definition: regions.h:90
pel ymax
Definition: regions.h:92
pel xmin
Definition: regions.h:91
XOBJ_COMMON struct edgelist * link
Definition: regions.h:89
pel * xvalues
Definition: regions.h:93
pel xmax
Definition: regions.h:91
Definition: regions.h:31
fractpel edgexmax
Definition: regions.h:49
struct strokeinfo * strokeinfo
Definition: regions.h:56
XOBJ_COMMON struct fractpoint origin
Definition: regions.h:34
struct edgelist * lastedge
Definition: regions.h:50
fractpel lastdy
Definition: regions.h:47
pel ymin
Definition: regions.h:36
pel xmax
Definition: regions.h:37
struct fractpoint ending
Definition: regions.h:35
struct edgelist * anchor
Definition: regions.h:38
struct edgelist * firstedge
Definition: regions.h:50
void(* newedgefcn)(struct region *, fractpel, fractpel, fractpel, fractpel, int)
Definition: regions.h:53
pel xmin
Definition: regions.h:36
fractpel edgexmin
Definition: regions.h:49
fractpel firstx
Definition: regions.h:48
pel ymax
Definition: regions.h:37
fractpel firsty
Definition: regions.h:48
pel * edge
Definition: regions.h:51
struct picture * thresholded
Definition: regions.h:39
fractpel edgeYstop
Definition: regions.h:52
Definition: paths.h:128
return() int(((double) *(font_tbl[cur_fnt].wtbl+(int)(*(font_tbl[cur_fnt].char_wi+(int)(ch - font_tbl[cur_fnt].char_f)% 256)))/(double)(1L<< 20)) *(double) font_tbl[cur_fnt].scale)