1 /* Copyright (C) 2001-2019 Artifex Software, Inc.
2    All Rights Reserved.
3 
4    This software is provided AS-IS with no warranty, either express or
5    implied.
6 
7    This software is distributed under license and may not be copied,
8    modified or distributed except as expressly authorized under the terms
9    of the license contained in the file LICENSE in this distribution.
10 
11    Refer to licensing information at http://www.artifex.com or contact
12    Artifex Software, Inc.,  1305 Grant Avenue - Suite 200, Novato,
13    CA 94945, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* ImageType 3 internal API */
18 
19 #ifndef gximage3_INCLUDED
20 #  define gximage3_INCLUDED
21 
22 #include "gsiparm3.h"
23 #include "gxiparam.h"
24 
25 /*
26  * The machinery for splitting an ImageType3 image into pixel and mask data
27  * is used both for imaging per se and for writing high-level output.
28  * We implement this by making the procedures for setting up the mask image
29  * and clipping devices virtual.
30  */
31 
32 /*
33  * Make the mask image device -- the device that processes mask bits.
34  * The device is closed and freed at the end of processing the image.
35  */
36 #define IMAGE3_MAKE_MID_PROC(proc)\
37   int proc(gx_device **pmidev, gx_device *dev, int width, int height,\
38            gs_memory_t *mem)
39 typedef IMAGE3_MAKE_MID_PROC((*image3_make_mid_proc_t));
40 
41 /*
42  * Make the mask clip device -- the device that uses the mask image to
43  * clip the (opaque) image data -- and its enumerator.
44  * The device is closed and freed at the end of processing the image.
45  */
46 #define IMAGE3_MAKE_MCDE_PROC(proc)\
47   int proc(/* The initial arguments are those of begin_typed_image. */\
48                gx_device *dev,\
49            const gs_gstate *pgs,\
50            const gs_matrix *pmat,\
51            const gs_image_common_t *pic,\
52            const gs_int_rect *prect,\
53            const gx_drawing_color *pdcolor,\
54            const gx_clip_path *pcpath, gs_memory_t *mem,\
55            gx_image_enum_common_t **pinfo,\
56            /* The following arguments are added. */\
57            gx_device **pmcdev, gx_device *midev,\
58            gx_image_enum_common_t *pminfo,\
59            const gs_int_point *origin)
60 typedef IMAGE3_MAKE_MCDE_PROC((*image3_make_mcde_proc_t));
61 
62 /*
63  * Begin processing an ImageType 3 image, with the mask device creation
64  * procedures as additional parameters.
65  */
66 int gx_begin_image3_generic(gx_device * dev,
67                             const gs_gstate *pgs,
68                             const gs_matrix *pmat,
69                             const gs_image_common_t *pic,
70                             const gs_int_rect *prect,
71                             const gx_drawing_color *pdcolor,
72                             const gx_clip_path *pcpath, gs_memory_t *mem,
73                             IMAGE3_MAKE_MID_PROC((*make_mid)),
74                             IMAGE3_MAKE_MCDE_PROC((*make_mcde)),
75                             gx_image_enum_common_t **pinfo);
76 
77 #endif /* gximage3_INCLUDED */
78