xref: /plan9/sys/src/cmd/gs/src/gximage3.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: gximage3.h,v 1.8 2002/06/16 08:55:53 lpd Exp $ */
18 /* ImageType 3 internal API */
19 
20 #ifndef gximage3_INCLUDED
21 #  define gximage3_INCLUDED
22 
23 #include "gsiparm3.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 IMAGE3_MAKE_MID_PROC(proc)\
38   int proc(gx_device **pmidev, gx_device *dev, int width, int height,\
39 	   gs_memory_t *mem)
40 typedef IMAGE3_MAKE_MID_PROC((*image3_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 IMAGE3_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,\
59 	   gx_image_enum_common_t *pminfo,\
60 	   const gs_int_point *origin)
61 typedef IMAGE3_MAKE_MCDE_PROC((*image3_make_mcde_proc_t));
62 
63 /*
64  * Begin processing an ImageType 3 image, with the mask device creation
65  * procedures as additional parameters.
66  */
67 int gx_begin_image3_generic(gx_device * dev,
68 			    const gs_imager_state *pis,
69 			    const gs_matrix *pmat,
70 			    const gs_image_common_t *pic,
71 			    const gs_int_rect *prect,
72 			    const gx_drawing_color *pdcolor,
73 			    const gx_clip_path *pcpath, gs_memory_t *mem,
74 			    IMAGE3_MAKE_MID_PROC((*make_mid)),
75 			    IMAGE3_MAKE_MCDE_PROC((*make_mcde)),
76 			    gx_image_enum_common_t **pinfo);
77 
78 #endif /* gximage3_INCLUDED */
79