home *** CD-ROM | disk | FTP | other *** search
/ The Net Power 1997 April / NETDisc0497.iso / pc / demos / mmedia / xres / data.z / OPI2.PS < prev    next >
Encoding:
Text File  |  1995-10-30  |  3.3 KB  |  120 lines

  1. %!
  2. %%VMusage: 0 0
  3. %%VMlocation: global
  4. %%
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6. %%                                    %%
  7. %% OPIProcSet: procedures to go into CommentDict to enable basic    %%
  8. %% OPI processing, for OPI version 2.0. This procset should be able %%
  9. %% to handle both version 1 and version 2 comments as well as files %%
  10. %% that include both.                            %%
  11. %%                                    %%
  12. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  13.  
  14.  
  15. /OPI2.0ProcSet <<
  16.  
  17. /Initialise {
  18.   userdict /OPIinitialised? known {
  19.     userdict /OPIinitialised? get
  20.   } {
  21.     false
  22.   } ifelse
  23.   not {
  24.     currentglobal false setglobal
  25.     userdict /OPIdocomment {
  26.       exch OPIdict 3 1 roll put
  27.     } put
  28.     userdict /OPIdoobject_v1 {
  29.       /OPI2.0ProcSet /ProcSet findresource begin DoObject_v1 end
  30.     } put
  31.     userdict /OPIdoobject_v2 {
  32.       /OPI2.0ProcSet /ProcSet findresource begin DoObject_v2 end
  33.     } put
  34.     userdict /OPIdict 8 dict put
  35.     userdict /OPIinitialised? true put
  36.     setglobal
  37.   } if
  38. } bind
  39.  
  40. /CommentDict <<
  41.   /ALDImageFileName {/ALDImageFileName OPIdocomment}
  42.   /ALDImageID {/ALDImageID OPIdocomment}
  43.   /ALDImageCropRect {/ALDImageCropRect OPIdocomment}
  44.   /ALDImagePosition {/ALDImagePosition OPIdocomment}
  45.   /ALDImageColor {/ALDImageColor OPIdocomment}
  46.   /ALDImageTint {/ALDImageTint OPIdocomment}
  47.   /ALDImageTransparency {/ALDImageTransparency OPIdocomment}
  48.   /ALDImageGrayMap {/ALDImageGrayMap OPIdocomment}
  49.   /BeginObject {pop OPIdoobject_v1}
  50.   /ImageFileName {/ALDImageFileName OPIdocomment}
  51.   /MainImage {/MainImage OPIdocomment}
  52.   /ImageDimensions {/ImageDimensions OPIdocomment}
  53.   /ImageCropRect {/ALDImageCropRect OPIdocomment}
  54.   /ImageInks {/ImageINks OPIdocomment}
  55.   /BeginIncludedImage {pop OPIdoobject_v2}
  56. >>
  57.  
  58. /DoObject_v1 {
  59.   2 dict begin
  60.   /opi_junk 2048 string def
  61.   userdict /OPIdict get dup /ALDImageFileName known
  62.   exch /ALDImageID known or {
  63.     currentfile opi_junk {readline} stopped {
  64.       pop
  65.     } {
  66.       pop
  67.       /opi_nextline exch def
  68.       opi_nextline (%%BeginOPI: 2.0) eq {
  69.         userdict /OPIdict get dup {pop 1 index exch undef} forall
  70.         /OPI2 true put
  71.       } {
  72.         userdict /OPIdict get {OPI_image} stopped {
  73.           (%%[ OPI substitution failed; using low resolution image ]%%) = flush
  74.           pop
  75.           opi_nextline 0 get 16#25 ne {
  76.             opi_nextline end cvx exec
  77.             1 dict begin
  78.           } if
  79.         } {
  80.           {
  81.             currentfile opi_junk {readline} stopped {
  82.               pop pop
  83.             } {
  84.                not {stop} if
  85.                (%%EndObject) eq {exit} if
  86.             } ifelse
  87.           } loop
  88.         } ifelse
  89.       } ifelse
  90.     } ifelse
  91.   } if
  92.   end
  93. } bind
  94.  
  95. /DoObject_v2 {
  96.   2 dict begin
  97.   /opi_junk 2048 string def
  98.   userdict /OPIdict get dup /ALDImageFileName known exch /MainImage known or {
  99.     userdict /OPIdict get {OPI_image} stopped {
  100.       (%%[ OPI substitution failed; using low resolution image ]%%) = flush
  101.       pop
  102.     } {
  103.       {
  104.         currentfile opi_junk {readline} stopped {
  105.           pop pop
  106.         } {
  107.           not {stop} if
  108.           (%%EndOPI) eq {exit} if
  109.         } ifelse
  110.       } loop
  111.     } ifelse
  112.   } if
  113.   end
  114. } bind
  115.  
  116. >> /ProcSet defineresource
  117.  
  118. dup /Initialise get exec
  119.  
  120.