~ubuntu-branches/ubuntu/karmic/grace/karmic

« back to all changes in this revision

Viewing changes to T1lib/type1/spaces_rmz.h

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-19 14:19:58 UTC
  • Revision ID: james.westby@ubuntu.com-20020319141958-5gxna6vo1ek3zjml
Tags: upstream-5.1.7
ImportĀ upstreamĀ versionĀ 5.1.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 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
#include "types.h"
 
32
 
 
33
#define   USER                       t1_User
 
34
#define   IDENTITY                   t1_Identity
 
35
 
 
36
#define   Context(d,u)               t1_Context(d,u)
 
37
/*
 
38
#define   Transform(o,f1,f2,f3,f4)   t1_Transform(o,f1,f2,f3,f4)
 
39
*/
 
40
#define   Rotate(o,d)                t1_Rotate(o,d)
 
41
/*
 
42
#define   Scale(o,sx,sy)             t1_Scale(o,sx,sy)
 
43
*/
 
44
#define   QuerySpace(S,f1,f2,f3,f4)  t1_QuerySpace(S,f1,f2,f3,f4)
 
45
#define   Warp(s1,o,s2)              t1_Warp(s1,o,s2)
 
46
 
 
47
struct XYspace *t1_Context(); /* creates a coordinate space for a device      */
 
48
struct xobject *t1_Transform();  /* transform an object                       */
 
49
struct xobject *t1_Rotate();  /* rotate an object                             */
 
50
/*
 
51
struct xobject *t1_Scale(); */  /* scale an object                              */
 
52
struct xobject *t1_Warp();    /* transform like delta of two spaces           */
 
53
void t1_QuerySpace();         /* returns coordinate space matrix              */
 
54
 
 
55
/*END SHARED*/
 
56
/*SHARED*/
 
57
 
 
58
#define   DeviceResolution   t1_DeviceResolution
 
59
#define   InitSpaces()       t1_InitSpaces()
 
60
#define   CopySpace(s)       t1_CopySpace(s)
 
61
#define   Xform(o,M)         t1_Xform(o,M)
 
62
#define   UnConvert(S,pt,xp,yp)    t1_UnConvert(S,pt,xp,yp)
 
63
#define   MatrixMultiply(A,B,C)    t1_MMultiply(A,B,C)
 
64
#define   MatrixInvert(A,B)        t1_MInvert(A,B)
 
65
#define   PseudoSpace(S,M)   t1_PseudoSpace(S,M)
 
66
#define   FindContext(M)     t1_FindContext(M)
 
67
 
 
68
void t1_InitSpaces();         /* initialize pre-defined coordinate spaces     */
 
69
struct XYspace *t1_CopySpace(); /* duplicate a coordinate space               */
 
70
struct xobject *t1_Xform();   /* transform object by matrix                   */
 
71
void t1_UnConvert();          /* return user coordinates from device coordinates */
 
72
void t1_MMultiply();          /* multiply two matrices                        */
 
73
void t1_MInvert();            /* invert a matrix                              */
 
74
void t1_PseudoSpace();        /* force a coordinate space from a matrix       */
 
75
int t1_FindContext();         /* return the "context" represented by a matrix */
 
76
 
 
77
/*END SHARED*/
 
78
/*SHARED*/
 
79
 
 
80
/* #define    KillSpace(s)     Free(s)
 
81
Note - redefined KillSpace() to check references !
 
82
3-26-91 PNM */
 
83
 
 
84
#define KillSpace(s)      if ( (--(s->references) == 0) ||\
 
85
                      ( (s->references == 1) && ISPERMANENT(s->flag) ) )\
 
86
                        Free(s)
 
87
 
 
88
#define    ConsumeSpace(s)  MAKECONSUME(s,KillSpace(s))
 
89
#define    UniqueSpace(s)   MAKEUNIQUE(s,CopySpace(s))
 
90
 
 
91
/*END SHARED*/
 
92
/*SHARED*/
 
93
 
 
94
typedef SHORT pel;           /* integer pel locations                        */
 
95
typedef LONG fractpel;       /* fractional pel locations                     */
 
96
 
 
97
#define   FRACTBITS     16   /* number of fractional bits in 'fractpel'      */
 
98
/*
 
99
We define the following macros to convert from 'fractpel' to 'pel' and
 
100
vice versa:
 
101
*/
 
102
#define   TOFRACTPEL(p)   (((fractpel)p)<<FRACTBITS)
 
103
#define   FPHALF          (1<<(FRACTBITS-1))
 
104
#define   NEARESTPEL(fp)  (((fp)+FPHALF)>>FRACTBITS)
 
105
#define   FRACTFLOAT   (DOUBLE)(1L<<FRACTBITS)
 
106
 
 
107
/*END SHARED*/
 
108
/*SHARED*/
 
109
 
 
110
struct doublematrix {
 
111
       DOUBLE normal[2][2];
 
112
       DOUBLE inverse[2][2];
 
113
} ;
 
114
 
 
115
/*END SHARED*/
 
116
/*SHARED*/
 
117
 
 
118
struct XYspace {
 
119
       XOBJ_COMMON           /* xobject common data define 3-26-91 PNM       */
 
120
                             /* type = SPACETYPE                             */
 
121
       int (*convert)();     /* calculate "fractpoint" X,Y from float X,Y    */
 
122
       int (*iconvert)();    /* calculate "fractpoint" X,Y from int X,Y      */
 
123
       fractpel (*xconvert)();  /* subroutine of convert                     */
 
124
       fractpel (*yconvert)();  /* subroutine of convert                     */
 
125
       fractpel (*ixconvert)();  /* subroutine of iconvert                   */
 
126
       fractpel (*iyconvert)();  /* subroutine of iconvert                   */
 
127
       int ID;               /* unique identifier (used in font caching)     */
 
128
       unsigned char context;  /* device context of coordinate space         */
 
129
       struct doublematrix tofract;  /* xform to get to fractional pels      */
 
130
       fractpel itofract[2][2];  /* integer version of "tofract.normal"      */
 
131
} ;
 
132
 
 
133
#define    INVALIDID  0      /* no valid space will have this ID             */
 
134
 
 
135
/*END SHARED*/
 
136
/*SHARED*/
 
137
 
 
138
struct fractpoint {
 
139
       fractpel x,y;
 
140
} ;
 
141
 
 
142
/*END SHARED*/
 
143
/*SHARED*/
 
144
 
 
145
#define  NULLCONTEXT   0
 
146
 
 
147
/*END SHARED*/