1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied, modified
8
or distributed except as expressly authorized under the terms of that
9
license. Refer to licensing information at http://www.artifex.com/
10
or contact Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134,
11
San Rafael, CA 94903, U.S.A., +1(415)492-9861, for further information.
14
/* $Id: gzcpath.h 8022 2007-06-05 22:23:38Z giles $ */
15
/* Structure definitions for clipping paths */
16
/* Requires gzpath.h. */
18
#ifndef gzcpath_INCLUDED
19
# define gzcpath_INCLUDED
25
* The reference counting considerations for clip paths are the same as
26
* for paths. We need a separate reference count for the clip list,
27
* since its existence and lifetime are not necessarily the same as
31
typedef struct gx_clip_rect_list_s {
36
#define private_st_clip_rect_list() /* in gxcpath.c */\
37
gs_private_st_ptrs_add0(st_clip_rect_list, gx_clip_rect_list,\
38
"gx_clip_rect_list", clip_rect_list_enum_ptrs, clip_rect_list_reloc_ptrs,\
42
* When the clip path consists of the intersection of two or more
43
* source paths, we maintain the complete list paths, so that it
44
* can be accurately output for high-level devices.
47
typedef struct gx_cpath_path_list_s gx_cpath_path_list;
49
struct gx_cpath_path_list_s {
53
gx_cpath_path_list *next;
56
#define private_st_cpath_path_list() /* in gxcpath.c */\
57
gs_private_st_suffix_add1(st_cpath_path_list, gx_cpath_path_list,\
58
"gs_cpath_list", cpath_path_list_enum_ptrs, cpath_path_list_reloc_ptrs,\
61
/* gx_clip_path is a 'subclass' of gx_path. */
62
struct gx_clip_path_s {
64
gx_clip_rect_list local_list;
65
int rule; /* rule for insideness of path */
66
/* Anything within the inner_box is guaranteed to fall */
67
/* entirely within the clipping path. */
68
gs_fixed_rect inner_box;
69
/* Anything outside the outer_box is guaranteed to fall */
70
/* entirely outside the clipping path. This is the same */
71
/* as the path bounding box, widened to pixel boundaries. */
72
gs_fixed_rect outer_box;
73
gx_clip_rect_list *rect_list;
74
bool path_valid; /* path representation is valid */
75
gx_cpath_path_list *path_list;
76
/* The id changes whenever the clipping region changes. */
80
extern_st(st_clip_path);
81
#define public_st_clip_path() /* in gxcpath.c */\
82
gs_public_st_composite(st_clip_path, gx_clip_path, "clip_path",\
83
clip_path_enum_ptrs, clip_path_reloc_ptrs)
84
#define st_clip_path_max_ptrs (st_path_max_ptrs + 1)
86
/* Inline accessors. */
87
#define gx_cpath_is_shared(pcpath)\
88
((pcpath)->rect_list->rc.ref_count > 1)
90
/* Define the structure for enumerating a clipping list. */
96
cpe_scan, cpe_left, cpe_right, cpe_close, cpe_done
98
struct gs_cpath_enum_s {
99
gs_path_enum path_enum; /* used iff clipping path exists as a path, */
100
/* must be first for subclassing */
102
gx_clip_rect *visit; /* scan pointer for finding next start */
103
gx_clip_rect *rp; /* scan pointer for current rectangle */
104
cpe_visit_t first_visit;
107
gs_int_point line_end;
111
#define private_st_cpath_enum() /* in gxcpath.c */\
112
gs_private_st_suffix_add2(st_cpath_enum, gs_cpath_enum, "gs_cpath_enum",\
113
cpath_enum_enum_ptrs, cpath_enum_reloc_ptrs, st_path_enum,\
116
#endif /* gzcpath_INCLUDED */