1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: gscindex.h 8868 2008-07-23 23:29:39Z mvrhel $ */
15
/* Client interface to Indexed color facilities */
17
#ifndef gscindex_INCLUDED
18
# define gscindex_INCLUDED
24
* Indexed color spaces.
26
* If the color space will use a procedure rather than a byte table,
27
* ptbl should be set to 0.
29
* Unlike most of the other color space constructors, this one initializes
30
* some of the fields of the colorspace. In the case in which a string table
31
* is used for mapping, it initializes the entire structure. Note that the
32
* client is responsible for the table memory in that case; the color space
33
* will not free it when the color space itself is released.
35
* For the case of an indexed color space based on a procedure, a default
36
* procedure will be provided that simply echoes the color values already in
37
* the palette; the client may override these procedures by use of
38
* gs_cspace_indexed_set_proc. If the client wishes to insert values into
39
* the palette, it should do so by using gs_cspace_indexed_value_array, and
40
* directly inserting the desired values into the array.
42
* If the client does insert values into the palette directly, the default
43
* procedures provided by the client are fairly efficient, and there are
44
* few instances in which the client would need to replace them.
46
extern int gs_cspace_build_Indexed(
47
gs_color_space ** ppcspace,
48
gs_color_space * pbase_cspace,
50
const gs_const_string * ptbl,
54
/* Return the number of entries in the palette of an indexed color space. */
55
extern int gs_cspace_indexed_num_entries(
56
const gs_color_space * pcspace
59
/* In the case of a procedure-based indexed color space, get a pointer to */
60
/* the array of cached values. */
61
extern float *gs_cspace_indexed_value_array(
62
const gs_color_space * pcspace
65
/* Set the lookup procedure to be used for an Indexed color space. */
66
extern int gs_cspace_indexed_set_proc(
67
gs_color_space * pcspace,
68
int (*proc) (const gs_color_space *, int, float *)
71
/* Look up an index in an Indexed color space. */
72
int gs_cspace_indexed_lookup(const gs_color_space *, int,
75
/* Look up an index in an Indexed color space. Return as a byte */
76
int gs_cspace_indexed_lookup_bytes(const gs_color_space *pcs, float index_float,
77
unsigned char *output);
79
/* Look up an index in an Indexed color space. Return as a frac */
80
int gs_cspace_indexed_lookup_frac(const gs_color_space *pcs, float index_float,
83
#endif /* gscindex_INCLUDED */