Tizen 2.0 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     const cairo_box_t *limits;
51     int num_limits;
52
53     unsigned int maybe_region : 1; /* hint: 0 implies that it cannot be */
54     unsigned int has_intersections : 1;
55     unsigned int is_rectilinear : 1;
56     unsigned int is_rectangular : 1;
57
58     int num_traps;
59     int traps_size;
60     cairo_trapezoid_t *traps;
61     cairo_trapezoid_t  traps_embedded[16];
62 };
63
64 /* cairo-traps.c */
65 cairo_private void
66 _cairo_traps_init (cairo_traps_t *traps);
67
68 cairo_private void
69 _cairo_traps_init_with_clip (cairo_traps_t *traps,
70                              const cairo_clip_t *clip);
71
72 cairo_private void
73 _cairo_traps_limit (cairo_traps_t       *traps,
74                     const cairo_box_t   *boxes,
75                     int                  num_boxes);
76
77 cairo_private cairo_status_t
78 _cairo_traps_init_boxes (cairo_traps_t      *traps,
79                          const cairo_boxes_t *boxes);
80
81 cairo_private void
82 _cairo_traps_clear (cairo_traps_t *traps);
83
84 cairo_private void
85 _cairo_traps_fini (cairo_traps_t *traps);
86
87 #define _cairo_traps_status(T) (T)->status
88
89 cairo_private void
90 _cairo_traps_translate (cairo_traps_t *traps, int x, int y);
91
92 cairo_private cairo_status_t
93 _cairo_traps_tessellate_rectangle (cairo_traps_t *traps,
94                                    const cairo_point_t *top_left,
95                                    const cairo_point_t *bottom_right);
96
97 cairo_private void
98 _cairo_traps_add_trap (cairo_traps_t *traps,
99                        cairo_fixed_t top, cairo_fixed_t bottom,
100                        cairo_line_t *left, cairo_line_t *right);
101
102 cairo_private int
103 _cairo_traps_contain (const cairo_traps_t *traps,
104                       double x, double y);
105
106 cairo_private void
107 _cairo_traps_extents (const cairo_traps_t *traps,
108                       cairo_box_t         *extents);
109
110 cairo_private cairo_int_status_t
111 _cairo_traps_extract_region (cairo_traps_t  *traps,
112                              cairo_antialias_t antialias,
113                              cairo_region_t **region);
114
115 cairo_private cairo_bool_t
116 _cairo_traps_to_boxes (cairo_traps_t *traps,
117                        cairo_antialias_t antialias,
118                        cairo_boxes_t *boxes);
119
120 cairo_private cairo_status_t
121 _cairo_traps_path (const cairo_traps_t *traps,
122                    cairo_path_fixed_t  *path);
123
124 cairo_private cairo_int_status_t
125 _cairo_rasterise_polygon_to_traps (cairo_polygon_t                      *polygon,
126                                    cairo_fill_rule_t                     fill_rule,
127                                    cairo_antialias_t                     antialias,
128                                    cairo_traps_t *traps);
129
130 CAIRO_END_DECLS
131
132 #endif /* CAIRO_TRAPS_PRIVATE_H */