xref: /plan9/sys/src/cmd/gs/src/gdevmrop.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 1995, 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: gdevmrop.h,v 1.6 2002/06/16 07:25:26 lpd Exp $ */
18 /* Definitions for device RasterOp implementations. */
19 /* Requires gxdevmem.h, gsropt.h */
20 
21 #ifndef gdevmrop_INCLUDED
22 #  define gdevmrop_INCLUDED
23 
24 /*
25  * Compute the effective RasterOp for the 1-bit case,
26  * taking transparency into account.
27  */
28 gs_rop3_t gs_transparent_rop(gs_logical_operation_t lop);
29 
30 #ifdef DEBUG
31 /* Trace a [strip_]copy_rop call. */
32 void trace_copy_rop(const char *cname, gx_device * dev,
33 		    const byte * sdata, int sourcex, uint sraster,
34 		    gx_bitmap_id id, const gx_color_index * scolors,
35 		    const gx_strip_bitmap * textures,
36 		    const gx_color_index * tcolors,
37 		    int x, int y, int width, int height,
38 		    int phase_x, int phase_y, gs_logical_operation_t lop);
39 #endif
40 
41 /*
42  * PostScript colors normally act as the texture for RasterOp, with a null
43  * (all zeros) source.  For images with CombineWithColor = true, we need
44  * a way to use the image data as the source.  We implement this with a
45  * device that applies RasterOp with a specified texture to drawing
46  * operations, treating the drawing color as source rather than texture.
47  * The texture is a gx_device_color; it may be any type of color, even a
48  * pattern.
49  */
50 #ifndef gx_device_color_DEFINED
51 #  define gx_device_color_DEFINED
52 typedef struct gx_device_color_s gx_device_color;
53 #endif
54 
55 #ifndef gx_device_rop_texture_DEFINED
56 #  define gx_device_rop_texture_DEFINED
57 typedef struct gx_device_rop_texture_s gx_device_rop_texture;
58 #endif
59 
60 struct gx_device_rop_texture_s {
61     gx_device_forward_common;
62     gs_logical_operation_t log_op;
63     gx_device_color texture;
64 };
65 
66 #define private_st_device_rop_texture()	/* in gdevrops.c */\
67   gs_private_st_composite_use_final(st_device_rop_texture,\
68     gx_device_rop_texture, "gx_device_rop_texture",\
69     device_rop_texture_enum_ptrs, device_rop_texture_reloc_ptrs,\
70     gx_device_finalize)
71 
72 /* Create a RasterOp source device. */
73 int gx_alloc_rop_texture_device(gx_device_rop_texture ** prsdev,
74 				gs_memory_t * mem,
75 				client_name_t cname);
76 
77 /* Initialize a RasterOp source device. */
78 void gx_make_rop_texture_device(gx_device_rop_texture * rsdev,
79 				gx_device * target,
80 				gs_logical_operation_t lop,
81 				const gx_device_color * texture);
82 
83 #endif /* gdevmrop_INCLUDED */
84