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