Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
% Copyright (C) 1995 Aladdin Enterprises.  All rights reserved
2
% 
3
% This software is provided AS-IS with no warranty, either express or
4
% implied.
5
% 
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.
9
% 
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.
15
 
16
% $Id: stcolor.ps,v 1.4 2002/02/21 21:49:28 giles Exp $
17
% stcolor.ps
18
% Epson Stylus-Color Printer-Driver
19
 
20
% The purpose of this file is to configure the stcolor-printer driver
21
 
22
%
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.
27
 
28
statusdict begin product end
29
dup (Ghostscript) eq 1 index (Aladdin Ghostscript) eq or
30
exch (AFPL Ghostscript) eq or{
31
 
32
% fetch the current device-parameters this is specific for Ghostscript.
33
 
34
  /STCold currentdevice getdeviceprops .dicttomark def
35
 
36
% Any Ghostscript-Driver has a Name, verify that the selected device is
37
% stcolor, otherwise nothing than another message will be produced.
38
 
39
  STCold /Name get (stcolor) eq {
40
 
41
%
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.
46
%
47
 
48
     /STCdeftransfer [ 0.0 1.0 ] def
49
 
50
     /STCKtransfer360 [
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
55
     ] def
56
 
57
     /STCKtransfer720 [
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
62
     ] def
63
 
64
% compute the resolution
65
 
66
     STCold /HWResolution get dup
67
 
68
 
69
% pick the colormodel
70
     STCold /ProcessColorModel get /STCcolor exch def
71
 
72
 
73
     mark % prepare stack for "putdeviceprops" 
74
 
75
% warn for BitsPerPixel=30 with fsrgb
76
     STCcolor /DeviceRGB eq STCold /BitsPerPixel get 32 eq and 
77
     {
78
       (%%[ stcolor.ps: inefficient RGB-setup, recommend BitsPerPixel=24 ]%%\n)
79
       print
80
      } if
81
 
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.
86
 
87
     STCold /Dithering get (gscmyk) eq 
88
     { 
89
        /Dithering (hscmyk) % preferred dithering-method
90
     } if % might be necessary to change STCcolor too
91
 
92
%
93
% select the array according to the resolution
94
%
95
     STCdpi 359.0 lt 
96
     { STCdeftransfer }
97
     { STCdpi 361.0 lt
98
       { STCKtransfer360 }
99
       { STCdpi 719.0 gt
100
         { STCKtransfer720 }
101
         {
102
           STCKtransfer360 length STCKtransfer720 length eq
103
           {
104
 
105
             {
106
               dup dup 
107
               STCKtransfer360 exch get 
108
               exch STCKtransfer720 exch get 
109
               add 2.0 div 
110
               STCKtransfer360 3 1 roll put
111
             } for
112
           }if
113
           STCKtransfer360
114
         } ifelse
115
       }ifelse
116
     } ifelse
117
     /STCtransfer exch def
118
 
119
%
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.
122
%
123
 
124
%
125
% RGB-Model requires inversion of the transfer-arrays
126
%
127
     STCcolor /DeviceRGB eq 
128
     {
129
        /RGBtransfer STCtransfer length array def
130
 
131
        {
132
          dup RGBtransfer length 1 sub exch sub exch 
133
          STCtransfer exch get 1.0 exch sub
134
          RGBtransfer 3 1 roll put
135
        } for
136
 
137
        /Rtransfer RGBtransfer
138
        /Gtransfer RGBtransfer
139
        /Btransfer RGBtransfer
140
 
141
        /Rcoding   RGBtransfer
142
        /Gcoding   RGBtransfer
143
        /Bcoding   RGBtransfer
144
 
145
     }{
146
 
147
       /Ctransfer STCtransfer
148
       /Mtransfer STCtransfer
149
       /Ytransfer STCtransfer
150
       /Ktransfer STCtransfer
151
 
152
       /Ccoding   STCtransfer
153
       /Mcoding   STCtransfer
154
       /Ycoding   STCtransfer
155
       /Kcoding   STCtransfer
156
 
157
     } ifelse
158
 
159
     counttomark 0 ne 
160
        {currentdevice putdeviceprops pop}{cleartomark}ifelse
161
 
162
% decativate predefined correction
163
 
164
     {} dup dup currenttransfer setcolortransfer
165
 
166
  }{
167
    (%%[ stcolor.ps: currentdevice is not stcolor - ignored ]%%\n) print
168
  } ifelse
169
}{
170
  (%%[ stcolor.ps: not interpreted by AFPL Ghostscript - ignored ]%%\n) print
171
} ifelse