Back to index

tetex-bin  3.0
spaces_rmz.h
Go to the documentation of this file.
00001 /* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 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 #define   USER                       t1_User
00034 #define   IDENTITY                   t1_Identity
00035  
00036 #define   Context(d,u)               t1_Context(d,u)
00037 /*
00038 #define   Transform(o,f1,f2,f3,f4)   t1_Transform(o,f1,f2,f3,f4)
00039 */
00040 #define   Rotate(o,d)                t1_Rotate(o,d)
00041 /*
00042 #define   Scale(o,sx,sy)             t1_Scale(o,sx,sy)
00043 */
00044 #define   QuerySpace(S,f1,f2,f3,f4)  t1_QuerySpace(S,f1,f2,f3,f4)
00045 #define   Warp(s1,o,s2)              t1_Warp(s1,o,s2)
00046  
00047 struct XYspace *t1_Context(); /* creates a coordinate space for a device      */
00048 struct xobject *t1_Transform();  /* transform an object                       */
00049 struct xobject *t1_Rotate();  /* rotate an object                             */
00050 /*
00051 struct xobject *t1_Scale(); */  /* scale an object                              */
00052 struct xobject *t1_Warp();    /* transform like delta of two spaces           */
00053 void t1_QuerySpace();         /* returns coordinate space matrix              */
00054  
00055 /*END SHARED*/
00056 /*SHARED*/
00057  
00058 #define   DeviceResolution   t1_DeviceResolution
00059 #define   InitSpaces()       t1_InitSpaces()
00060 #define   CopySpace(s)       t1_CopySpace(s)
00061 #define   Xform(o,M)         t1_Xform(o,M)
00062 #define   UnConvert(S,pt,xp,yp)    t1_UnConvert(S,pt,xp,yp)
00063 #define   MatrixMultiply(A,B,C)    t1_MMultiply(A,B,C)
00064 #define   MatrixInvert(A,B)        t1_MInvert(A,B)
00065 #define   PseudoSpace(S,M)   t1_PseudoSpace(S,M)
00066 #define   FindContext(M)     t1_FindContext(M)
00067  
00068 void t1_InitSpaces();         /* initialize pre-defined coordinate spaces     */
00069 struct XYspace *t1_CopySpace(); /* duplicate a coordinate space               */
00070 struct xobject *t1_Xform();   /* transform object by matrix                   */
00071 void t1_UnConvert();          /* return user coordinates from device coordinates */
00072 void t1_MMultiply();          /* multiply two matrices                        */
00073 void t1_MInvert();            /* invert a matrix                              */
00074 void t1_PseudoSpace();        /* force a coordinate space from a matrix       */
00075 int t1_FindContext();         /* return the "context" represented by a matrix */
00076  
00077 /*END SHARED*/
00078 /*SHARED*/
00079  
00080 /* #define    KillSpace(s)     Free(s)
00081 Note - redefined KillSpace() to check references !
00082 3-26-91 PNM */
00083  
00084 #define KillSpace(s)      if ( (--(s->references) == 0) ||\
00085                       ( (s->references == 1) && ISPERMANENT(s->flag) ) )\
00086                         Free(s)
00087  
00088 #define    ConsumeSpace(s)  MAKECONSUME(s,KillSpace(s))
00089 #define    UniqueSpace(s)   MAKEUNIQUE(s,CopySpace(s))
00090  
00091 /*END SHARED*/
00092 /*SHARED*/
00093  
00094 typedef SHORT pel;           /* integer pel locations                        */
00095 typedef LONG fractpel;       /* fractional pel locations                     */
00096  
00097 #define   FRACTBITS     16   /* number of fractional bits in 'fractpel'      */
00098 /*
00099 We define the following macros to convert from 'fractpel' to 'pel' and
00100 vice versa:
00101 */
00102 #define   TOFRACTPEL(p)   (((fractpel)p)<<FRACTBITS)
00103 #define   FPHALF          (1<<(FRACTBITS-1))
00104 #define   NEARESTPEL(fp)  (((fp)+FPHALF)>>FRACTBITS)
00105 #define   FRACTFLOAT   (DOUBLE)(1L<<FRACTBITS)
00106  
00107 /*END SHARED*/
00108 /*SHARED*/
00109  
00110 struct doublematrix {
00111        DOUBLE normal[2][2];
00112        DOUBLE inverse[2][2];
00113 } ;
00114  
00115 /*END SHARED*/
00116 /*SHARED*/
00117  
00118 struct XYspace {
00119        XOBJ_COMMON           /* xobject common data define 3-26-91 PNM       */
00120                           /* type = SPACETYPE                       */
00121        int (*convert)();     /* calculate "fractpoint" X,Y from float X,Y    */
00122        int (*iconvert)();    /* calculate "fractpoint" X,Y from int X,Y      */
00123        fractpel (*xconvert)();  /* subroutine of convert                     */
00124        fractpel (*yconvert)();  /* subroutine of convert                     */
00125        fractpel (*ixconvert)();  /* subroutine of iconvert                   */
00126        fractpel (*iyconvert)();  /* subroutine of iconvert                   */
00127        int ID;               /* unique identifier (used in font caching)     */
00128        unsigned char context;  /* device context of coordinate space         */
00129        struct doublematrix tofract;  /* xform to get to fractional pels      */
00130        fractpel itofract[2][2];  /* integer version of "tofract.normal"      */
00131 } ;
00132  
00133 #define    INVALIDID  0      /* no valid space will have this ID             */
00134  
00135 /*END SHARED*/
00136 /*SHARED*/
00137  
00138 struct fractpoint {
00139        fractpel x,y;
00140 } ;
00141  
00142 /*END SHARED*/
00143 /*SHARED*/
00144  
00145 #define  NULLCONTEXT   0
00146  
00147 /*END SHARED*/