transform.h revision 6ea72052
1/* $Xorg: transform.h,v 1.4 2001/02/09 02:05:33 xorgcvs Exp $ */ 2/* 3 4Copyright 1993, 1998 The Open Group 5 6Permission to use, copy, modify, distribute, and sell this software and its 7documentation for any purpose is hereby granted without fee, provided that 8the above copyright notice appear in all copies and that both that 9copyright notice and this permission notice appear in supporting 10documentation. 11 12The above copyright notice and this permission notice shall be included 13in all copies or substantial portions of the Software. 14 15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 16OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 19OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 20ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 21OTHER DEALINGS IN THE SOFTWARE. 22 23Except as contained in this notice, the name of The Open Group shall 24not be used in advertising or otherwise to promote the sale, use or 25other dealings in this Software without prior written authorization 26from The Open Group. 27 28*/ 29/* $XFree86: xc/programs/oclock/transform.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ 30 31 32/* 33 * header file for transformed coordinate system. No rotations 34 * supported, as elipses cannot be rotated in X. 35 */ 36 37typedef struct _transform { 38 double mx, bx; 39 double my, by; 40} Transform; 41 42typedef struct _TPoint { 43 double x, y; 44} TPoint; 45 46typedef struct _TRectangle { 47 double x, y, width, height; 48} TRectangle; 49 50# define Xx(x,y,t) ((int)((t)->mx * (x) + (t)->bx + 0.5)) 51# define Xy(x,y,t) ((int)((t)->my * (y) + (t)->by + 0.5)) 52# define Xwidth(w,h,t) ((int)((t)->mx * (w) + 0.5)) 53# define Xheight(w,h,t) ((int)((t)->my * (h) + 0.5)) 54# define Tx(x,y,t) ((((double) (x)) - (t)->bx) / (t)->mx) 55# define Ty(x,y,t) ((((double) (y)) - (t)->by) / (t)->my) 56# define Twidth(w,h,t) (((double) (w)) / (t)->mx) 57# define Theight(w,h,t) (((double) (h)) / (t)->my) 58 59extern void TFillPolygon ( Display *dpy, Drawable d, GC gc, Transform *t, 60 TPoint *points, int n_points, int shape, int mode ); 61extern void TDrawArc ( Display *dpy, Drawable d, GC gc, Transform *t, 62 double x, double y, double width, double height, 63 int angle1, int angle2 ); 64extern void TFillArc ( Display *dpy, Drawable d, GC gc, Transform *t, 65 double x, double y, double width, double height, 66 int angle1, int angle2 ); 67extern void SetTransform ( Transform *t, int xx1, int xx2, int xy1, int xy2, 68 double tx1, double tx2, double ty1, double ty2 ); 69