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