00001
00002 c
00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993,
00004 c by Steve McMillan, Drexel University, Philadelphia, PA.
00005 c
00006 c All rights reserved.
00007 c
00008 c Redistribution and use in source and binary forms are permitted
00009 c provided that the above copyright notice and this paragraph are
00010 c duplicated in all such forms and that any documentation,
00011 c advertising materials, and other materials related to such
00012 c distribution and use acknowledge that the software was developed
00013 c by the author named above.
00014 c
00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 c
00019 c
00020
00021 block data ps setup
00022 save
00023 common /ps color set/ ipscolor
00024 common /ps write/ iwrite
00025 data ipscolor/0/iwrite/0/
00026 end
00027
00028
00029 subroutine set ps write
00030 save
00031 c
00032 c Toggle forced rewriting of long files.
00033 c
00034 common /ps write/ iwrite
00035
00036 iwrite = 1 - iwrite
00037
00038 end
00039
00040
00041 subroutine ps stroke
00042 save
00043 common /ps strokes/ nstroke,nstrpage,nstroketot
00044 c
00045 if (nstroke.gt.0) then
00046 write(42,'(''stroke'')')
00047 nstroke = 0
00048 end if
00049 c
00050 end
00051
00052
00053 subroutine set ps color
00054 save
00055 c
00056 c Toggle between greyscale and color output.
00057 c
00058 common /ps color set/ ipscolor
00059 common /mcpak_colormap/ ncolors
00060 c
00061 parameter (NXCOLORS = 16)
00062 c
00063 ipscolor = 1 - ipscolor
00064 c
00065 if (ipscolor.eq.0) then
00066 c
00067 c Greyscale, 256 levels:
00068 c
00069 ncolors = 256
00070 c
00071 else
00072 c
00073 c Color, NXCOLORS levels:
00074 c
00075 ncolors = NXCOLORS
00076 c
00077 end if
00078 c
00079 return
00080 c
00081 entry get ps color(ipsc)
00082 ipsc = ipscolor
00083 c
00084 end
00085
00086
00087 subroutine ps color(icolor)
00088 save
00089 common /ps color set/ ipscolor
00090 common /mcpak_colormap/ ncolors
00091 c
00092 c Set up PostScript color/grey level.
00093 c
00094 c The color map mimics the current X-window colors (see "mcdxsubs.c"):
00095 c
00096 c 0 = "white"
00097 c 1 = "black"
00098 c 2 = "blue"
00099 c 3 = "purple"
00100 c 4 = "violet"
00101 c 5 = "magenta"
00102 c 6 = "light blue"
00103 c 7 = "gray"
00104 c 8 = "cyan"
00105 c 9 = "green"
00106 c 10 = "lime green"
00107 c 11 = "yellow"
00108 c 12 = "orange"
00109 c 13 = "brown"
00110 c 14 = "red"
00111 c 15 = "pink"
00112
00113 c Note that color 0 is white here, whereas for greyscale, 0 is black!
00114
00115 parameter (NXCOLORS = 16)
00116 integer red(0:NXCOLORS-1),green(0:NXCOLORS-1),blue(0:NXCOLORS-1)
00117 c
00118 data red/ 255, 0, 0, 160, 238, 255, 191, 192, 0, 0,
00119 & 50, 255, 255, 165, 255, 255/
00120 data green/ 255, 0, 0, 32, 130, 0, 239, 192, 255, 255,
00121 & 205, 255, 165, 42, 0, 192/
00122 data blue/ 255, 0, 255, 240, 238, 255, 255, 192, 255, 0,
00123 & 50, 0, 0, 42, 0, 203/
00124 c
00125 call ps stroke
00126 c
00127 if (ipscolor.eq.0) then
00128 c
00129 c Greyscale:
00130 c
00131 ic = max(0,icolor)
00132 do while (ic.ge.ncolors)
00133 ic = ic - ncolors
00134 end do
00135
00136 c Force 0 and 1 to be black for a large color range.
00137
00138 if (ncolors.gt.16 .and. ic.eq.1) ic = 0
00139 write(42,'(f5.3,'' setgray'')')ic/(ncolors-1.)
00140 c
00141 else
00142 c
00143 c Color:
00144 c
00145 ic = max(0,icolor)
00146 do while (ic.ge.ncolors)
00147 ic = ic - ncolors
00148 end do
00149 write(42,'(3f6.3,'' setrgbcolor'')')
00150 & red(ic)/255.,green(ic)/255.,blue(ic)/255.
00151 c
00152 end if
00153 c
00154 end
00155
00156
00157 subroutine ps page(iopt)
00158 save
00159 common /ps strokes/ nstroke,nstrpage,nstroketot
00160 common /ps pages/ npage
00161 c
00162 if (nstrpage.eq.0) return
00163 call printid
00164 c write(42,'(''gsave showpage grestore newpath'')')
00165 write(42,'(''showpage newpath'')')
00166 if(iopt.eq.0)return
00167 c
00168 npage = npage+1
00169 write(42,'(/''%%Page: '',i4)')npage
00170 nstrpage = 0
00171 c
00172 end