1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/StringIO Tue Jan 17 09:21:45 2017 +0100
1.3 @@ -0,0 +1,458 @@
1.4 +%!PS-Adobe-3.0
1.5 +%%Creator: (ImageMagick)
1.6 +%%Title: (StringIO)
1.7 +%%CreationDate: (2016-03-09T10:39:22+01:00)
1.8 +%%BoundingBox: 706 146 740 214
1.9 +%%HiResBoundingBox: 706 146 740 214
1.10 +%%DocumentData: Clean7Bit
1.11 +%%LanguageLevel: 1
1.12 +%%Orientation: Portrait
1.13 +%%PageOrder: Ascend
1.14 +%%Pages: 1
1.15 +%%EndComments
1.16 +
1.17 +%%BeginDefaults
1.18 +%%EndDefaults
1.19 +
1.20 +%%BeginProlog
1.21 +%
1.22 +% Display a color image. The image is displayed in color on
1.23 +% Postscript viewers or printers that support color, otherwise
1.24 +% it is displayed as grayscale.
1.25 +%
1.26 +/DirectClassPacket
1.27 +{
1.28 + %
1.29 + % Get a DirectClass packet.
1.30 + %
1.31 + % Parameters:
1.32 + % red.
1.33 + % green.
1.34 + % blue.
1.35 + % length: number of pixels minus one of this color (optional).
1.36 + %
1.37 + currentfile color_packet readhexstring pop pop
1.38 + compression 0 eq
1.39 + {
1.40 + /number_pixels 3 def
1.41 + }
1.42 + {
1.43 + currentfile byte readhexstring pop 0 get
1.44 + /number_pixels exch 1 add 3 mul def
1.45 + } ifelse
1.46 + 0 3 number_pixels 1 sub
1.47 + {
1.48 + pixels exch color_packet putinterval
1.49 + } for
1.50 + pixels 0 number_pixels getinterval
1.51 +} bind def
1.52 +
1.53 +/DirectClassImage
1.54 +{
1.55 + %
1.56 + % Display a DirectClass image.
1.57 + %
1.58 + systemdict /colorimage known
1.59 + {
1.60 + columns rows 8
1.61 + [
1.62 + columns 0 0
1.63 + rows neg 0 rows
1.64 + ]
1.65 + { DirectClassPacket } false 3 colorimage
1.66 + }
1.67 + {
1.68 + %
1.69 + % No colorimage operator; convert to grayscale.
1.70 + %
1.71 + columns rows 8
1.72 + [
1.73 + columns 0 0
1.74 + rows neg 0 rows
1.75 + ]
1.76 + { GrayDirectClassPacket } image
1.77 + } ifelse
1.78 +} bind def
1.79 +
1.80 +/GrayDirectClassPacket
1.81 +{
1.82 + %
1.83 + % Get a DirectClass packet; convert to grayscale.
1.84 + %
1.85 + % Parameters:
1.86 + % red
1.87 + % green
1.88 + % blue
1.89 + % length: number of pixels minus one of this color (optional).
1.90 + %
1.91 + currentfile color_packet readhexstring pop pop
1.92 + color_packet 0 get 0.299 mul
1.93 + color_packet 1 get 0.587 mul add
1.94 + color_packet 2 get 0.114 mul add
1.95 + cvi
1.96 + /gray_packet exch def
1.97 + compression 0 eq
1.98 + {
1.99 + /number_pixels 1 def
1.100 + }
1.101 + {
1.102 + currentfile byte readhexstring pop 0 get
1.103 + /number_pixels exch 1 add def
1.104 + } ifelse
1.105 + 0 1 number_pixels 1 sub
1.106 + {
1.107 + pixels exch gray_packet put
1.108 + } for
1.109 + pixels 0 number_pixels getinterval
1.110 +} bind def
1.111 +
1.112 +/GrayPseudoClassPacket
1.113 +{
1.114 + %
1.115 + % Get a PseudoClass packet; convert to grayscale.
1.116 + %
1.117 + % Parameters:
1.118 + % index: index into the colormap.
1.119 + % length: number of pixels minus one of this color (optional).
1.120 + %
1.121 + currentfile byte readhexstring pop 0 get
1.122 + /offset exch 3 mul def
1.123 + /color_packet colormap offset 3 getinterval def
1.124 + color_packet 0 get 0.299 mul
1.125 + color_packet 1 get 0.587 mul add
1.126 + color_packet 2 get 0.114 mul add
1.127 + cvi
1.128 + /gray_packet exch def
1.129 + compression 0 eq
1.130 + {
1.131 + /number_pixels 1 def
1.132 + }
1.133 + {
1.134 + currentfile byte readhexstring pop 0 get
1.135 + /number_pixels exch 1 add def
1.136 + } ifelse
1.137 + 0 1 number_pixels 1 sub
1.138 + {
1.139 + pixels exch gray_packet put
1.140 + } for
1.141 + pixels 0 number_pixels getinterval
1.142 +} bind def
1.143 +
1.144 +/PseudoClassPacket
1.145 +{
1.146 + %
1.147 + % Get a PseudoClass packet.
1.148 + %
1.149 + % Parameters:
1.150 + % index: index into the colormap.
1.151 + % length: number of pixels minus one of this color (optional).
1.152 + %
1.153 + currentfile byte readhexstring pop 0 get
1.154 + /offset exch 3 mul def
1.155 + /color_packet colormap offset 3 getinterval def
1.156 + compression 0 eq
1.157 + {
1.158 + /number_pixels 3 def
1.159 + }
1.160 + {
1.161 + currentfile byte readhexstring pop 0 get
1.162 + /number_pixels exch 1 add 3 mul def
1.163 + } ifelse
1.164 + 0 3 number_pixels 1 sub
1.165 + {
1.166 + pixels exch color_packet putinterval
1.167 + } for
1.168 + pixels 0 number_pixels getinterval
1.169 +} bind def
1.170 +
1.171 +/PseudoClassImage
1.172 +{
1.173 + %
1.174 + % Display a PseudoClass image.
1.175 + %
1.176 + % Parameters:
1.177 + % class: 0-PseudoClass or 1-Grayscale.
1.178 + %
1.179 + currentfile buffer readline pop
1.180 + token pop /class exch def pop
1.181 + class 0 gt
1.182 + {
1.183 + currentfile buffer readline pop
1.184 + token pop /depth exch def pop
1.185 + /grays columns 8 add depth sub depth mul 8 idiv string def
1.186 + columns rows depth
1.187 + [
1.188 + columns 0 0
1.189 + rows neg 0 rows
1.190 + ]
1.191 + { currentfile grays readhexstring pop } image
1.192 + }
1.193 + {
1.194 + %
1.195 + % Parameters:
1.196 + % colors: number of colors in the colormap.
1.197 + % colormap: red, green, blue color packets.
1.198 + %
1.199 + currentfile buffer readline pop
1.200 + token pop /colors exch def pop
1.201 + /colors colors 3 mul def
1.202 + /colormap colors string def
1.203 + currentfile colormap readhexstring pop pop
1.204 + systemdict /colorimage known
1.205 + {
1.206 + columns rows 8
1.207 + [
1.208 + columns 0 0
1.209 + rows neg 0 rows
1.210 + ]
1.211 + { PseudoClassPacket } false 3 colorimage
1.212 + }
1.213 + {
1.214 + %
1.215 + % No colorimage operator; convert to grayscale.
1.216 + %
1.217 + columns rows 8
1.218 + [
1.219 + columns 0 0
1.220 + rows neg 0 rows
1.221 + ]
1.222 + { GrayPseudoClassPacket } image
1.223 + } ifelse
1.224 + } ifelse
1.225 +} bind def
1.226 +
1.227 +/DisplayImage
1.228 +{
1.229 + %
1.230 + % Display a DirectClass or PseudoClass image.
1.231 + %
1.232 + % Parameters:
1.233 + % x & y translation.
1.234 + % x & y scale.
1.235 + % label pointsize.
1.236 + % image label.
1.237 + % image columns & rows.
1.238 + % class: 0-DirectClass or 1-PseudoClass.
1.239 + % compression: 0-none or 1-RunlengthEncoded.
1.240 + % hex color packets.
1.241 + %
1.242 + gsave
1.243 + /buffer 512 string def
1.244 + /byte 1 string def
1.245 + /color_packet 3 string def
1.246 + /pixels 768 string def
1.247 +
1.248 + currentfile buffer readline pop
1.249 + token pop /x exch def
1.250 + token pop /y exch def pop
1.251 + x y translate
1.252 + currentfile buffer readline pop
1.253 + token pop /x exch def
1.254 + token pop /y exch def pop
1.255 + currentfile buffer readline pop
1.256 + token pop /pointsize exch def pop
1.257 + /Times-Roman findfont pointsize scalefont setfont
1.258 + x y scale
1.259 + currentfile buffer readline pop
1.260 + token pop /columns exch def
1.261 + token pop /rows exch def pop
1.262 + currentfile buffer readline pop
1.263 + token pop /class exch def pop
1.264 + currentfile buffer readline pop
1.265 + token pop /compression exch def pop
1.266 + class 0 gt { PseudoClassImage } { DirectClassImage } ifelse
1.267 + grestore
1.268 + showpage
1.269 +} bind def
1.270 +%%EndProlog
1.271 +%%Page: 1 1
1.272 +%%PageBoundingBox: 706 146 740 214
1.273 +DisplayImage
1.274 +706 146
1.275 +34 68
1.276 +12
1.277 +34 68
1.278 +0
1.279 +0
1.280 +474640474640474640474640474640474640474640474640474640474640474640474640474640
1.281 +474640474640474640474640474640474640474640474640474640474640474640474640474640