2 % Copyright (C) 2000 Aladdin Enterprises. All rights reserved.
4 % This software is provided AS-IS with no warranty, either express or
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.
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.
17 % $Id: image-qa.ps,v 1.5 2002/02/21 21:49:28 giles Exp $
18 % Tests for the image operators
20 % Specifications for Image operator testing.
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.
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.
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).
35 % 3. DeviceGray, DeviceRGB, and DeviceN color, both direct and Indexed.
36 % Indexed color will use the common pallete size of 256 colors.
38 % 4. For simple masks, both colored and uncolored Patterns.
40 % 5. CombineWithColor true and false; several different colors for the
41 % true case (including black, white, other solid colors, halftones,
44 % 6. Source transparency true and false.
46 % 7. Texture transparency true and false.
48 % 8. Different RasterOp values.
50 % 9. For ImageType 4, different color keys (out-of-range, specific
51 % color other than white, range without white).
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.
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
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).
73 % Total string size is kept below 65535.
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.
83 % -------------------------------------------------------------------------
85 % Testing the RasterOp-related functions (5/6/7/8) is not necessary at this
86 % time. They are well isolated logically.
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
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).
97 % ==========================================================================
100 % Procedure to generate test mask data
102 % WM and HM must be defined prior to invocation
105 % The mask data is stored into a string named /MaskData
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.
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
120 /B exch def % byte within the row
121 /C B Y WB mul add def
124 /b exch def % bit within the character
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
132 { true } % pad bits are always set
134 % stack: true if pixel is set
136 MB b get P or /P exch def
138 } for % Bits within a byte
140 } for % Bytes within the row
141 } for % Rows in the mask
145 % WM and HM must be defined prior to invocation
148 % The mask data is stored into a string named /MaskData
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)
157 /WB WM BPC mul 7 add 8 div cvi def % Width in Bytes
158 /MaskData WB HM mul string def
163 MaskData % Target string
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
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
176 } for % Rows in the mask
179 % -----------------------------------------------------------------------
181 % Procedure to generate image data
183 % WD and HD must be defined prior to invocation
184 % { proc } ImageGen -
186 % The procedure is called once for each pixel
187 % Local definitions are R, G, B, X and Y
189 % Example: Generate RGB Chunky pixel data (single data source) BPC = 8
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
205 /D X WD 2 div sub WD div dup mul Y HD 2 div sub HD div dup mul add sqrt def
207 /A X WD 2 div sub Y HD 2 div sub atan 360 div def
209 .7 D .3 sub .60 div sub % Saturation
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
214 X WD 2 div gt Y HD 2 div sub abs 2 le and { pop 0 } if % asymmetric marker
216 currentrgbcolor /B exch def /G exch def /R exch def
220 pop % discard the procedure
225 % -----------------------------------------------------------------------
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 % -----------------------------------------------------------------------
234 % Procedure to make invocation of image operators more concise
236 % YY, SX, SY, WD and HD should be defined prior to invocation
237 % X matrix source decode DoImageMask -
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
255 /MultipleDataSources false
264 % YY, SX, SY, WD and HD should be defined prior to invocation
265 % X Y BPC matrix source multi decode DoImage1 -
272 /S exch def % May be an array of sources
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
286 /MultipleDataSources MS
288 /BitsPerComponent BPC
296 % YY, SX, SY, WD and HD should be defined prior to invocation
297 % X Y BPC matrix source multi decode MaskColor DoImage4 -
305 /S exch def % May be an array of sources
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
319 /MultipleDataSources MS
321 /BitsPerComponent BPC
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 -
340 /S exch def % May be an array of sources - For InterleaveType 3
341 % S[0] is the Mask DataSource
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
356 /MultipleDataSources MS
357 /DataSource IT 3 ne { S } { S 1 get exec } ifelse
358 /BitsPerComponent BPC
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 ]
374 /DataSource S 0 get exec % DataSource only allowed for InterleaveType 3
376 /BitsPerComponent IT 1 eq { BPC } { 1 } ifelse
391 % -----------------------------------------------------------------------
393 /Helvetica-Bold findfont 20 scalefont /TitleFont exch def
396 /Helvetica-Narrow findfont FontSize scalefont /LegendFont exch def
398 /blockshow { % like "show" but '\n' causes new-line
400 currentpoint /showY exch def /showX exch def
403 { 1 string dup 0 4 -1 roll put show }
404 { pop showX showY FontSize sub dup /showY exch def moveto }
409 /TX 013 def % Title left X
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
422 /BY 036 def % Bottom Title Top line
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
436 % -----------------------------------------------------------------------
438 % Utility procedures to support storing 4 and 12 bit elements in
441 % <string> <index> <value> put##bit -
443 % <index> will have a fractional part ( .5 ) if the element
444 % starts on a 4-bit boundary.
446 % <value> is between 0 and 1 and is scaled 0 to 15 (4bit) or
451 exch dup cvi dup 3 1 roll eq 3 -1 roll exch
452 { % integer index means high nibble.
455 { % low nibble -- combine with high nibble
456 2 index 2 index get or put
462 1 index cvi /I exch def
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
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
477 % -----------------------------------------------------------------------
479 % Procedures to use generated string data as procedure or files
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
489 /FM MaskData dup length () /SubFileDecode filter def
490 { { FM sM readstring pop } }
493 /FileTailString (12345) def % Marker string to check file data usage
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
503 MaskData dup length () /SubFileDecode filter
508 /FD RGBData dup length () /SubFileDecode filter def
509 { { FD sD readstring pop } }
513 RGBData dup length () /SubFileDecode filter
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
522 /FR RData dup length () /SubFileDecode filter def
523 { FR sR readstring pop }
527 /FG GData dup length () /SubFileDecode filter def
528 { FG sG readstring pop }
532 /FB BData dup length () /SubFileDecode filter def
533 { FB sB readstring pop }
537 RData dup length () /SubFileDecode filter
542 GData dup length () /SubFileDecode filter
547 BData dup length () /SubFileDecode filter
551 % -----------------------------------------------------------------------
553 % Procedure to handle fileposition. Ghostscript has a private
554 % operator .fileposition that works when fileposition does not
557 % Returns: fileposition true if successful
561 { pop /.fileposition load } % most likely to succeed
562 { /fileposition load }
570 % -----------------------------------------------------------------------
572 % Procedure to provide =only operator if not present. Suggested
573 % by Alex Cherepanov to use =print operator present on some Adobe
577 { /=print where { pop /=print load } { /print load } ifelse
582 % -----------------------------------------------------------------------
584 % Procedure to make sure that the file is at the EOF.
585 % added above (string == FileTailString.
587 % If not, it will mark the image area with a red "F"
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
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
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
616 /CSpaceName { % - CSpaceName <string>
617 CSpace dup type /arraytype eq { 0 get } if
620 % -----------------------------------------------------------------------
627 /CSpace /DeviceRGB def
629 % Use an unusual (unpleasant?) underlying color
630 .6 .95 .4 setrgbcolor clippath fill
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
639 .4 .1 .7 setrgbcolor % contrasting color for stencil masking
640 /SX SX 2 mul def /SY SY 2 mul def
643 TX IMLRTB MaskData [1 0] DoImageMask
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
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
659 % -----------------------------------------------------------------------
661 % Type 1 and Type 4 Tests
663 % /CSpace and /IR are defined in order to generate various pages
666 % Use an unusual (unpleasant?) underlying color
667 .6 .95 .4 setrgbcolor clippath fill
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
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
687 .4 .1 .7 setrgbcolor % contrasting color for stencil masking
691 /SX SX 2 mul def /SY SY 2 mul def
694 TX IMLRTB MaskData [1 0] DoImageMask
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
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
707 % ----------------------------------------------------------------------
708 % Type 1 Stencil Mask Images
711 TX YA SY add moveto (\nType 1\nStencil\nMask) blockshow
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
725 % ----------------------------------------------------------------------
726 % Type 1 RGB Single Data Sources, BPC==8
729 TX YY SY add moveto (\nType 1\nRGB\nBPC=8) blockshow
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
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
748 % ----------------------------------------------------------------------
749 % Type 1 RGB Multiple Data Sources, BPC==8
751 WD HD mul /RData 1 index string def
752 /GData 1 index string def
753 /BData exch string def
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
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
769 % ----------------------------------------------------------------------
770 % Type 4 RGB Single Data Sources, BPC==8, mask black
773 TX YY SY add moveto (\nType 4\nBPC=8\nmask=black) blockshow
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
785 % ----------------------------------------------------------------------
786 % Type 4 RGB Multiple Data Sources, BPC==8, mask black
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
796 % ----------------------------------------------------------------------
797 % Type 4 RGB Single Data Sources, BPC==8, mask white
800 TX YY SY add moveto (\nType 4\nBPC=8\nmask=white) blockshow
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
813 % ----------------------------------------------------------------------
814 % Type 4 RGB Multiple Data Sources, BPC==8, mask white
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
824 % ----------------------------------------------------------------------
825 % Type 4 RGB Single Data Sources, BPC==8, mask gray
828 TX YY SY add moveto (\nType 4\nBPC=8\nmask=gray) blockshow
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
840 % ----------------------------------------------------------------------
841 % Type 4 RGB Multiple Data Sources, BPC==8, mask gray
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
851 % ----------------------------------------------------------------------
852 % Type 4 RGB Single Data Sources, BPC==8, mask range
855 TX YY SY add moveto (\nType 4\nBPC=8\nmask range) blockshow
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
867 % ----------------------------------------------------------------------
868 % Type 4 RGB Multiple Data Sources, BPC==8, mask range
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
878 % ----------------------------------------------------------------------
879 % Type 1 RGB Single Data Sources, BPC==12
882 TX YY SY add moveto (\nType 1\nRGB\nBPC=12) blockshow
884 /RGBData WD 36 mul 7 add 8 div cvi HD mul string def
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
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
902 % ----------------------------------------------------------------------
903 % Type 1 RGB Multiple Data Sources, BPC==12
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
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
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
923 % ----------------------------------------------------------------------
924 % Type 4 RGB Single Data Sources, BPC==12, mask range
927 TX YY SY add moveto (\nType 4\nBPC=12\nmask range) blockshow
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
939 % ----------------------------------------------------------------------
940 % Type 4 RGB Multiple Data Sources, BPC==12, mask range
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
950 % ----------------------------------------------------------------------
951 % Type 1 RGB Single Data Sources, BPC==4
954 TX YY SY add moveto (\nType 1\nRGB\nBPC=4) blockshow
956 /RGBData WD 12 mul 7 add 8 div cvi HD mul string def
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
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
974 % ----------------------------------------------------------------------
975 % Type 1 RGB Multiple Data Sources, BPC==4
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
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
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
995 % ----------------------------------------------------------------------
996 % Type 4 RGB Single Data Sources, BPC==4, mask range
999 TX YY SY add moveto (\nType 4\nBPC=4\nmask range) blockshow
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
1011 % ----------------------------------------------------------------------
1012 % Type 4 RGB Multiple Data Sources, BPC==4, mask range
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
1024 } bind def % T1T4Tests
1026 % -----------------------------------------------------------------------
1031 % Use an unusual (unpleasant?) underlying color
1032 .6 .95 .4 setrgbcolor clippath fill
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
1041 .4 .1 .7 setrgbcolor % contrasting color for stencil masking
1045 /SX SX 2 mul def /SY SY 2 mul def
1048 XA IMLRTB MaskData [1 0] DoImageMask
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
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
1061 % ----------------------------------------------------------------------
1062 % InterleaveType 1, BPC==8, WM=WD, HM=HD
1063 % IT 1 is what GS calls "chunky pixel"
1065 TX YY SY add moveto (\nIntType 1\nBPC=8) blockshow
1067 % Generate the MaskData first
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
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
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
1093 % ----------------------------------------------------------------------
1094 % InterleaveType 1, BPC==12, WM=WD, HM=HD
1095 % IT 1 is what GS calls "chunky pixel"
1097 TX YY SY add moveto (\nIntType 1\nBPC=12) blockshow
1099 % Generate the MaskData first
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
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
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
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
1129 % ----------------------------------------------------------------------
1130 % InterleaveType 1, BPC==4, WM=WD, HM=HD
1131 % IT 1 is what GS calls "chunky pixel"
1133 TX YY SY add moveto (\nIntType 1\nBPC=4) blockshow
1135 % Generate the MaskData first
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
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
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
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
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).
1168 TX YY SY add moveto (\nIntType 2\nBPC=8) blockshow
1170 % Generate the MaskData first
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
1178 RGBData 1 index WB sub
1179 MaskData Y WB mul WB getinterval
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
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
1201 % ----------------------------------------------------------------------
1202 % InterleaveType 2, BPC==12, WM=WD, HM=HD
1204 TX YY SY add moveto (\nIntType 2\nBPC=12) blockshow
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
1211 RGBData 1 index WB sub cvi
1212 MaskData Y WB mul WB getinterval
1216 dup 2 index R put12bit
1217 dup 2 index 1.5 add G put12bit
1218 exch 3.0 add B put12bit
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
1234 % ----------------------------------------------------------------------
1235 % InterleaveType 2, BPC==4, WM=WD, HM=HD
1237 TX YY SY add moveto (\nIntType 2\nBPC=4) blockshow
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
1244 RGBData 1 index WB sub cvi
1245 MaskData Y WB mul WB getinterval
1249 dup 2 index R put4bit
1250 dup 2 index 0.5 add G put4bit
1251 exch 1.0 add B put4bit
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
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).
1272 TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=.6*WD\nHM=HD/2) blockshow
1274 % Generate the MaskData first
1275 /WM WD .6 mul cvi def
1276 /HM HD 2 div cvi def
1278 /HD HM 2 mul def % make HD even for this exercise
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
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
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
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
1323 /HD saveHD def % put odd HD back
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).
1330 TX YY SY add moveto (\nIntType 2\nBPC=8\nWM=1.3*WD\nHM=2*HD) blockshow
1332 % Generate the MaskData first
1333 /WM WD 1.3 mul cvi def
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
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
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
1368 TX YY SY add moveto (\nIntType 2\nBPC=12\nWM=1.3*WD\nHM=2*HD) blockshow
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
1376 RGBData 1 index WB HR mul sub cvi
1377 MaskData Y WB HR mul mul WB HR mul getinterval
1381 dup 2 index R put12bit
1382 dup 2 index 1.5 add G put12bit
1383 exch 3.0 add B put12bit
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
1399 % ----------------------------------------------------------------------
1400 % InterleaveType 2, BPC==4, WM=1.3*WD, HM=2*HD
1402 TX YY SY add moveto (\nIntType 2\nBPC=4\nWM=1.3*WD\nHM=2*HD) blockshow
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
1410 RGBData 1 index WB HR mul sub cvi
1411 MaskData Y WB HR mul mul WB HR mul getinterval
1415 dup 2 index R put4bit
1416 dup 2 index 0.5 add G put4bit
1417 exch 1.0 add B put4bit
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
1434 % ----------------------------------------------------------------------
1436 % Use an unusual (unpleasant?) underlying color
1437 .6 .95 .4 setrgbcolor clippath fill
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
1447 .4 .1 .7 setrgbcolor % contrasting color for stencil masking
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).
1454 TX YY SY add moveto (BPC=8\nMulti\nfalse) blockshow
1456 % Generate the MaskData first
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
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
1482 % ----------------------------------------------------------------------
1483 % InterleaveType 3, BPC==12, WM=WD, HM=HD
1485 TX YY SY add moveto (BPC=12\nMulti\nfalse) blockshow
1487 /RGBData WD 36 mul 7 add 8 div cvi HD mul string def
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
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
1508 % ----------------------------------------------------------------------
1509 % InterleaveType 3, BPC==4, WM=WD, HM=HD
1511 TX YY SY add moveto (BPC=4\nMulti\nfalse) blockshow
1513 /RGBData WD 12 mul 7 add 8 div cvi HD mul string def
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
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
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).
1539 TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
1541 % Generate the MaskData first
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
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
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
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).
1575 TX YY SY add moveto (BPC=8\nMulti\ntrue) blockshow
1577 % Generate the MaskData first
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
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
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
1605 % ----------------------------------------------------------------------
1606 % InterleaveType 3, BPC==12, WM=WD, HM=HD
1608 TX YY SY add moveto (BPC=12\nMulti\ntrue) blockshow
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
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
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
1635 % ----------------------------------------------------------------------
1636 % InterleaveType 3, BPC==4, WM=WD, HM=HD
1638 TX YY SY add moveto (BPC=4\nMulti\ntrue) blockshow
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
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
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
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).
1671 TX YY SY add moveto (BPC=8\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
1673 /WM 0.9 WD mul cvi def
1674 /HM 1.1 HD mul cvi def
1675 % Generate the MaskData first
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
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
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
1703 % ----------------------------------------------------------------------
1704 % InterleaveType 3, BPC==12, WM=WD, HM=HD
1706 TX YY SY add moveto (BPC=12\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
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
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
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
1733 % ----------------------------------------------------------------------
1734 % InterleaveType 3, BPC==4, WM=WD, HM=HD
1736 TX YY SY add moveto (BPC=4\nMulti\ntrue\nWM=.9*WD\nHM=1.1*HD) blockshow
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
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
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
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).
1769 TX YY SY add moveto (BPC=8\nMulti\ntrue\nWM=1.1*WD\nHM=.9*HD) blockshow
1771 /WM 1.1 WD mul cvi def
1772 /HM 0.9 HD mul cvi def
1773 % Generate the MaskData first
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
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
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
1802 } bind def % T3Tests
1805 % ----------------------------------------------------------------------
1806 % Do the various rotations
1808 /CSpace /DeviceRGB def
1810 [ 0 10 -10 45 90 180 270 ]
1811 pop [ 0 ] % delete this line to enable tests
1812 { /IR exch def T1T4Tests } forall
1814 [ 0 10 -10 45 90 180 270 ]
1815 pop [ 0 ] % delete this line to enable tests
1816 { /IR exch def T3Tests } forall
1818 /CSpace [ /DeviceN [/Blue /Red /Green] /DeviceRGB { } ] def
1820 [ 0 10 -10 45 90 180 270 ]
1821 pop [ 0 ] % delete this line to enable tests
1822 { /IR exch def T1T4Tests } forall
1824 [ 0 10 -10 45 90 180 270 ]
1825 pop [ 0 ] % delete this line to enable tests
1826 { /IR exch def T3Tests } forall