gstparam.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /* Copyright (C) 2000 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: gstparam.h,v 1.15 2005/08/30 16:49:34 igor Exp $ */
  14. /* Transparency parameter definitions */
  15. #ifndef gstparam_INCLUDED
  16. # define gstparam_INCLUDED
  17. #include "gsccolor.h"
  18. #include "gsrefct.h"
  19. /* Define the names of the known blend modes. */
  20. typedef enum {
  21. BLEND_MODE_Compatible,
  22. BLEND_MODE_Normal,
  23. BLEND_MODE_Multiply,
  24. BLEND_MODE_Screen,
  25. BLEND_MODE_Difference,
  26. BLEND_MODE_Darken,
  27. BLEND_MODE_Lighten,
  28. BLEND_MODE_ColorDodge,
  29. BLEND_MODE_ColorBurn,
  30. BLEND_MODE_Exclusion,
  31. BLEND_MODE_HardLight,
  32. BLEND_MODE_Overlay,
  33. BLEND_MODE_SoftLight,
  34. BLEND_MODE_Luminosity,
  35. BLEND_MODE_Hue,
  36. BLEND_MODE_Saturation,
  37. BLEND_MODE_Color
  38. #define MAX_BLEND_MODE BLEND_MODE_Color
  39. } gs_blend_mode_t;
  40. #define GS_BLEND_MODE_NAMES\
  41. "Compatible", "Normal", "Multiply", "Screen", "Difference",\
  42. "Darken", "Lighten", "ColorDodge", "ColorBurn", "Exclusion",\
  43. "HardLight", "Overlay", "SoftLight", "Luminosity", "Hue",\
  44. "Saturation", "Color"
  45. /* Define the common part for a transparency stack state. */
  46. typedef enum {
  47. TRANSPARENCY_STATE_Group = 1, /* must not be 0 */
  48. TRANSPARENCY_STATE_Mask
  49. } gs_transparency_state_type_t;
  50. #define GS_TRANSPARENCY_STATE_COMMON\
  51. gs_transparency_state_t *saved;\
  52. gs_transparency_state_type_t type
  53. typedef struct gs_transparency_state_s gs_transparency_state_t;
  54. struct gs_transparency_state_s {
  55. GS_TRANSPARENCY_STATE_COMMON;
  56. };
  57. /* Define the common part for a cached transparency mask. */
  58. #define GS_TRANSPARENCY_MASK_COMMON\
  59. rc_header rc
  60. typedef struct gs_transparency_mask_s {
  61. GS_TRANSPARENCY_MASK_COMMON;
  62. } gs_transparency_mask_t;
  63. /* Define the parameter structure for a transparency group. */
  64. #ifndef gs_color_space_DEFINED
  65. # define gs_color_space_DEFINED
  66. typedef struct gs_color_space_s gs_color_space;
  67. #endif
  68. #ifndef gs_function_DEFINED
  69. typedef struct gs_function_s gs_function_t;
  70. # define gs_function_DEFINED
  71. #endif
  72. /* (Update gs_trans_group_params_init if these change.) */
  73. typedef struct gs_transparency_group_params_s {
  74. const gs_color_space *ColorSpace;
  75. bool Isolated;
  76. bool Knockout;
  77. } gs_transparency_group_params_t;
  78. /* Define the parameter structure for a transparency mask. */
  79. typedef enum {
  80. TRANSPARENCY_MASK_Alpha,
  81. TRANSPARENCY_MASK_Luminosity
  82. } gs_transparency_mask_subtype_t;
  83. #define GS_TRANSPARENCY_MASK_SUBTYPE_NAMES\
  84. "Alpha", "Luminosity"
  85. /* See the gx_transparency_mask_params_t type below */
  86. /* (Update gs_trans_mask_params_init if these change.) */
  87. typedef struct gs_transparency_mask_params_s {
  88. gs_transparency_mask_subtype_t subtype;
  89. int Background_components;
  90. float Background[GS_CLIENT_COLOR_MAX_COMPONENTS];
  91. float GrayBackground;
  92. int (*TransferFunction)(floatp in, float *out, void *proc_data);
  93. gs_function_t *TransferFunction_data;
  94. } gs_transparency_mask_params_t;
  95. #define MASK_TRANSFER_FUNCTION_SIZE 256
  96. /* The post clist version of transparency mask parameters */
  97. typedef struct gx_transparency_mask_params_s {
  98. gs_transparency_mask_subtype_t subtype;
  99. int Background_components;
  100. float Background[GS_CLIENT_COLOR_MAX_COMPONENTS];
  101. float GrayBackground;
  102. bool function_is_identity;
  103. byte transfer_fn[MASK_TRANSFER_FUNCTION_SIZE];
  104. } gx_transparency_mask_params_t;
  105. /* Select the opacity or shape parameters. */
  106. typedef enum {
  107. TRANSPARENCY_CHANNEL_Opacity = 0,
  108. TRANSPARENCY_CHANNEL_Shape = 1
  109. } gs_transparency_channel_selector_t;
  110. #endif /* gstparam_INCLUDED */