00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include "def.h"
00013 #include "graphics.h"
00014
00015
00016 int graphics = FALSE;
00017
00018
00019 void
00020 graphics_init()
00021 {
00022 ps_open_PostScript();
00023 snews_setup();
00024 ps_flush_PostScript();
00025 graphics = TRUE;
00026 }
00027
00028
00029
00030 #define INCHES 100
00031
00032
00033 void
00034 draw_line(x1,y1,x2,y2)
00035 double x1, y1, x2, y2;
00036 {
00037 int x1i = (int) (INCHES * x1);
00038 int y1i = (int) (INCHES * y1);
00039 int x2i = (int) (INCHES * x2);
00040 int y2i = (int) (INCHES * y2);
00041
00042 if (!graphics) graphics_init();
00043 snews_line(x1i, y1i, x2i, y2i);
00044 ps_flush_PostScript();
00045 }
00046
00047
00048 void
00049 draw_string(str,x,y)
00050 char *str;
00051 double x,y;
00052 {
00053 int xi = (int) (INCHES * x);
00054 int yi = (int) (INCHES * y);
00055 if (!graphics) graphics_init();
00056 snews_string(str, xi, yi);
00057 ps_flush_PostScript();
00058 }
00059
00060
00061 void
00062 graphics_close()
00063 {
00064 while ('X' != getc(PostScriptInput)) ;
00065 while ('\n' != getc(PostScriptInput)) ;
00066 ps_close_PostScript();
00067 graphics = FALSE;
00068 }