xref: /plan9/sys/src/cmd/gs/src/gxclip.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 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: gxclip.h,v 1.5 2002/06/16 08:45:43 lpd Exp $ */
18 /* Internal definitions for clipping */
19 
20 #ifndef gxclip_INCLUDED
21 #  define gxclip_INCLUDED
22 
23 /*
24  * Both rectangle list and mask clipping use callback procedures to process
25  * each rectangle selected by the clipping region.  They share both the
26  * callback procedures themselves and the structure that provides closure
27  * data for these procedures.  We define a single closure structure, rather
28  * than one per client/callback, just to reduce source code clutter.  The
29  * comments below show which clients use each member.
30  */
31 typedef struct clip_callback_data_s {
32     /*
33      * The original driver procedure stores the following of its arguments
34      * that the callback procedure or the clipping algorithm needs.
35      */
36     gx_device *tdev;		/* target device (always set) */
37     int x, y, w, h;		/* (always set) */
38     gx_color_index color[2];	/* (all but copy_color) */
39     const byte *data;		/* copy_*, fill_mask */
40     int sourcex;		/* ibid. */
41     uint raster;		/* ibid. */
42     int depth;			/* copy_alpha, fill_mask */
43     const gx_drawing_color *pdcolor;	/* fill_mask */
44     gs_logical_operation_t lop;	/* fill_mask, strip_copy_rop */
45     const gx_clip_path *pcpath;	/* fill_mask */
46     const gx_strip_bitmap *tiles;	/* strip_tile_rectangle */
47     gs_int_point phase;		/* strip_* */
48     const gx_color_index *scolors;	/* strip_copy_rop */
49     const gx_strip_bitmap *textures;	/* ibid. */
50     const gx_color_index *tcolors;	/* ibid. */
51 } clip_callback_data_t;
52 
53 /* Declare the callback procedures. */
54 int
55     clip_call_fill_rectangle(clip_callback_data_t * pccd,
56 			     int xc, int yc, int xec, int yec),
57     clip_call_copy_mono(clip_callback_data_t * pccd,
58 			int xc, int yc, int xec, int yec),
59     clip_call_copy_color(clip_callback_data_t * pccd,
60 			 int xc, int yc, int xec, int yec),
61     clip_call_copy_alpha(clip_callback_data_t * pccd,
62 			 int xc, int yc, int xec, int yec),
63     clip_call_fill_mask(clip_callback_data_t * pccd,
64 			int xc, int yc, int xec, int yec),
65     clip_call_strip_tile_rectangle(clip_callback_data_t * pccd,
66 				   int xc, int yc, int xec, int yec),
67     clip_call_strip_copy_rop(clip_callback_data_t * pccd,
68 			     int xc, int yc, int xec, int yec);
69 
70 #endif /* gxclip_INCLUDED */
71