1 /* Copyright (C) 1995, 2000 artofcode LLC.  All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify it
4   under the terms of the GNU General Public License as published by the
5   Free Software Foundation; either version 2 of the License, or (at your
6   option) any later version.
7 
8   This program is distributed in the hope that it will be useful, but
9   WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License along
14   with this program; if not, write to the Free Software Foundation, Inc.,
15   59 Temple Place, Suite 330, Boston, MA, 02111-1307.
16 
17 */
18 
19 /*$Id: gdevmrop.h,v 1.3.6.1.2.1 2003/01/17 00:49:01 giles Exp $ */
20 /* Definitions for device RasterOp implementations. */
21 /* Requires gxdevmem.h, gsropt.h */
22 
23 #ifndef gdevmrop_INCLUDED
24 #  define gdevmrop_INCLUDED
25 
26 /*
27  * Compute the effective RasterOp for the 1-bit case,
28  * taking transparency into account.
29  */
30 gs_rop3_t gs_transparent_rop(P1(gs_logical_operation_t lop));
31 
32 #ifdef DEBUG
33 /* Trace a [strip_]copy_rop call. */
34 void trace_copy_rop(P16(const char *cname, gx_device * dev,
35 			const byte * sdata, int sourcex, uint sraster,
36 			gx_bitmap_id id, const gx_color_index * scolors,
37 			const gx_strip_bitmap * textures,
38 			const gx_color_index * tcolors,
39 			int x, int y, int width, int height,
40 			int phase_x, int phase_y, gs_logical_operation_t lop));
41 #endif
42 
43 /*
44  * PostScript colors normally act as the texture for RasterOp, with a null
45  * (all zeros) source.  For images with CombineWithColor = true, we need
46  * a way to use the image data as the source.  We implement this with a
47  * device that applies RasterOp with a specified texture to drawing
48  * operations, treating the drawing color as source rather than texture.
49  * The texture is a gx_device_color; it may be any type of color, even a
50  * pattern.
51  */
52 #ifndef gx_device_color_DEFINED
53 #  define gx_device_color_DEFINED
54 typedef struct gx_device_color_s gx_device_color;
55 #endif
56 
57 #ifndef gx_device_rop_texture_DEFINED
58 #  define gx_device_rop_texture_DEFINED
59 typedef struct gx_device_rop_texture_s gx_device_rop_texture;
60 #endif
61 
62 struct gx_device_rop_texture_s {
63     gx_device_forward_common;
64     gs_logical_operation_t log_op;
65     gx_device_color texture;
66 };
67 
68 #define private_st_device_rop_texture()	/* in gdevrops.c */\
69   gs_private_st_composite_use_final(st_device_rop_texture,\
70     gx_device_rop_texture, "gx_device_rop_texture",\
71     device_rop_texture_enum_ptrs, device_rop_texture_reloc_ptrs,\
72     gx_device_finalize)
73 
74 /* Create a RasterOp source device. */
75 int gx_alloc_rop_texture_device(P3(gx_device_rop_texture ** prsdev,
76 				   gs_memory_t * mem,
77 				   client_name_t cname));
78 
79 /* Initialize a RasterOp source device. */
80 void gx_make_rop_texture_device(P4(gx_device_rop_texture * rsdev,
81 				   gx_device * target,
82 				   gs_logical_operation_t lop,
83 				   const gx_device_color * texture));
84 
85 #endif /* gdevmrop_INCLUDED */
86