1 /* Copyright (C) 1999, 2001 Aladdin Enterprises. All rights reserved. 2 3 This software is provided AS-IS with no warranty, either express or 4 implied. 5 6 This software is distributed under license and may not be copied, 7 modified or distributed except as expressly authorized under the terms 8 of the license contained in the file LICENSE in this distribution. 9 10 For more information about licensing, please refer to 11 http://www.ghostscript.com/licensing/. For information on 12 commercial licensing, go to http://www.artifex.com/licensing/ or 13 contact Artifex Software, Inc., 101 Lucas Valley Road #110, 14 San Rafael, CA 94903, U.S.A., +1(415)492-9861. 15 */ 16 17 /* $Id: gxcie.h,v 1.7 2002/06/16 08:45:43 lpd Exp $ */ 18 /* Internal definitions for CIE color implementation */ 19 /* Requires gxcspace.h */ 20 21 #ifndef gxcie_INCLUDED 22 # define gxcie_INCLUDED 23 24 #include "gscie.h" 25 26 /* 27 * These color space implementation procedures are defined in gscie.c or 28 * gsciemap.c, and referenced from the color space structures in gscscie.c. 29 */ 30 /* 31 * We use CIExxx rather than CIEBasedxxx in some places because 32 * gcc under VMS only retains 23 characters of procedure names, 33 * and DEC C truncates all identifiers at 31 characters. 34 */ 35 36 /* Defined in gscie.c */ 37 38 cs_proc_init_color(gx_init_CIE); 39 cs_proc_restrict_color(gx_restrict_CIEDEFG); 40 cs_proc_install_cspace(gx_install_CIEDEFG); 41 cs_proc_restrict_color(gx_restrict_CIEDEF); 42 cs_proc_install_cspace(gx_install_CIEDEF); 43 cs_proc_restrict_color(gx_restrict_CIEABC); 44 cs_proc_install_cspace(gx_install_CIEABC); 45 cs_proc_restrict_color(gx_restrict_CIEA); 46 cs_proc_install_cspace(gx_install_CIEA); 47 48 /* 49 * Initialize (just enough of) an imager state so that "concretizing" colors 50 * using this imager state will do only the CIE->XYZ mapping. This is a 51 * semi-hack for the PDF writer. 52 */ 53 extern int gx_cie_to_xyz_alloc(gs_imager_state **, 54 const gs_color_space *, gs_memory_t *); 55 extern void gx_cie_to_xyz_free(gs_imager_state *); 56 57 /* Defined in gsciemap.c */ 58 59 /* 60 * Test whether a CIE rendering has been defined; ensure that the joint 61 * caches are loaded. Note that the procedure may return if no rendering 62 * has been defined, and returns if an error occurs. 63 */ 64 #define CIE_CHECK_RENDERING(pcs, pconc, pis, do_exit) \ 65 BEGIN \ 66 if (pis->cie_render == 0) { \ 67 /* No rendering has been defined yet: return black. */ \ 68 pconc[0] = pconc[1] = pconc[2] = frac_0; \ 69 do_exit; \ 70 } \ 71 if (pis->cie_joint_caches->status != CIE_JC_STATUS_COMPLETED) { \ 72 int code = gs_cie_jc_complete(pis, pcs); \ 73 \ 74 if (code < 0) \ 75 return code; \ 76 } \ 77 END 78 79 /* 80 * Do the common remapping operation for CIE color spaces. Returns the 81 * number of components of the concrete color space (3 if RGB, 4 if CMYK). 82 * This simply calls a procedure variable stored in the joint caches 83 * structure. 84 */ 85 extern int gx_cie_remap_finish( cie_cached_vector3, 86 frac *, 87 const gs_imager_state *, 88 const gs_color_space * ); 89 /* Make sure the prototype matches the one defined in gscie.h. */ 90 extern GX_CIE_REMAP_FINISH_PROC(gx_cie_remap_finish); 91 92 /* 93 * Define the real remap_finish procedure. Except for CIE->XYZ mapping, 94 * this is what is stored in the remap_finish member of the joint caches. 95 */ 96 extern GX_CIE_REMAP_FINISH_PROC(gx_cie_real_remap_finish); 97 /* 98 * Define the remap_finish procedure for CIE->XYZ mapping. 99 */ 100 extern GX_CIE_REMAP_FINISH_PROC(gx_cie_xyz_remap_finish); 101 102 cs_proc_concretize_color(gx_concretize_CIEDEFG); 103 cs_proc_concretize_color(gx_concretize_CIEDEF); 104 cs_proc_concretize_color(gx_concretize_CIEABC); 105 cs_proc_remap_color(gx_remap_CIEABC); 106 cs_proc_concretize_color(gx_concretize_CIEA); 107 108 /* Defined in gscscie.c */ 109 110 /* GC routines exported for gsicc.c */ 111 extern_st(st_cie_common); 112 extern_st(st_cie_common_elements_t); 113 114 /* set up the common default values for a CIE color space */ 115 extern void gx_set_common_cie_defaults( gs_cie_common *, 116 void * client_data ); 117 118 /* Load the common caches for a CIE color space */ 119 extern void gx_cie_load_common_cache(gs_cie_common *, gs_state *); 120 121 /* Complete loading of the common caches */ 122 extern void gx_cie_common_complete(gs_cie_common *); 123 124 /* "indirect" color space installation procedure */ 125 cs_proc_install_cspace(gx_install_CIE); 126 127 /* allocate and initialize the common part of a cie color space */ 128 extern void * gx_build_cie_space( gs_color_space ** ppcspace, 129 const gs_color_space_type * pcstype, 130 gs_memory_type_ptr_t stype, 131 gs_memory_t * pmem ); 132 133 /* 134 * Determine the concrete space which underlies a CIE based space. For all 135 * device independent color spaces, this is dependent on the current color 136 * rendering dictionary, rather than the current color space. This procedure 137 * is exported for use by gsicc.c to implement ICCBased color spaces. 138 */ 139 cs_proc_concrete_space(gx_concrete_space_CIE); 140 141 #endif /* gxcie_INCLUDED */ 142