image-qa.ps 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828
  1. %!PS
  2. % Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
  3. %
  4. % This file is part of AFPL Ghostscript.
  5. %
  6. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  7. % distributor accepts any responsibility for the consequences of using it, or
  8. % for whether it serves any particular purpose or works at all, unless he or
  9. % she says so in writing. Refer to the Aladdin Free Public License (the
  10. % "License") for full details.
  11. %
  12. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  13. % in a plain ASCII text file named PUBLIC. The License grants you the right
  14. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  15. % conditions described in the License. Among other things, the License
  16. % requires that the copyright notice and this notice be preserved on all
  17. % copies.
  18. %
  19. % $Id: image-qa.ps,v 1.3 2001/04/04 04:54:53 rayjj Exp $
  20. % Tests for the image operators
  21. % Specifications for Image operator testing.
  22. %
  23. % 1. All 8 standard orientations (0, 90, 180, 270 degree rotations with
  24. % and without reflection); ditto those orientations perturbed by +/-
  25. % 10 degrees, and by 45 degrees.
  26. %
  27. % Enough space is provided around images on a test page to allow
  28. % these permutations to use the same page layout. This will make
  29. % test page construction easier and simplify page checking.
  30. %
  31. % 2. All 9 image types (ImageType 1 mask, ImageType 1 opaque,
  32. % ImageType 3 with all 3 InterleaveTypes and with unequal scaling
  33. % for InterleaveType 2 and 3, ImageType 4 with both range and
  34. % single-point matching).
  35. %
  36. % 3. DeviceGray, DeviceRGB, and DeviceN color, both direct and Indexed.
  37. % Indexed color will use the common pallete size of 256 colors.
  38. %
  39. % 4. For simple masks, both colored and uncolored Patterns.
  40. %
  41. % 5. CombineWithColor true and false; several different colors for the
  42. % true case (including black, white, other solid colors, halftones,
  43. % and patterns).
  44. %
  45. % 6. Source transparency true and false.
  46. %
  47. % 7. Texture transparency true and false.
  48. %
  49. % 8. Different RasterOp values.
  50. %
  51. % 9. For ImageType 4, different color keys (out-of-range, specific
  52. % color other than white, range without white).
  53. %
  54. % 10. String, file, and procedure data sources; for multi-component
  55. % color spaces, MultipleDataSources = true. This is tested by
  56. % constructing string data sources that are used as input to
  57. % SubFileDecode filter to create a filetype data source. These
  58. % filters are read into scratch strings for the procedure data
  59. % source case. The procedure data source scratch string length
  60. % does not match the raster width, and the width x height is
  61. % not an integer multiple of the string length.
  62. %
  63. % Also for the File case, the number of bytes consumed is
  64. % checked after the image operator to verify that the exact
  65. % amount of data is used. This is particularly important when
  66. % the currentfile is used as a source (possibly through a
  67. % filter.
  68. %
  69. % Image bytes per line are < 500 bytes to exercise direct and
  70. % buffer copy gs_image_next_planes mode with the default stream
  71. % buffer size of 512 bytes. Procedure string size is greater
  72. % than the image bytes per line for the same reason (sM and sD).
  73. %
  74. % Total string size is kept below 65535.
  75. /WidthRGB 83 def
  76. /HeightRGB 89 def
  77. %
  78. % 11. Banded and non-banded rendering. This can be tested by running
  79. % test files throuch with different page device parameters to
  80. % force banding vs. page mode.
  81. %
  82. % -------------------------------------------------------------------------
  83. %
  84. % Testing the RasterOp-related functions (5/6/7/8) is not necessary at this
  85. % time. They are well isolated logically.
  86. %
  87. % Testing orientation (1) and color masking (9) would be a good idea at some
  88. % point, because this code has broken many times in the past and has had a
  89. % long bug tail.
  90. %
  91. % The really important things to test are 2 (image type), 3/4 (color space --
  92. % but only with regard to number of components, plus DeviceN and simple masks
  93. % with a Pattern, which exercise special control paths), 10 (data source),
  94. % and 11 (banding modes).
  95. %
  96. % ==========================================================================
  97. %
  98. % Procedure to generate test mask data
  99. %
  100. % WM and HM must be defined prior to invocation
  101. % MaskGen -
  102. %
  103. % The mask data is stored into a string named /MaskData
  104. %
  105. % The mask consists of a "target". Bits past width WM are
  106. % filled with 1's to make sure that pad bits are ignored.
  107. %
  108. /MaskGen {
  109. /H8 HM 8 div def
  110. /X0 WM 2 div def
  111. /Y0 HM 2 div def
  112. /WB WM 7 add 8 div cvi def
  113. /MaskData WB HM mul string def
  114. /MB [ 128 64 32 16 8 4 2 1 ] def
  115. 0 1 HM 1 sub {
  116. /Y exch def
  117. 0 1 WB 1 sub {
  118. /B exch def % byte within the row
  119. /C B Y WB mul add def
  120. /P 0 def
  121. 0 1 7 {
  122. /b exch def % bit within the character
  123. /X b B 8 mul add def
  124. X WM lt
  125. { X Y eq
  126. X HM 1 sub Y sub eq or
  127. Y Y0 gt X X0 sub abs 2 le and or
  128. X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or
  129. }
  130. { true } % pad bits are always set
  131. ifelse
  132. % stack: true if pixel is set
  133. {
  134. MB b get P or /P exch def
  135. } if
  136. } for % Bits within a byte
  137. MaskData C P put
  138. } for % Bytes within the row
  139. } for % Rows in the mask
  140. } bind def % MaskGen
  141. %
  142. % WM and HM must be defined prior to invocation
  143. % BPC MaskGenBPC -
  144. %
  145. % The mask data is stored into a string named /MaskData
  146. %
  147. % The mask consists of a "target". BPC is the size of the elements
  148. % in the MaskData string (must be 4, 8 or 12)
  149. %
  150. /MaskGenBPC {
  151. /BPC exch def
  152. /X0 WM 2 div def
  153. /Y0 HM 2 div def
  154. /WB WM BPC mul 7 add 8 div cvi def % Width in Bytes
  155. /MaskData WB HM mul string def
  156. 0 1 HM 1 sub {
  157. /Y exch def
  158. 0 1 WM 1 sub {
  159. /X exch def
  160. MaskData % Target string
  161. X Y eq
  162. X HM 1 sub Y sub eq or
  163. Y Y0 gt X X0 sub abs 2 le and or
  164. X X0 sub WM div dup mul Y Y0 sub HM div dup mul add sqrt 9 mul cvi 2 mod 1 eq or
  165. X BPC mul 8 div Y WB mul add exch
  166. [
  167. { } % BPC = 0
  168. { { 1 } { 0 } ifelse put4bit } % BPC = 4
  169. { { 255 } { 0 } ifelse exch cvi exch put } % BPC = 8
  170. { { 1 } { 0 } ifelse put12bit } % BPC = 12
  171. ] BPC 4 div cvi get exec
  172. } for
  173. } for % Rows in the mask
  174. } bind def
  175. % -----------------------------------------------------------------------
  176. % Procedure to generate image data
  177. %
  178. % WD and HD must be defined prior to invocation
  179. % { proc } ImageGen -
  180. %
  181. % The procedure is called once for each pixel
  182. % Local definitions are R, G, B, X and Y
  183. % Example: Generate RGB Chunky pixel data (single data source) BPC = 8
  184. % /WD WidthRGB def
  185. % /HD HeightRGB def
  186. % /RGBData WD HD mul 3 mul string def
  187. % { X Y WD mul add 3 mul RGBData
  188. % dup 2 index R 255 mul cvi put
  189. % dup 2 index 1 add G 255 mul cvi put
  190. % exch 2 add B 255 mul cvi put
  191. % } ImageGen
  192. /ImageGen {
  193. gsave
  194. 0 1 HD 1 sub {
  195. /Y exch def
  196. 0 1 WD 1 sub {
  197. /X exch def
  198. /D X WD 2 div sub WD div dup mul Y HD 2 div sub HD div dup mul add sqrt def
  199. /D D .6 div def
  200. /A X WD 2 div sub Y HD 2 div sub atan 360 div def
  201. A % Hue
  202. .7 D .3 sub .60 div sub % Saturation
  203. dup 0.05 lt
  204. { .95 D .8 sub 3 mul sub 3 mul cvi 3 div sqrt } % Level once Saturation < 0
  205. { .7 D .25 sub .75 div add } % Level inside
  206. ifelse
  207. X WD 2 div gt Y HD 2 div sub abs 2 le and { pop 0 } if % asymmetric marker
  208. sethsbcolor
  209. currentrgbcolor /B exch def /G exch def /R exch def
  210. dup exec
  211. } for
  212. } for
  213. pop % discard the procedure
  214. grestore
  215. } bind def
  216. % -----------------------------------------------------------------------
  217. %
  218. % Procedures for ImageMatrix creation
  219. /IMLRTB { [ WD 0 0 HD neg 0 HD ] } def
  220. /IMLRBT { [ WD 0 0 HD 0 0 ] } def
  221. /IMRLTB { [ WD neg 0 0 HD neg WD HD ] } def
  222. /IMRLBT { [ WD neg 0 0 HD WD 0 ] } def
  223. % -----------------------------------------------------------------------
  224. %
  225. % Procedure to make invocation of image operators more concise
  226. %
  227. % YY, SX, SY, WD and HD should be defined prior to invocation
  228. % X matrix source decode DoImageMask -
  229. %
  230. /DoImageMask {
  231. gsave
  232. /D exch def
  233. /S exch def
  234. /M exch def
  235. /XX 1 index def
  236. YY translate SX SY scale
  237. 0 setlinewidth 0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto 0 0 lineto stroke
  238. .5 .5 translate
  239. IR rotate
  240. -.5 -.5 translate
  241. <<
  242. /ImageType 1
  243. /Width WM
  244. /Height HM
  245. /ImageMatrix M
  246. /MultipleDataSources false
  247. /DataSource S
  248. /Decode D
  249. /BitsPerComponent 1
  250. >>
  251. imagemask
  252. grestore
  253. } bind def
  254. % YY, SX, SY, WD and HD should be defined prior to invocation
  255. % X Y BPC matrix source multi decode DoImage1 -
  256. %
  257. /DoImage1 {
  258. gsave
  259. CSpace setcolorspace
  260. /D exch def
  261. /MS exch def
  262. /S exch def % May be an array of sources
  263. /M exch def
  264. /BPC exch def
  265. /XX 1 index def
  266. YY translate SX SY scale
  267. 0 setlinewidth 0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto 0 0 lineto stroke
  268. .5 .5 translate
  269. IR rotate
  270. -.5 -.5 translate
  271. <<
  272. /ImageType 1
  273. /Width WD
  274. /Height HD
  275. /ImageMatrix M
  276. /MultipleDataSources MS
  277. /DataSource S
  278. /BitsPerComponent BPC
  279. /Decode D
  280. >>
  281. image
  282. grestore
  283. } bind def
  284. % YY, SX, SY, WD and HD should be defined prior to invocation
  285. % X Y BPC matrix source multi decode MaskColor DoImage4 -
  286. %
  287. /DoImage4 {
  288. gsave
  289. CSpace setcolorspace
  290. /MC exch def
  291. /D exch def
  292. /MS exch def
  293. /S exch def % May be an array of sources
  294. /M exch def
  295. /BPC exch def
  296. /XX 1 index def
  297. YY translate SX SY scale
  298. 0 setlinewidth 0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto 0 0 lineto stroke
  299. .5 .5 translate
  300. IR rotate
  301. -.5 -.5 translate
  302. <<
  303. /ImageType 4
  304. /Width WD
  305. /Height HD
  306. /ImageMatrix M
  307. /MultipleDataSources MS
  308. /DataSource S
  309. /BitsPerComponent BPC
  310. /Decode D
  311. /MaskColor MC
  312. >>
  313. image
  314. grestore
  315. } bind def
  316. % YY, SX, SY, W, HD (Data) WM, HM (Mask) should be defined prior to invocation
  317. % (IT is InterleaveType)
  318. % X Y BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  319. %
  320. /DoImage3 {
  321. gsave
  322. CSpace setcolorspace
  323. /IT exch def
  324. /DD exch def
  325. /DM exch def
  326. /MS exch def
  327. /S exch def % May be an array of sources - For InterleaveType 3
  328. % S[0] is the Mask DataSource
  329. /M exch def
  330. /BPC exch def
  331. /XX 1 index def
  332. YY translate SX SY scale
  333. 0 setlinewidth 0 0 moveto 1 0 lineto 1 1 lineto 0 1 lineto 0 0 lineto stroke
  334. .5 .5 translate
  335. IR rotate
  336. -.5 -.5 translate
  337. /DataImage
  338. <<
  339. /ImageType 1
  340. /Width WD
  341. /Height HD
  342. /ImageMatrix M
  343. /MultipleDataSources MS
  344. /DataSource IT 3 ne { S } { S 1 get exec } ifelse
  345. /BitsPerComponent BPC
  346. /Decode DD
  347. >>
  348. def
  349. /MaskImage
  350. <<
  351. /ImageType 1
  352. /Width WM
  353. /Height HM
  354. /ImageMatrix % construct the mask matrix using signs from the DataImage matrix
  355. /M0 M 0 get WD abs div cvi def
  356. /M3 M 3 get HD abs div cvi def
  357. /M4 M 4 get WD abs div cvi def
  358. /M5 M 5 get HD abs div cvi def
  359. [ WM M0 mul 0 0 HM M3 mul WM M4 mul HM M5 mul ]
  360. IT 3 eq {
  361. /DataSource S 0 get exec % DataSource only allowed for InterleaveType 3
  362. } if
  363. /BitsPerComponent IT 1 eq { BPC } { 1 } ifelse
  364. /Decode DM
  365. >>
  366. def
  367. <<
  368. /ImageType 3
  369. /DataDict DataImage
  370. /MaskDict MaskImage
  371. /InterleaveType IT
  372. >>
  373. image
  374. grestore
  375. } bind def
  376. % -----------------------------------------------------------------------
  377. %
  378. /Helvetica-Bold findfont 20 scalefont /TitleFont exch def
  379. /FontSize 10 def
  380. /Helvetica-Narrow findfont FontSize scalefont /LegendFont exch def
  381. /blockshow { % like "show" but '\n' causes new-line
  382. dup = flush %DEBUG
  383. currentpoint /showY exch def /showX exch def
  384. {
  385. dup 10 ne
  386. { 1 string dup 0 4 -1 roll put show }
  387. { pop showX showY FontSize sub dup /showY exch def moveto }
  388. ifelse
  389. } forall
  390. } bind def
  391. /TX 013 def % Title left X
  392. /SX 036 def
  393. /XA 060 def
  394. /XB XA SX 1.5 mul add def
  395. /XC XA SX 3.0 mul add def
  396. /XD XA SX 4.5 mul add def
  397. /XE XA SX 6.0 mul add def
  398. /XF XA SX 7.5 mul add def
  399. /XG XA SX 9.0 mul add def
  400. /XH XA SX 10.5 mul add def
  401. /XI XA SX 12.0 mul add def
  402. /XJ XA SX 13.5 mul add def
  403. /BY 036 def % Bottom Title Top line
  404. /SY 037 def
  405. /YA 050 def
  406. /YB YA SY 1.8 mul add def
  407. /YC YA SY 3.6 mul add def
  408. /YD YA SY 5.4 mul add def
  409. /YE YA SY 7.2 mul add def
  410. /YF YA SY 9.0 mul add def
  411. /YG YA SY 10.8 mul add def
  412. /YH YA SY 12.6 mul add def
  413. /YI YA SY 14.4 mul add def
  414. /YJ YA SY 16.2 mul add def
  415. /YK YA SY 18.0 mul add def
  416. % -----------------------------------------------------------------------
  417. %
  418. % Utility procedures to support storing 4 and 12 bit elements in
  419. % strings.
  420. %
  421. % <string> <index> <value> put##bit -
  422. %
  423. % <index> will have a fractional part ( .5 ) if the element
  424. % starts on a 4-bit boundary.
  425. %
  426. % <value> is between 0 and 1 and is scaled 0 to 15 (4bit) or
  427. % 0 to 4095 (12 bit)
  428. /put4bit {
  429. 15 mul cvi
  430. exch dup cvi dup 3 1 roll eq 3 -1 roll exch
  431. { % integer index means high nibble.
  432. 16 mul put
  433. }
  434. { % low nibble -- combine with high nibble
  435. 2 index 2 index get or put
  436. }
  437. ifelse
  438. } bind def
  439. /put12bit {
  440. 1 index cvi /I exch def
  441. 2 index /S exch def
  442. 4095 mul cvi
  443. exch dup dup cvi eq
  444. { % integer index means high byte is aligned
  445. cvi exch 3 copy 16 div cvi put
  446. exch 1 add exch 15 and 16 mul put
  447. }
  448. { % low nibble -- combine with high nibble
  449. cvi exch 3 copy 2 index 2 index get exch 256 div cvi or put
  450. 255 and exch 1 add exch put
  451. }
  452. ifelse
  453. } bind def
  454. % -----------------------------------------------------------------------
  455. %
  456. % Procedures to use generated string data as procedure or files
  457. /WD WidthRGB def
  458. /HD HeightRGB def
  459. /sM WidthRGB 2 mul 1 sub string def % long enough to hold more than one mask line
  460. /sD WidthRGB 7 mul 1 sub string def % long enough to hold more than one 12 bit RGB line
  461. % worst case is 12bit ImageType3 InterleaveType 1 == 48 bits
  462. /MaskDProc {
  463. /FM MaskData dup length () /SubFileDecode filter def
  464. { { FM sM readstring pop } }
  465. } bind def
  466. /FileTailString (12345) def % Marker string to check file data usage
  467. /AppendFileTail { % <string> AppendFileTail <string_with_tail> <original_length>
  468. dup length FileTailString length add string
  469. dup 0 3 index putinterval
  470. dup 2 index length FileTailString putinterval
  471. exch length
  472. } bind def
  473. /MaskDFile {
  474. MaskData dup length () /SubFileDecode filter
  475. /MDF 1 index def
  476. } bind def
  477. /RGBDProc {
  478. /FD RGBData dup length () /SubFileDecode filter def
  479. { { FD sD readstring pop } }
  480. } bind def
  481. /RGBDFile {
  482. RGBData dup length () /SubFileDecode filter
  483. /RGBDF 1 index def
  484. } bind def
  485. /sR WidthRGB 2 mul 1 sub string def % long enough to hold more than one line of 12 bit data
  486. /sG WidthRGB 2 mul 1 sub string def
  487. /sB WidthRGB 2 mul 1 sub string def
  488. /RDProc {
  489. /FR RData dup length () /SubFileDecode filter def
  490. { FR sR readstring pop }
  491. } bind def
  492. /GDProc {
  493. /FG GData dup length () /SubFileDecode filter def
  494. { FG sG readstring pop }
  495. } bind def
  496. /BDProc {
  497. /FB BData dup length () /SubFileDecode filter def
  498. { FB sB readstring pop }
  499. } bind def
  500. /RDFile {
  501. RData dup length () /SubFileDecode filter
  502. /RDF 1 index def
  503. } bind def
  504. /GDFile {
  505. GData dup length () /SubFileDecode filter
  506. /GDF 1 index def
  507. } bind def
  508. /BDFile {
  509. BData dup length () /SubFileDecode filter
  510. /BDF 1 index def
  511. } bind def
  512. % -----------------------------------------------------------------------
  513. %
  514. % Procedure to handle fileposition. Ghostscript has a private
  515. % operator .fileposition that works when fileposition does not
  516. %
  517. % <file> tryfilepos
  518. % Returns: fileposition true if successful
  519. % 0 false if not
  520. /tryfilepos {
  521. /.fileposition where
  522. { pop /.fileposition load } % most likely to succeed
  523. { /fileposition load }
  524. ifelse
  525. stopped
  526. { pop 0 false }
  527. { true }
  528. ifelse
  529. } bind def
  530. % -----------------------------------------------------------------------
  531. %
  532. % Procedure to provide =only operator if not present. Suggested
  533. % by Alex Cherepanov to use =print operator present on some Adobe
  534. % implementations.
  535. /=only where
  536. { pop }
  537. { /=print where { pop /=print load } { /print load } ifelse
  538. /=only exch def
  539. }
  540. ifelse
  541. % -----------------------------------------------------------------------
  542. %
  543. % Procedure to make sure that the file is at the EOF.
  544. % added above (string == FileTailString.
  545. %
  546. % If not, it will mark the image area with a red "F"
  547. %
  548. % <string> <title> <file> CheckFileTail - XX is the horizontal position
  549. % YY is the vertical position
  550. % SX,SY determine size of "F" if fail
  551. /CheckFileTail {
  552. dup
  553. status not dup % status false says no longer valid
  554. { (Unexpected EOF: XX,YY=) print XX =only (,) print YY = false }
  555. { 1 index tryfilepos not exch 5 index length ne or dup
  556. { 3 index print ( fileposition = ) print
  557. 2 index tryfilepos pop =only
  558. ( doesn't match expected = ) print 4 index length = flush
  559. }
  560. if
  561. }
  562. ifelse
  563. or
  564. {
  565. gsave .8 0 0 setrgbcolor
  566. SX 4 div setlinewidth
  567. XX YY moveto 0 SY rlineto SX 0 rlineto stroke
  568. XX YY SY .5 mul add moveto SX .5 mul 0 rlineto stroke
  569. grestore
  570. }
  571. if
  572. pop pop pop
  573. } bind def
  574. /CSpaceName { % - CSpaceName <string>
  575. CSpace dup type /arraytype eq { 0 get } if
  576. 15 string cvs
  577. } bind def
  578. % -----------------------------------------------------------------------
  579. %
  580. % tests
  581. /CheckImage {
  582. /IR 0 def
  583. /CSpace /DeviceRGB def
  584. % Use an unusual (unpleasant?) underlying color
  585. .6 .95 .4 setrgbcolor clippath fill
  586. 0 0 0 setrgbcolor
  587. TitleFont setfont
  588. 200 760 moveto (Image Type 3 Tests) show
  589. 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
  590. 170 720 moveto (Colorspace = ) show CSpaceName show
  591. LegendFont setfont
  592. .4 .1 .7 setrgbcolor % contrasting color for stencil masking
  593. /SX SX 2 mul def /SY SY 2 mul def
  594. /YY 780 SY sub def
  595. MaskGen
  596. TX IMLRTB MaskData [1 0] DoImageMask
  597. /RGBData WD HD mul 3 mul string def
  598. { X Y WD mul add 3 mul RGBData
  599. dup 2 index R 255 mul cvi put
  600. dup 2 index 1 add G 255 mul cvi put
  601. exch 2 add B 255 mul cvi put
  602. } ImageGen
  603. % X BPC matrix source multi decode
  604. XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  605. /SX SX 2 div def /SY SY 2 div def
  606. showpage
  607. } def
  608. % -----------------------------------------------------------------------
  609. %
  610. % Type 1 and Type 4 Tests
  611. % /CSpace and /IR are defined in order to generate various pages
  612. /T1T4Tests { %
  613. % Use an unusual (unpleasant?) underlying color
  614. .6 .95 .4 setrgbcolor clippath fill
  615. 0 0 0 setrgbcolor
  616. TitleFont setfont
  617. 120 760 moveto (Image Type 1 and ImageType 4 Tests) show
  618. 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
  619. 170 720 moveto (Colorspace = ) show CSpaceName show
  620. LegendFont setfont
  621. XA BY moveto (Decode\nInverted) blockshow
  622. XB BY moveto ( IMLRTB\nDS=string) blockshow
  623. XC BY moveto ( IMLRBT\nDS=string) blockshow
  624. XD BY moveto ( IMRLTB\nDS=string) blockshow
  625. XE BY moveto ( IMRLBT\nDS=string) blockshow
  626. XF BY moveto (IMLRTB\nDS=proc) blockshow
  627. XG BY moveto (IMLRTB\nDS=file) blockshow
  628. XH BY moveto ( Multi\nDS=string) blockshow
  629. XI BY moveto ( Multi\nDS=proc) blockshow
  630. XJ BY moveto ( Multi\nDS=file) blockshow
  631. .4 .1 .7 setrgbcolor % contrasting color for stencil masking
  632. /WM WD def
  633. /HM HD def
  634. /SX SX 2 mul def /SY SY 2 mul def
  635. /YY 780 SY sub def
  636. MaskGen
  637. TX IMLRTB MaskData [1 0] DoImageMask
  638. /RGBData WD HD mul 3 mul string def
  639. { X Y WD mul add 3 mul RGBData
  640. dup 2 index R 255 mul cvi put
  641. dup 2 index 1 add G 255 mul cvi put
  642. exch 2 add B 255 mul cvi put
  643. } ImageGen
  644. % X BPC matrix source multi decode
  645. XI 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  646. /SX SX 2 div def /SY SY 2 div def
  647. % ----------------------------------------------------------------------
  648. % Type 1 Stencil Mask Images
  649. /YY YA def
  650. TX YA SY add moveto (\nType 1\nStencil\nMask) blockshow
  651. MaskGen
  652. % X matrix source decode
  653. XA IMLRTB MaskData [0 1] DoImageMask
  654. XB IMLRTB MaskData [1 0] DoImageMask
  655. XC IMLRBT MaskData [1 0] DoImageMask
  656. XD IMRLTB MaskData [1 0] DoImageMask
  657. XE IMRLBT MaskData [1 0] DoImageMask
  658. XF IMLRTB MaskDProc [1 0] DoImageMask
  659. XG IMLRTB MaskDFile [1 0] DoImageMask
  660. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  661. % ----------------------------------------------------------------------
  662. % Type 1 RGB Single Data Sources, BPC==8
  663. /YY YB def
  664. TX YY SY add moveto (\nType 1\nRGB\nBPC=8) blockshow
  665. /RGBData WD HD mul 3 mul string def
  666. { X Y WD mul add 3 mul RGBData
  667. dup 2 index R 255 mul cvi put
  668. dup 2 index 1 add G 255 mul cvi put
  669. exch 2 add B 255 mul cvi put
  670. } ImageGen
  671. % X BPC matrix source multi decode
  672. XA 8 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
  673. XB 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  674. XC 8 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
  675. XD 8 IMRLTB RGBData false [0 1 0 1 0 1] DoImage1
  676. XE 8 IMRLBT RGBData false [0 1 0 1 0 1] DoImage1
  677. XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
  678. XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
  679. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  680. % ----------------------------------------------------------------------
  681. % Type 1 RGB Multiple Data Sources, BPC==8
  682. WD HD mul /RData 1 index string def
  683. /GData 1 index string def
  684. /BData exch string def
  685. { X Y WD mul add
  686. RData 1 index R 255 mul cvi put
  687. GData 1 index G 255 mul cvi put
  688. BData exch B 255 mul cvi put
  689. } ImageGen
  690. % X BPC matrix source multi decode
  691. XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
  692. XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
  693. XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
  694. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  695. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  696. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  697. % ----------------------------------------------------------------------
  698. % Type 4 RGB Single Data Sources, BPC==8, mask black
  699. /YY YE def
  700. TX YY SY add moveto (\nType 4\nBPC=8\nmask=black) blockshow
  701. % X BPC matrix source multi decode MaskColor
  702. XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 000 000 000 ] DoImage4
  703. XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  704. XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  705. XD 8 IMRLTB RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  706. XE 8 IMRLBT RGBData false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  707. XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  708. XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  709. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  710. % ----------------------------------------------------------------------
  711. % Type 4 RGB Multiple Data Sources, BPC==8, mask black
  712. % X BPC matrix source multi decode MaskColor
  713. XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  714. XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  715. XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 000 000 000 ] DoImage4
  716. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  717. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  718. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  719. % ----------------------------------------------------------------------
  720. % Type 4 RGB Single Data Sources, BPC==8, mask white
  721. /YY YF def
  722. TX YY SY add moveto (\nType 4\nBPC=8\nmask=white) blockshow
  723. % X BPC matrix source multi decode MaskColor
  724. XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 255 255 255 ] DoImage4
  725. gsave .5 .2 .2 setrgbcolor XB YY SX 13 mul SY rectfill grestore
  726. XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  727. XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  728. XD 8 IMRLTB RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  729. XE 8 IMRLBT RGBData false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  730. XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  731. XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  732. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  733. % ----------------------------------------------------------------------
  734. % Type 4 RGB Multiple Data Sources, BPC==8, mask white
  735. % X BPC matrix source multi decode MaskColor
  736. XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  737. XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  738. XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 255 255 255 ] DoImage4
  739. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  740. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  741. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  742. % ----------------------------------------------------------------------
  743. % Type 4 RGB Single Data Sources, BPC==8, mask gray
  744. /YY YG def
  745. TX YY SY add moveto (\nType 4\nBPC=8\nmask=gray) blockshow
  746. % X BPC matrix source multi decode MaskColor
  747. XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 147 147 147 ] DoImage4
  748. XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  749. XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  750. XD 8 IMRLTB RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  751. XE 8 IMRLBT RGBData false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  752. XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  753. XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  754. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  755. % ----------------------------------------------------------------------
  756. % Type 4 RGB Multiple Data Sources, BPC==8, mask gray
  757. % X BPC matrix source multi decode MaskColor
  758. XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  759. XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  760. XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 147 147 147 ] DoImage4
  761. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  762. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  763. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  764. % ----------------------------------------------------------------------
  765. % Type 4 RGB Single Data Sources, BPC==8, mask range
  766. /YY YH def
  767. TX YY SY add moveto (\nType 4\nBPC=8\nmask range) blockshow
  768. % X BPC matrix source multi decode MaskColor
  769. XA 8 IMLRTB RGBData false [1 0 1 0 1 0] [ 020 200 020 200 020 200 ] DoImage4
  770. XB 8 IMLRTB RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  771. XC 8 IMLRBT RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  772. XD 8 IMRLTB RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  773. XE 8 IMRLBT RGBData false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  774. XF 8 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  775. XG 8 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  776. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  777. % ----------------------------------------------------------------------
  778. % Type 4 RGB Multiple Data Sources, BPC==8, mask range
  779. % X Y SX SY BPC matrix source multi decode MaskColor
  780. XH 8 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  781. XI 8 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  782. XJ 8 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 020 200 020 200 020 200 ] DoImage4
  783. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  784. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  785. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  786. % ----------------------------------------------------------------------
  787. % Type 1 RGB Single Data Sources, BPC==12
  788. /YY YC def
  789. TX YY SY add moveto (\nType 1\nRGB\nBPC=12) blockshow
  790. /RGBData WD 36 mul 7 add 8 div cvi HD mul string def
  791. {
  792. X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add
  793. RGBData 1 index R put12bit
  794. RGBData 1 index 1.5 add G put12bit
  795. RGBData exch 3 add B put12bit
  796. } ImageGen
  797. % X BPC matrix source multi decode
  798. XA 12 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
  799. XB 12 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  800. XC 12 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
  801. XD 12 IMRLTB RGBData false [0 1 0 1 0 1] DoImage1
  802. XE 12 IMRLBT RGBData false [0 1 0 1 0 1] DoImage1
  803. XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
  804. XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
  805. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  806. % ----------------------------------------------------------------------
  807. % Type 1 RGB Multiple Data Sources, BPC==12
  808. WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
  809. /GData 1 index string def
  810. /BData exch string def
  811. {
  812. X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
  813. RData 1 index R put12bit
  814. GData 1 index G put12bit
  815. BData exch B put12bit
  816. } ImageGen
  817. % X BPC matrix source multi decode
  818. XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
  819. XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
  820. XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
  821. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  822. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  823. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  824. % ----------------------------------------------------------------------
  825. % Type 4 RGB Single Data Sources, BPC==12, mask range
  826. /YY YI def
  827. TX YY SY add moveto (\nType 4\nBPC=12\nmask range) blockshow
  828. % X BPC matrix source multi decode MaskColor
  829. XA 12 IMLRTB RGBData false [1 0 1 0 1 0] [ 300 3000 300 3000 300 3000 ] DoImage4
  830. XB 12 IMLRTB RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  831. XC 12 IMLRBT RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  832. XD 12 IMRLTB RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  833. XE 12 IMRLBT RGBData false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  834. XF 12 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  835. XG 12 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  836. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  837. % ----------------------------------------------------------------------
  838. % Type 4 RGB Multiple Data Sources, BPC==12, mask range
  839. % X BPC matrix source multi decode MaskColor
  840. XH 12 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  841. XI 12 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  842. XJ 12 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 300 3000 300 3000 300 3000 ] DoImage4
  843. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  844. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  845. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  846. % ----------------------------------------------------------------------
  847. % Type 1 RGB Single Data Sources, BPC==4
  848. /YY YD def
  849. TX YY SY add moveto (\nType 1\nRGB\nBPC=4) blockshow
  850. /RGBData WD 12 mul 7 add 8 div cvi HD mul string def
  851. {
  852. X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add
  853. RGBData 1 index R put4bit
  854. RGBData 1 index 0.5 add G put4bit
  855. RGBData exch 1.0 add B put4bit
  856. } ImageGen
  857. % X BPC matrix source multi decode
  858. XA 4 IMLRTB RGBData false [1 0 1 0 1 0] DoImage1
  859. XB 4 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  860. XC 4 IMLRBT RGBData false [0 1 0 1 0 1] DoImage1
  861. XD 4 IMRLTB RGBData false [0 1 0 1 0 1] DoImage1
  862. XE 4 IMRLBT RGBData false [0 1 0 1 0 1] DoImage1
  863. XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] DoImage1
  864. XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] DoImage1
  865. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  866. % ----------------------------------------------------------------------
  867. % Type 1 RGB Multiple Data Sources, BPC==4
  868. WD 1 add 2 div cvi HD mul /RData 1 index string def
  869. /GData 1 index string def
  870. /BData exch string def
  871. {
  872. X 2 div Y WD 1 add 2 div cvi mul add
  873. RData 1 index R put4bit
  874. GData 1 index G put4bit
  875. BData exch B put4bit
  876. } ImageGen
  877. % X BPC matrix source multi decode
  878. XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] DoImage1
  879. XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] DoImage1
  880. XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] DoImage1
  881. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  882. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  883. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  884. % ----------------------------------------------------------------------
  885. % Type 4 RGB Single Data Sources, BPC==4, mask range
  886. /YY YJ def
  887. TX YY SY add moveto (\nType 4\nBPC=4\nmask range) blockshow
  888. % X BPC matrix source multi decode MaskColor
  889. XA 4 IMLRTB RGBData false [1 0 1 0 1 0] [ 1 10 1 10 1 10 ] DoImage4
  890. XB 4 IMLRTB RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  891. XC 4 IMLRBT RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  892. XD 4 IMRLTB RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  893. XE 4 IMRLBT RGBData false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  894. XF 4 IMLRTB RGBDProc false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  895. XG 4 IMLRTB RGBDFile false [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  896. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  897. % ----------------------------------------------------------------------
  898. % Type 4 RGB Multiple Data Sources, BPC==4, mask range
  899. % X BPC matrix source multi decode MaskColor
  900. XH 4 IMLRTB [ RData GData BData ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  901. XI 4 IMLRTB [ RDProc GDProc BDProc ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  902. XJ 4 IMLRTB [ RDFile GDFile BDFile ] true [0 1 0 1 0 1] [ 1 10 1 10 1 10 ] DoImage4
  903. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  904. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  905. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  906. showpage
  907. } bind def % T1T4Tests
  908. % -----------------------------------------------------------------------
  909. %
  910. % Type 3 Tests
  911. /T3Tests {
  912. % Use an unusual (unpleasant?) underlying color
  913. .6 .95 .4 setrgbcolor clippath fill
  914. 0 0 0 setrgbcolor
  915. TitleFont setfont
  916. 200 760 moveto (Image Type 3 Tests) show
  917. 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
  918. 170 720 moveto (Colorspace = ) show CSpaceName show
  919. LegendFont setfont
  920. .4 .1 .7 setrgbcolor % contrasting color for stencil masking
  921. /WM WD def
  922. /HM HD def
  923. /SX SX 2 mul def /SY SY 2 mul def
  924. /YY 780 SY sub def
  925. MaskGen
  926. XA IMLRTB MaskData [1 0] DoImageMask
  927. /RGBData WD HD mul 3 mul string def
  928. { X Y WD mul add 3 mul RGBData
  929. dup 2 index R 255 mul cvi put
  930. dup 2 index 1 add G 255 mul cvi put
  931. exch 2 add B 255 mul cvi put
  932. } ImageGen
  933. % X BPC matrix source multi decode
  934. XH 8 IMLRTB RGBData false [0 1 0 1 0 1] DoImage1
  935. /SX SX 2 div def /SY SY 2 div def
  936. % ----------------------------------------------------------------------
  937. % InterleaveType 1, BPC==8, WM=WD, HM=HD
  938. % IT 1 is what GS calls "chunky pixel"
  939. /YY YA def
  940. TX YY SY add moveto (\nIntType 1\nBPC=8) blockshow
  941. % Generate the MaskData first
  942. 8 MaskGenBPC
  943. % Generate the Data Image (uses the MaskData)
  944. /RGBData WD HD mul 4 mul string def
  945. { X Y WD mul add 4 mul % 4 bytes Mask,Red,Green,Blue
  946. RGBData
  947. dup 2 index MaskData X Y WB mul add get put
  948. dup 2 index 1 add R 255 mul cvi put
  949. dup 2 index 2 add G 255 mul cvi put
  950. exch 3 add B 255 mul cvi put
  951. }
  952. ImageGen
  953. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  954. XA 8 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 1 DoImage3
  955. XB 8 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 1 DoImage3
  956. XC 8 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 1 DoImage3
  957. XD 8 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  958. XE 8 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  959. XF 8 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  960. XG 8 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  961. XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
  962. XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
  963. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  964. % ----------------------------------------------------------------------
  965. % InterleaveType 1, BPC==12, WM=WD, HM=HD
  966. % IT 1 is what GS calls "chunky pixel"
  967. /YY YB def
  968. TX YY SY add moveto (\nIntType 1\nBPC=12) blockshow
  969. % Generate the MaskData first
  970. 12 MaskGenBPC
  971. % Generate the Data Image (uses the MaskData)
  972. /RGBData WD HD mul 6 mul string def
  973. { X Y WD mul add 6 mul % 6 bytes Mask,Red,Green,Blue
  974. RGBData
  975. dup 2 index
  976. MaskData X 1.5 mul .5 add cvi
  977. Y WB mul add get % get the aligned mask byte (hi or lo)
  978. 0 eq { 0 } { 1 } ifelse
  979. put12bit
  980. dup 2 index 1.5 add R put12bit
  981. dup 2 index 3.0 add G put12bit
  982. exch 4.5 add B put12bit
  983. }
  984. ImageGen
  985. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  986. XA 12 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 1 DoImage3
  987. XB 12 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 1 DoImage3
  988. XC 12 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 1 DoImage3
  989. XD 12 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  990. XE 12 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  991. XF 12 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  992. XG 12 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  993. XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
  994. XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
  995. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  996. % ----------------------------------------------------------------------
  997. % InterleaveType 1, BPC==4, WM=WD, HM=HD
  998. % IT 1 is what GS calls "chunky pixel"
  999. /YY YC def
  1000. TX YY SY add moveto (\nIntType 1\nBPC=4) blockshow
  1001. % Generate the MaskData first
  1002. 4 MaskGenBPC
  1003. % Generate the Data Image (uses the MaskData)
  1004. /RGBData WD HD mul 2 mul string def
  1005. { X Y WD mul add 2 mul % 2 bytes Mask,Red,Green,Blue
  1006. RGBData
  1007. dup 2 index MaskData X 2 div cvi Y WB mul add get
  1008. X 1 and 0 eq { 128 div cvi } { 1 and } ifelse
  1009. put4bit
  1010. dup 2 index 0.5 add R put4bit
  1011. dup 2 index 1.0 add G put4bit
  1012. exch 1.5 add B put4bit
  1013. }
  1014. ImageGen
  1015. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1016. XA 4 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 1 DoImage3
  1017. XB 4 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 1 DoImage3
  1018. XC 4 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 1 DoImage3
  1019. XD 4 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1020. XE 4 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1021. XF 4 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1022. XG 4 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1023. XH 4 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1024. XI 4 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 1 DoImage3
  1025. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1026. % ----------------------------------------------------------------------
  1027. % InterleaveType 2, BPC==8, WM=WD, HM=HD
  1028. % IT 2 is line interleave -- Mask line follwoed by Data line
  1029. % RGB Image Data must be chunky (MultipleDatasources==false).
  1030. /YY YD def
  1031. TX YY SY add moveto (\nIntType 2\nBPC=8) blockshow
  1032. % Generate the MaskData first
  1033. MaskGen
  1034. % Generate the Data Image (uses the MaskData)
  1035. /BPL WD 3 mul WB add cvi def % BytesPerLine
  1036. /RGBData BPL HD mul string def
  1037. { X 3 mul Y BPL mul add WB add % 3 bytes Red,Green,Blue + Mask Bytes
  1038. X 0 eq {
  1039. RGBData 1 index WB sub
  1040. MaskData Y WB mul WB getinterval
  1041. putinterval
  1042. } if
  1043. RGBData
  1044. dup 2 index R 255 mul cvi put
  1045. dup 2 index 1 add G 255 mul cvi put
  1046. exch 2 add B 255 mul cvi put
  1047. }
  1048. ImageGen
  1049. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1050. XA 8 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1051. XB 8 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1052. XC 8 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1053. XD 8 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1054. XE 8 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1055. XF 8 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1056. XG 8 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1057. XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1058. XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1059. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1060. % ----------------------------------------------------------------------
  1061. % InterleaveType 2, BPC==12, WM=WD, HM=HD
  1062. /YY YE def
  1063. TX YY SY add moveto (\nIntType 2\nBPC=12) blockshow
  1064. % Generate the Data Image (uses the MaskData)
  1065. /BPL WD 36 mul 7 add 8 div cvi WB add def % BytesPerLine
  1066. /RGBData BPL HD mul string def
  1067. { X 36 mul 8 div Y BPL mul add WB add
  1068. X 0 eq {
  1069. RGBData 1 index WB sub cvi
  1070. MaskData Y WB mul WB getinterval
  1071. putinterval
  1072. } if
  1073. RGBData
  1074. dup 2 index R put12bit
  1075. dup 2 index 1.5 add G put12bit
  1076. exch 3.0 add B put12bit
  1077. }
  1078. ImageGen
  1079. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1080. XA 12 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1081. XB 12 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1082. XC 12 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1083. XD 12 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1084. XE 12 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1085. XF 12 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1086. XG 12 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1087. XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1088. XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1089. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1090. % ----------------------------------------------------------------------
  1091. % InterleaveType 2, BPC==4, WM=WD, HM=HD
  1092. /YY YF def
  1093. TX YY SY add moveto (\nIntType 2\nBPC=4) blockshow
  1094. % Generate the Data Image (uses the MaskData)
  1095. /BPL WD 12 mul 7 add 8 div cvi WB add def % BytesPerLine
  1096. /RGBData BPL HD mul string def
  1097. { X 12 mul 8 div Y BPL mul add WB add
  1098. X 0 eq {
  1099. RGBData 1 index WB sub cvi
  1100. MaskData Y WB mul WB getinterval
  1101. putinterval
  1102. } if
  1103. RGBData
  1104. dup 2 index R put4bit
  1105. dup 2 index 0.5 add G put4bit
  1106. exch 1.0 add B put4bit
  1107. }
  1108. ImageGen
  1109. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1110. XA 4 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1111. XB 4 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1112. XC 4 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1113. XD 4 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1114. XE 4 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1115. XF 4 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1116. XG 4 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1117. XH 4 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1118. XI 4 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1119. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1120. % ----------------------------------------------------------------------
  1121. % InterleaveType 2, BPC==8, WM=.6*WD, HM=HD/2
  1122. % IT 2 is line interleave -- Mask line follwoed by Data line
  1123. % RGB Image Data must be chunky (MultipleDatasources==false).
  1124. /YY YG def
  1125. TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=.6*WD\nHM=HD/2) blockshow
  1126. % Generate the MaskData first
  1127. /WM WD .6 mul cvi def
  1128. /HM HD 2 div cvi def
  1129. /saveHD HD def
  1130. /HD HM 2 mul def % make HD even for this exercise
  1131. MaskGen
  1132. % Generate the Data Image (uses the MaskData)
  1133. /BPL WD 3 mul def % BytesPerLine RGB Data
  1134. /RGBData BPL HD mul WB HM mul add string def
  1135. { X 3 mul Y BPL mul add Y 2 div cvi 1 add WB mul add % 3 bytes Red,Green,Blue + Mask
  1136. X 0 eq Y 1 and 0 eq and { % Do one row of Mask every other image row
  1137. RGBData 1 index WB sub
  1138. MaskData Y 2 div cvi WB mul WB getinterval
  1139. putinterval
  1140. } if
  1141. RGBData
  1142. dup 2 index R 255 mul cvi put
  1143. dup 2 index 1 add G 255 mul cvi put
  1144. exch 2 add B 255 mul cvi put
  1145. }
  1146. ImageGen
  1147. %DEBUG /xx (xx) (w) file def
  1148. %DEBUG 0 1 HM 1 sub { MaskData exch WB mul WB getinterval xx exch writehexstring xx (\n) writestring } for
  1149. %DEBUG xx (----------------------------------------------------------------\n) writestring
  1150. %DEBUG 0 2 HD 1 sub {
  1151. %DEBUG RGBData 1 index BPL mul 2 index 2 div cvi WB mul add
  1152. %DEBUG WB getinterval xx exch writehexstring xx (\n) writestring
  1153. %DEBUG RGBData 1 index BPL mul 2 index 2 div cvi 1 add WB mul add
  1154. %DEBUG BPL getinterval xx exch writehexstring xx (\n) writestring
  1155. %DEBUG RGBData 1 index 1 add BPL mul 2 index 2 div cvi 1 add WB mul add
  1156. %DEBUG BPL getinterval xx exch writehexstring xx (\n) writestring
  1157. %DEBUG pop
  1158. %DEBUG } for
  1159. %DEBUG xx closefile
  1160. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1161. XA 8 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1162. XB 8 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1163. XC 8 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1164. XD 8 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1165. XE 8 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1166. XF 8 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1167. XG 8 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1168. XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1169. XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1170. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1171. /HD saveHD def % put odd HD back
  1172. % ----------------------------------------------------------------------
  1173. % InterleaveType 2, BPC==8, WM=1.3*WD, HM=2*HD
  1174. % IT 2 is line interleave -- Mask line follwoed by Data line
  1175. % RGB Image Data must be chunky (MultipleDatasources==false).
  1176. /YY YH def
  1177. TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=1.3*WD\nHM=2*HD) blockshow
  1178. % Generate the MaskData first
  1179. /WM WD 1.3 mul cvi def
  1180. /HM HD 2 mul def
  1181. MaskGen
  1182. % Generate the Data Image (uses the MaskData)
  1183. /HR HM HD div cvi def
  1184. /BPL WD 3 mul WB HR mul add cvi def % BytesPerLine
  1185. /RGBData BPL HD mul string def
  1186. { X 3 mul Y BPL mul add WB HR mul add % 3 bytes Red,Green,Blue + Mask Bytes
  1187. X 0 eq { % Do HM/HD rows of Mask
  1188. RGBData 1 index WB HR mul sub
  1189. MaskData Y WB HR mul mul WB HR mul getinterval
  1190. putinterval
  1191. } if
  1192. RGBData
  1193. dup 2 index R 255 mul cvi put
  1194. dup 2 index 1 add G 255 mul cvi put
  1195. exch 2 add B 255 mul cvi put
  1196. }
  1197. ImageGen
  1198. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1199. XA 8 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1200. XB 8 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1201. XC 8 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1202. XD 8 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1203. XE 8 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1204. XF 8 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1205. XG 8 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1206. XH 8 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1207. XI 8 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1208. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1209. % ----------------------------------------------------------------------
  1210. % InterleaveType 2, BPC==12, WM=1.3*WD, HM=2*HD
  1211. /YY YI def
  1212. TX YY SY add moveto (\nIntType 2\nBPC=12\nWM=1.3*WD\nHM=2*HD) blockshow
  1213. % Generate the Data Image (uses the MaskData)
  1214. /HR HM HD div cvi def
  1215. /BPL WD 36 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine
  1216. /RGBData BPL HD mul string def
  1217. { X 36 mul 8 div Y BPL mul add WB HR mul add
  1218. X 0 eq {
  1219. RGBData 1 index WB HR mul sub cvi
  1220. MaskData Y WB HR mul mul WB HR mul getinterval
  1221. putinterval
  1222. } if
  1223. RGBData
  1224. dup 2 index R put12bit
  1225. dup 2 index 1.5 add G put12bit
  1226. exch 3.0 add B put12bit
  1227. }
  1228. ImageGen
  1229. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1230. XA 12 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1231. XB 12 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1232. XC 12 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1233. XD 12 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1234. XE 12 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1235. XF 12 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1236. XG 12 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1237. XH 12 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1238. XI 12 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1239. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1240. % ----------------------------------------------------------------------
  1241. % InterleaveType 2, BPC==4, WM=1.3*WD, HM=2*HD
  1242. /YY YJ def
  1243. TX YY SY add moveto (\nIntType 2\nBPC=4\nWM=1.3*WD\nHM=2*HD) blockshow
  1244. % Generate the Data Image (uses the MaskData)
  1245. /HR HM HD div cvi def
  1246. /BPL WD 12 mul 7 add 8 div cvi WB HR mul add def % BytesPerLine
  1247. /RGBData BPL HD mul string def
  1248. { X 12 mul 8 div Y BPL mul add WB HR mul add
  1249. X 0 eq {
  1250. RGBData 1 index WB HR mul sub cvi
  1251. MaskData Y WB HR mul mul WB HR mul getinterval
  1252. putinterval
  1253. } if
  1254. RGBData
  1255. dup 2 index R put4bit
  1256. dup 2 index 0.5 add G put4bit
  1257. exch 1.0 add B put4bit
  1258. }
  1259. ImageGen
  1260. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1261. XA 4 IMLRTB RGBData false [0 1] [1 0 1 0 1 0] 2 DoImage3
  1262. XB 4 IMLRTB RGBData false [1 0] [1 0 1 0 1 0] 2 DoImage3
  1263. XC 4 IMLRTB RGBData false [0 1] [0 1 0 1 0 1] 2 DoImage3
  1264. XD 4 IMLRTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1265. XE 4 IMLRBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1266. XF 4 IMRLTB RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1267. XG 4 IMRLBT RGBData false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1268. XH 4 IMLRTB RGBDProc false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1269. XI 4 IMLRTB RGBDFile false [1 0] [0 1 0 1 0 1] 2 DoImage3
  1270. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1271. showpage
  1272. % ----------------------------------------------------------------------
  1273. % Use an unusual (unpleasant?) underlying color
  1274. .6 .95 .4 setrgbcolor clippath fill
  1275. 0 0 0 setrgbcolor
  1276. TitleFont setfont
  1277. 200 760 moveto (Image Type 3 Tests) show
  1278. 200 740 moveto (Rotation Angle = ) show IR 3 string cvs show
  1279. 200 720 moveto (InterleaveType 3) show
  1280. 170 700 moveto (Colorspace = ) show CSpaceName show
  1281. LegendFont setfont
  1282. .4 .1 .7 setrgbcolor % contrasting color for stencil masking
  1283. % ----------------------------------------------------------------------
  1284. % InterleaveType 3, BPC==8, WM=WD, HM=HD
  1285. % IT 3 is line interleave -- Mask and Data in separate sources
  1286. % RGB Image Data chunky (MultipleDatasources==false).
  1287. /YY YA def
  1288. TX YY SY add moveto (BPC=8\nMulti\nfalse) blockshow
  1289. % Generate the MaskData first
  1290. /WM WD def
  1291. /HM HD def
  1292. MaskGen
  1293. % Generate the Data Image
  1294. /RGBData WD HD mul 3 mul string def
  1295. { X Y WD mul add 3 mul RGBData
  1296. dup 2 index R 255 mul cvi put
  1297. dup 2 index 1 add G 255 mul cvi put
  1298. exch 2 add B 255 mul cvi put
  1299. } ImageGen
  1300. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1301. XA 8 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3
  1302. XB 8 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3
  1303. XC 8 IMLRTB [ MaskData RGBData ] false [0 1] [0 1 0 1 0 1] 3 DoImage3
  1304. XD 8 IMLRTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1305. XE 8 IMLRBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1306. XF 8 IMRLTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1307. XG 8 IMRLBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1308. XH 8 IMLRTB [ MaskDProc RGBDProc ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1309. XI 8 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1310. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1311. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1312. % ----------------------------------------------------------------------
  1313. % InterleaveType 3, BPC==12, WM=WD, HM=HD
  1314. /YY YB def
  1315. TX YY SY add moveto (BPC=12\nMulti\nfalse) blockshow
  1316. /RGBData WD 36 mul 7 add 8 div cvi HD mul string def
  1317. {
  1318. X 36 mul 8 div Y WD 36 mul 7 add 8 div cvi mul add
  1319. RGBData 1 index R put12bit
  1320. RGBData 1 index 1.5 add G put12bit
  1321. RGBData exch 3 add B put12bit
  1322. } ImageGen
  1323. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1324. XA 12 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3
  1325. XB 12 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3
  1326. XC 12 IMLRTB [ MaskData RGBData ] false [0 1] [0 1 0 1 0 1] 3 DoImage3
  1327. XD 12 IMLRTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1328. XE 12 IMLRBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1329. XF 12 IMRLTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1330. XG 12 IMRLBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1331. XH 12 IMLRTB [ MaskDProc RGBDProc ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1332. XI 12 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1333. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1334. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1335. % ----------------------------------------------------------------------
  1336. % InterleaveType 3, BPC==4, WM=WD, HM=HD
  1337. /YY YC def
  1338. TX YY SY add moveto (BPC=4\nMulti\nfalse) blockshow
  1339. /RGBData WD 12 mul 7 add 8 div cvi HD mul string def
  1340. {
  1341. X 12 mul 8 div Y WD 12 mul 7 add 8 div cvi mul add
  1342. RGBData 1 index R put4bit
  1343. RGBData 1 index 0.5 add G put4bit
  1344. RGBData exch 1.0 add B put4bit
  1345. } ImageGen
  1346. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1347. XA 4 IMLRTB [ MaskData RGBData ] false [0 1] [1 0 1 0 1 0] 3 DoImage3
  1348. XB 4 IMLRTB [ MaskData RGBData ] false [1 0] [1 0 1 0 1 0] 3 DoImage3
  1349. XC 4 IMLRTB [ MaskData RGBData ] false [0 1] [0 1 0 1 0 1] 3 DoImage3
  1350. XD 4 IMLRTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1351. XE 4 IMLRBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1352. XF 4 IMRLTB [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1353. XG 4 IMRLBT [ MaskData RGBData ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1354. XH 4 IMLRTB [ MaskDProc RGBDProc ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1355. XI 4 IMLRTB [ MaskDFile RGBDFile ] false [1 0] [0 1 0 1 0 1] 3 DoImage3
  1356. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1357. RGBData (RGB) RGBDF CheckFileTail % Check that the correct amount of data was consumed
  1358. % ----------------------------------------------------------------------
  1359. % InterleaveType 3, BPC==8, WM=WD, HM=HD
  1360. % IT 3 is line interleave -- Mask and Data in separate sources
  1361. % RGB Image Data seprate (MultipleDatasources==true).
  1362. /YY YA def
  1363. TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
  1364. % Generate the MaskData first
  1365. MaskGen
  1366. % Generate the Data Image
  1367. WD HD mul /RData 1 index string def
  1368. /GData 1 index string def
  1369. /BData exch string def
  1370. { X Y WD mul add
  1371. RData 1 index R 255 mul cvi put
  1372. GData 1 index G 255 mul cvi put
  1373. BData exch B 255 mul cvi put
  1374. } ImageGen
  1375. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1376. XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1377. XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1378. XC 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1379. XD 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1380. XE 8 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1381. XF 8 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1382. XG 8 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1383. XH 8 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1384. XI 8 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1385. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1386. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1387. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1388. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1389. % ----------------------------------------------------------------------
  1390. % InterleaveType 3, BPC==8, WM=WD, HM=HD
  1391. % IT 3 is line interleave -- Mask and Data in separate sources
  1392. % RGB Image Data seprate (MultipleDatasources==true).
  1393. /YY YD def
  1394. TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
  1395. % Generate the MaskData first
  1396. MaskGen
  1397. % Generate the Data Image
  1398. WD HD mul /RData 1 index string def
  1399. /GData 1 index string def
  1400. /BData exch string def
  1401. { X Y WD mul add
  1402. RData 1 index R 255 mul cvi put
  1403. GData 1 index G 255 mul cvi put
  1404. BData exch B 255 mul cvi put
  1405. } ImageGen
  1406. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1407. XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1408. XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1409. XC 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1410. XD 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1411. XE 8 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1412. XF 8 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1413. XG 8 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1414. XH 8 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1415. XI 8 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1416. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1417. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1418. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1419. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1420. % ----------------------------------------------------------------------
  1421. % InterleaveType 3, BPC==12, WM=WD, HM=HD
  1422. /YY YE def
  1423. TX YY SY add moveto (BPC=12\nMulti\ntrue) blockshow
  1424. WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
  1425. /GData 1 index string def
  1426. /BData exch string def
  1427. {
  1428. X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
  1429. RData 1 index R put12bit
  1430. GData 1 index G put12bit
  1431. BData exch B put12bit
  1432. } ImageGen
  1433. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1434. XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1435. XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1436. XC 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1437. XD 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1438. XE 12 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1439. XF 12 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1440. XG 12 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1441. XH 12 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1442. XI 12 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1443. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1444. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1445. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1446. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1447. % ----------------------------------------------------------------------
  1448. % InterleaveType 3, BPC==4, WM=WD, HM=HD
  1449. /YY YF def
  1450. TX YY SY add moveto (BPC=4\nMulti\ntrue) blockshow
  1451. WD 1 add 2 div cvi HD mul /RData 1 index string def
  1452. /GData 1 index string def
  1453. /BData exch string def
  1454. {
  1455. X 2 div Y WD 1 add 2 div cvi mul add
  1456. RData 1 index R put4bit
  1457. GData 1 index G put4bit
  1458. BData exch B put4bit
  1459. } ImageGen
  1460. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1461. XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1462. XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1463. XC 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1464. XD 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1465. XE 4 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1466. XF 4 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1467. XG 4 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1468. XH 4 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1469. XI 4 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1470. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1471. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1472. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1473. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1474. % ----------------------------------------------------------------------
  1475. % InterleaveType 3, BPC==8, WM=.9*WD, HM=1.1*HD
  1476. % IT 3 is line interleave -- Mask and Data in separate sources
  1477. % RGB Image Data seprate (MultipleDatasources==true).
  1478. /YY YG def
  1479. TX YY SY add moveto (BPC=8\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
  1480. /WM 0.9 WD mul cvi def
  1481. /HM 1.1 HD mul cvi def
  1482. % Generate the MaskData first
  1483. MaskGen
  1484. % Generate the Data Image
  1485. WD HD mul /RData 1 index string def
  1486. /GData 1 index string def
  1487. /BData exch string def
  1488. { X Y WD mul add
  1489. RData 1 index R 255 mul cvi put
  1490. GData 1 index G 255 mul cvi put
  1491. BData exch B 255 mul cvi put
  1492. } ImageGen
  1493. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1494. XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1495. XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1496. XC 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1497. XD 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1498. XE 8 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1499. XF 8 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1500. XG 8 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1501. XH 8 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1502. XI 8 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1503. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1504. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1505. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1506. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1507. % ----------------------------------------------------------------------
  1508. % InterleaveType 3, BPC==12, WM=WD, HM=HD
  1509. /YY YI def
  1510. TX YY SY add moveto (BPC=12\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
  1511. WD 3 mul 1 add 2 div cvi HD mul /RData 1 index string def
  1512. /GData 1 index string def
  1513. /BData exch string def
  1514. {
  1515. X 3 mul 2 div Y WD 3 mul 1 add 2 div cvi mul add
  1516. RData 1 index R put12bit
  1517. GData 1 index G put12bit
  1518. BData exch B put12bit
  1519. } ImageGen
  1520. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1521. XA 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1522. XB 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1523. XC 12 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1524. XD 12 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1525. XE 12 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1526. XF 12 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1527. XG 12 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1528. XH 12 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1529. XI 12 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1530. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1531. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1532. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1533. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1534. % ----------------------------------------------------------------------
  1535. % InterleaveType 3, BPC==4, WM=WD, HM=HD
  1536. /YY YJ def
  1537. TX YY SY add moveto (BPC=4\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
  1538. WD 1 add 2 div cvi HD mul /RData 1 index string def
  1539. /GData 1 index string def
  1540. /BData exch string def
  1541. {
  1542. X 2 div Y WD 1 add 2 div cvi mul add
  1543. RData 1 index R put4bit
  1544. GData 1 index G put4bit
  1545. BData exch B put4bit
  1546. } ImageGen
  1547. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1548. XA 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1549. XB 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1550. XC 4 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1551. XD 4 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1552. XE 4 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1553. XF 4 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1554. XG 4 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1555. XH 4 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1556. XI 4 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1557. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1558. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1559. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1560. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1561. % ----------------------------------------------------------------------
  1562. % InterleaveType 3, BPC==8, WM=1.1*WD, HM=.9*HD
  1563. % IT 3 is line interleave -- Mask and Data in separate sources
  1564. % RGB Image Data seprate (MultipleDatasources==true).
  1565. /YY YH def
  1566. TX YY SY add moveto (BPC=8\nMulti\ntrue\nWM=1.1*WD\nHM=.9*HD) blockshow
  1567. /WM 1.1 WD mul cvi def
  1568. /HM 0.9 HD mul cvi def
  1569. % Generate the MaskData first
  1570. MaskGen
  1571. % Generate the Data Image
  1572. WD HD mul /RData 1 index string def
  1573. /GData 1 index string def
  1574. /BData exch string def
  1575. { X Y WD mul add
  1576. RData 1 index R 255 mul cvi put
  1577. GData 1 index G 255 mul cvi put
  1578. BData exch B 255 mul cvi put
  1579. } ImageGen
  1580. % X BPC matrix source multi MaskDecode DataDecode IT DoImage3 -
  1581. XA 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [1 0 1 0 1 0] 3 DoImage3
  1582. XB 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [1 0 1 0 1 0] 3 DoImage3
  1583. XC 8 IMLRTB [ MaskData [RData GData BData] ] true [0 1] [0 1 0 1 0 1] 3 DoImage3
  1584. XD 8 IMLRTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1585. XE 8 IMLRBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1586. XF 8 IMRLTB [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1587. XG 8 IMRLBT [ MaskData [RData GData BData] ] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1588. XH 8 IMLRTB [ MaskDProc [RDProc GDProc BDProc]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1589. XI 8 IMLRTB [ MaskDFile [RDFile GDFile BDFile]] true [1 0] [0 1 0 1 0 1] 3 DoImage3
  1590. MaskData (Mask) MDF CheckFileTail % Check that the correct amount of data was consumed
  1591. RData (Red) RDF CheckFileTail % Check that the correct amount of data was consumed
  1592. GData (Grn) GDF CheckFileTail % Check that the correct amount of data was consumed
  1593. BData (Blu) BDF CheckFileTail % Check that the correct amount of data was consumed
  1594. showpage
  1595. } bind def % T3Tests
  1596. % ----------------------------------------------------------------------
  1597. % Do the various rotations
  1598. %
  1599. /CSpace /DeviceRGB def
  1600. [ 0 10 -10 45 90 180 270 ]
  1601. pop [ 0 ] % delete this line to enable tests
  1602. { /IR exch def T1T4Tests } forall
  1603. [ 0 10 -10 45 90 180 270 ]
  1604. pop [ 0 ] % delete this line to enable tests
  1605. { /IR exch def T3Tests } forall
  1606. /CSpace [ /DeviceN [/Blue /Red /Green] /DeviceRGB { } ] def
  1607. [ 0 10 -10 45 90 180 270 ]
  1608. pop [ 0 ] % delete this line to enable tests
  1609. { /IR exch def T1T4Tests } forall
  1610. [ 0 10 -10 45 90 180 270 ]
  1611. pop [ 0 ] % delete this line to enable tests
  1612. { /IR exch def T3Tests } forall