gs_trap.ps 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. % Copyright (C) 1999, 2000 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_trap.ps,v 1.6 2002/06/02 12:03:28 mpsuzuki Exp $
  16. % PostScript LanguageLevel 3 in-RIP trapping support.
  17. ll3dict begin
  18. % We need LanguageLevel 2 or higher in order to have setuserparams and
  19. % defineresource.
  20. languagelevel dup 2 .max .setlanguagelevel
  21. % ------ Trapping ------ %
  22. % The PostScript-level trapping parameters are maintained in userdict,
  23. % and explicitly reinstalled upon restore.
  24. /Trapping mark
  25. /settrapparams dup { % <paramdict> settrapparams -
  26. /.trapparams .uservar dup length dict .copydict
  27. dup 2 index {
  28. % Stack: paramdict olddict olddict key value
  29. 2 index 2 index known { put dup } { pop pop } ifelse
  30. } forall pop
  31. dup .settrapparams % Let the operator check parameter validity.
  32. .userdict /.trapparams 3 -1 roll put pop
  33. } bind .makeoperator
  34. /.copyparams { % <obj> .copyparams <obj'>
  35. dup type /dicttype eq {
  36. dup length dict .copydict
  37. dup {
  38. .copyparams 3 copy put pop pop
  39. } forall
  40. } {
  41. dup type /arraytype eq {
  42. [ exch { .copyparams } forall ]
  43. } if
  44. } ifelse
  45. } odef
  46. /currenttrapparams dup { % - currenttrapparams <paramdict>
  47. /.trapparams .uservar .copyparams
  48. } bind .makeoperator
  49. /settrapzone dup { % - settrapzone -
  50. % ****** DUMMY ******
  51. newpath
  52. } bind .makeoperator
  53. % Define initial (dummy) trapping parameters.
  54. % These values are mostly complete guesses.
  55. userdict /.trapparams mark
  56. /BlackColorLimit 1.0
  57. /BlackDensityLimit 1.0
  58. /BlackWidth 1.0
  59. /ColorantZoneDetails 0 dict
  60. /Enabled true
  61. /HalftoneName null
  62. /ImageInternalTrapping false
  63. /ImagemaskTrapping true
  64. /ImageResolution 1
  65. /ImageToObjectTrapping true
  66. /ImageTrapPlacement /Center
  67. /SlidingTrapLimit 1.0
  68. /StepLimit 1.0
  69. /TrapColorScaling 0.0
  70. /TrapSetName null
  71. /TrapWidth 1.0
  72. .dicttomark readonly put
  73. .dicttomark /ProcSet defineresource pop
  74. % Define the InkParams and TrapParams resource categories.
  75. { /InkParams /TrapParams } {
  76. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  77. /InstanceType /dicttype def
  78. currentdict end /Category defineresource pop
  79. } forall
  80. % Define the TrappingType resource category.
  81. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  82. /InstanceType /integertype def
  83. /TrappingType currentdict end /Category defineresource pop
  84. {1001} { dup /TrappingType defineresource pop } forall
  85. .setlanguagelevel
  86. end % ll3dict