Tizen 2.0 Release
[framework/graphics/cairo.git] / src / cairo-surface-wrapper-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  * Copyright © 2009 Chris Wilson
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it either under the terms of the GNU Lesser General Public
9  * License version 2.1 as published by the Free Software Foundation
10  * (the "LGPL") or, at your option, under the terms of the Mozilla
11  * Public License Version 1.1 (the "MPL"). If you do not alter this
12  * notice, a recipient may use your version of this file under either
13  * the MPL or the LGPL.
14  *
15  * You should have received a copy of the LGPL along with this library
16  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
18  * You should have received a copy of the MPL along with this library
19  * in the file COPYING-MPL-1.1
20  *
21  * The contents of this file are subject to the Mozilla Public License
22  * Version 1.1 (the "License"); you may not use this file except in
23  * compliance with the License. You may obtain a copy of the License at
24  * http://www.mozilla.org/MPL/
25  *
26  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
27  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
28  * the specific language governing rights and limitations.
29  *
30  * The Original Code is the cairo graphics library.
31  *
32  * The Initial Developer of the Original Code is University of Southern
33  * California.
34  *
35  * Contributor(s):
36  *      Chris Wilson <chris@chris-wilson.co.u>
37  */
38
39 #ifndef CAIRO_SURFACE_WRAPPER_PRIVATE_H
40 #define CAIRO_SURFACE_WRAPPER_PRIVATE_H
41
42 #include "cairoint.h"
43 #include "cairo-types-private.h"
44 #include "cairo-surface-backend-private.h"
45
46 CAIRO_BEGIN_DECLS
47
48 struct _cairo_surface_wrapper {
49     cairo_surface_t *target;
50
51     cairo_matrix_t transform;
52
53     cairo_bool_t has_extents;
54     cairo_rectangle_int_t extents;
55     const cairo_clip_t *clip;
56
57     cairo_bool_t needs_transform;
58 };
59
60 cairo_private void
61 _cairo_surface_wrapper_init (cairo_surface_wrapper_t *wrapper,
62                              cairo_surface_t *target);
63
64 cairo_private void
65 _cairo_surface_wrapper_intersect_extents (cairo_surface_wrapper_t *wrapper,
66                                           const cairo_rectangle_int_t *extents);
67
68 cairo_private void
69 _cairo_surface_wrapper_set_inverse_transform (cairo_surface_wrapper_t *wrapper,
70                                               const cairo_matrix_t *transform);
71
72 cairo_private void
73 _cairo_surface_wrapper_set_clip (cairo_surface_wrapper_t *wrapper,
74                                  const cairo_clip_t *clip);
75
76 cairo_private void
77 _cairo_surface_wrapper_fini (cairo_surface_wrapper_t *wrapper);
78
79 static inline cairo_bool_t
80 _cairo_surface_wrapper_has_fill_stroke (cairo_surface_wrapper_t *wrapper)
81 {
82     return wrapper->target->backend->fill_stroke != NULL;
83 }
84
85 cairo_private cairo_status_t
86 _cairo_surface_wrapper_acquire_source_image (cairo_surface_wrapper_t *wrapper,
87                                              cairo_image_surface_t  **image_out,
88                                              void                   **image_extra);
89
90 cairo_private void
91 _cairo_surface_wrapper_release_source_image (cairo_surface_wrapper_t *wrapper,
92                                              cairo_image_surface_t  *image,
93                                              void                   *image_extra);
94
95
96 cairo_private cairo_status_t
97 _cairo_surface_wrapper_paint (cairo_surface_wrapper_t *wrapper,
98                               cairo_operator_t   op,
99                               const cairo_pattern_t *source,
100                               const cairo_clip_t            *clip);
101
102 cairo_private cairo_status_t
103 _cairo_surface_wrapper_mask (cairo_surface_wrapper_t *wrapper,
104                              cairo_operator_t    op,
105                              const cairo_pattern_t *source,
106                              const cairo_pattern_t *mask,
107                              const cairo_clip_t     *clip);
108
109 cairo_private cairo_status_t
110 _cairo_surface_wrapper_stroke (cairo_surface_wrapper_t *wrapper,
111                                cairo_operator_t          op,
112                                const cairo_pattern_t    *source,
113                                const cairo_path_fixed_t *path,
114                                const cairo_stroke_style_t       *stroke_style,
115                                const cairo_matrix_t             *ctm,
116                                const cairo_matrix_t             *ctm_inverse,
117                                double                    tolerance,
118                                cairo_antialias_t         antialias,
119                                const cairo_clip_t               *clip);
120
121 cairo_private cairo_status_t
122 _cairo_surface_wrapper_fill_stroke (cairo_surface_wrapper_t *wrapper,
123                                     cairo_operator_t         fill_op,
124                                     const cairo_pattern_t   *fill_source,
125                                     cairo_fill_rule_t        fill_rule,
126                                     double                   fill_tolerance,
127                                     cairo_antialias_t        fill_antialias,
128                                     const cairo_path_fixed_t*path,
129                                     cairo_operator_t         stroke_op,
130                                     const cairo_pattern_t   *stroke_source,
131                                     const cairo_stroke_style_t    *stroke_style,
132                                     const cairo_matrix_t            *stroke_ctm,
133                                     const cairo_matrix_t            *stroke_ctm_inverse,
134                                     double                   stroke_tolerance,
135                                     cairo_antialias_t        stroke_antialias,
136                                     const cairo_clip_t      *clip);
137
138 cairo_private cairo_status_t
139 _cairo_surface_wrapper_fill (cairo_surface_wrapper_t *wrapper,
140                              cairo_operator_t    op,
141                              const cairo_pattern_t *source,
142                              const cairo_path_fixed_t   *path,
143                              cairo_fill_rule_t   fill_rule,
144                              double              tolerance,
145                              cairo_antialias_t   antialias,
146                              const cairo_clip_t *clip);
147
148 cairo_private cairo_status_t
149 _cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t *wrapper,
150                                          cairo_operator_t            op,
151                                          const cairo_pattern_t      *source,
152                                          const char                 *utf8,
153                                          int                         utf8_len,
154                                          const cairo_glyph_t        *glyphs,
155                                          int                         num_glyphs,
156                                          const cairo_text_cluster_t *clusters,
157                                          int                         num_clusters,
158                                          cairo_text_cluster_flags_t  cluster_flags,
159                                          cairo_scaled_font_t        *scaled_font,
160                                          const cairo_clip_t         *clip);
161
162 cairo_private cairo_surface_t *
163 _cairo_surface_wrapper_create_similar (cairo_surface_wrapper_t *wrapper,
164                                        cairo_content_t  content,
165                                        int              width,
166                                        int              height);
167 cairo_private cairo_bool_t
168 _cairo_surface_wrapper_get_extents (cairo_surface_wrapper_t *wrapper,
169                                     cairo_rectangle_int_t   *extents);
170
171 cairo_private void
172 _cairo_surface_wrapper_get_font_options (cairo_surface_wrapper_t    *wrapper,
173                                          cairo_font_options_t       *options);
174
175 cairo_private cairo_surface_t *
176 _cairo_surface_wrapper_snapshot (cairo_surface_wrapper_t *wrapper);
177
178 cairo_private cairo_bool_t
179 _cairo_surface_wrapper_has_show_text_glyphs (cairo_surface_wrapper_t *wrapper);
180
181 static inline cairo_bool_t
182 _cairo_surface_wrapper_is_active (cairo_surface_wrapper_t *wrapper)
183 {
184     return wrapper->target != (cairo_surface_t *) 0;
185 }
186
187 cairo_private cairo_bool_t
188 _cairo_surface_wrapper_get_target_extents (cairo_surface_wrapper_t *wrapper,
189                                            cairo_rectangle_int_t *extents);
190
191 CAIRO_END_DECLS
192
193 #endif /* CAIRO_SURFACE_WRAPPER_PRIVATE_H */