]> git.ipfire.org Git - thirdparty/cups.git/blob - pstoraster/gxcolor2.h
Import cups.org releases
[thirdparty/cups.git] / pstoraster / gxcolor2.h
1 /* Copyright (C) 1993, 1995, 1997, 1998 Aladdin Enterprises. All rights reserved.
2
3 This file is part of GNU Ghostscript.
4
5 GNU Ghostscript is distributed in the hope that it will be useful, but
6 WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
7 to anyone for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing. Refer
9 to the GNU General Public License for full details.
10
11 Everyone is granted permission to copy, modify and redistribute GNU
12 Ghostscript, but only under the conditions described in the GNU General
13 Public License. A copy of this license is supposed to have been given
14 to you along with GNU Ghostscript so you can know your rights and
15 responsibilities. It should be in a file named COPYING. Among other
16 things, the copyright notice and this notice must be preserved on all
17 copies.
18
19 Aladdin Enterprises supports the work of the GNU Project, but is not
20 affiliated with the Free Software Foundation or the GNU Project. GNU
21 Ghostscript, as distributed by Aladdin Enterprises, does not require any
22 GNU software to build or run it.
23 */
24
25 /*$Id$ */
26 /* Internal definitions for Level 2 color routines */
27 /* Requires gsstruct.h, gxfixed.h */
28
29 #ifndef gxcolor2_INCLUDED
30 # define gxcolor2_INCLUDED
31
32 #include "gscolor2.h"
33 #include "gsrefct.h"
34 #include "gxbitmap.h"
35
36 /* Cache for Indexed color with procedure, or Separation color. */
37 struct gs_indexed_map_s {
38 rc_header rc;
39 union {
40 int (*lookup_index) (P3(const gs_indexed_params *, int, float *));
41 int (*tint_transform) (P3(const gs_separation_params *, floatp, float *));
42 } proc;
43 uint num_values; /* base_space->type->num_components * (hival + 1) */
44 float *values; /* actually [num_values] */
45 };
46
47 extern_st(st_indexed_map);
48 #define public_st_indexed_map() /* in gscolor2.c */\
49 gs_public_st_ptrs1(st_indexed_map, gs_indexed_map, "gs_indexed_map",\
50 indexed_map_enum_ptrs, indexed_map_reloc_ptrs, values)
51
52 /* Allocate an indexed map and its values. */
53 int alloc_indexed_map(P4(gs_indexed_map ** ppmap, int num_values,
54 gs_memory_t * mem, client_name_t cname));
55
56 /* Free an indexed map and its values when the reference count goes to 0. */
57 rc_free_proc(free_indexed_map);
58
59 /*
60 * We define 'tiling space' as the space in which (0,0) is the origin of
61 * the key pattern cell and in which coordinate (i,j) is displaced by
62 * i * XStep + j * YStep from the origin. In this space, it is easy to
63 * compute a (rectangular) set of tile copies that cover a (rectangular)
64 * region to be tiled. Note that since all we care about is that the
65 * stepping matrix (the transformation from tiling space to device space)
66 * yield the right set of coordinates for integral X and Y values, we can
67 * adjust it to make the tiling computation easier; in particular, we can
68 * arrange it so that all 4 transformation factors are non-negative.
69 */
70
71 /* Implementation of Pattern instances. */
72 struct gs_pattern_instance_s {
73 rc_header rc;
74 gs_client_pattern template;
75 /* Following are created by makepattern */
76 gs_state *saved;
77 gs_matrix step_matrix; /* tiling space -> device space */
78 gs_rect bbox; /* bbox of tile in tiling space */
79 bool is_simple; /* true if xstep/ystep = tile size */
80 /*
81 * uses_mask is always true for PostScript patterns, but is false
82 * for bitmap patterns that don't have explicit transparent pixels.
83 */
84 bool uses_mask; /* if true, pattern mask must be created */
85 gs_int_point size; /* in device coordinates */
86 gx_bitmap_id id; /* key for cached bitmap */
87 /* (= id of mask) */
88 };
89
90 /* The following is only public for a type test in the interpreter */
91 /* (.buildpattern operator). */
92 extern_st(st_pattern_instance);
93 #define public_st_pattern_instance() /* in gspcolor.c */\
94 gs_public_st_ptrs_add1(st_pattern_instance, gs_pattern_instance,\
95 "pattern instance", pattern_instance_enum_ptrs,\
96 pattern_instance_reloc_ptrs, st_pattern1_template, template, saved)
97
98 #endif /* gxcolor2_INCLUDED */