void PrTransform::Xform( const PrVector& rhs, PrVector& dest ) const { PrVector6 tmpRhs(rhs); PrVector6 tmpDest; Xform( tmpRhs, tmpDest ); dest = tmpDest; }
struct XYspace * Context(pointer device, /* device token */ double units) /* multiples of one inch */ { double M[2][2]; /* device transformation matrix */ register int n; /* will hold device context number */ register struct XYspace *S; /* XYspace constructed */ ARGCHECK((device == NULL), "Context of NULLDEVICE not allowed", NULL, IDENTITY, (0), struct XYspace *); ARGCHECK((units == 0.0), "Context: bad units", NULL, IDENTITY, (0), struct XYspace *); n = FindDeviceContext(device); LONGCOPY(M, contexts[n].normal, sizeof(M)); M[0][0] *= units; M[0][1] *= units; M[1][0] *= units; M[1][1] *= units; S = (struct XYspace *)Xform(IDENTITY, M); S->context = n; return(S); }
struct xobject *t1_Xform( register struct xobject *obj, /* object to transform */ register DOUBLE M[2][2]) /* transformation matrix */ { if (obj == NULL) return(NULL); if (obj->type == FONTTYPE) { register struct font *F = (struct font *) obj; F = UniqueFont(F); return((struct xobject*)F); } if (obj->type == PICTURETYPE) { /* In the case of a picture, we choose both to update the picture's transformation matrix and keep the handles up to date. */ register struct picture *P = (struct picture *) obj; register struct segment *handles; /* temporary path to transform handles */ P = UniquePicture(P); handles = PathSegment(LINETYPE, P->origin.x, P->origin.y); handles = Join(handles, PathSegment(LINETYPE, P->ending.x, P->ending.y) ); handles = (struct segment *)Xform((struct xobject *) handles, M); P->origin = handles->dest; P->ending = handles->link->dest; KillPath(handles); return((struct xobject *)P); } if (ISPATHTYPE(obj->type)) { struct XYspace pseudo; /* local temporary space */ PseudoSpace(&pseudo, M); return((struct xobject *) PathTransform((struct segment *)obj, &pseudo)); } if (obj->type == SPACETYPE) { register struct XYspace *S = (struct XYspace *) obj; /* replaced ISPERMANENT(S->flag) with S->references > 1 3-26-91 PNM */ if (S->references > 1) S = CopySpace(S); else S->ID = NEXTID; MatrixMultiply(S->tofract.normal, M, S->tofract.normal); /* * mark inverted matrix invalid: */ S->flag &= ~HASINVERSE(ON); FillOutFcns(S); return((struct xobject *) S); } return(ArgErr("Untransformable object", obj, obj)); }
struct XYspace *Context( void *device, /* device token */ DOUBLE units) /* multiples of one inch */ { DOUBLE M[2][2]; /* device transformation matrix */ register int n; /* will hold device context number */ register struct XYspace *S; /* XYspace constructed */ IfTrace2((MustTraceCalls),"Context(%p, %f)\n", device, units); ARGCHECK((device == NULL), "Context of NULLDEVICE not allowed", NULL, IDENTITY, (0), struct XYspace *); ARGCHECK((units == 0.0), "Context: bad units", NULL, IDENTITY, (0), struct XYspace *); n = FindDeviceContext(device); INT32COPY(M, contexts[n].normal, sizeof(M)); M[0][0] *= units; M[0][1] *= units; M[1][0] *= units; M[1][1] *= units; S = (struct XYspace *)Xform(IDENTITY, M); S->context = n; return(S); }
struct xobject * xiRotate(struct xobject *obj, /* object to be transformed */ double degrees) /* degrees of COUNTER-clockwise rotation */ { double M[2][2]; M[0][0] = M[1][1] = DegreeCos(degrees); M[1][0] = - (M[0][1] = DegreeSin(degrees)); ConsiderContext(obj, M); return(Xform(obj, M)); }
struct xobject * t1_Scale(struct xobject *obj, /* object to scale */ double sx, double sy) /* scale factors in x and y */ { double M[2][2]; M[0][0] = sx; M[1][1] = sy; M[1][0] = M[0][1] = 0.0; ConsiderContext(obj, M); return(Xform(obj, M)); }
struct xobject *t1_Scale( struct xobject *obj, /* object to scale */ DOUBLE sx, DOUBLE sy) /* scale factors in x and y */ { DOUBLE M[2][2]; IfTrace3((MustTraceCalls),"Scale(%p, %f, %f)\n", obj, sx, sy); M[0][0] = sx; M[1][1] = sy; M[1][0] = M[0][1] = 0.0; ConsiderContext(obj, M); return(Xform(obj, M)); }
/* :h3.Transform() - Transform an Object This is the external user's entry point. */ struct xobject * t1_Transform(struct xobject *obj, double cxx, double cyx, /* 2x2 transform matrix elements */ double cxy, double cyy) /* in row order */ { double M[2][2]; M[0][0] = cxx; M[0][1] = cyx; M[1][0] = cxy; M[1][1] = cyy; ConsiderContext(obj, M); return(Xform(obj, M)); }
struct xobject *xiRotate( struct xobject *obj, /* object to be transformed */ DOUBLE degrees) /* degrees of COUNTER-clockwise rotation */ { DOUBLE M[2][2]; IfTrace2((MustTraceCalls),"Rotate(%p, %f)\n", obj, degrees); M[0][0] = M[1][1] = DegreeCos(degrees); M[1][0] = - (M[0][1] = DegreeSin(degrees)); ConsiderContext(obj, M); return(Xform(obj, M)); }
/* :h3.Transform() - Transform an Object This is the external user's entry point. */ struct xobject *t1_Transform( struct xobject *obj, DOUBLE cxx, DOUBLE cyx, /* 2x2 transform matrix ... */ DOUBLE cxy, DOUBLE cyy) /* ... elements in row order */ { DOUBLE M[2][2]; IfTrace1((MustTraceCalls),"Transform(%p,", obj); IfTrace4((MustTraceCalls)," %f %f %f %f)\n", cxx, cyx, cxy, cyy); M[0][0] = cxx; M[0][1] = cyx; M[1][0] = cxy; M[1][1] = cyy; ConsiderContext(obj, M); return(Xform(obj, M)); }