summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlgs/lib/gs_ciecs3.ps
blob: 0d7fb03eff6902758e126af8012a2a401b4f12f3 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
%    Copyright (C) 2002 Aladdin Enterprises.  All rights reserved.
% 
% This software is provided AS-IS with no warranty, either express or
% implied.
% 
% This software is distributed under license and may not be copied,
% modified or distributed except as expressly authorized under the terms
% of the license contained in the file LICENSE in this distribution.
% 
% For more information about licensing, please refer to
% http://www.ghostscript.com/licensing/. For information on
% commercial licensing, go to http://www.artifex.com/licensing/ or
% contact Artifex Software, Inc., 101 Lucas Valley Road #110,
% San Rafael, CA  94903, U.S.A., +1(415)492-9861.

% $Id: gs_ciecs3.ps 7204 2006-11-15 23:59:58Z ray $
% Level 3 CIEBased color space method dictionaries.
% This assumes gs_ciecs2.ps has already been processed.

%
% The validation routines in these method dictionaries perform only
% partial validations; the .setcie* operators will perform the rest.
%


.currentglobal true .setglobal
.cspace_util begin


/.setciedefspace where
  {
    pop
    colorspacedict
    /CIEBasedDEF
      mark
        /cs_potential_indexed_base true
        /cs_potential_pattern_base true
        /cs_potential_alternate true
        /cs_potential_icc_alternate true
        /cs_get_ncomps //ncomps_3

        /cs_get_range
          {
            1 get /RangeDEF .knownget not
              { //dflt_range_3 }
            if
          }
        bind

	% per Page 233 of the PLRM, default color should be as close to 0.0 as possible
	% within the RangeDEF
        /cs_get_default_color { 1 get /RangeDEF .knownget {
	    aload pop pop 5 1 roll pop 4 1 roll pop 3 1 roll
	  } {
	    0.0 0.0 0.0 
	  } ifelse 
	} bind
        /cs_get_currentgray //no_currentgray
        /cs_get_currentrgb //no_currentrgb
        /cs_get_currentcmyk //no_currentcmyk
        /cs_validate //check_cie_cspace
        /cs_substitute //dup_1
        /cs_prepare {}

        /cs_install
          {
            NOCIE
              { pop /DeviceRGB //.cs_install exec }
              { 1 get .setciedefspace }
            ifelse
          }
        bind

        /cs_prepare_color //validate_3
        /cs_complete_setcolor //pop_1
      .dicttomark
    put
  }
if


/.setciedefgspace where
  {
    pop
    colorspacedict
    /CIEBasedDEFG
      mark
        /cs_potential_indexed_base true
        /cs_potential_pattern_base true
        /cs_potential_alternate true
        /cs_potential_icc_alternate true
        /cs_get_ncomps //ncomps_4

        /cs_get_range
          {
            1 get /RangeDEFG .knownget not
              { //dflt_range_4 }
            if
          }
        bind

	% per Page 233 of the PLRM, default color should be as close to 0.0 as possible
	% within the RangeDEFG
        /cs_get_default_color { 1 get /RangeDEFG .knownget {
	    aload pop pop 7 1 roll pop 6 1 roll pop 5 1 roll pop 4 1 roll
	  } {
	    0.0 0.0 0.0 0.0
	  } ifelse 
	} bind
        /cs_get_currentgray //no_currentgray
        /cs_get_currentrgb //no_currentrgb
        /cs_get_currentcmyk //no_currentcmyk
        /cs_validate //check_cie_cspace
        /cs_substitute //dup_1
        /cs_prepare {}

        % the use of the DeviceCMYK color space is questionable:
        % it will likely have the wrong polarity
        /cs_install
          {
            NOCIE
              { pop /DeviceCMYK //.cs_install exec }
              { 1 get .setciedefgspace }
            ifelse
          }
        bind

        /cs_prepare_color //validate_4
        /cs_complete_setcolor //pop_1
      .dicttomark
    put
  }
if


end     % .cspace_util
.setglobal