home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Source / CommentedPSCode / RCS / Bitmaps,v < prev    next >
Encoding:
Text File  |  1995-06-12  |  19.1 KB  |  839 lines

  1. head     1.8;
  2. branch   ;
  3. access   ;
  4. symbols  beta10:1.7;
  5. locks    death:1.8;
  6. comment  @# @;
  7.  
  8.  
  9. 1.8
  10. date     93.04.04.23.30.34;  author death;  state Exp;
  11. branches ;
  12. next     1.7;
  13.  
  14. 1.7
  15. date     93.01.09.21.07.26;  author death;  state Exp;
  16. branches ;
  17. next     1.6;
  18.  
  19. 1.6
  20. date     93.01.01.11.51.33;  author death;  state Exp;
  21. branches ;
  22. next     1.5;
  23.  
  24. 1.5
  25. date     92.12.31.15.34.13;  author death;  state Exp;
  26. branches ;
  27. next     1.4;
  28.  
  29. 1.4
  30. date     92.12.05.23.07.22;  author death;  state Exp;
  31. branches ;
  32. next     1.3;
  33.  
  34. 1.3
  35. date     92.12.03.18.01.53;  author death;  state Exp;
  36. branches ;
  37. next     1.2;
  38.  
  39. 1.2
  40. date     92.11.27.19.37.57;  author death;  state Exp;
  41. branches ;
  42. next     1.1;
  43.  
  44. 1.1
  45. date     92.11.08.09.28.54;  author death;  state Exp;
  46. branches ;
  47. next     ;
  48.  
  49.  
  50. desc
  51. @@
  52.  
  53.  
  54. 1.8
  55. log
  56. @Sun Apr  4 23:30:34 PDT 1993
  57. @
  58. text
  59. @%BEGIN Bitmaps
  60.  
  61. %%%%%%%%%%%%%
  62. %    Define lengh of a run, and the byte which is repeated that many times
  63. %%%%%%%%%%%%%
  64. /lengthByte 1 string def
  65. /runByte 1 string def
  66.  
  67. %%%%%%%%%%%%%
  68. %    Name:    unpackbytes
  69. %    Syntax:    - unpackbytes -
  70. %    About:    This unpacks packed hex data into a binary string. Data format
  71. %            is identical to PS level 2 RLE and Mac PackBits (plus
  72. %            terminating 0x80).  Each chunk of data starts with a 'length'
  73. %            byte. If it is < 128 use that number of following bytes (plus
  74. %            one) literally. If it is > 128, next byte should be used
  75. %            257-length times.  Note: if 128 ends up in data, we don't deal
  76. %            properly (it shouldn't though)
  77. %%%%%%%%%%%%%
  78. /unpackbytes 
  79.     %
  80.     %    Get a byte which tells us how to extract the next chunk of data
  81.     %
  82.     /thelength 
  83.         currentfile lengthByte readhexstring pop 
  84.         0 get 
  85.     def 
  86.     %
  87.     %    If length < 128, copy that number of bytes+1 in litterally
  88.     %    Otherwise, copy next byte 257-length number of times
  89.     %
  90.     thelength 128 lt 
  91.     { 
  92.         /dataString thelength 1 add  string def 
  93.         currentfile dataString readhexstring pop 
  94.     }
  95.     { 
  96.         /runlength 257 thelength sub def 
  97.         /runString runlength  string def
  98.         currentfile runByte readhexstring pop pop 
  99.  
  100.         0 1 runlength 1 sub 
  101.             { runString exch runByte putinterval } 
  102.         for 
  103.         runString 
  104.     } 
  105.     ifelse 
  106. }
  107. def
  108.  
  109. %%%%%%%%%%%%%
  110. %    Name:    bitmap        [0090, 0091, 0097, 0098  (Pict1 & subset pict2)]
  111. %    Syntax:    colordat bits mode llx lly width height sourcewW sourceH
  112. %            bool [regiondata] bool bitmap -
  113. %    About:    Display a B&W bitmap. If bool is true, clipping region data
  114. %            follows. The width & height of the image, and the rect (origin,
  115. %            width, height) to display it follow. Mac drawing mode, bitdepth,
  116. %            then info for a colorspace definition. Final args are redundant.
  117. %            (both this and colorbitmap have same args this way)
  118. %%%%%%%%%%%%%
  119. /bitmap
  120. {
  121.     gsave
  122.         % use flag on stack
  123.         {
  124.             initclip
  125.             regionBounds
  126.             clip
  127.             /numShapes exch def
  128.             numShapes  0 gt
  129.             {
  130.                 numShapes
  131.                 regionPath
  132.                 clip
  133.             }
  134.             if
  135.         }
  136.         if
  137.         /isPacked exch def
  138.         /sourceHeight exch def
  139.         /sourceWidth exch def
  140.         /destHeight exch def
  141.         /destWidth exch def
  142.         /boty exch def
  143.         /botx exch def
  144.         /mode exch def
  145.         /bitDepth exch def        % unused
  146.         /colordata exch def    %  "
  147.         /numcolors exch def    %  "
  148.         %
  149.         %    Compute a string with length equal to the number of bytes used
  150.         %    per scaline.  That number is (bits-per-scaline /8), & wrap up to
  151.         %    next whole byte.
  152.         %
  153.         /scanString  sourceWidth 8 div ceiling cvi  string def
  154.         botx boty destHeight add translate
  155.         destWidth destHeight scale
  156.         %
  157.         %    With B&W bitmaps, it's easy to support the two Or transfer modes
  158.         %    Check for the two Or modes, and use proper imageMask.
  159.         %    Otherwise, default to doing a srcCpy
  160.         %
  161.         0 setgray
  162.         PSlevel 1 eq
  163.         {
  164.             mode /srcOr eq
  165.             mode /notSrcOr eq
  166.             or 
  167.             {
  168.                 %
  169.                 %    Compute a true or false value for imagemask using mode
  170.                 %
  171.                 sourceWidth sourceHeight     mode /notSrcOr eq
  172.                 [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  173.                 isPacked true eq
  174.                     { {unpackbytes} }
  175.                     { {currentfile scanString readhexstring pop} } 
  176.                 ifelse
  177.                 imagemask
  178.             }
  179.             {
  180.                 %
  181.                 %    Do a copy mode.
  182.                 %
  183.                 sourceWidth sourceHeight 1
  184.                 [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  185.                 isPacked true eq
  186.                     { {unpackbytes} }
  187.                     { {currentfile scanString readhexstring pop} } 
  188.                 ifelse
  189.                 image
  190.             }
  191.             ifelse
  192.             %
  193.             %    Remove the trailing end-of-line80 or eol>
  194.             %
  195.             isPacked false eq
  196.                 { 2 { currentfile read pop pop } repeat  }
  197.                 { 4 { currentfile read pop pop } repeat  }
  198.             ifelse
  199.         }
  200.         {
  201.             /DeviceGray  setcolorspace
  202.             %
  203.             %    Build the dict. parameter for the PS2 image or imageMask op.
  204.             %
  205.             /imageParams 7 dict def
  206.             imageParams begin
  207.                 /ImageType            1    def
  208.                 /Width                 sourceWidth  def
  209.                 /Height                sourceHeight  def
  210.                 /BitsPerComponent    1    def
  211.                 /Decode            mode /notSrcOr eq
  212.                                     { [ 1 0 ] }  { [ 0 1 ] } ifelse def
  213.                 /ImageMatrix    [sourceWidth 0 0  sourceHeight
  214.                                     0 sourceHeight]  def
  215.                 /DataSource isPacked true eq
  216.                             { currentfile  /ASCIIHexDecode filter
  217.                                 /RunLengthDecode filter}
  218.                             { currentfile  /ASCIIHexDecode filter}
  219.                             ifelse
  220.                         def
  221.             end
  222.  
  223.             mode /srcOr eq
  224.             mode /notSrcOr eq
  225.             or 
  226.                 { imageParams imagemask }
  227.                 { imageParams image }
  228.             ifelse
  229.         }
  230.         ifelse
  231.     grestore
  232. }
  233. def
  234.  
  235. %%%%%%%%%%%%%
  236. %    Name:    colorbitmap        [0090, 0091, 0097, 0098  (for pict2 images)]
  237. %    Syntax:    colordat bits mode llx lly width height sourcewW sourceH
  238. %            bool [regiondata] bool colorbitmap -
  239. %    About:    Display a bitmap. If bool is true, clipping region data follows.
  240. %            The width and height of the image, and the rect (origin, width,
  241. %            height) to display it follow.  Mac drawing mode, bitdepth, then
  242. %            info for a colorspace definition. The bit data follows.
  243. %%%%%%%%%%%%%
  244. /colorbitmap
  245.     gsave
  246.         % use flag on stack
  247.         {
  248.             initclip
  249.             regionBounds
  250.             clip
  251.             /numShapes exch def
  252.             numShapes  0 gt
  253.             {
  254.                 numShapes
  255.                 regionPath
  256.                 clip
  257.             }
  258.             if
  259.         }
  260.         if
  261.         /isPacked exch def
  262.         /sourceHeight exch def
  263.         /sourceWidth exch def
  264.         /destHeight exch def
  265.         /destWidth exch def
  266.         /boty exch def
  267.         /botx exch def
  268.         /mode exch def
  269.         /sampleDepth  exch def
  270.         /colordata exch def
  271.         /numcolors exch def
  272.         %
  273.         %    Move to the right location and scale coordinate space properly.
  274.         %
  275.         botx boty destHeight add translate
  276.         destWidth destHeight scale
  277.         PSlevel 1 eq
  278.         {
  279.             %
  280.             %    Compute string with space for full scanline of image data:
  281.             %    Use bits per scanline, divide by 8, round up to whole byte.
  282.             %
  283.             /scanString  sourceWidth sampleDepth mul 8 div
  284.                     ceiling cvi  string def
  285.             sourceWidth sourceHeight sampleDepth
  286.             [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  287.             isPacked true eq
  288.                 { {unpackbytes} }
  289.                 { {currentfile scanString readhexstring pop} } 
  290.             ifelse
  291.             image
  292.             %
  293.             %    Remove trailing end-of-line80 or eol>
  294.             %
  295.             isPacked false eq
  296.                 { 2 { currentfile read pop pop } repeat  }
  297.                 { 4 { currentfile read pop pop } repeat  }
  298.             ifelse
  299.         }
  300.         {
  301.             [ /Indexed  /DeviceRGB numcolors colordata] setcolorspace
  302.             %
  303.             %    Build the dict. parameter to the PS level 2 image operator
  304.             %
  305.             /imageParams 7 dict def
  306.             imageParams begin
  307.                 /ImageType        1 def
  308.                 /Width             sourceWidth def
  309.                 /Height            sourceHeight def
  310.                 /BitsPerComponent    sampleDepth def
  311.                 /Decode            [ 0 2 sampleDepth exp 1 sub ] def
  312.                 /ImageMatrix    [sourceWidth 0 0  sourceHeight 0
  313.                                     sourceHeight]  def
  314.                 /DataSource     isPacked true eq
  315.                             { currentfile  /ASCIIHexDecode filter
  316.                                     /RunLengthDecode filter}
  317.                             { currentfile  /ASCIIHexDecode filter}
  318.                             ifelse
  319.                         def
  320.             end
  321.             imageParams image
  322.         }
  323.         ifelse
  324.     grestore
  325. }
  326. def
  327.  
  328. %END Bitmaps
  329. @
  330.  
  331.  
  332. 1.7
  333. log
  334. @Sat Jan  9 21:07:25 PST 1993
  335. @
  336. text
  337. @d55 1
  338. a55 1
  339. %            [regiondata] bool bitmap -
  340. d181 1
  341. a181 1
  342. %            [regiondata] bool colorbitmap -
  343. @
  344.  
  345.  
  346. 1.6
  347. log
  348. @Fri Jan  1 11:51:33 PST 1993
  349. @
  350. text
  351. @a3 5
  352. %    Note:
  353. %    
  354. %%%%%%%%%%%%%
  355.  
  356. %%%%%%%%%%%%%
  357. d9 2
  358. a10 2
  359. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  360. %    Utility routine:    unpackbytes
  361. d12 8
  362. a19 11
  363. %    Description:
  364. %        This unpacks packed hex data into binary strings. Data format is identical 
  365. %        to PS level 2 RLE and the same as Mac PackBits (plus terminating 80).
  366. %        Data is divided into chunks.  Each chunk starts with a 'length' byte.
  367. %        if byte is < 128 use that number of following bytes (plus one) literally. 
  368. %        if byte is > 128, next byte should be used 257-(thatbyte) times
  369. %        128 (80) is improperly dealt with here if it appears in the data
  370. %        (it is an error when it does) Ignoring 128 saves time, tho, and all
  371. %        files using this are well formed and don't use it.
  372. %    Bugs:
  373. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  374. d49 2
  375. a50 1
  376. } def 
  377. d52 10
  378. a61 15
  379.  
  380.  
  381. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  382. %    Opcode:    0090, 0091, 0097, 0098  (for B&W images (Pict1 & subset pict2))
  383. %    Name:    bitmap
  384. %    Syntax:    mode llx lly width height sourcewidth sourceheight [regiondata] bool bitmap -
  385. %    Description:
  386. %        This takes a fair bit of data on the stack and displays an image.  Specifically,
  387. %        if 'bool' is true, then it is followed by regiondata, which describes a clipping region
  388. %        for the bitmap.  if it is false, there is none.  This is followed by a description of
  389. %        the width and height of the image, the width and height it is to be displayed at,
  390. %        the lower and left coordinates it is to be displayed at, and a mac drawing mode to be
  391. %        used.  Following the operator should be all the bitmap data.
  392. %    Bugs:
  393. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  394. d65 1
  395. a65 1
  396.         % use the true or false flag on the stack when we were called
  397. d88 2
  398. a89 2
  399.         /bitDepth exch def
  400.         /colordata exch def    % unused in this routine
  401. d92 3
  402. a94 4
  403.         %    Set up, and read in the hex data and display it.
  404.         %    compute a string with that is identical to the number of bytes used per
  405.         %    scaline.  That number is (bits-per-scaline /8) [equals num bytes as float number]
  406.         %    wrap this up to the next whole  byte, and there you go.
  407. d100 3
  408. a102 5
  409.         %    In this case of B&W bitmaps, it's easy to support tthe two Or transfer
  410.         %    modes thanks to the wonder of imageMask.   Check for the two transfer
  411.         %    modes, and use a proper imagemask.  Otherwise, default to doing a srcCpy
  412.         %    (note, a notSrcCopy might be straightforward if we inverted bytes after
  413.         %    reading them into scanString)
  414. d104 1
  415. d112 1
  416. a112 1
  417.                 %    Set our pen to black.  We don't want to inadvertantly imagemask in color
  418. a113 5
  419.                 0 setgray
  420.                 %
  421.                 %    Compute a true or false value for imagemask.  if the mode is notSrcOr we
  422.                 %    pass false to imagemask.  Otherwise, a true.
  423.                 %
  424. d117 2
  425. a118 2
  426.                     {{unpackbytes} }
  427.                     {{currentfile scanString readhexstring pop} } 
  428. d123 3
  429. d129 2
  430. a130 2
  431.                     {{unpackbytes} }
  432.                     {{currentfile scanString readhexstring pop} } 
  433. a143 1
  434.             0 setgray
  435. d146 1
  436. a146 2
  437.             %    Build the dictinary parameter to the PS level 2 image operator
  438.             %    (can't use << or >> because PS level 1 gets unhappy)
  439. d150 11
  440. a160 8
  441.                 /ImageType    1            def
  442.                 /Width         sourceWidth    def
  443.                 /Height        sourceHeight    def
  444.                 /BitsPerComponent    1 def
  445.                 /Decode            mode /notSrcOr eq  { [ 1 0 ] }  { [ 0 1 ] }  ifelse   def
  446.                 /ImageMatrix    [sourceWidth 0 0  sourceHeight 0 sourceHeight]  def
  447.                 /DataSource         isPacked true eq
  448.                             { currentfile  /ASCIIHexDecode filter /RunLengthDecode filter}
  449. d165 1
  450. d175 2
  451. a176 1
  452. } def
  453. d178 9
  454. a186 17
  455.  
  456.  
  457. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  458. %    Opcode:    0090, 0091, 0097, 0098  (for pict2 images)
  459. %    Name:    colorbitmap
  460. %    Syntax:    colordef bits mode llx lly width height sourcewW sourceH [regiondata] bool pict2bitmap -
  461. %    Description:
  462. %        This takes a fair bit of data on the stack and displays an image.  Specifically,
  463. %        if 'bool' is true, then it is followed by regiondata, which describes a clipping region
  464. %        for the bitmap.  if it is false, there is none.  This is followed by a description of
  465. %        the width and height of the image, the width and height it is to be displayed at,
  466. %        the lower and left coordinates it is to be displayed at, and a mac drawing mode to be
  467. %        used.  After these, there is a number of bits deep (per sample) that this bitmap will
  468. %        use.  After this, an indexed colorspace definition to be used with the bitmap if this is a
  469. %        ps level 2 interpreter. Following the the operator is all the raw bitmap data.
  470. %    Bugs:
  471. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  472. d190 1
  473. a190 1
  474.         % use the true or false flag on the stack when we were called
  475. d212 1
  476. a212 1
  477.         pop            % we don't care about the mode, for now.
  478. d225 1
  479. a225 1
  480.             %    Get bits per scanline, divide by 8, round up to next whole byte.
  481. d227 2
  482. a228 1
  483.             /scanString  sourceWidth sampleDepth mul 8 div ceiling cvi  string def
  484. d233 1
  485. a233 1
  486.                 {{currentfile scanString readhexstring pop} } 
  487. d237 1
  488. a237 1
  489.             %    Remove the trailing end-of-line80 or eol> (for RLE and Asciihexdec. filters)
  490. d245 1
  491. a245 3
  492.             [ /Indexed  /DeviceRGB numcolors colordata] setcolorspace            %
  493.             %    Build the dictinary parameter to the PS level 2 image operator
  494.             %    (can't use << or >> because PS level 1 gets unhappy)
  495. d247 2
  496. d251 3
  497. a253 3
  498.                 /ImageType    1            def
  499.                 /Width         sourceWidth    def
  500.                 /Height        sourceHeight    def
  501. d256 5
  502. a260 3
  503.                 /ImageMatrix    [sourceWidth 0 0  sourceHeight 0 sourceHeight]  def
  504.                 /DataSource         isPacked true eq
  505.                             { currentfile  /ASCIIHexDecode filter /RunLengthDecode filter}
  506. d269 2
  507. a270 2
  508. } def
  509.  
  510. @
  511.  
  512.  
  513. 1.5
  514. log
  515. @Thu Dec 31 15:34:13 PST 1992
  516. @
  517. text
  518. @@
  519.  
  520.  
  521. 1.4
  522. log
  523. @Sat Dec  5 23:07:22 PST 1992
  524. @
  525. text
  526. @d3 8
  527. a10 1
  528. % Define values for storing the 'length' byte and a byte when a run is found 
  529. d12 1
  530. d14 14
  531. a27 15
  532. % define a string to be used when reading a byte that has been repeated 
  533.  /runByte 1 string def
  534.  
  535. %
  536. % - unpackbytes -
  537. %
  538. % This unpacks packed hex data into binary strings. Data format is identical 
  539. % to PS level 2 RLE and the same as Mac PackBits (plus terminating 80).
  540. % Data is divided into chunks.  Each chunk starts with a 'length' byte.
  541. % if byte is < 128 use that number of following bytes (plus one) literally. 
  542. % if byte is > 128, next byte should be used 257-(thatbyte) times
  543. % 128 (80) is improperly dealt with here if it appears in the data
  544. % (it is an error when it does) Ignoring 128 saves time, tho, and all
  545. % files using this are well formed and don't use it.
  546. d30 3
  547. a32 1
  548.     % get the length byte 
  549. d37 4
  550. a40 1
  551.  
  552. a42 1
  553.         % the length byte says copy thelength bytes literally
  554. a46 1
  555.         % the length byte says copy next byte 257-thelength times 
  556. d52 1
  557. a52 1
  558.         { runString exch runByte putinterval } 
  559. d101 2
  560. d152 1
  561. a152 1
  562.             %    Remove the trailing (end-of-line)80>  or just (end-of-line)>
  563. d154 2
  564. a155 1
  565.             isPacked true eq
  566. a156 1
  567.                 { 2 { currentfile read pop pop } repeat } 
  568. d183 2
  569. a184 2
  570.             { imageParams imagemask }
  571.             { imageParams image }
  572. d235 2
  573. d242 1
  574. a242 1
  575.         PSlevel 2 eq
  576. d244 21
  577. a264 2
  578.             /colordata exch def
  579.             /numcolors exch def
  580. a283 24
  581.         }
  582.         {
  583.             %    PS Level 1
  584.             pop    % the color lookup info
  585.             %
  586.             %    Compute string with space for full scanline of image data:
  587.             %    Get bits per scanline, divide by 8, round up to next whole byte.
  588.             %
  589.             /scanString  sourceWidth sampleDepth mul 8 div ceiling cvi  string def
  590.             sourceWidth sourceHeight sampleDepth
  591.             [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  592.             isPacked true eq
  593.                 { {unpackbytes} }
  594.                 {{currentfile scanString readhexstring pop} } 
  595.             ifelse
  596.             image
  597.             %
  598.             %    Remove the trailing (end-of-line)80>  or just (end-of-line)>
  599.             %    (80 is the PS level 2 RLE end of file marker, and > is eof for ascii hex encoded files)
  600.             %
  601.             isPacked true eq
  602.                 { 4 { currentfile read pop pop } repeat  }
  603.                 { 2 { currentfile read pop pop } repeat } 
  604.             ifelse
  605. @
  606.  
  607.  
  608. 1.3
  609. log
  610. @Thu Dec  3 18:01:52 PST 1992
  611. @
  612. text
  613. @d90 1
  614. d107 1
  615. a107 3
  616.         mode /srcOr eq
  617.         mode /notSrcOr eq
  618.         or 
  619. d109 30
  620. d140 1
  621. a140 1
  622.             %    Set our pen to black.  We don't want to inadvertantly imagemask in color
  623. a141 7
  624.             0 setgray
  625.             %
  626.             %    Compute a true or false value for imagemask.  if the mode is notSrcOr we
  627.             %    pass false to imagemask.  Otherwise, a true.
  628.             %
  629.             sourceWidth sourceHeight     mode /notSrcOr eq
  630.             [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  631. d143 2
  632. a144 2
  633.                 {{unpackbytes} }
  634.                 {{currentfile scanString readhexstring pop} } 
  635. a145 1
  636.             imagemask
  637. d148 25
  638. a172 5
  639.             sourceWidth sourceHeight 1
  640.             [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  641.             isPacked true eq
  642.                 {{unpackbytes} }
  643.                 {{currentfile scanString readhexstring pop} } 
  644. a173 1
  645.             image
  646. d230 3
  647. a232 2
  648.             setcolorspace        % use the colorspace definition on the stack
  649.             %
  650. d244 5
  651. a248 1
  652.                 /DataSource currentfile  /ASCIIHexDecode filter def
  653. d263 1
  654. a263 1
  655.                 {{unpackbytes} }
  656. d268 2
  657. a269 1
  658.             %    Skip  end of file marker (> (decimal value is 62)).
  659. d271 4
  660. a274 1
  661.             2 { currentfile read pop pop    } repeat
  662. @
  663.  
  664.  
  665. 1.2
  666. log
  667. @Fri Nov 27 19:37:56 PST 1992
  668. @
  669. text
  670. @a48 17
  671. %
  672. % - showimage -
  673. %
  674. % This reads the packed data in, unpacks it, and displays the image properly. 
  675. % It also reads and discards the terminating byte (80).   
  676. /showimage 
  677.     576 720 scale 
  678.     576 720 1 
  679.     [576 0 0 -720 0 720] 
  680.     {unpackbytes} 
  681.     image
  682.     % Discard the final 80 byte.
  683.     currentfile lengthByte readhexstring pop pop
  684. } def
  685. a50 1
  686.  
  687. a66 1
  688.     
  689. d70 1
  690. a70 1
  691.             regionPath
  692. d72 8
  693. d82 1
  694. d89 1
  695. a89 3
  696.         pop        % we don't care about the mode, for now.
  697.  
  698.     
  699. d92 3
  700. d96 2
  701. a97 2
  702.         /scanString 1 string def
  703.         botx boty sourceHeight add translate
  704. d99 37
  705. a135 4
  706.         sourceWidth sourceHeight false
  707.         [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  708.         {currentfile scanString readhexstring pop} 
  709.         imagemask
  710. d143 1
  711. a143 1
  712. %    Name:    pict2bitmap
  713. d156 1
  714. a156 1
  715. /pict2bitmap
  716. d162 1
  717. a162 1
  718.             regionPath
  719. d164 8
  720. d174 1
  721. d183 5
  722. a187 1
  723.         %    Might want to modify this when do 1 operand iomage...
  724. d191 15
  725. a205 13
  726.             botx boty sourceHeight add translate
  727.             destWidth destHeight scale
  728.             %    Build the dictionary to pass to the PS level 2 image operator.
  729.             <<
  730.                 /ImageType 1
  731.                 /Width             sourceWidth
  732.                 /Height            sourceHeight
  733.                 /BitsPerComponent    sampleDepth
  734.                 /Decode            [0 1 0 1 0 1]
  735.                 /ImageMatrix    [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  736.                 /DataSource currentfile  /ASCIIHexDecode filter
  737.             >>
  738.             image
  739. d209 1
  740. a209 1
  741.             pop
  742. d211 2
  743. a212 1
  744.             %    Set up, and read in the hex data and display it.
  745. d214 1
  746. a214 3
  747.             /scanString 1 string def
  748.             botx boty sourceHeight add translate
  749.             destWidth destHeight scale
  750. d217 4
  751. a220 1
  752.             {currentfile scanString readhexstring pop} 
  753. d222 4
  754. @
  755.  
  756.  
  757. 1.1
  758. log
  759. @Sun Nov  8 09:28:54 PST 1992
  760. @
  761. text
  762. @d1 1
  763. a2 1
  764.  
  765. d70 11
  766. a80 2
  767. %    Opcode 90, 91, 97, 98: fill BitsRect SameRgn
  768. %    mode llyxlly width height sourcewidth sourceheight bitsRect -
  769. d83 1
  770. a83 13
  771.     % read a region in if there is one
  772.     {initclip regionPath clip}
  773.     if
  774.     /sourceHeight exch def
  775.     /sourceWidth exch def
  776.     /destHeight exch def
  777.     /destWidth exch def
  778.     /boty exch def
  779.     /botx exch def
  780.     pop    % we don't care about the mode, for now.
  781. % buggy     /scanString sourceWidth 8 idiv 1 add string def %% nort good
  782.     /scanString 1 string def
  783. d85 21
  784. d116 1
  785. d118 13
  786. a130 3
  787. %    Opcode 90, 91, 97, 98 for pict2: fill BitsRect SameRgn
  788. %    mode llyxlly width height sourcewidth sourceheight bitsRect -
  789. %    insert alarm bells.  BIG ones...
  790. a133 20
  791.     % read a region in if there is one
  792.     {initclip regionPath clip}
  793.     if
  794.     /sourceHeight exch def
  795.     /sourceWidth exch def
  796.     /destHeight exch def
  797.     /destWidth exch def
  798.     /boty exch def
  799.     /botx exch def
  800.     pop    % we don't care about the mode, for now.
  801.     /sampleDepth  exch def
  802.     /numCLUTentries exch def
  803.     
  804.     % pop all the clut entries, because we dont have PS level 2 yet...
  805.     numCLUTentries
  806.         {pop}
  807.     repeat
  808.     
  809. %%    /scanString sourceWidth 8 idiv 1 add string def %% nort good
  810.     /scanString 1 string def
  811. d135 48
  812. a182 6
  813.         botx boty sourceHeight add translate
  814.         destWidth destHeight scale
  815.         sourceWidth sourceHeight sampleDepth   % for color images, this will be messy, because we ignoreing the clut...
  816.         [sourceWidth 0 0  sourceHeight 0 sourceHeight] 
  817.         {currentfile scanString readhexstring pop} 
  818.         image
  819. d187 1
  820. a187 10
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831. @
  832.