~ubuntu-branches/ubuntu/hardy/ghostscript/hardy

« back to all changes in this revision

Viewing changes to src/gscolor2.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2007-11-22 12:17:43 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071122121743-cd70s3ypq0r243mp
Tags: 8.61.dfsg.1-0ubtuntu1
* New upstream release
  o Final 8.61 release
* debian/patches/09_ijs_krgb_support.dpatch: Adapted to upstream changes.
* debian/rules: Updated CUPS-related variables for "make install" calls.
* debian/rules: Remove /usr/include/ghostscript from the ghostscript
  package, they go into lings-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/* $Id: gscolor2.c 8022 2007-06-05 22:23:38Z giles $ */
 
14
/* $Id: gscolor2.c 8250 2007-09-25 13:31:24Z giles $ */
15
15
/* Level 2 color operators for Ghostscript library */
16
16
#include "memory_.h"
17
17
#include "gx.h"
153
153
/* ------ Color space ------ */
154
154
 
155
155
/* Define the Indexed color space type. */
156
 
private cs_proc_restrict_color(gx_restrict_Indexed);
157
 
private cs_proc_concrete_space(gx_concrete_space_Indexed);
158
 
private cs_proc_concretize_color(gx_concretize_Indexed);
159
 
private cs_proc_install_cspace(gx_install_Indexed);
160
 
private cs_proc_set_overprint(gx_set_overprint_Indexed);
161
 
private cs_proc_final(gx_final_Indexed);
162
 
private cs_proc_serialize(gx_serialize_Indexed);
 
156
static cs_proc_restrict_color(gx_restrict_Indexed);
 
157
static cs_proc_concrete_space(gx_concrete_space_Indexed);
 
158
static cs_proc_concretize_color(gx_concretize_Indexed);
 
159
static cs_proc_install_cspace(gx_install_Indexed);
 
160
static cs_proc_set_overprint(gx_set_overprint_Indexed);
 
161
static cs_proc_final(gx_final_Indexed);
 
162
static cs_proc_serialize(gx_serialize_Indexed);
163
163
const gs_color_space_type gs_color_space_type_Indexed = {
164
164
    gs_color_space_index_Indexed, false, false,
165
165
    &st_color_space_Indexed, gx_num_components_1,
175
175
 
176
176
/* GC procedures. */
177
177
 
178
 
private uint
 
178
static uint
179
179
indexed_table_size(const gs_color_space *pcs)
180
180
{
181
181
    return (pcs->params.indexed.hival + 1) * pcs->params.indexed.n_comps;
182
182
}
183
 
private 
 
183
static 
184
184
ENUM_PTRS_WITH(cs_Indexed_enum_ptrs, gs_color_space *pcs) return 0;
185
185
case 0:
186
186
if (pcs->params.indexed.use_proc)
189
189
    return ENUM_CONST_STRING2(pcs->params.indexed.lookup.table.data,
190
190
                              indexed_table_size(pcs));
191
191
ENUM_PTRS_END
192
 
private RELOC_PTRS_WITH(cs_Indexed_reloc_ptrs, gs_color_space *pcs)
 
192
static RELOC_PTRS_WITH(cs_Indexed_reloc_ptrs, gs_color_space *pcs)
193
193
{
194
194
    if (pcs->params.indexed.use_proc)
195
195
        RELOC_PTR(gs_color_space, params.indexed.lookup.map);
207
207
 
208
208
/* Color space installation for an Indexed color space. */
209
209
 
210
 
private int
 
210
static int
211
211
gx_install_Indexed(gs_color_space * pcs, gs_state * pgs)
212
212
{
213
213
    return (*pcs->base_space->type->install_cspace)
216
216
 
217
217
/* Color space overprint setting ditto. */
218
218
 
219
 
private int
 
219
static int
220
220
gx_set_overprint_Indexed(const gs_color_space * pcs, gs_state * pgs)
221
221
{
222
222
    return (*pcs->base_space->type->set_overprint)
225
225
 
226
226
/* Color space finalization ditto. */
227
227
 
228
 
private void
 
228
static void
229
229
gx_final_Indexed(const gs_color_space * pcs)
230
230
{
231
231
    if (pcs->params.indexed.use_proc) {
242
242
 * 3, and 4 entry palettes, and a general case. Note that these procedures
243
243
 * do not range-check their input values.
244
244
 */
245
 
private int
 
245
static int
246
246
map_palette_entry_1(const gs_color_space * pcs, int indx, float *values)
247
247
{
248
248
    values[0] = pcs->params.indexed.lookup.map->values[indx];
249
249
    return 0;
250
250
}
251
251
 
252
 
private int
 
252
static int
253
253
map_palette_entry_3(const gs_color_space * pcs, int indx, float *values)
254
254
{
255
255
    const float *pv = &(pcs->params.indexed.lookup.map->values[3 * indx]);
260
260
    return 0;
261
261
}
262
262
 
263
 
private int
 
263
static int
264
264
map_palette_entry_4(const gs_color_space * pcs, int indx, float *values)
265
265
{
266
266
    const float *pv = &(pcs->params.indexed.lookup.map->values[4 * indx]);
272
272
    return 0;
273
273
}
274
274
 
275
 
private int
 
275
static int
276
276
map_palette_entry_n(const gs_color_space * pcs, int indx, float *values)
277
277
{
278
278
    int m = cs_num_components(pcs->base_space);
288
288
/*
289
289
 * Allocate an indexed map to be used as a palette for indexed color space.
290
290
 */
291
 
private gs_indexed_map *
 
291
static gs_indexed_map *
292
292
alloc_indexed_palette(
293
293
                         const gs_color_space * pbase_cspace,
294
294
                         int nvals,
402
402
/* ------ Colors ------ */
403
403
 
404
404
/* Force an Indexed color into legal range. */
405
 
private void
 
405
static void
406
406
gx_restrict_Indexed(gs_client_color * pcc, const gs_color_space * pcs)
407
407
{
408
408
    float value = pcc->paint.values[0];
414
414
}
415
415
 
416
416
/* Color remapping for Indexed color spaces. */
417
 
private const gs_color_space *
 
417
static const gs_color_space *
418
418
gx_concrete_space_Indexed(const gs_color_space * pcs,
419
419
                          const gs_imager_state * pis)
420
420
{
421
421
    return cs_concrete_space(pcs->base_space, pis);
422
422
}
423
423
 
424
 
private int
 
424
static int
425
425
gx_concretize_Indexed(const gs_client_color * pc, const gs_color_space * pcs,
426
426
                      frac * pconc, const gs_imager_state * pis)
427
427
{
477
477
 
478
478
/* ---------------- Serialization. -------------------------------- */
479
479
 
480
 
private int 
 
480
static int 
481
481
gx_serialize_Indexed(const gs_color_space * pcs, stream * s)
482
482
{
483
483
    const gs_indexed_params * p = &pcs->params.indexed;