transform.h revision 2ddb6cf1
1a1d141d5Smrg/* 2a1d141d5Smrg * header file for transformed coordinate system. No rotations 3a1d141d5Smrg * supported, as elipses cannot be rotated in X. 4a1d141d5Smrg */ 5a1d141d5Smrg/* $XFree86$ */ 6a1d141d5Smrg 7a1d141d5Smrgtypedef struct _transform { 8a1d141d5Smrg double mx, bx; 9a1d141d5Smrg double my, by; 10a1d141d5Smrg} Transform; 11a1d141d5Smrg 12a1d141d5Smrgtypedef struct _TPoint { 13a1d141d5Smrg double x, y; 14a1d141d5Smrg} TPoint; 15a1d141d5Smrg 16a1d141d5Smrgtypedef struct _TRectangle { 17a1d141d5Smrg double x, y, width, height; 18a1d141d5Smrg} TRectangle; 19a1d141d5Smrg 20a1d141d5Smrg# define Xx(x,y,t) ((int)((t)->mx * (x) + (t)->bx + 0.5)) 21a1d141d5Smrg# define Xy(x,y,t) ((int)((t)->my * (y) + (t)->by + 0.5)) 22a1d141d5Smrg# define Xwidth(w,h,t) ((int)((t)->mx * (w) + 0.5)) 23a1d141d5Smrg# define Xheight(w,h,t) ((int)((t)->my * (h) + 0.5)) 24a1d141d5Smrg# define Tx(x,y,t) ((((double) (x)) - (t)->bx) / (t)->mx) 25a1d141d5Smrg# define Ty(x,y,t) ((((double) (y)) - (t)->by) / (t)->my) 26a1d141d5Smrg# define Twidth(w,h,t) (((double) (w)) / (t)->mx) 27a1d141d5Smrg# define Theight(w,h,t) (((double) (h)) / (t)->my) 28a1d141d5Smrg 292ddb6cf1Smrgextern void Trectangle (const Transform *t, const TRectangle *in, TRectangle *out); 30a1d141d5Smrgextern void SetTransform (Transform *t, 31a1d141d5Smrg int xx1, int xx2, int xy1, int xy2, 32a1d141d5Smrg double tx1, double tx2, double ty1, double ty2); 33