xref: /plan9/sys/src/cmd/gs/src/gximag3x.h (revision 593dc095aefb2a85c828727bbfa9da139a49bdf4)
1 /* Copyright (C) 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: gximag3x.h,v 1.7 2002/06/16 08:55:53 lpd Exp $ */
18 /* ImageType 3x internal API */
19 
20 #ifndef gximag3x_INCLUDED
21 #  define gximag3x_INCLUDED
22 
23 #include "gsipar3x.h"
24 #include "gxiparam.h"
25 
26 /*
27  * The machinery for splitting an ImageType3 image into pixel and mask data
28  * is used both for imaging per se and for writing high-level output.
29  * We implement this by making the procedures for setting up the mask image
30  * and clipping devices virtual.
31  */
32 
33 /*
34  * Make the mask image device -- the device that processes mask bits.
35  * The device is closed and freed at the end of processing the image.
36  */
37 #define IMAGE3X_MAKE_MID_PROC(proc)\
38   int proc(gx_device **pmidev, gx_device *dev, int width, int height,\
39 	   int depth, gs_memory_t *mem)
40 typedef IMAGE3X_MAKE_MID_PROC((*image3x_make_mid_proc_t));
41 
42 /*
43  * Make the mask clip device -- the device that uses the mask image to
44  * clip the (opaque) image data -- and its enumerator.
45  * The device is closed and freed at the end of processing the image.
46  */
47 #define IMAGE3X_MAKE_MCDE_PROC(proc)\
48   int proc(/* The initial arguments are those of begin_typed_image. */\
49 	   gx_device *dev,\
50 	   const gs_imager_state *pis,\
51 	   const gs_matrix *pmat,\
52 	   const gs_image_common_t *pic,\
53 	   const gs_int_rect *prect,\
54 	   const gx_drawing_color *pdcolor,\
55 	   const gx_clip_path *pcpath, gs_memory_t *mem,\
56 	   gx_image_enum_common_t **pinfo,\
57 	   /* The following arguments are added. */\
58 	   gx_device **pmcdev, gx_device *midev[2],\
59 	   gx_image_enum_common_t *pminfo[2],\
60 	   const gs_int_point origin[2],\
61 	   const gs_image3x_t *pim)
62 typedef IMAGE3X_MAKE_MCDE_PROC((*image3x_make_mcde_proc_t));
63 
64 /*
65  * Begin processing an ImageType 3x image, with the mask device creation
66  * procedures as additional parameters.
67  */
68 int gx_begin_image3x_generic(gx_device * dev,
69 			     const gs_imager_state *pis,
70 			     const gs_matrix *pmat,
71 			     const gs_image_common_t *pic,
72 			     const gs_int_rect *prect,
73 			     const gx_drawing_color *pdcolor,
74 			     const gx_clip_path *pcpath, gs_memory_t *mem,
75 			     IMAGE3X_MAKE_MID_PROC((*make_mid)),
76 			     IMAGE3X_MAKE_MCDE_PROC((*make_mcde)),
77 			     gx_image_enum_common_t **pinfo);
78 
79 #endif /* gximag3x_INCLUDED */
80