/* * GRAPH, Version 1.00 - 4 August 1989 * * Copyright 1989, David Gay. All Rights Reserved. * This software is freely redistrubatable. */ /* Set up a coordinate system in a Rastport */ #ifndef COORDS_H #define COORDS_H /* The class used */ struct RWindow { struct RastPort *rp; /* The rastport associated woth this coord system */ /* The methods : */ void (*delete)(struct RWindow *this); /* Do a Movw/Draw, checks for overflow, etc */ void (*rdo)(struct RWindow *this, void (*func)(struct RastPort *rp, long sx , long sy), double x, double y); double (*sx)(struct RWindow *this, double x); /* real coords -> rastport co ords */ double (*sy)(struct RWindow *this, double y); double (*x)(struct RWindow *this, long sx); /* rastport coords -> real co ords */ double (*y)(struct RWindow *this, long sy); }; /* Create a coordinate system in Rastport rp (w by h pixels), {x,y}{min,max}offset : offset in rp at which coords starts (normally > 0) {x,y}{min,max} : limits for coords logx, logy : logarithmic scale ? clip : setup clipping to {x,y}{min,max}offset boundaries ? */ struct RWindow *new_RWindow(struct RastPort *rp, long w, long h, long xminoffset, long yminoffset, long xmaxoffset, long ymaxoffset, double xmin, double ymin, double xmax, double ymax, long logx, long logy, long clip); long ftol(double x); /* convert double to integer, round down. cf floor */ extern void Move(), BigDraw(); /* Easy calling for Move, Draw in real coords */ #define RMove(rwin, x, y) ((rwin)->rdo((rwin), Move, (x), (y))) #define RDraw(rwin, x, y) ((rwin)->rdo((rwin), BigDraw, (x), (y))) #endif