r59: First functional version of SDF library for X-window
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 May 2000 22:48:17 +0000 (22:48 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 24 May 2000 22:48:17 +0000 (22:48 +0000)
include/ct.h
include/ezplot.h
include/ir.h
include/sgp.h

index 79c6ec871cfe72208da9667c9809ab451a9d7445..4d4ba757b4c90c745d20e39129eefe397073978e 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ct.h,v 1.5 2000/05/11 01:04:44 kevin Exp $
+**  $Id: ct.h,v 1.6 2000/05/24 22:48:17 kevin Exp $
 **  $Log: ct.h,v $
+**  Revision 1.6  2000/05/24 22:48:17  kevin
+**  First functional version of SDF library for X-window
+**
 **  Revision 1.5  2000/05/11 01:04:44  kevin
 **  Added Microsoft Windows compatibility
 **
@@ -11,7 +14,7 @@
 **  function renaming for phantoms and phantom elements
 **
 **  Revision 1.3  2000/04/30 19:17:35  kevin
-**  Set up include files for conditional INTERACTIVE_GRAPHICS
+**  Set up include files for conditional SGP
 **
 **  Revision 1.2  2000/04/28 14:14:16  kevin
 **  *** empty log message ***
@@ -53,6 +56,12 @@ typedef long off_t;
 #ifdef HAVE_PNG
 #include "png.h"
 #endif
+#ifdef HAVE_G2_H
+#include "g2.h"
+#ifdef HAVE_X11
+#include "g2_X11.h"
+#endif
+#endif
 #ifdef HAVE_STDIO_H
 #include <stdio.h>
 #endif
@@ -118,7 +127,7 @@ typedef long off_t;
 #include "ir.h"
 #include "keyboard.h"
 #include "cio.h"
-#ifdef HAVE_INTERACTIVE_GRAPHICS
+#ifdef HAVE_SGP
 #include "ezplot.h"
 #include "sgp.h"
 #endif
index 988c0534e5d02a3d04f7e801c6fda61c8c25405a..4494f01470613349566cc8a1e5f922588867fe5a 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ezplot.h,v 1.3 2000/05/07 12:46:19 kevin Exp $
+**  $Id: ezplot.h,v 1.4 2000/05/24 22:48:17 kevin Exp $
 **  $Log: ezplot.h,v $
+**  Revision 1.4  2000/05/24 22:48:17  kevin
+**  First functional version of SDF library for X-window
+**
 **  Revision 1.3  2000/05/07 12:46:19  kevin
 **  made c++ compatible
 **
@@ -326,16 +329,20 @@ extern bool ezplot_firstcall;   /* set to false on first call to EZSET or EZPLOT
 
 
 /* axis.c */
-int axis_scale(double min, double max, int nint, double *minp, double *maxp, int *nintp);
+int axis_scale (double min, double max, int nint, double *minp, double *maxp, int *nintp);
+
 /* ezplot.c */
-int ezplot(double x[], double y[], int num);
+SGP_ID ezplot(double x[], double y[], int num);
 void ezinit(void);
 void ezfree(void);
 void ezclear(void);
+
 /* ezplot1d.c */
 void ezplot_1d(double *y, int n);
+
 /* ezset.c */
 int ezset(char *command);
+
 /* makefmt.c */
 void make_numfmt(char *fmtstr, int *fldwid, int *nfrac, double min, double max, int nint);
 
index 08cdd1d9b2014381b8ecb8eb710ab8ece91ca943..cf8b6a09ff80573e945533e2101b6d7c1bf0b597 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: ir.h,v 1.15 2000/05/16 04:33:17 kevin Exp $
+**  $Id: ir.h,v 1.16 2000/05/24 22:48:17 kevin Exp $
 **  $Log: ir.h,v $
+**  Revision 1.16  2000/05/24 22:48:17  kevin
+**  First functional version of SDF library for X-window
+**
 **  Revision 1.15  2000/05/16 04:33:17  kevin
 **  Updated documentation
 **
@@ -420,7 +423,9 @@ IMAGE *image_create(const char *fname, const int nx, const int ny);
 int image_clear(IMAGE *im);
 int image_save(IMAGE *im);
 IMAGE *image_load(const char *fname);
-void image_filter_response(IMAGE *im, int domain, double bw, int filt_type, double filt_param, int opt_trace);
+void image_filter_response(IMAGE *im, const DomainType domain, double bw, const FilterType filt_type, double filt_param, const int opt_trace);
+int image_display (const IMAGE *im);
+int image_display_scale (const IMAGE *im, const int scale, const double pmin, const double pmax);
 
 /* options.c */
 int opt_set_trace(const char *optarg);
@@ -451,7 +456,7 @@ void calc_arc(double x[], double y[], const int pts, const double xcent, const d
 void calc_ellipse(double x[], double y[], const int pts, const double u, const double v);
 int circle_pts(double theta);
 void phm_print(PHANTOM *phm);
-#if HAVE_INTERACTIVE_GRAPHICS
+#if HAVE_SGP
 void phm_show(const PHANTOM *phm);
 void phm_draw(const PHANTOM *phm);
 #endif
index d913ede25d3f2ed589f39fdd3021104585d80e46..32671396ac548bc61ca6690255fea66cfcaa0c68 100644 (file)
@@ -2,8 +2,11 @@
 **  This is part of the CTSim program
 **  Copyright (C) 1983-2000 Kevin Rosenberg
 **
-**  $Id: sgp.h,v 1.6 2000/05/11 14:07:00 kevin Exp $
+**  $Id: sgp.h,v 1.7 2000/05/24 22:48:17 kevin Exp $
 **  $Log: sgp.h,v $
+**  Revision 1.7  2000/05/24 22:48:17  kevin
+**  First functional version of SDF library for X-window
+**
 **  Revision 1.6  2000/05/11 14:07:00  kevin
 **  Added support for Windows NT
 **
@@ -33,6 +36,7 @@
 **  along with this program; if not, write to the Free Software
 **  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ******************************************************************************/
+
 /*----------------------------------------------------------------------*/
 /*                Standard Graphics Package Header File                */
 /*----------------------------------------------------------------------*/
 #include "kstddef.h"
 #include "kmath.h"
 
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#if HAVE_G2_H
+#include "g2.h"
+#include "g2_X11.h"
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
@@ -70,6 +83,36 @@ extern "C" {
 
 /* data structures */
 
+struct sgp_window_st {
+    int pw_xsize;         /* Physical Window size */
+   int pw_ysize;
+   char title[256];
+   int g2_id;
+    double xw_min;    /* Window extents */
+    double yw_min;
+    double xw_max;
+    double yw_max;
+    double xv_min;    /* Viewport extents */
+    double yv_min;
+    double xv_max;
+    double yv_max;
+    double view[4];   /* Viewport array for clip_rect() */
+    double curx;      /* Current stylus position in world coords */
+    double cury;
+    int recalc_mc_to_ndc;
+    int recalc_ndc_to_mc;
+    GRFMTX_2D wc_to_ndc_x;     /* World coord to NDC matrix */
+    GRFMTX_2D mc_to_ndc_x;     /* Master to NDC */
+    GRFMTX_2D ndc_to_mc_x;     /* NDC to Master */
+    GRFMTX_2D ctm_2_x;        /* Current transfromation matrix */
+
+    int phys_curx;
+    int phys_cury;
+};
+
+typedef struct sgp_window_st SGP_WINDOW;
+typedef struct sgp_window_st *SGP_ID;
+
 struct device_st {
        int open;                       /* TRUE if device is open for output */
        int xsize, ysize;               /* Size of device in pixels */
@@ -117,16 +160,6 @@ typedef struct state_st GRFSTATE;
 struct point   {double x, y, z;};
 
 
-/******************************************************************
- *                                                               *
- *   GRAPH.H                                                     *
- *                                                               *
- *   Max R. Dursteler    Dec 1983                                *
- *   12405 Village Square Terrace                                *
- *   Rockville Md. 20852                                         *
- ******************************************************************
- */
-
 /* Constants */
 
 /* Flagcodes for motion directions */
@@ -160,41 +193,10 @@ struct point      {double x, y, z;};
 
 /*-------------------------------------------------------------------------*/
 
-#define X_STKMIN  10           /* joystick specific values */
-#define X_STKMAX 313
-#define Y_STKMIN  10
-#define Y_STKMAX 313
-
-#define X_LOCMAX  (X_STKMAX - X_STKMIN);       /* range from readloc() */
-#define Y_LOCMAX  (Y_STKMAX - Y_STKMIN);       /*   = 0 to LOCMAX */
-
-#define JOYSTK1   0            /* device names */
-#define JOYSTK2   1
-
-#define BUTT_DONE  2           /* Right joystick button to end a command */
-#define BUTT_START 1           /* Left joystick button to start a command */
-#define BUTT_BOTH  3           /* Both buttons pressed */
-
-#define RL_ERROR  -1           /* readloc() return codes */
-#define RL_OFF     0
-#define RL_ON     1
-
-/*-------------------------------------------------------------------------*/
-
-struct raster_st {
-    int type;
-    int xmin, ymin;
-    int xmax, ymax;
-};
-
-typedef struct raster_st RASTER;
-
-/*-------------------------------------------------------------------------*/
-
-
 /* circle.c */
-void circle(const double r);
-void drawarc(double start, double stop, const double r);
+void sgp2_draw_circle(const double r);
+void sgp2_draw_arc(double start, double stop, const double r);
+
 /* ctm.c */
 void ctm_xlat_pre_2(double x, double y);
 void ctm_xlat_post_2(double x, double y);
@@ -212,66 +214,67 @@ void ident_gmtx_2(GRFMTX_2D m);
 void mult_gmtx_2(GRFMTX_2D a, GRFMTX_2D b, GRFMTX_2D c);
 void invert_gmtx_2(GRFMTX_2D a, GRFMTX_2D b);
 double determ_gmtx_2(GRFMTX_2D a);
+
 /* drawbox.c */
-void drawbox(double xmin, double ymin, double xmax, double ymax);
+void sgp2_draw_rect (double xmin, double ymin, double xmax, double ymax);
+
 /* sgp.c */
-void gp_init_2(void);
-void window2(double xmin, double ymin, double xmax, double ymax);
-void window_2(double xmin, double ymin, double xmax, double ymax);
-void viewprt2(double xmin, double ymin, double xmax, double ymax);
-void viewport_2(double xmin, double ymin, double xmax, double ymax);
-void framevpt(void);
+SGP_ID sgp2_init (int xsize, int ysize, const char *title);
+void sgp2_close (SGP_ID gid);
+void sgp2_set_active_win (SGP_ID);
+SGP_ID sgp2_get_active_win (void);
+void sgp2_clear (void);
+void sgp2_window(double xmin, double ymin, double xmax, double ymax);
+void sgp2_viewport(double xmin, double ymin, double xmax, double ymax);
+void sgp2_frame_vpt(void);
 void calc_wc_to_ndc(void);
 void calc_ndc_to_mc(void);
 void wc_to_ndc(double xw, double yw, double *xn, double *yn);
 void ndc_to_wc(double xn, double yn, double *xw, double *yw);
-void color(int icol);
-void linestyle(int style);
-void line_abs_2(double x, double y);
-void lineabs2(double x, double y);
-void move_abs_2(double x, double y);
-void moveabs2(double x, double y);
-void line_rel_2(double x, double y);
-void linerel2(double x, double y);
-void move_rel_2(double x, double y);
-void moverel2(double x, double y);
-void draw_text(char *message);
-void drawtext(char *message);
-void polylnabs2(double x[], double y[], int n);
-void markabs2(double x, double y);
-void markrel2(double x, double y);
-void pntabs2(double x, double y);
-void pntrel2(double x, double y);
+void sgp2_color(int icol);
+void sgp2_line_style(int style);
+void sgp2_line_abs(double x, double y);
+void sgp2_move_abs(double x, double y);
+void sgp2_line_rel(double x, double y);
+void sgp2_move_rel(double x, double y);
+void sgp2_draw_text(char *message);
+void sgp2_polyline_abs(double x[], double y[], int n);
+void sgp2_mark_abs(double x, double y);
+void sgp2_mark_rel(double x, double y);
+void sgp2_point_abs(double x, double y);
+void sgp2_point_rel(double x, double y);
+void charsize(double wid, double height);
+void textangle(double angle);
 void ctm_clr_2(void);
 void ctm_get_2(GRFMTX_2D m);
 void ctm_set_2(GRFMTX_2D m);
 void ctm_pre_mult_2(GRFMTX_2D m);
 void ctm_post_mult_2(GRFMTX_2D m);
+
 /* sgpdrive.c */
-int initgrf2(void);
+int _sgp2_init_dev(SGP_ID gid);
 int initdevice(int dev, int mode, int xsize, int ysize);
 int opendevice(int dev);
 void closedevice(int dev);
 void termdevice(int dev);
-void stylus(double x, double y, int beam);
-void pntndc(double x, double y);
-void markndc(double x, double y);
+void _sgp2_stylus(SGP_ID gid, double x, double y, int beam);
+void pntndc (SGP_ID gid, double x, double y);
+void markndc (SGP_ID gid, double x, double y);
 GRFSTATE *inqstate(void);
 void gp_set_aspect(int dev, double asp);
 void setlinestyle(int style);
 void setlinewidth(int wid);
 DEVICE *inqdev(int dev);
-void settext(double width, double height, double textangle, int font);
+void _sgp2_set_text(SGP_ID gid, double width, double height, double textangle, int font);
 void settextclr(int fore, int back);
 void setcolor(int fore);
 void setbackg(int back);
 int initmarker(int marker, int color);
 int settextdir(int direction);
-void charsize(double wid, double height);
-void textangle(double angle);
-void drivtext(char *message);
+void _sgp2_dev_text(SGP_ID gid, char *message);
 void termgrf2(void);
 void flushdevice(int dev);
+
 /* sgptext.c */
 void wrtsymbol(int sym, int x, int y, DEVICE *dev);
 void wrtchar(int ch, int x, int y, CHARSPEC *cspec, DEVICE *dev);