1 /* Copyright (C) 2000 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: gscindex.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */ 18 /* Client interface to Indexed color facilities */ 19 20 #ifndef gscindex_INCLUDED 21 # define gscindex_INCLUDED 22 23 #include "gscspace.h" 24 25 /* 26 * Indexed color spaces. 27 * 28 * If the color space will use a procedure rather than a byte table, 29 * ptbl should be set to 0. 30 * 31 * Unlike most of the other color space constructors, this one initializes 32 * some of the fields of the colorspace. In the case in which a string table 33 * is used for mapping, it initializes the entire structure. Note that the 34 * client is responsible for the table memory in that case; the color space 35 * will not free it when the color space itself is released. 36 * 37 * For the case of an indexed color space based on a procedure, a default 38 * procedure will be provided that simply echoes the color values already in 39 * the palette; the client may override these procedures by use of 40 * gs_cspace_indexed_set_proc. If the client wishes to insert values into 41 * the palette, it should do so by using gs_cspace_indexed_value_array, and 42 * directly inserting the desired values into the array. 43 * 44 * If the client does insert values into the palette directly, the default 45 * procedures provided by the client are fairly efficient, and there are 46 * few instances in which the client would need to replace them. 47 */ 48 extern int gs_cspace_build_Indexed( 49 gs_color_space ** ppcspace, 50 const gs_color_space * pbase_cspace, 51 uint num_entries, 52 const gs_const_string * ptbl, 53 gs_memory_t * pmem 54 ); 55 56 /* Return the number of entries in the palette of an indexed color space. */ 57 extern int gs_cspace_indexed_num_entries( 58 const gs_color_space * pcspace 59 ); 60 61 /* In the case of a procedure-based indexed color space, get a pointer to */ 62 /* the array of cached values. */ 63 extern float *gs_cspace_indexed_value_array( 64 const gs_color_space * pcspace 65 ); 66 67 /* Set the lookup procedure to be used for an Indexed color space. */ 68 extern int gs_cspace_indexed_set_proc( 69 gs_color_space * pcspace, 70 int (*proc) (const gs_indexed_params *, int, float *) 71 ); 72 73 /* Look up an index in an Indexed color space. */ 74 int gs_cspace_indexed_lookup(const gs_indexed_params *, int, 75 gs_client_color *); 76 77 #endif /* gscindex_INCLUDED */ 78