gs_ciecs2.ps 3.4 KB

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