Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* Copyright (C) 1994, 1996, 1997, 1998, 1999 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: gzcpath.h,v 1.5 2003/11/12 14:29:08 igor Exp $ */
18
/* Structure definitions for clipping paths */
19
/* Requires gzpath.h. */
20
 
21
#ifndef gzcpath_INCLUDED
22
#  define gzcpath_INCLUDED
23
 
24
#include "gxcpath.h"
25
 
26
/*
27
 * The reference counting considerations for clip paths are the same as
28
 * for paths.  We need a separate reference count for the clip list,
29
 * since its existence and lifetime are not necessarily the same as
30
 * those of the path.
31
 */
32
 
33
typedef struct gx_clip_rect_list_s {
34
    rc_header rc;
35
    gx_clip_list list;
36
} gx_clip_rect_list;
37
 
38
#define private_st_clip_rect_list()	/* in gxcpath.c */\
39
  gs_private_st_ptrs_add0(st_clip_rect_list, gx_clip_rect_list,\
40
    "gx_clip_rect_list", clip_rect_list_enum_ptrs, clip_rect_list_reloc_ptrs,\
41
    st_clip_list, list)
42
 
43
/*
44
 * When the clip path consists of the intersection of two or more
45
 * source paths, we maintain the complete list paths, so that it
46
 * can be accurately output for high-level devices.
47
 */
48
 
49
typedef struct gx_cpath_path_list_s gx_cpath_path_list;
50
 
51
struct gx_cpath_path_list_s {
52
    gx_path path;
53
    rc_header rc;
54
    int rule;
55
    gx_cpath_path_list *next;
56
};
57
 
58
#define private_st_cpath_path_list() 	/* in gxcpath.c */\
59
  gs_private_st_suffix_add1(st_cpath_path_list, gx_cpath_path_list,\
60
    "gs_cpath_list", cpath_path_list_enum_ptrs, cpath_path_list_reloc_ptrs,\
61
    st_path, next)
62
 
63
/* gx_clip_path is a 'subclass' of gx_path. */
64
struct gx_clip_path_s {
65
    gx_path path;
66
    gx_clip_rect_list local_list;
67
    int rule;			/* rule for insideness of path */
68
    /* Anything within the inner_box is guaranteed to fall */
69
    /* entirely within the clipping path. */
70
    gs_fixed_rect inner_box;
71
    /* Anything outside the outer_box is guaranteed to fall */
72
    /* entirely outside the clipping path.  This is the same */
73
    /* as the path bounding box, widened to pixel boundaries. */
74
    gs_fixed_rect outer_box;
75
    gx_clip_rect_list *rect_list;
76
    bool path_valid;		/* path representation is valid */
77
    gx_cpath_path_list *path_list;
78
    /* The id changes whenever the clipping region changes. */
79
    gs_id id;
80
};
81
 
82
extern_st(st_clip_path);
83
#define public_st_clip_path()	/* in gxcpath.c */\
84
  gs_public_st_composite(st_clip_path, gx_clip_path, "clip_path",\
85
    clip_path_enum_ptrs, clip_path_reloc_ptrs)
86
#define st_clip_path_max_ptrs (st_path_max_ptrs + 1)
87
 
88
/* Inline accessors. */
89
#define gx_cpath_is_shared(pcpath)\
90
  ((pcpath)->rect_list->rc.ref_count > 1)
91
 
92
/* Define the structure for enumerating a clipping list. */
93
typedef enum {
94
    visit_left = 1,
95
    visit_right = 2
96
} cpe_visit_t;
97
typedef enum {
98
    cpe_scan, cpe_left, cpe_right, cpe_close, cpe_done
99
} cpe_state_t;
100
struct gs_cpath_enum_s {
101
    gs_path_enum path_enum;	/* used iff clipping path exists as a path, */
102
    /* must be first for subclassing */
103
    bool using_path;
104
    gx_clip_rect *visit;	/* scan pointer for finding next start */
105
    gx_clip_rect *rp;		/* scan pointer for current rectangle */
106
    cpe_visit_t first_visit;
107
    cpe_state_t state;
108
    bool have_line;
109
    gs_int_point line_end;
110
    bool any_rectangles;
111
};
112
 
113
#define private_st_cpath_enum()		/* in gxcpath.c */\
114
  gs_private_st_suffix_add2(st_cpath_enum, gs_cpath_enum, "gs_cpath_enum",\
115
    cpath_enum_enum_ptrs, cpath_enum_reloc_ptrs, st_path_enum,\
116
    visit, rp)
117
 
118
#endif /* gzcpath_INCLUDED */