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) 2002 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: gs_ciecs2.ps,v 1.1 2002/08/22 07:12:28 henrys Exp $
17
% Level 2 CIEBased color space method dictionaries.
18
 
19
%
20
% The validation routines in these method dictionaries perform only
21
% partial validations; the .setcie* operators will perform the rest.
22
%
23
 
24
% verify that at least one of the CIEBased color spaces is supported
25
true
26
  { /.setcieaspace /.setcieabcspace /.setciedefspace /.setciedefgspace }
27
  {
28
    where
29
      { pop not exit }
30
    if
31
  }
32
forall
33
  { currentfile closefile }
34
if
35
 
36
 
37
.currentglobal true .setglobal
38
.cspace_util begin
39
 
40
%
41
%   <obj>   check_cie_cspace   <obj>
42
%
43
% Perform a very basic check that an object is a CIEBased color space
44
% array.
45
%
46
/check_cie_cspace
47
  {
48
    //check_array exec
49
    dup 1 get type /dicttype ne
50
      //setcspace_typecheck
51
    if
52
  }
53
bind def
54
 
55
 
56
 
57
/.setcieaspace where
58
  {
59
    pop
60
    colorspacedict
61
    /CIEBasedA
62
      mark
63
        /cs_potential_indexed_base true
64
        /cs_potential_pattern_base true
65
        /cs_potential_alternate true
66
        /cs_potential_icc_alternate true
67
        /cs_get_ncomps //ncomps_1
68
 
69
        /cs_get_range
70
          {
71
            1 get /RangeA .knownget not
72
              { //dflt_range_1 }
73
            if
74
          }
75
        bind
76
 
77
        /cs_get_default_color { pop 0 } bind
78
        /cs_get_currentgray //no_currentgray
79
        /cs_get_currentrgb //no_currentrgb
80
        /cs_get_currentcmyk //no_currentcmyk
81
        /cs_validate //check_cie_cspace
82
        /cs_substitute //dup_1
83
        /cs_prepare {}
84
 
85
        /cs_install
86
          {
87
            NOCIE
88
              { pop /DeviceGray //.cs_install exec }
89
              { 1 get .setcieaspace }
90
            ifelse
91
          }
92
        bind
93
 
94
        /cs_prepare_color //validate_1
95
        /cs_complete_setcolor //pop_1
96
      .dicttomark
97
    put
98
  }
99
if
100
 
101
/.setcieabcspace where
102
  {
103
    pop
104
    colorspacedict
105
    /CIEBasedABC
106
      mark
107
        /cs_potential_indexed_base true
108
        /cs_potential_pattern_base true
109
        /cs_potential_alternate true
110
        /cs_potential_icc_alternate true
111
        /cs_get_ncomps //ncomps_3
112
 
113
        /cs_get_range
114
          {
115
            1 get /RangeABC .knownget not
116
              { //dflt_range_3 }
117
            if
118
          }
119
        bind
120
 
121
        /cs_get_default_color { pop 0 0 0 } bind
122
        /cs_get_currentgray //no_currentgray
123
        /cs_get_currentrgb //no_currentrgb
124
        /cs_get_currentcmyk //no_currentcmyk
125
        /cs_validate //check_cie_cspace
126
        /cs_substitute //dup_1
127
        /cs_prepare {}
128
 
129
        /cs_install
130
          {
131
            NOCIE
132
              { pop /DeviceRGB //.cs_install exec }
133
              { 1 get .setcieabcspace }
134
            ifelse
135
          }
136
        bind
137
 
138
        /cs_prepare_color //validate_3
139
        /cs_complete_setcolor //pop_1
140
      .dicttomark
141
    put
142
  }
143
if
144
 
145
 
146
end     % .cspace_util
147
.setglobal