home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / g / gs252src.zip / GS252 / GSCSPACE.H < prev    next >
C/C++ Source or Header  |  1992-07-17  |  4KB  |  113 lines

  1. /* Copyright (C) 1991, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gscspace.h */
  21. /* Client interface to color spaces for Ghostscript library */
  22.  
  23. #ifndef gscspace_INCLUDED
  24. #  define gscspace_INCLUDED
  25.  
  26. /* Color spaces.  Note that Level 1 configurations */
  27. /* support only the Device color spaces. */
  28. typedef enum {
  29.     gs_color_space_DeviceGray = 0,
  30.     gs_color_space_DeviceRGB,
  31.     gs_color_space_DeviceCMYK,
  32.     /* FOLLOWING ARE NOT USED YET */
  33.     gs_color_space_CIEBasedABC,
  34.     gs_color_space_CIEBasedA,
  35.     gs_color_space_Separation,
  36.     gs_color_space_Indexed,
  37.     gs_color_space_Pattern
  38. } gs_color_space_type;
  39. /* Map a (non-pattern) color space to the number of components */
  40. /* in a color drawn from that space. */
  41. extern const int gs_color_space_num_components[];
  42.  
  43. /*
  44.  * Color spaces are complicated because different spaces involve
  45.  * different kinds of parameters, as follows:
  46.  
  47. Space        Space parameters        Color parameters
  48. -----        ----------------        ----------------
  49. DeviceGray    (none)                1 real [0-1]
  50. DeviceRGB    (none)                3 reals [0-1]
  51. DeviceCMYK    (none)                4 reals [0-1]
  52. CIEBasedABC    dictionary            3 reals
  53. CIEBasedA    dictionary            1 real
  54. Separation    name, alt_space, tint_xform    1 real [0-1]
  55. Indexed        hival, lookup, base_space    1 int [0-maxval]
  56. Pattern        colored: (none)            dictionary
  57.         uncolored: base_space        dictionary + base space params
  58.  
  59.  */
  60.  
  61.     /* Base color spaces (Device and CIE) */
  62.  
  63. typedef struct gs_cie_abc_s gs_cie_abc;
  64. typedef struct gs_cie_a_s gs_cie_a;
  65. #define gs_base_cspace_params\
  66.     gs_cie_abc *abc;\
  67.     gs_cie_a *a
  68. typedef struct gs_base_color_space_s {
  69.     gs_color_space_type type;
  70.     union {
  71.         gs_base_cspace_params;
  72.     } params;
  73. } gs_base_color_space;
  74.  
  75.     /* Non-pattern color spaces (base + Separation + Indexed) */
  76.  
  77. typedef struct gs_separation_params_s {
  78.     uint sname;    /* BOGUS, should be some other type */
  79.     gs_base_color_space alt_space;
  80.     int (*tint_transform)(P2(floatp, float*));
  81. } gs_separation_params;
  82. typedef struct gs_indexed_params_s {
  83.     const byte *lookup;
  84.     int hival;
  85.     gs_base_color_space base_space;
  86. } gs_indexed_params;
  87. #define gs_non_pattern_cspace_params\
  88.     gs_base_cspace_params;\
  89.     gs_separation_params separation;\
  90.     gs_indexed_params indexed
  91. typedef struct gs_non_pattern_color_space_s {
  92.     gs_color_space_type type;
  93.     union {
  94.         gs_non_pattern_cspace_params;
  95.     } params;
  96. } gs_non_pattern_color_space;
  97.  
  98.     /* General color spaces (including patterns) */
  99.  
  100. typedef struct gs_pattern_params_s {
  101.     int has_base_space;
  102.     gs_non_pattern_color_space base_space;
  103. } gs_pattern_params;
  104. typedef struct gs_color_space_s {
  105.     gs_color_space_type type;
  106.     union {
  107.         gs_non_pattern_cspace_params;
  108.         gs_pattern_params pattern;
  109.     } params;
  110. } gs_color_space;
  111.  
  112. #endif                    /* gscspace_INCLUDED */
  113.