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