logo

scripts

A bunch of scripts, some to be moved to their own repository git clone https://hacktivis.me/git/scripts.git

curses (9647B)


  1. %!PS-Adobe-3.0
  2. %%Creator: (ImageMagick)
  3. %%Title: (curses)
  4. %%CreationDate: (2015-02-28T00:59:16+01:00)
  5. %%BoundingBox: 570 406 623 442
  6. %%HiResBoundingBox: 570 406 623 442
  7. %%DocumentData: Clean7Bit
  8. %%LanguageLevel: 1
  9. %%Orientation: Portrait
  10. %%PageOrder: Ascend
  11. %%Pages: 1
  12. %%EndComments
  13. %%BeginDefaults
  14. %%EndDefaults
  15. %%BeginProlog
  16. %
  17. % Display a color image. The image is displayed in color on
  18. % Postscript viewers or printers that support color, otherwise
  19. % it is displayed as grayscale.
  20. %
  21. /DirectClassPacket
  22. {
  23. %
  24. % Get a DirectClass packet.
  25. %
  26. % Parameters:
  27. % red.
  28. % green.
  29. % blue.
  30. % length: number of pixels minus one of this color (optional).
  31. %
  32. currentfile color_packet readhexstring pop pop
  33. compression 0 eq
  34. {
  35. /number_pixels 3 def
  36. }
  37. {
  38. currentfile byte readhexstring pop 0 get
  39. /number_pixels exch 1 add 3 mul def
  40. } ifelse
  41. 0 3 number_pixels 1 sub
  42. {
  43. pixels exch color_packet putinterval
  44. } for
  45. pixels 0 number_pixels getinterval
  46. } bind def
  47. /DirectClassImage
  48. {
  49. %
  50. % Display a DirectClass image.
  51. %
  52. systemdict /colorimage known
  53. {
  54. columns rows 8
  55. [
  56. columns 0 0
  57. rows neg 0 rows
  58. ]
  59. { DirectClassPacket } false 3 colorimage
  60. }
  61. {
  62. %
  63. % No colorimage operator; convert to grayscale.
  64. %
  65. columns rows 8
  66. [
  67. columns 0 0
  68. rows neg 0 rows
  69. ]
  70. { GrayDirectClassPacket } image
  71. } ifelse
  72. } bind def
  73. /GrayDirectClassPacket
  74. {
  75. %
  76. % Get a DirectClass packet; convert to grayscale.
  77. %
  78. % Parameters:
  79. % red
  80. % green
  81. % blue
  82. % length: number of pixels minus one of this color (optional).
  83. %
  84. currentfile color_packet readhexstring pop pop
  85. color_packet 0 get 0.299 mul
  86. color_packet 1 get 0.587 mul add
  87. color_packet 2 get 0.114 mul add
  88. cvi
  89. /gray_packet exch def
  90. compression 0 eq
  91. {
  92. /number_pixels 1 def
  93. }
  94. {
  95. currentfile byte readhexstring pop 0 get
  96. /number_pixels exch 1 add def
  97. } ifelse
  98. 0 1 number_pixels 1 sub
  99. {
  100. pixels exch gray_packet put
  101. } for
  102. pixels 0 number_pixels getinterval
  103. } bind def
  104. /GrayPseudoClassPacket
  105. {
  106. %
  107. % Get a PseudoClass packet; convert to grayscale.
  108. %
  109. % Parameters:
  110. % index: index into the colormap.
  111. % length: number of pixels minus one of this color (optional).
  112. %
  113. currentfile byte readhexstring pop 0 get
  114. /offset exch 3 mul def
  115. /color_packet colormap offset 3 getinterval def
  116. color_packet 0 get 0.299 mul
  117. color_packet 1 get 0.587 mul add
  118. color_packet 2 get 0.114 mul add
  119. cvi
  120. /gray_packet exch def
  121. compression 0 eq
  122. {
  123. /number_pixels 1 def
  124. }
  125. {
  126. currentfile byte readhexstring pop 0 get
  127. /number_pixels exch 1 add def
  128. } ifelse
  129. 0 1 number_pixels 1 sub
  130. {
  131. pixels exch gray_packet put
  132. } for
  133. pixels 0 number_pixels getinterval
  134. } bind def
  135. /PseudoClassPacket
  136. {
  137. %
  138. % Get a PseudoClass packet.
  139. %
  140. % Parameters:
  141. % index: index into the colormap.
  142. % length: number of pixels minus one of this color (optional).
  143. %
  144. currentfile byte readhexstring pop 0 get
  145. /offset exch 3 mul def
  146. /color_packet colormap offset 3 getinterval def
  147. compression 0 eq
  148. {
  149. /number_pixels 3 def
  150. }
  151. {
  152. currentfile byte readhexstring pop 0 get
  153. /number_pixels exch 1 add 3 mul def
  154. } ifelse
  155. 0 3 number_pixels 1 sub
  156. {
  157. pixels exch color_packet putinterval
  158. } for
  159. pixels 0 number_pixels getinterval
  160. } bind def
  161. /PseudoClassImage
  162. {
  163. %
  164. % Display a PseudoClass image.
  165. %
  166. % Parameters:
  167. % class: 0-PseudoClass or 1-Grayscale.
  168. %
  169. currentfile buffer readline pop
  170. token pop /class exch def pop
  171. class 0 gt
  172. {
  173. currentfile buffer readline pop
  174. token pop /depth exch def pop
  175. /grays columns 8 add depth sub depth mul 8 idiv string def
  176. columns rows depth
  177. [
  178. columns 0 0
  179. rows neg 0 rows
  180. ]
  181. { currentfile grays readhexstring pop } image
  182. }
  183. {
  184. %
  185. % Parameters:
  186. % colors: number of colors in the colormap.
  187. % colormap: red, green, blue color packets.
  188. %
  189. currentfile buffer readline pop
  190. token pop /colors exch def pop
  191. /colors colors 3 mul def
  192. /colormap colors string def
  193. currentfile colormap readhexstring pop pop
  194. systemdict /colorimage known
  195. {
  196. columns rows 8
  197. [
  198. columns 0 0
  199. rows neg 0 rows
  200. ]
  201. { PseudoClassPacket } false 3 colorimage
  202. }
  203. {
  204. %
  205. % No colorimage operator; convert to grayscale.
  206. %
  207. columns rows 8
  208. [
  209. columns 0 0
  210. rows neg 0 rows
  211. ]
  212. { GrayPseudoClassPacket } image
  213. } ifelse
  214. } ifelse
  215. } bind def
  216. /DisplayImage
  217. {
  218. %
  219. % Display a DirectClass or PseudoClass image.
  220. %
  221. % Parameters:
  222. % x & y translation.
  223. % x & y scale.
  224. % label pointsize.
  225. % image label.
  226. % image columns & rows.
  227. % class: 0-DirectClass or 1-PseudoClass.
  228. % compression: 0-none or 1-RunlengthEncoded.
  229. % hex color packets.
  230. %
  231. gsave
  232. /buffer 512 string def
  233. /byte 1 string def
  234. /color_packet 3 string def
  235. /pixels 768 string def
  236. currentfile buffer readline pop
  237. token pop /x exch def
  238. token pop /y exch def pop
  239. x y translate
  240. currentfile buffer readline pop
  241. token pop /x exch def
  242. token pop /y exch def pop
  243. currentfile buffer readline pop
  244. token pop /pointsize exch def pop
  245. /Times-Roman findfont pointsize scalefont setfont
  246. x y scale
  247. currentfile buffer readline pop
  248. token pop /columns exch def
  249. token pop /rows exch def pop
  250. currentfile buffer readline pop
  251. token pop /class exch def pop
  252. currentfile buffer readline pop
  253. token pop /compression exch def pop
  254. class 0 gt { PseudoClassImage } { DirectClassImage } ifelse
  255. grestore
  256. showpage
  257. } bind def
  258. %%EndProlog
  259. %%Page: 1 1
  260. %%PageBoundingBox: 570 406 623 442
  261. DisplayImage
  262. 570 406
  263. 53 36
  264. 12
  265. 53 36
  266. 1
  267. 1
  268. 1
  269. 8
  270. 202020202020202020202020202020202020202020202020202020202020202020202020
  271. 202020202020202020202020202020202020202020202020202020202020202020202020
  272. 202020202020202020202020202020202020202020202020202020202020202020202020
  273. 202020202020202020202020202020202020202020202020202020202020202020202020
  274. 202020202020202020202020202020202020202020202020202020202020202020202020
  275. 202020202020202020202020202020202020202020202020202020202020202020202020
  276. 202020202020202020202020202020202020202020202020202020202020202020202020
  277. 202020202020202020202020202020202020202020202020202020202020202020202020
  278. 202020202020202020202020202020202020202020202020202020202020202020202020
  279. 202020202020202020202020202020202020202020202020202020202020202020202020
  280. 202020202020202020202020202020202020202020202020202020202020202020202020
  281. 202020202020202020202020202020202020202020202020202020202020202020202020
  282. 202020202020202020202020202020202020202020202020202020202020202020202020
  283. 202020202020202020202020202020202020202020202020202020202020202020202020
  284. 202020202020202020202020202020202020202020202020202020202020202020202020
  285. 202020202020202020202020202020202020202020202020202020202020202020202020
  286. 202020202020202020202020202020202020202020202020202020202020202020202020
  287. 202020202020202020202020202020202020202020202020202020202020202020202020
  288. 202020202020202020202020202020202020202020202020202020202020202020202020
  289. 202020202020202020202020202020202020202020202020202020202020202020202020
  290. 202020202020202020202020202020202020202020202020202020202020202020202020
  291. 202020202020202020202020202020202020202020202020202020202020202020202020
  292. 202020202020202020202020202020202020202020202020202020202020202020202020
  293. 202020202020202020202020202020202020202020202020202020202020202020202020
  294. 202020202020202020202020202020202020202020202020202020202020202020202020
  295. 202020202020202020202020202020202020202020202020202020202020202020202020
  296. 202020202020202020202020202020202020202020202020202020202020202020202020
  297. 202020202020202020202020202020202020202020202020202020202020202020202020
  298. 202020202020202020202020202020202020202020202020202020202020202020202020
  299. 202020202020202020202020202020202020202020202020202020202020202020202020
  300. 202020202020202020202020202020202020202020202020202020202020202020202020
  301. 202020202020202020202020202020202020202020202020202020202020202020202020
  302. 202020202020202020202020202020202020202020202020202020202020202020202020
  303. 202020202020202020202020202020202020202020202020202020202020202020202020
  304. 202020202020202020202020202020202020202020202020202020202020202020202020
  305. 202020202020202020202020202020202020202020202020202020202020202020202020
  306. 202020202020202020202020202020202020202020202020202020202020202020202020
  307. 202020202020202020202020202020202020202020202020202020202020202020202020
  308. 202020202020202020202020202020202020202020202020202020202020202020202020
  309. 202020202020202020202020202020202020202020202020202020202020202020202020
  310. 202020202020202020202020202020202020202020202020202020202020202020202020
  311. 202020202020202020202020202020202020202020202020202020202020202020202020
  312. 202020202020202020202020202020202020202020202020202020202020202020202020
  313. 202020202020202020202020202020202020202020202020202020202020202020202020
  314. 202020202020202020202020202020202020202020202020202020202020202020202020
  315. 202020202020202020202020202020202020202020202020202020202020202020202020
  316. 202020202020202020202020202020202020202020202020202020202020202020202020
  317. 202020202020202020202020202020202020202020202020202020202020202020202020
  318. 202020202020202020202020202020202020202020202020202020202020202020202020
  319. 202020202020202020202020202020202020202020202020202020202020202020202020
  320. 202020202020202020202020202020202020202020202020202020202020202020202020
  321. 202020202020202020202020202020202020202020202020202020202020202020202020
  322. 202020202020202020202020202020202020202020202020202020202020202020202020
  323. %%PageTrailer
  324. %%Trailer
  325. %%EOF