Back to index

tetex-bin  3.0
paths_rmz.h
Go to the documentation of this file.
00001 /* $XConsortium: paths.h,v 1.2 91/10/10 11:18:50 rws Exp $ */
00002 /* Copyright International Business Machines, Corp. 1991
00003  * All Rights Reserved
00004  * Copyright Lexmark International, Inc. 1991
00005  * All Rights Reserved
00006  *
00007  * License to use, copy, modify, and distribute this software and its
00008  * documentation for any purpose and without fee is hereby granted,
00009  * provided that the above copyright notice appear in all copies and that
00010  * both that copyright notice and this permission notice appear in
00011  * supporting documentation, and that the name of IBM or Lexmark not be
00012  * used in advertising or publicity pertaining to distribution of the
00013  * software without specific, written prior permission.
00014  *
00015  * IBM AND LEXMARK PROVIDE THIS SOFTWARE "AS IS", WITHOUT ANY WARRANTIES OF
00016  * ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO ANY
00017  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
00018  * AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.  THE ENTIRE RISK AS TO THE
00019  * QUALITY AND PERFORMANCE OF THE SOFTWARE, INCLUDING ANY DUTY TO SUPPORT
00020  * OR MAINTAIN, BELONGS TO THE LICENSEE.  SHOULD ANY PORTION OF THE
00021  * SOFTWARE PROVE DEFECTIVE, THE LICENSEE (NOT IBM OR LEXMARK) ASSUMES THE
00022  * ENTIRE COST OF ALL SERVICING, REPAIR AND CORRECTION.  IN NO EVENT SHALL
00023  * IBM OR LEXMARK BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
00024  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
00025  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
00026  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
00027  * THIS SOFTWARE.
00028  */
00029 /*SHARED*/
00030 
00031 #include "types.h"
00032 
00033 
00034 #define XOBJ_COMMON      char type; unsigned char flag; short references;
00035 #include "spaces_rmz.h"
00036 
00037 
00038 
00039 /*
00040 
00041 #define   Loc(S,x,y)                   t1_Loc(S,(DOUBLE)x,(DOUBLE)y)
00042 #define   ILoc(S,x,y)                  t1_ILoc(S,x,y)
00043 #define   Line(P)                      t1_Line(P)
00044 #define   Join(p1,p2)                  t1_Join(p1,p2)
00045 #define   ClosePath(p)                 t1_ClosePath(p,0)
00046 #define   CloseLastSubPath(p)          t1_ClosePath(p,1)
00047 #define   Conic(B,C,s)                 t1_Conic(B,C,(DOUBLE)s)
00048 #define   RoundConic(M,C,r)            t1_RoundConic(M,C,(DOUBLE)r)
00049 #define   ArcP3(S,P2,P3)               t1_ArcP3(S,P2,P3)
00050 #define   ArcCA(S,C,d)                 t1_ArcCA(S,C,(DOUBLE)d)
00051 #define   Bezier(B,C,D)                t1_Bezier(B,C,D)
00052 #define   Hint(S,r,w,o,h,a,d,l)        t1_Hint(S,r,w,o,h,a,d,l)
00053 #define   Reverse(p)                   t1_Reverse(p)
00054 #define   ReverseSubPaths(p)           t1_ReverseSubPaths(p)
00055 #define   AddLoc(p1,p2)                t1_Join(p1,p2)
00056 #define   SubLoc(p1,p2)                t1_SubLoc(p1,p2)
00057 #define   DropSegment(p)               t1_DropSegment(p)
00058 #define   HeadSegment(p)               t1_HeadSegment(p)
00059 #define   QueryLoc(P,S,x,y)            t1_QueryLoc(P,S,x,y)
00060 #define   QueryPath(p,t,B,C,D,r)       t1_QueryPath(p,t,B,C,D,r)
00061 #define   QueryBounds(p,S,x1,y1,x2,y2)  t1_QueryBounds(p,S,x1,y1,x2,y2)
00062  
00063 */
00064 
00065 /*
00066 struct segment *t1_Loc();    
00067 struct segment *t1_ILoc();           
00068 struct segment *t1_Line(); 
00069 struct segment *t1_Join();
00070 struct segment *t1_ClosePath();  
00071 struct conicsegment *t1_Conic(); 
00072 struct conicsegment *t1_RoundConic(); 
00073 struct conicsegment *t1_ArcP3(); 
00074 struct conicsegment *t1_ArcCA(); 
00075 struct beziersegment *t1_Bezier(); 
00076 struct hintsegment *t1_Hint(); 
00077 struct segment *t1_Reverse(); 
00078 struct segment *t1_ReverseSubPaths(); 
00079 struct segment *t1_SubLoc(); 
00080 struct segment *t1_DropSegment(); 
00081 struct segment *t1_HeadSegment();
00082 void t1_QueryLoc();           
00083 void t1_QueryPath();          
00084 void t1_QueryBounds();        
00085 
00086 */
00087 /*END SHARED*/
00088 /*SHARED*/
00089  
00090 #define   CopyPath(p)             t1_CopyPath(p)
00091 #define   KillPath(p)             t1_KillPath(p)
00092 #define   PathTransform(p,m)      t1_PathXform(p,m)
00093 #define   PathDelta(p,pt)         t1_PathDelta(p,pt)
00094 #define   BoundingBox(h,w)        t1_BoundingBox(h,w)
00095 #define   PathSegment(t,x,y)      t1_PathSegment(t,(fractpel)x,(fractpel)y)
00096 #define   JoinSegment(b,t,x,y,a)  t1_JoinSegment(b,t,(fractpel)x,(fractpel)y,a)
00097 #define   Hypoteneuse(dx,dy)      t1_Hypoteneuse(dx,dy)
00098 #define   BoxPath(S,h,w)          t1_BoxPath(S,h,w)
00099  
00100 struct segment *t1_CopyPath(); /* duplicate a path                            */
00101 void t1_KillPath();           /* destroy a path                               */
00102 struct segment *t1_PathXform();  /* transform a path arbitrarily              */
00103 void t1_PathDelta();          /* calculate the ending point of a path         */
00104 struct segment *t1_PathSegment(); /* produce a MOVE or LINE segment           */
00105 struct segment *t1_JoinSegment(); /* join a MOVE or LINE segment to a path    */
00106 DOUBLE t1_Hypoteneuse();      /* returns the length of a line                 */
00107 struct segment *t1_BoxPath();   /* returns a rectangular path                 */
00108  
00109 /*END SHARED*/
00110 /*SHARED*/
00111  
00112 #define    ConsumePath(p)    MAKECONSUME(p,KillPath(p))
00113 #define    UniquePath(p)     MAKEUNIQUE(p,CopyPath(p))
00114  
00115 /*END SHARED*/
00116 /*SHARED*/
00117  
00118 struct segment {
00119        XOBJ_COMMON     /* xobject common data define 3-26-91 PNM             */
00120        unsigned char size;   /* size of the structure                        */
00121        unsigned char context;  /* index to device context                    */
00122        struct segment *link; /* pointer to next structure in linked list     */
00123        struct segment *last; /* pointer to last structure in list            */
00124        struct fractpoint dest; /* relative ending location of path segment   */
00125 } ;
00126  
00127 #define   ISCLOSED(flag)   ((flag)&0x80)  /* subpath is closed               */
00128 #define   LASTCLOSED(flag) ((flag)&0x40)  /* last segment in closed subpath  */
00129  
00130 /*
00131 NOTE: The ISCLOSED flag is set on the MOVETYPE segment before the
00132 subpath proper; the LASTCLOSED flag is set on the last segment (LINETYPE)
00133 in the subpath
00134  
00135 We define the ISPATHANCHOR predicate to test that a path handle
00136 passed by the user is valid:
00137 */
00138  
00139 #define   ISPATHANCHOR(p)  (ISPATHTYPE(p->type)&&p->last!=NULL)
00140  
00141 /*
00142 For performance reasons, a user's "location" object is identical to
00143 a path whose only segment is a move segment.  We define a predicate
00144 to test for this case.  See also :hdref refid=location..
00145 */
00146  
00147 #define   ISLOCATION(p)    ((p)->type == MOVETYPE && (p)->link == NULL)
00148  
00149 /*END SHARED*/
00150 /*SHARED*/
00151  
00152 struct conicsegment {
00153        XOBJ_COMMON          /* xobject common data define 3-26-91 PNM        */
00154                             /* type = CONICTYPE                             */
00155        unsigned char size;   /* as with any 'segment' type                   */
00156        unsigned char context;  /* as with any 'segment' type                 */
00157        struct segment *link; /* as with any 'segment' type                   */
00158        struct segment *last; /* as with any 'segment' type                   */
00159        struct fractpoint dest;  /* Ending point (C point)                    */
00160        struct fractpoint M;  /* "midpoint" of conic explained above          */
00161        float roundness;      /* explained above                              */
00162 } ;
00163 /*END SHARED*/
00164 /*SHARED*/
00165  
00166 struct beziersegment {
00167        XOBJ_COMMON           /* xobject common data define 3-26-91 PNM       */
00168                           /* type = BEZIERTYPE                       */
00169        unsigned char size;   /* as with any 'segment' type                   */
00170        unsigned char context;  /* as with any 'segment' type                 */
00171        struct segment *link; /* as with any 'segment' type                   */
00172        struct segment *last; /* as with any 'segment' type                   */
00173        struct fractpoint dest;  /* ending point (D)                          */
00174        struct fractpoint B;  /* control point B                              */
00175        struct fractpoint C;  /* control point C                              */
00176 } ;
00177  
00178 /*END SHARED*/
00179 /*SHARED*/
00180  
00181 struct hintsegment {
00182        XOBJ_COMMON            /* xobject common data define 3-26-91 PNM      */
00183                               /* type = HINTTYPE                    */
00184        unsigned char size;   /* size of the structure                        */
00185        unsigned char context;  /* device context                             */
00186        struct segment *link; /* pointer to next structure in linked list     */
00187        struct segment *last; /* pointer to last structure in list            */
00188        struct fractpoint dest; /* ALWAYS 0,0                                 */
00189        struct fractpoint ref;
00190        struct fractpoint width;
00191        char orientation;
00192        char hinttype;
00193        char adjusttype;
00194        char direction;
00195        int label;
00196 } ;
00197  
00198 /*END SHARED*/
00199 /*SHARED*/
00200  
00201 /*
00202 CONCAT links the 'p2' path chain on the end of the 'p1' chain.  (This macro
00203 is also used by the STROKES module.)
00204 */
00205 #define  CONCAT(p1, p2)  { \
00206        (struct segment *)(p1)->last->link = (struct segment *)p2;   \
00207        (struct segment *)(p1)->last = p2->last;   \
00208        (struct segment *)(p2)->last = NULL; }    
00209  
00210 /*END SHARED*/