home *** CD-ROM | disk | FTP | other *** search
/ jppd.dyndns.org / jppd.dyndns.org.tar / jppd.dyndns.org / QUERYPRO / Impressora_PDF / converter.exe / GPLGS / stcolor.ps < prev    next >
Text File  |  2002-02-22  |  5KB  |  172 lines

  1. % Copyright (C) 1995 Aladdin Enterprises.  All rights reserved
  2. % This software is provided AS-IS with no warranty, either express or
  3. % implied.
  4. % This software is distributed under license and may not be copied,
  5. % modified or distributed except as expressly authorized under the terms
  6. % of the license contained in the file LICENSE in this distribution.
  7. % For more information about licensing, please refer to
  8. % http://www.ghostscript.com/licensing/. For information on
  9. % commercial licensing, go to http://www.artifex.com/licensing/ or
  10. % contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. % San Rafael, CA  94903, U.S.A., +1(415)492-9861.
  12.  
  13. % $Id: stcolor.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
  14. % stcolor.ps
  15. % Epson Stylus-Color Printer-Driver
  16.  
  17. % The purpose of this file is to configure the stcolor-printer driver
  18.  
  19. %
  20. % It is useless and dangerous to interpret the following code with anything
  21. % else than Ghostscript, so this condition is verified first. If this fails
  22. % a message is send to the output. If this message bothers you, remove it,
  23. % but I prefer to know why the device-setup failed.
  24.  
  25. statusdict begin product end
  26. dup (Ghostscript) eq 1 index (Aladdin Ghostscript) eq or
  27. exch (AFPL Ghostscript) eq or{
  28.  
  29. % fetch the current device-parameters this is specific for Ghostscript.
  30.  
  31.   /STCold currentdevice getdeviceprops .dicttomark def
  32.  
  33. % Any Ghostscript-Driver has a Name, verify that the selected device is
  34. % stcolor, otherwise nothing than another message will be produced.
  35.  
  36.   STCold /Name get (stcolor) eq {
  37.  
  38. %
  39. % The main thing this file does, is to establish transfer-functions.
  40. % Here are two predefined arrays for 360x360Dpi and for 720x720DpI.
  41. % If resolution is 360x720 or 720x360 the average is used. You may
  42. % want to define other arrays here.
  43. %
  44.  
  45.      /STCdeftransfer [ 0.0 1.0 ] def
  46.  
  47.      /STCKtransfer360 [
  48.        0.0000 0.0034 0.0185 0.0377 0.0574 0.0769 0.0952 0.1147
  49.        0.1337 0.1540 0.1759 0.1985 0.2209 0.2457 0.2706 0.2949
  50.        0.3209 0.3496 0.3820 0.4145 0.4505 0.4907 0.5344 0.5840
  51.        0.6445 0.7093 0.8154 0.9816 0.9983 0.9988 0.9994 1.0000
  52.      ] def
  53.  
  54.      /STCKtransfer720 [
  55.        0.0000 0.0011 0.0079 0.0151 0.0217 0.0287 0.0354 0.0425
  56.        0.0492 0.0562 0.0633 0.0700 0.0766 0.0835 0.0900 0.0975
  57.        0.1054 0.1147 0.1243 0.1364 0.1489 0.1641 0.1833 0.2012
  58.        0.2217 0.2492 0.2814 0.3139 0.3487 0.3996 0.4527 0.5195
  59.      ] def
  60.  
  61. % compute the resolution
  62.  
  63.      STCold /HWResolution get dup
  64.      0 get exch 1 get mul sqrt /STCdpi exch def
  65.  
  66. % pick the colormodel
  67.      STCold /ProcessColorModel get /STCcolor exch def
  68.  
  69.  
  70.      mark % prepare stack for "putdeviceprops" 
  71.  
  72. % warn for BitsPerPixel=30 with fsrgb
  73.      STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and 
  74.      {
  75.        (%%[ stcolor.ps: inefficient RGB-setup, recommend BitsPerPixel=24 ]%%\n)
  76.        print
  77.       } if
  78.  
  79. % if the Dithering-Method is default (gscmyk), change it to fscmyk
  80. % this is achieved by pushing a name/value-pair onto the stack
  81. % if the selected algorithm uses another ProcessColorModel, it is necessary
  82. % to change the Value of STCcolor according to the new algorithm.
  83.  
  84.      STCold /Dithering get (gscmyk) eq 
  85.      { 
  86.         /Dithering (hscmyk) % preferred dithering-method
  87.      } if % might be necessary to change STCcolor too
  88.  
  89. %
  90. % select the array according to the resolution
  91. %
  92.      STCdpi 359.0 lt 
  93.      { STCdeftransfer }
  94.      { STCdpi 361.0 lt
  95.        { STCKtransfer360 }
  96.        { STCdpi 719.0 gt
  97.          { STCKtransfer720 }
  98.          {
  99.            STCKtransfer360 length STCKtransfer720 length eq
  100.            {
  101.              0 1 STCKtransfer360 length 1 sub 
  102.              {
  103.                dup dup 
  104.                STCKtransfer360 exch get 
  105.                exch STCKtransfer720 exch get 
  106.                add 2.0 div 
  107.                STCKtransfer360 3 1 roll put
  108.              } for
  109.            }if
  110.            STCKtransfer360
  111.          } ifelse
  112.        }ifelse
  113.      } ifelse
  114.      /STCtransfer exch def
  115.  
  116. %
  117. % Add the arrays. With Version 1.17 and above, it seems to be 
  118. % a good idea, to use the transfer-arrays as coding-arrays too.
  119. %
  120.  
  121. %
  122. % RGB-Model requires inversion of the transfer-arrays
  123. %
  124.      STCcolor /DeviceRGB eq 
  125.      {
  126.         /RGBtransfer STCtransfer length array def
  127.         0 1 STCtransfer length 1 sub
  128.         {
  129.           dup RGBtransfer length 1 sub exch sub exch 
  130.           STCtransfer exch get 1.0 exch sub
  131.           RGBtransfer 3 1 roll put
  132.         } for
  133.  
  134.         /Rtransfer RGBtransfer
  135.         /Gtransfer RGBtransfer
  136.         /Btransfer RGBtransfer
  137.  
  138.         /Rcoding   RGBtransfer
  139.         /Gcoding   RGBtransfer
  140.         /Bcoding   RGBtransfer
  141.  
  142.      }{
  143.  
  144.        /Ctransfer STCtransfer
  145.        /Mtransfer STCtransfer
  146.        /Ytransfer STCtransfer
  147.        /Ktransfer STCtransfer
  148.  
  149.        /Ccoding   STCtransfer
  150.        /Mcoding   STCtransfer
  151.        /Ycoding   STCtransfer
  152.        /Kcoding   STCtransfer
  153.  
  154.      } ifelse
  155.  
  156.      counttomark 0 ne 
  157.         {currentdevice putdeviceprops pop}{cleartomark}ifelse
  158.  
  159. % decativate predefined correction
  160.  
  161.      {} dup dup currenttransfer setcolortransfer
  162.  
  163.   }{
  164.     (%%[ stcolor.ps: currentdevice is not stcolor - ignored ]%%\n) print
  165.   } ifelse
  166. }{
  167.   (%%[ stcolor.ps: not interpreted by AFPL Ghostscript - ignored ]%%\n) print
  168. } ifelse
  169.