1 /*****************************************************************************
2 ** This is part of the CTSim program
3 ** Copyright (C) 1983-2000 Kevin Rosenberg
5 ** $Id: sgp.h,v 1.4 2000/04/30 19:17:35 kevin Exp $
7 ** Revision 1.4 2000/04/30 19:17:35 kevin
8 ** Set up include files for conditional INTERACTIVE_GRAPHICS
10 ** Revision 1.3 2000/04/28 18:35:21 kevin
11 ** removed unused files
13 ** Revision 1.2 2000/04/28 14:14:16 kevin
14 ** *** empty log message ***
17 ** This program is free software; you can redistribute it and/or modify
18 ** it under the terms of the GNU General Public License (version 2) as
19 ** published by the Free Software Foundation.
21 ** This program is distributed in the hope that it will be useful,
22 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
23 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 ** GNU General Public License for more details.
26 ** You should have received a copy of the GNU General Public License
27 ** along with this program; if not, write to the Free Software
28 ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 ******************************************************************************/
30 /*----------------------------------------------------------------------*/
31 /* Standard Graphics Package Header File */
32 /*----------------------------------------------------------------------*/
50 #define LS_SOLID 0xffff
51 #define LS_DASH1 0xff00
52 #define LS_DASH2 0xf0f0
53 #define LS_DASH3 0xcccc
54 #define LS_DASH4 0xff3e
55 #define LS_DOTTED 0xaaaa
63 int open; /* TRUE if device is open for output */
64 int xsize, ysize; /* Size of device in pixels */
65 int xmin, ymin; /* smallest coordinates */
66 int xmax, ymax; /* Maximum coordinates */
67 int colormax; /* Maximum color number of device */
68 int style; /* Current linestyle of device */
69 int width; /* Current width of device */
70 int color; /* Current color of device */
71 int icurx, icury; /* Current position */
72 int icwidth, icheight; /* Size of characters in pixels */
73 int cfore, cback; /* Character foregnd & backgnd colors */
74 float asp; /* Aspect ratio. Multipy x coord */
75 int (*dotfunc)(int x1, int y1, int color); /* Dot function for device */
76 int (*linefunc)(int x1, int y1, int x2, int y2, int color); /* Line function for device */
77 unsigned int nbytes; /* Size of buffer in bytes */
78 char *buf; /* Pointer to buffer */
79 unsigned int bufseg, bufoff; /* Buffer memory location */
80 int mode; /* Device mode */
84 float width, height; /* size of characters in NDC */
85 float textangle; /* text angle in radians */
86 float charupangle; /* character up angle */
87 int font; /* font for characters */
88 int updir, textdir; /* text direct & character orientation */
89 int fore, back; /* foreground & background color */
90 /* if back = -1, then transparent back */
94 int foregnd, backgnd; /* current foregound & background colors */
95 int linestyle; /* current 16 bit linestyle */
96 int linewidth; /* current width of line (in pixels) */
97 int marktype; /* current marker type */
98 int markcolor; /* current marker color */
99 float xndc, yndc; /* current position in NDC */
102 typedef struct device_st DEVICE;
103 typedef struct charsp_st CHARSPEC;
104 typedef struct state_st GRFSTATE;
106 struct point {double x, y, z;};
109 /******************************************************************
113 * Max R. Dursteler Dec 1983 *
114 * 12405 Village Square Terrace *
115 * Rockville Md. 20852 *
116 ******************************************************************
121 /* Flagcodes for motion directions */
122 #define XPLUS 001 /* right */
123 #define XMINUS 002 /* left */
124 #define YPLUS 004 /* up */
125 #define YMINUS 010 /* down */
127 /* Codes for marker symbols */
128 #define POINT 0 /* small dot */
129 #define SQUARE 1 /* empty square */
130 #define FSQUARE 2 /* filled square */
131 #define DIAMOND 3 /* empty diamond */
132 #define FDIAMOND 4 /* filled diamond */
133 #define CROSS 5 /* cross */
134 #define XCROSS 6 /* x */
135 #define CERCLE 7 /* open circle */
136 #define FCERCLE 8 /* filled circle */
137 #define BSQUARE 9 /* big open square */
138 #define BDIAMOND 10 /* big open diamond */
140 #define NMARKERS 11 /* Number of available symbol types */
142 /*-------------------------------------------------------------------------*/
144 #define PSET 0 /* codes for raster merging */
150 /*-------------------------------------------------------------------------*/
152 #define X_STKMIN 10 /* joystick specific values */
157 #define X_LOCMAX (X_STKMAX - X_STKMIN); /* range from readloc() */
158 #define Y_LOCMAX (Y_STKMAX - Y_STKMIN); /* = 0 to LOCMAX */
160 #define JOYSTK1 0 /* device names */
163 #define BUTT_DONE 2 /* Right joystick button to end a command */
164 #define BUTT_START 1 /* Left joystick button to start a command */
165 #define BUTT_BOTH 3 /* Both buttons pressed */
167 #define RL_ERROR -1 /* readloc() return codes */
171 /*-------------------------------------------------------------------------*/
179 typedef struct raster_st RASTER;
181 /*-------------------------------------------------------------------------*/
185 void circle(const double r);
186 void drawarc(double start, double stop, const double r);
188 int ctm_xlat_pre_2(double x, double y);
189 int ctm_xlat_post_2(double x, double y);
190 int ctm_scale_pre_2(double sx, double sy);
191 int ctm_scale_post_2(double sx, double sy);
192 int ctm_rotate_pre_2(double theta);
193 int ctm_rotate_post_2(double theta);
194 int ctm_shear_pre_2(double shrx, double shry);
195 int ctm_shear_post_2(double shrx, double shry);
196 int xlat_gmtx_2(GRFMTX_2D m, double x, double y);
197 int scale_gmtx_2(GRFMTX_2D m, double sx, double sy);
198 int shear_gmtx_2(GRFMTX_2D m, double shrx, double shry);
199 int rotate_gmtx_2(GRFMTX_2D m, double theta);
200 int ident_gmtx_2(GRFMTX_2D m);
201 int mult_gmtx_2(GRFMTX_2D a, GRFMTX_2D b, GRFMTX_2D c);
202 int invert_gmtx_2(GRFMTX_2D a, GRFMTX_2D b);
203 double determ_gmtx_2(GRFMTX_2D a);
205 int drawbox(double xmin, double ymin, double xmax, double ymax);
208 int window2(double xmin, double ymin, double xmax, double ymax);
209 int window_2(double xmin, double ymin, double xmax, double ymax);
210 int viewprt2(double xmin, double ymin, double xmax, double ymax);
211 int viewport_2(double xmin, double ymin, double xmax, double ymax);
213 int calc_wc_to_ndc(void);
214 int calc_ndc_to_mc(void);
215 int wc_to_ndc(double xw, double yw, double *xn, double *yn);
216 int ndc_to_wc(double xn, double yn, double *xw, double *yw);
218 int linestyle(int style);
219 int line_abs_2(double x, double y);
220 int lineabs2(double x, double y);
221 int move_abs_2(double x, double y);
222 int moveabs2(double x, double y);
223 int line_rel_2(double x, double y);
224 int linerel2(double x, double y);
225 int move_rel_2(double x, double y);
226 int moverel2(double x, double y);
227 int draw_text(char *message);
228 int drawtext(char *message);
229 int polylnabs2(double x[], double y[], int n);
230 int markabs2(double x, double y);
231 int markrel2(double x, double y);
232 int pntabs2(double x, double y);
233 int pntrel2(double x, double y);
235 int ctm_get_2(GRFMTX_2D m);
236 int ctm_set_2(GRFMTX_2D m);
237 int ctm_pre_mult_2(GRFMTX_2D m);
238 int ctm_post_mult_2(GRFMTX_2D m);
241 int initdevice(int dev, int mode, int xsize, int ysize);
242 int opendevice(int dev);
243 int closedevice(int dev);
244 int termdevice(int dev);
245 void stylus(double x, double y, int beam);
246 int pntndc(double x, double y);
247 int markndc(double x, double y);
248 GRFSTATE *inqstate(void);
249 int gp_set_aspect(int dev, double asp);
250 void setlinestyle(int style);
251 int setlinewidth(int wid);
252 DEVICE *inqdev(int dev);
253 int settext(double width, double height, double textangle, int font);
254 int settextclr(int fore, int back);
255 int setcolor(int fore);
256 int setbackg(int back);
257 int initmarker(int marker, int color);
258 int settextdir(int direction);
259 int charsize(double wid, double height);
260 int textangle(double angle);
261 int drivtext(char *message);
263 int flushdevice(int dev);
265 void wrtsymbol(int sym, int x, int y, DEVICE *dev);
266 void wrtchar(int ch, int x, int y, CHARSPEC *cspec, DEVICE *dev);
267 void wrttext(char txtstr[], int x, int y, CHARSPEC *cspec, DEVICE *dev);
268 void crtcolor(int mode, int *f, int *b);