1 /* Copyright (C) 2001-2012 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.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
13    CA  94903, U.S.A., +1(415)492-9861, for further information.
14 */
15 
16 
17 /* State and interface definitions for clipping path accumulator */
18 /* Requires gxdevice.h, gzcpath.h */
19 
20 #ifndef gzacpath_INCLUDED
21 #  define gzacpath_INCLUDED
22 
23 #include "gxcpath.h"
24 
25 /*
26  * Device for accumulating a rectangle list.  This device can clip
27  * the list being accumulated with a clipping rectangle on the fly:
28  * we use this to clip clipping paths to band boundaries when
29  * rendering a band list.
30  */
31 typedef struct gx_device_cpath_accum_s {
32     gx_device_common;
33     gs_memory_t *list_memory;
34     gs_int_rect clip_box;
35     gs_int_rect bbox;
36     gx_clip_list list;
37 } gx_device_cpath_accum;
38 
39 #define public_st_device_cpath_accum()\
40   gs_public_st_complex_only(st_device_cpath_accum, gx_device_cpath_accum,\
41     "gx_device_cpath_accum", 0, device_cpath_accum_enum_ptrs,\
42     device_cpath_accum_reloc_ptrs, gx_device_finalize)
43 
44 /* Start accumulating a clipping path. */
45 void gx_cpath_accum_begin(gx_device_cpath_accum * padev, gs_memory_t * mem);
46 
47 /* Set the accumulator's clipping box. */
48 void gx_cpath_accum_set_cbox(gx_device_cpath_accum * padev,
49                              const gs_fixed_rect * pbox);
50 
51 /* Finish accumulating a clipping path. */
52 /* Note that this releases the old contents of the clipping path. */
53 int gx_cpath_accum_end(const gx_device_cpath_accum * padev,
54                        gx_clip_path * pcpath);
55 
56 /* Discard an accumulator in case of error. */
57 void gx_cpath_accum_discard(gx_device_cpath_accum * padev);
58 
59 /* Intersect two clipping paths using an accumulator. */
60 int gx_cpath_intersect_path_slow(gx_clip_path *, gx_path *, int,
61                         gs_imager_state *, const gx_fill_params *);
62 
63 int cpath_accum_fill_rect_with(gx_device_cpath_accum *pcdev, gx_device *tdev,
64                                gx_device_color *pdevc);
65 
66 #endif /* gzacpath_INCLUDED */
67