home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 February / PCWK0296.iso / sharewar / dos / inne / gs300ini / gs_dps1.ps < prev    next >
Encoding:
Text File  |  1994-08-02  |  4.6 KB  |  158 lines

  1. %    Copyright (C) 1990, 1991, 1993, 1994 Aladdin Enterprises.  All rights reserved.
  2. % This file is part of Aladdin Ghostscript.
  3. % Aladdin Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author
  4. % or distributor accepts any responsibility for the consequences of using it,
  5. % or for whether it serves any particular purpose or works at all, unless he
  6. % or she says so in writing.  Refer to the Aladdin Ghostscript Free Public
  7. % License (the "License") for full details.
  8. % Every copy of Aladdin Ghostscript must include a copy of the License,
  9. % normally in a plain ASCII text file named PUBLIC.  The License grants you
  10. % the right to copy, modify and redistribute Aladdin Ghostscript, but only
  11. % under certain conditions described in the License.  Among other things, the
  12. % License requires that the copyright notice and this notice be preserved on
  13. % all copies.
  14.  
  15. % Initialization file for analogs of Display PostScript functions
  16. % that are also included in Level 2.
  17. % When this is run, systemdict is still writable,
  18. % but everything defined here goes into level2dict.
  19.  
  20. level2dict begin
  21.  
  22. % ------ Virtual memory ------ %
  23.  
  24. /currentshared /.currentglobal load def
  25. /scheck /.gcheck load def
  26. /setshared /.setglobal load def
  27. %****** FOLLOWING IS WRONG ******
  28. /shareddict currentdict /globaldict .knownget not { 20 dict } if def
  29. /SharedFontDirectory 2 dict def        % will auto-expand
  30.  
  31. % ------ Fonts ------ %
  32.  
  33. /selectfont
  34.     { exch findfont exch
  35.       dup type /arraytype eq { makefont } { scalefont } ifelse
  36.       setfont
  37.     } odef
  38. /undefinefont
  39.     { FontDirectory exch undef
  40.     } odef
  41.  
  42. % ------ Halftones ------ %
  43.  
  44. /.makestackdict
  45.     { { counttomark -1 roll } forall .dicttomark
  46.     } bind def
  47. /currenthalftone
  48.     { mark .currenthalftone
  49.        { { exch pop }        % halftone
  50.          { /HalftoneType 1        % screen
  51.         { /Frequency /Angle /SpotFunction }
  52.            .makestackdict
  53.          }
  54.          { /HalftoneType 2        % colorscreen
  55.         { /RedFrequency /RedAngle /RedSpotFunction
  56.           /GreenFrequency /GreenAngle /GreenSpotFunction
  57.           /BlueFrequency /BlueAngle /BlueSpotFunction
  58.           /GrayFrequency /GrayAngle /GraySpotFunction
  59.         }
  60.            .makestackdict
  61.          }
  62.        }
  63.       exch get exec
  64.     } odef
  65. % Define sethalftone so it converts all other types to type 5.
  66. /.sethalftoneRGBV    % <dict> <type> <keys> <keysRGBV>
  67.     { 4 -1 roll exch { 1 index exch get exch } forall 15 1 roll
  68.       14 -2 roll mark 15 1 roll { /Gray /Blue /Green /Red }
  69.        {        % stack: v0 v1 v2 type keys comp
  70.          mark
  71.          2 index 0 get 8 -1 roll
  72.          4 index 1 get 9 -1 roll
  73.          6 index 2 get 10 -1 roll
  74.             % stack: type keys comp mark k0 v0 k1 v1 k2 v2
  75.          /HalftoneType 10 index .dicttomark
  76.          counttomark 2 roll
  77.        }
  78.       forall pop pop
  79.       /Default 1 index .dicttomark .sethalftone5
  80.     } bind def
  81. /sethalftone
  82.     { dup /HalftoneType get 1 sub
  83.        {  { mark /Default 2 index .dicttomark .sethalftone5 }
  84.           { 1 { /Frequency /Angle /SpotFunction }
  85.         { /RedFrequency /RedAngle /RedSpotFunction
  86.           /GreenFrequency /GreenAngle /GreenSpotFunction
  87.           /BlueFrequency /BlueAngle /BlueSpotFunction
  88.           /GrayFrequency /GrayAngle /GraySpotFunction
  89.         } .sethalftoneRGBV
  90.           }
  91.           { mark /Default 2 index .dicttomark .sethalftone5 }
  92.           { 3 { /Width /Height /Thresholds }
  93.         { /RedWidth /RedHeight /RedThresholds
  94.           /GreenWidth /GreenHeight /GreenThresholds
  95.           /BlueWidth /BlueHeight /BlueThresholds
  96.           /GrayWidth /GrayHeight /GrayThresholds
  97.         } .sethalftoneRGBV
  98.           }
  99.           { dup .sethalftone5 }
  100.        } exch get exec
  101.     } odef
  102. % Redefine setscreen to recognize halftone dictionaries.
  103. /setscreen
  104.     { dup type /dicttype eq
  105.        { sethalftone pop pop }
  106.        { //setscreen }
  107.       ifelse
  108.     } odef
  109.  
  110. % ------ User objects ------ %
  111.  
  112. /.localarray
  113.     { currentglobal false setglobal
  114.       exch array exch setglobal
  115.     } bind def
  116. /defineuserobject
  117.     { userdict /UserObjects known
  118.        { 1 index userdict /UserObjects get length ge
  119.           { 1 index 1 add .localarray userdict /UserObjects get
  120.         1 index copy pop
  121.         userdict /UserObjects 3 -1 roll put
  122.           }
  123.          if
  124.        }
  125.        { userdict /UserObjects 3 index 1 add .localarray put
  126.        }
  127.       ifelse
  128.       userdict /UserObjects get 3 1 roll put
  129.     } odef
  130. /execuserobject
  131.     { userdict /UserObjects get exch get exec
  132.     } odef
  133. /undefineuserobject
  134.     { userdict /UserObjects get exch null put
  135.     } odef
  136.  
  137. % ------ User paths ------ %
  138.  
  139. /upath
  140.     { [ exch {/ucache cvx} if pathbbox /setbbox cvx
  141.       {/moveto cvx} {/lineto cvx} {/curveto cvx} {/closepath cvx}
  142.       pathforall ] cvx
  143.     } odef
  144.  
  145. % Dummy definitions for cache control operators
  146.  
  147. /ucachestatus
  148.     { mark 0 0 0 0 0 } odef
  149. /setucacheparams
  150.     { cleartomark } odef
  151.  
  152. % End of level2dict
  153.  
  154. end
  155.