/* ___________________________ A graphics header file of simple graphics functions. Author: John E. Howland, Ph.D. Department of Computer Science Trinity University 715 Stadium Drive San Antonio, Texas 78212 Voice: (512) 736-7480 Fax: (512) 694-0125 Bitnet: jhowland@trinity.edu Last Change: 900903 (Added some functionality for SGRP) */ #include /* ______________________________________________________________ constants */ #define PLAIN_WINDOW 0 /* plain WindowFrame style */ #define DROP_SHADOW_WINDOW 1 /* drop shadow WindowFrame style */ #define TICKLENGTH 6 /* size, in pixels of a tick mark */ #define MARKER_SIZE 2 /* default MarkerSize */ #define MARKER_CIRCLE 0 /* circle MarkerStyle */ #define MARKER_SQUARE 1 /* square MarkerStyle */ #define LINE_WIDTH 1 /* default LineWidth */ #define CONTINUOUS 0 /* default LineStyle (continuous) */ #define DASHED 1 /* dashed LineStyle */ #define DOTTED 2 /* dotted LineStyle */ /* ______________________________________________________________ types and globals */ typedef double Xform[3][3]; /* the transform type */ typedef struct /* a rectangle in world coordinates */ { double top, left, bottom, right; } windRect ; Rect _viewport; /* the viewport */ windRect _window; /* the window */ double _windowCenterx, _windowCentery; short _viewportCenterx, _viewportCentery; double _scalex, _scaley;/* the x and y scale factors */ double _cx, _cy; /* the graphics cursor location(world) */ GrafPtr gOldPort; /* the previous (console) GrafPtr */ Boolean gPreserveAspectRatio = FALSE; /* Don't preserve aspect ratio */ short gWindowFrame = PLAIN_WINDOW; /* default window or viewport frame */ short gMarkerSize = MARKER_SIZE; /* default MarkerSize in pixels */ short gMarkerStyle = MARKER_CIRCLE; /* default MarkerStyle (circle) */ short gLineWidth = LINE_WIDTH; /* default Line Width 1 */ short gLineStyle = CONTINUOUS; /* Line Style */ /* ______________________________________________________________ function prototypes */ void initToolboxManagers(void); WindowPtr makeDrawingWindow(char *name, int left, int top, int right, int bottom); void disposeDrawingWindow(WindowPtr wPtr, int sec); void setScale(void); void setWindow(double top, double left, double bottom, double right); void setViewport(short top, short left, short bottom, short right); void view(double x, double y, short *viewx, short *viewy); void FrameViewport(void); void FrameWindow(void); void waitForKey(void); void waitForMouse(void); void eraseConsole(void); void circle(double x, double y, double r); void label(char *s); void point(double x, double y); void verticalTickMark(double x, double y, char *str); void horizontalTickMark(double x, double y, char *str); void scale(double sx, double sy, Xform transMatrix); void translate(double tx, double ty, Xform transMatrix); void rotate(double theta, Xform transMatrix); void multXform(Xform x, Xform y, Xform z); void printXform(Xform xform); void transformObject(int n, double object[][3], Xform xform, double result[][3]); void printObject(int n, double object[][3]); Boolean readObject(int *n, double object[][3]); void centerObject(int n, double object[][3], double *xcenter, double *ycenter); void drawObject(int n, double object[][3]); Boolean getInteger(int *x); Boolean getDoubleFloat(double *x); void plotBar(double x, double y); void plotPoint(double x, double y); void eraseViewport(void); void eraseWindow(void); /* These are the normal QuickDraw functions void LineTo(int x, int y); void Line(int dx, int dy); void MoveTo(int x, int y); void Move(int dx, int dy); */ void lineto(double x, double y); void line(double dx, double dy); void moveto(double x, double y); void move(double dx, double dy); void drawline(double x, double y, double x1, double y1); void SRGP_lineCoord(short x1, short y1, short x2, short y2); void SRGP_line(Point pt1, Point pt2); void SRGP_polyLineCoord(short vertexCount, short xArray[], short yArray[]); void SRGP_polyLine(short vertexCount, Point vertexList[]); void SRGP_setMarkerSize(short value); void SRGP_setMarkerStyle(short value); void SRGP_markerCoord(short x, short y); void SRGP_marker(Point pt); void SRGP_polyMarkerCoord(short vertexCount, short xArray[], short yArray[]); void SRGP_polyMarker(short vertexCount, Point vertexList[]); void SRGP_rectangleCoord(short leftX, short leftY, short rightX, short rightY); void SRGP_rectanglePt(Point bottomLeft, Point topRight); void SRGP_rectangle(Rect *rectangle); void SRGP_defPoint(short x, short y, Point *pt); void SRGP_defRectangle(short leftX, short leftY, short rightX, short rightY, Rect *rectangle); void SRGP_ellipseArc(Rect *extentRect, double startAngle, double endAngle); void SRGP_setLineStyle(short value); void SRGP_setLineWidth(short value);