1 /* Copyright (C) 1993, 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: gxcolor2.h,v 1.8 2003/04/21 15:39:47 igor Exp $ */ 18 /* Internal definitions for Level 2 color routines */ 19 /* Requires gsstruct.h, gxfixed.h */ 20 21 #ifndef gxcolor2_INCLUDED 22 # define gxcolor2_INCLUDED 23 24 #include "gscolor2.h" 25 #include "gsmatrix.h" /* for step_matrix */ 26 #include "gsrefct.h" 27 #include "gxbitmap.h" 28 29 /* Cache for Indexed color with procedure, or Separation color. */ 30 struct gs_indexed_map_s { 31 rc_header rc; 32 union { 33 int (*lookup_index)(const gs_indexed_params *, int, float *); 34 int (*tint_transform)(const gs_separation_params *, floatp, float *); 35 } proc; 36 void *proc_data; 37 uint num_values; /* base_space->type->num_components * (hival + 1) */ 38 float *values; /* actually [num_values] */ 39 }; 40 #define private_st_indexed_map() /* in gscolor2.c */\ 41 gs_private_st_ptrs2(st_indexed_map, gs_indexed_map, "gs_indexed_map",\ 42 indexed_map_enum_ptrs, indexed_map_reloc_ptrs, proc_data, values) 43 44 /* Define a lookup_index procedure that just returns the map values. */ 45 int lookup_indexed_map(const gs_indexed_params *, int, float *); 46 47 /* Allocate an indexed map and its values. */ 48 /* The initial reference count is 1. */ 49 int alloc_indexed_map(gs_indexed_map ** ppmap, int num_values, 50 gs_memory_t * mem, client_name_t cname); 51 52 /* Free an indexed map and its values when the reference count goes to 0. */ 53 rc_free_proc(free_indexed_map); 54 55 /**************** TO gxptype1.h ****************/ 56 57 /* 58 * We define 'tiling space' as the space in which (0,0) is the origin of 59 * the key pattern cell and in which coordinate (i,j) is displaced by 60 * i * XStep + j * YStep from the origin. In this space, it is easy to 61 * compute a (rectangular) set of tile copies that cover a (rectangular) 62 * region to be tiled. Note that since all we care about is that the 63 * stepping matrix (the transformation from tiling space to device space) 64 * yield the right set of coordinates for integral X and Y values, we can 65 * adjust it to make the tiling computation easier; in particular, we can 66 * arrange it so that all 4 transformation factors are non-negative. 67 */ 68 69 #ifndef gs_pattern1_instance_t_DEFINED 70 # define gs_pattern1_instance_t_DEFINED 71 typedef struct gs_pattern1_instance_s gs_pattern1_instance_t; 72 #endif 73 74 struct gs_pattern1_instance_s { 75 gs_pattern_instance_common; /* must be first */ 76 gs_pattern1_template_t template; 77 /* Following are created by makepattern */ 78 gs_matrix step_matrix; /* tiling space -> device space */ 79 gs_rect bbox; /* bbox of tile in tiling space */ 80 bool is_simple; /* true if xstep/ystep = tile size */ 81 /* 82 * uses_mask is always true for PostScript patterns, but is false 83 * for bitmap patterns that don't have explicit transparent pixels. 84 */ 85 bool uses_mask; /* if true, pattern mask must be created */ 86 gs_int_point size; /* in device coordinates */ 87 gx_bitmap_id id; /* key for cached bitmap (= id of mask) */ 88 }; 89 90 #define private_st_pattern1_instance() /* in gsptype1.c */\ 91 gs_private_st_composite(st_pattern1_instance, gs_pattern1_instance_t,\ 92 "gs_pattern1_instance_t", pattern1_instance_enum_ptrs,\ 93 pattern1_instance_reloc_ptrs) 94 95 #endif /* gxcolor2_INCLUDED */ 96