You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
2.9 KiB

1 month ago
  1. % Copyright (C) 2001-2023 Artifex Software, Inc.
  2. % All Rights Reserved.
  3. %
  4. % This software is provided AS-IS with no warranty, either express or
  5. % implied.
  6. %
  7. % This software is distributed under license and may not be copied,
  8. % modified or distributed except as expressly authorized under the terms
  9. % of the license contained in the file LICENSE in this distribution.
  10. %
  11. % Refer to licensing information at http://www.artifex.com or contact
  12. % Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
  13. % CA 94129, USA, for further information.
  14. %
  15. % PostScript LanguageLevel 3 in-RIP trapping support.
  16. ll3dict begin
  17. % We need LanguageLevel 2 or higher in order to have setuserparams and
  18. % defineresource.
  19. languagelevel dup 2 .max .setlanguagelevel
  20. % ------ Trapping ------ %
  21. % The PostScript-level trapping parameters are maintained in userdict,
  22. % and explicitly reinstalled upon restore.
  23. /Trapping mark
  24. /settrapparams dup { % <paramdict> settrapparams -
  25. /.trapparams .uservar dup length dict .copydict
  26. dup 2 index {
  27. % Stack: paramdict olddict olddict key value
  28. 2 index 2 index known { put dup } { pop pop } ifelse
  29. } forall pop
  30. dup .settrapparams % Let the operator check parameter validity.
  31. .userdict /.trapparams 3 -1 roll put pop
  32. } .internalbind .makeoperator
  33. /.copyparams { % <obj> .copyparams <obj'>
  34. dup type /dicttype eq {
  35. dup length dict .copydict
  36. dup {
  37. .copyparams 3 copy put pop pop
  38. } forall
  39. } {
  40. dup type /arraytype eq {
  41. [ exch { .copyparams } forall ]
  42. } if
  43. } ifelse
  44. } odef
  45. /currenttrapparams dup { % - currenttrapparams <paramdict>
  46. /.trapparams .uservar .copyparams
  47. } .internalbind executeonly .makeoperator
  48. /settrapzone dup { % - settrapzone -
  49. % ****** DUMMY ******
  50. newpath
  51. } .internalbind .makeoperator
  52. % Define initial (dummy) trapping parameters.
  53. % These values are mostly complete guesses.
  54. userdict /.trapparams mark
  55. /BlackColorLimit 1.0
  56. /BlackDensityLimit 1.0
  57. /BlackWidth 1.0
  58. /ColorantZoneDetails 0 dict
  59. /Enabled //true
  60. /HalftoneName //null
  61. /ImageInternalTrapping //false
  62. /ImagemaskTrapping //true
  63. /ImageResolution 1
  64. /ImageToObjectTrapping //true
  65. /ImageTrapPlacement /Center
  66. /SlidingTrapLimit 1.0
  67. /StepLimit 1.0
  68. /TrapColorScaling 0.0
  69. /TrapSetName //null
  70. /TrapWidth 1.0
  71. .dicttomark readonly put
  72. .dicttomark /ProcSet defineresource pop
  73. % Define the InkParams and TrapParams resource categories.
  74. { /InkParams /TrapParams } {
  75. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  76. /InstanceType /dicttype def
  77. currentdict end /Category defineresource pop
  78. } forall
  79. % Define the TrappingType resource category.
  80. /Generic /Category findresource dup maxlength 3 add dict .copydict begin
  81. /InstanceType /integertype def
  82. /TrappingType currentdict end /Category defineresource pop
  83. {1001} { dup /TrappingType defineresource pop } forall
  84. .setlanguagelevel
  85. end % ll3dict