summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/epspdf/makegray.pro
blob: 67dc570583949189faae0625ebdf01aef39dbc83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
%!
% makegray.pro, PostScript header file for grayscale conversion.

%%%%%
% Siep Kroonenberg, n dot s dot kroonenberg at rug dot nl
% Public domain.
%%%%%

% This version only handles some basic color models,
% and doesn't handle image data at all.
% A more robust version would be warmly welcomed.

%%%%<< /ProcessColorModel /DeviceGray >> setpagedevice
userdict begin
% .11*B + .59*G + .3*R
/setrgbcolor {
  0.11 mul exch 0.59 mul add exch 0.3 mul add
  systemdict begin setgray end
} def
% 1.0 - min(1.0, .3*C + .59*M + .11*Y + B)
/setcmykcolor {
  exch 0.11 mul add
  exch 0.59 mul add
  exch 0.3 mul add
  dup 1 gt {pop 1} if
  1 exch sub
  systemdict begin setgray end
} def
end