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