Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1997, 1998, 1999 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: gsptype1.h,v 1.5 2002/06/16 08:45:42 lpd Exp $ */
18
/* Client interface to PatternType 1 Patterns */
19
 
20
#ifndef gsptype1_INCLUDED
21
#  define gsptype1_INCLUDED
22
 
23
#include "gspcolor.h"
24
#include "gxbitmap.h"
25
 
26
/* ---------------- Types and structures ---------------- */
27
 
28
/* PatternType 1 template */
29
 
30
typedef struct gs_pattern1_template_s {
31
    /*
32
     * The common template must come first.  It defines type, uid,
33
     * PatternType, and client_data.
34
     */
35
    gs_pattern_template_common;
36
    int PaintType;
37
    int TilingType;
38
    gs_rect BBox;
39
    float XStep;
40
    float YStep;
41
    int (*PaintProc) (const gs_client_color *, gs_state *);
42
} gs_pattern1_template_t;
43
 
44
#define private_st_pattern1_template() /* in gspcolor.c */\
45
  gs_private_st_suffix_add0(st_pattern1_template,\
46
    gs_pattern1_template_t, "gs_pattern1_template_t",\
47
    pattern1_template_enum_ptrs, pattern1_template_reloc_ptrs,\
48
    st_pattern_template)
49
#define st_pattern1_template_max_ptrs st_pattern_template_max_ptrs
50
 
51
/* Backward compatibility */
52
typedef gs_pattern1_template_t gs_client_pattern;
53
 
54
/* ---------------- Procedures ---------------- */
55
 
56
/*
57
 * Construct a PatternType 1 Pattern color space.  If the base space is
58
 * NULL, the color space can only be used with colored patterns.
59
 */
60
extern int gs_cspace_build_Pattern1(
61
				    gs_color_space ** ppcspace,
62
				    const gs_color_space * pbase_cspace,
63
				    gs_memory_t * pmem
64
				    );
65
 
66
/* Initialize a PatternType 1 pattern. */
67
void gs_pattern1_init(gs_pattern1_template_t *);
68
 
69
/* Backward compatibility */
70
#define gs_client_pattern_init(ppat) gs_pattern1_init(ppat)
71
 
72
/*
73
 * Define versions of make_pattern and get_pattern specifically for
74
 * PatternType 1 patterns.
75
 *
76
 * The gs_memory_t argument for gs_makepattern may be NULL, meaning use the
77
 * same allocator as for the gs_state argument.  Note that gs_makepattern
78
 * uses rc_alloc_struct_1 to allocate pattern instances.
79
 */
80
int gs_makepattern(gs_client_color *, const gs_client_pattern *,
81
		   const gs_matrix *, gs_state *, gs_memory_t *);
82
const gs_client_pattern *gs_getpattern(const gs_client_color *);
83
 
84
/*
85
 * Make a pattern from a bitmap or pixmap. The pattern may be colored or
86
 * uncolored, as determined by the mask operand. This code is intended
87
 * primarily for use by PCL.
88
 *
89
 * By convention, if pmat is null the identity matrix will be used, and if
90
 * id is no_UniqueID the code will assign a unique id. Thes conventions allow
91
 * gs_makebitmappattern to be implemented as a macro. Also, if mem is a
92
 * null pointer, the memory allocator for the graphic state is used.
93
 *
94
 * For mask patterns, pix_depth must be 1, while pcspace and white_index are
95
 * ignored; the polarity of the mask considers ones part of the mask, while
96
 * zeros are not. For colored patterns pspace must point to an indexed color
97
 * space and the image must used the canoncial Decode array for this color
98
 * space. For both cases no interpolation or adjustment is provided.
99
 *
100
 * For backwards compatibility, if mask is false, pcspace is null, and
101
 * pix_depth is 1, the pattern will be rendered with a color space that maps
102
 * 0 to white and 1 to black.
103
 *
104
 * The image must be described by a gx_tile_bitmap structure (this is actually
105
 * somewhat awkward, but the only option available at the moment), and the
106
 * pattern step will exactly match the image size. The client need not maintain
107
 * the gx_tile_bitmap structure after the completion of this call, but the
108
 * raw image data itself must be kept until the pattern is no longer needed.
109
 *
110
 * NB: For proper handling of transparency in PCL, there must be only a single
111
 *     white value accessed by the pattern image. If the palette contains
112
 *     multiple white values, the PCL component must remap the image data to
113
 *     ensure that all white indices are mapped to the single, given white
114
 *     index.
115
 */
116
extern int gs_makepixmappattern(
117
				gs_client_color * pcc,
118
				const gs_depth_bitmap * pbitmap,
119
				bool mask,
120
				const gs_matrix * pmat,
121
				long id,
122
				const gs_color_space * pcspace,
123
				uint white_index,
124
				gs_state * pgs,
125
				gs_memory_t * mem
126
				);
127
 
128
/*
129
 *  Backwards compatibility feature, to allow the existing
130
 *  gs_makebitmappattern operation to still function.
131
 */
132
extern int gs_makebitmappattern_xform(
133
				      gs_client_color * pcc,
134
				      const gx_tile_bitmap * ptile,
135
				      bool mask,
136
				      const gs_matrix * pmat,
137
				      long id,
138
				      gs_state * pgs,
139
				      gs_memory_t * mem
140
				      );
141
 
142
#define gs_makebitmappattern(pcc, tile, mask, pgs, mem)                 \
143
    gs_makebitmappattern_xform(pcc, tile, mask, 0, no_UniqueID, pgs, mem)
144
 
145
#endif /* gsptype1_INCLUDED */