tizen 2.3.1 release
[framework/graphics/cairo.git] / src / cairo-traps-private.h
1 /* cairo - a vector graphics library with display and print output
2  *
3  * Copyright © 2002 University of Southern California
4  * Copyright © 2005 Red Hat, Inc.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it either under the terms of the GNU Lesser General Public
8  * License version 2.1 as published by the Free Software Foundation
9  * (the "LGPL") or, at your option, under the terms of the Mozilla
10  * Public License Version 1.1 (the "MPL"). If you do not alter this
11  * notice, a recipient may use your version of this file under either
12  * the MPL or the LGPL.
13  *
14  * You should have received a copy of the LGPL along with this library
15  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
17  * You should have received a copy of the MPL along with this library
18  * in the file COPYING-MPL-1.1
19  *
20  * The contents of this file are subject to the Mozilla Public License
21  * Version 1.1 (the "License"); you may not use this file except in
22  * compliance with the License. You may obtain a copy of the License at
23  * http://www.mozilla.org/MPL/
24  *
25  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
26  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
27  * the specific language governing rights and limitations.
28  *
29  * The Original Code is the cairo graphics library.
30  *
31  * The Initial Developer of the Original Code is University of Southern
32  * California.
33  *
34  * Contributor(s):
35  *      Carl D. Worth <cworth@cworth.org>
36  */
37
38 #ifndef CAIRO_TRAPS_PRIVATE_H
39 #define CAIRO_TRAPS_PRIVATE_H
40
41 #include "cairo-compiler-private.h"
42 #include "cairo-error-private.h"
43 #include "cairo-types-private.h"
44
45 CAIRO_BEGIN_DECLS
46
47 struct _cairo_traps {
48     cairo_status_t status;
49
50     cairo_box_t bounds;
51     const cairo_box_t *limits;
52     int num_limits;
53
54     unsigned int maybe_region : 1; /* hint: 0 implies that it cannot be */
55     unsigned int has_intersections : 1;
56     unsigned int is_rectilinear : 1;
57     unsigned int is_rectangular : 1;
58
59     int num_traps;
60     int traps_size;
61     cairo_trapezoid_t *traps;
62     cairo_trapezoid_t  traps_embedded[16];
63 };
64
65 /* cairo-traps.c */
66 cairo_private void
67 _cairo_traps_init (cairo_traps_t *traps);
68
69 cairo_private void
70 _cairo_traps_init_with_clip (cairo_traps_t *traps,
71                              const cairo_clip_t *clip);
72
73 cairo_private void
74 _cairo_traps_limit (cairo_traps_t       *traps,
75                     const cairo_box_t   *boxes,
76                     int                  num_boxes);
77
78 cairo_private cairo_status_t
79 _cairo_traps_init_boxes (cairo_traps_t      *traps,
80                          const cairo_boxes_t *boxes);
81
82 cairo_private void
83 _cairo_traps_clear (cairo_traps_t *traps);
84
85 cairo_private void
86 _cairo_traps_fini (cairo_traps_t *traps);
87
88 #define _cairo_traps_status(T) (T)->status
89
90 cairo_private void
91 _cairo_traps_translate (cairo_traps_t *traps, int x, int y);
92
93 cairo_private void
94 _cairo_traps_tessellate_triangle (cairo_traps_t *traps,
95                                   const cairo_point_t t[3]);
96
97 cairo_private void
98 _cairo_traps_tessellate_convex_quad (cairo_traps_t *traps,
99                                      const cairo_point_t q[4]);
100
101 cairo_private cairo_status_t
102 _cairo_traps_tessellate_rectangle (cairo_traps_t *traps,
103                                    const cairo_point_t *top_left,
104                                    const cairo_point_t *bottom_right);
105
106 cairo_private void
107 _cairo_traps_add_trap (cairo_traps_t *traps,
108                        cairo_fixed_t top, cairo_fixed_t bottom,
109                        cairo_line_t *left, cairo_line_t *right);
110
111 cairo_private int
112 _cairo_traps_contain (const cairo_traps_t *traps,
113                       double x, double y);
114
115 cairo_private void
116 _cairo_traps_extents (const cairo_traps_t *traps,
117                       cairo_box_t         *extents);
118
119 cairo_private cairo_int_status_t
120 _cairo_traps_extract_region (cairo_traps_t  *traps,
121                              cairo_antialias_t antialias,
122                              cairo_region_t **region);
123
124 cairo_private cairo_bool_t
125 _cairo_traps_to_boxes (cairo_traps_t *traps,
126                        cairo_antialias_t antialias,
127                        cairo_boxes_t *boxes);
128
129 cairo_private cairo_status_t
130 _cairo_traps_path (const cairo_traps_t *traps,
131                    cairo_path_fixed_t  *path);
132
133 cairo_private cairo_int_status_t
134 _cairo_rasterise_polygon_to_traps (cairo_polygon_t                      *polygon,
135                                    cairo_fill_rule_t                     fill_rule,
136                                    cairo_antialias_t                     antialias,
137                                    cairo_traps_t *traps);
138
139 CAIRO_END_DECLS
140
141 #endif /* CAIRO_TRAPS_PRIVATE_H */