1
0

gs_trap.ps 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. % Copyright (C) 1999, 2000 Aladdin Enterprises. All rights reserved.
  2. %
  3. % This file is part of AFPL Ghostscript.
  4. %
  5. % AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND. No author or
  6. % distributor accepts any responsibility for the consequences of using it, or
  7. % for whether it serves any particular purpose or works at all, unless he or
  8. % she says so in writing. Refer to the Aladdin Free Public License (the
  9. % "License") for full details.
  10. %
  11. % Every copy of AFPL Ghostscript must include a copy of the License, normally
  12. % in a plain ASCII text file named PUBLIC. The License grants you the right
  13. % to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14. % conditions described in the License. Among other things, the License
  15. % requires that the copyright notice and this notice be preserved on all
  16. % copies.
  17. % $Id: gs_trap.ps,v 1.3 2000/09/19 18:29:11 lpd Exp $
  18. % PostScript LanguageLevel 3 in-RIP trapping support.
  19. ll3dict begin
  20. % We need LanguageLevel 2 or higher in order to have setuserparams and
  21. % defineresource.
  22. languagelevel dup 2 max .setlanguagelevel
  23. % ------ Trapping ------ %
  24. % The PostScript-level trapping parameters are maintained in userdict,
  25. % and explicitly reinstalled upon restore.
  26. /Trapping mark
  27. /settrapparams dup { % <paramdict> settrapparams -
  28. /.trapparams .uservar dup length dict .copydict
  29. dup 2 index {
  30. % Stack: paramdict olddict olddict key value
  31. 2 index 2 index known { put dup } { pop pop } ifelse
  32. } forall pop
  33. dup .settrapparams % Let the operator check parameter validity.
  34. .userdict /.trapparams 3 -1 roll put pop
  35. } bind .makeoperator
  36. /.copyparams { % <obj> .copyparams <obj'>
  37. dup type /dicttype eq {
  38. dup length dict .copydict
  39. dup {
  40. .copyparams 3 copy put pop pop
  41. } forall
  42. } {
  43. dup type /arraytype eq {
  44. [ exch { .copyparams } forall ]
  45. } if
  46. } ifelse
  47. } odef
  48. /currenttrapparams dup { % - currenttrapparams <paramdict>
  49. /.trapparams .uservar .copyparams
  50. } bind .makeoperator
  51. /settrapzone dup { % - settrapzone -
  52. % ****** DUMMY ******
  53. newpath
  54. } bind .makeoperator
  55. % Define initial (dummy) trapping parameters.
  56. % These values are mostly complete guesses.
  57. userdict /.trapparams mark
  58. /BlackColorLimit 1.0
  59. /BlackDensityLimit 1.0
  60. /BlackWidth 1.0
  61. /ColorantZoneDetails 0 dict
  62. /Enabled true
  63. /HalftoneName null
  64. /ImageInternalTrapping false
  65. /ImagemaskTrapping true
  66. /ImageResolution 1
  67. /ImageToObjectTrapping true
  68. /ImageTrapPlacement /Center
  69. /SlidingTrapLimit 1.0
  70. /StepLimit 1.0
  71. /TrapColorScaling 0.0
  72. /TrapSetName null
  73. /TrapWidth 1.0
  74. .dicttomark readonly put
  75. .dicttomark /ProcSet defineresource pop
  76. % Define the InkParams and TrapParams resource categories.
  77. { /InkParams /TrapParams } {
  78. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  79. /InstanceType /dicttype def
  80. currentdict end /Category defineresource pop
  81. } forall
  82. % Define the TrappingType resource category.
  83. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  84. /InstanceType /integertype def
  85. /TrappingType currentdict end /Category defineresource pop
  86. {1001} { dup /TrappingType defineresource pop } forall
  87. .setlanguagelevel
  88. end % ll3dict