1
/* $XConsortium: spaces.h,v 1.3 91/10/10 11:19:22 rws 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
34
#define IDENTITY t1_Identity
36
#define Context(d,u) t1_Context(d,u)
38
#define Transform(o,f1,f2,f3,f4) t1_Transform(o,f1,f2,f3,f4)
40
#define Rotate(o,d) t1_Rotate(o,d)
42
#define Scale(o,sx,sy) t1_Scale(o,sx,sy)
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)
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 */
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 */
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)
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 */
80
/* #define KillSpace(s) Free(s)
81
Note - redefined KillSpace() to check references !
84
#define KillSpace(s) if ( (--(s->references) == 0) ||\
85
( (s->references == 1) && ISPERMANENT(s->flag) ) )\
88
#define ConsumeSpace(s) MAKECONSUME(s,KillSpace(s))
89
#define UniqueSpace(s) MAKEUNIQUE(s,CopySpace(s))
94
typedef SHORT pel; /* integer pel locations */
95
typedef LONG fractpel; /* fractional pel locations */
97
#define FRACTBITS 16 /* number of fractional bits in 'fractpel' */
99
We define the following macros to convert from 'fractpel' to 'pel' and
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)
110
struct doublematrix {
112
DOUBLE inverse[2][2];
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" */
133
#define INVALIDID 0 /* no valid space will have this ID */
145
#define NULLCONTEXT 0