gscrdp.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (C) 1998, 1999 Aladdin Enterprises. All rights reserved.
  2. This software is provided AS-IS with no warranty, either express or
  3. implied.
  4. This software is distributed under license and may not be copied,
  5. modified or distributed except as expressly authorized under the terms
  6. of the license contained in the file LICENSE in this distribution.
  7. For more information about licensing, please refer to
  8. http://www.ghostscript.com/licensing/. For information on
  9. commercial licensing, go to http://www.artifex.com/licensing/ or
  10. contact Artifex Software, Inc., 101 Lucas Valley Road #110,
  11. San Rafael, CA 94903, U.S.A., +1(415)492-9861.
  12. */
  13. /* $Id: gscrdp.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */
  14. /* Interface for device-specified CRDs */
  15. #ifndef gscrdp_INCLUDED
  16. # define gscrdp_INCLUDED
  17. #include "gscie.h"
  18. #include "gsparam.h"
  19. #ifndef gx_device_DEFINED
  20. # define gx_device_DEFINED
  21. typedef struct gx_device_s gx_device;
  22. #endif
  23. /*
  24. * A driver can provide any number of its own CRDs through (read-only)
  25. * device parameters whose values are slightly modified PostScript-style
  26. * dictionaries. The driver doesn't need to concern itself with how the
  27. * parameters are encoded: it simply constructs a CRD and calls
  28. * param_write_cie_render1.
  29. *
  30. * Logically, the pcrd parameter for this procedure and the next one
  31. * should be declared as const gs_cie_render *, but the procedures may
  32. * cause certain cached (idempotent) values to be computed.
  33. */
  34. int param_write_cie_render1(gs_param_list * plist, gs_param_name key,
  35. gs_cie_render * pcrd,
  36. gs_memory_t * mem);
  37. /*
  38. * For internal use, we also provide an API that writes the CRD directly
  39. * into a parameter list, rather than as a named parameter in a larger
  40. * list.
  41. */
  42. int param_put_cie_render1(gs_param_list * plist, gs_cie_render * pcrd,
  43. gs_memory_t * mem);
  44. /*
  45. * Client code that wants to initialize a CRD from a device parameter
  46. * uses the following complementary procedure. The customary way to
  47. * use this is:
  48. gs_c_param_list list;
  49. ...
  50. gs_c_param_list_write(&list, mem);
  51. gs_c_param_request(&list, "ParamName");
  52. code = gs_getdeviceparams(dev, &list);
  53. << error if code < 0 >>
  54. gs_c_param_list_read(&list);
  55. code = gs_cie_render1_param_initialize(pcrd, &list, "ParamName", dev);
  56. gs_c_param_list_release(&list);
  57. << error if code < 0 >>
  58. * where "ParamName" is the parameter name, e.g., "CRDDefault".
  59. */
  60. int gs_cie_render1_param_initialize(gs_cie_render * pcrd,
  61. gs_param_list * plist,
  62. gs_param_name key,
  63. gx_device * dev);
  64. /*
  65. * Again, we provide an internal procedure that doesn't involve a
  66. * parameter name.
  67. */
  68. int param_get_cie_render1(gs_cie_render * pcrd,
  69. gs_param_list * plist,
  70. gx_device * dev);
  71. /*
  72. * The actual representation of the CRD is a slightly modified PostScript
  73. * ColorRenderingType 1 dictionary. THE FOLLOWING IS SUBJECT TO CHANGE
  74. * WITHOUT NOTICE. Specifically, the following keys are different:
  75. * ColorRenderingType = GX_DEVICE_CRD1_TYPE
  76. */
  77. #define GX_DEVICE_CRD1_TYPE 101
  78. /*
  79. * (Instead of TransformPQR = [T1 T2 T3]:)
  80. * TransformPQRName = procedure name (a name)
  81. * TransformPQRData = procedure data (a string)
  82. * (Instead of EncodeLMN/ABC = [E1 E2 E3]:)
  83. * EncodeLMN/ABCValues = [V1,1 V1,2 ... V3,N], where Vi,j is the
  84. * j'th sampled value of the i'th encoding array, mapped linearly
  85. * to the corresponding domain (see gscie.h)
  86. * (Instead of RenderTable = [NA NB NC table m T1 ... Tm]:)
  87. * RenderTableSize = [NA NB NC m]
  88. * RenderTableTable = table (an array of strings)
  89. * RenderTableTValues = [V1,1 V1,2 ... Vm,N] (see above)
  90. * The PostScript setcolorrendering operator selects the correct operator
  91. * according to the ColorRenderingType key.
  92. */
  93. #endif /* gscrdp_INCLUDED */