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