fbaa91232e707d0b0ccb23dfb26dc61973dce2ad
[framework/graphics/cairo.git] / src / cairo-surface-backend-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_SURFACE_BACKEND_PRIVATE_H
39 #define CAIRO_SURFACE_BACKEND_PRIVATE_H
40
41 #include "cairo-compiler-private.h"
42 #include "cairo-error-private.h"
43
44 CAIRO_BEGIN_DECLS
45
46 struct _cairo_surface_backend {
47     cairo_surface_type_t type;
48
49     cairo_warn cairo_status_t
50     (*finish)                   (void                   *surface);
51
52     cairo_t *
53     (*create_context)           (void                   *surface);
54
55     cairo_surface_t *
56     (*create_similar)           (void                   *surface,
57                                  cairo_content_t         content,
58                                  int                     width,
59                                  int                     height);
60     cairo_surface_t *
61     (*create_similar_image)     (void                   *surface,
62                                  cairo_format_t         format,
63                                  int                     width,
64                                  int                     height);
65
66     cairo_surface_t *
67     (*map_to_image)             (void                   *surface,
68                                  const cairo_rectangle_int_t  *extents);
69     cairo_int_status_t
70     (*unmap_image)              (void                   *surface,
71                                  cairo_image_surface_t  *image);
72
73     cairo_surface_t *
74     (*source)                   (void                    *abstract_surface,
75                                  cairo_rectangle_int_t  *extents);
76
77     cairo_warn cairo_status_t
78     (*acquire_source_image)     (void                    *abstract_surface,
79                                  cairo_image_surface_t  **image_out,
80                                  void                   **image_extra);
81
82     cairo_warn void
83     (*release_source_image)     (void                   *abstract_surface,
84                                  cairo_image_surface_t  *image_out,
85                                  void                   *image_extra);
86
87     cairo_surface_t *
88     (*snapshot)                 (void                   *surface);
89
90     cairo_warn cairo_int_status_t
91     (*copy_page)                (void                   *surface);
92
93     cairo_warn cairo_int_status_t
94     (*show_page)                (void                   *surface);
95
96     /* Get the extents of the current surface. For many surface types
97      * this will be as simple as { x=0, y=0, width=surface->width,
98      * height=surface->height}.
99      *
100      * If this function is not implemented, or if it returns
101      * FALSE the surface is considered to be
102      * boundless and infinite bounds are used for it.
103      */
104     cairo_bool_t
105     (*get_extents)              (void                    *surface,
106                                  cairo_rectangle_int_t   *extents);
107
108     void
109     (*get_font_options)         (void                  *surface,
110                                  cairo_font_options_t  *options);
111
112     cairo_warn cairo_status_t
113     (*flush)                    (void                  *surface);
114
115     cairo_warn cairo_status_t
116     (*mark_dirty_rectangle)     (void                  *surface,
117                                  int                    x,
118                                  int                    y,
119                                  int                    width,
120                                  int                    height);
121
122     cairo_warn cairo_int_status_t
123     (*paint)                    (void                   *surface,
124                                  cairo_operator_t        op,
125                                  const cairo_pattern_t  *source,
126                                  const cairo_clip_t             *clip);
127
128     cairo_warn cairo_int_status_t
129     (*mask)                     (void                   *surface,
130                                  cairo_operator_t        op,
131                                  const cairo_pattern_t  *source,
132                                  const cairo_pattern_t  *mask,
133                                  const cairo_clip_t             *clip);
134
135     cairo_warn cairo_int_status_t
136     (*stroke)                   (void                   *surface,
137                                  cairo_operator_t        op,
138                                  const cairo_pattern_t  *source,
139                                  const cairo_path_fixed_t       *path,
140                                  const cairo_stroke_style_t     *style,
141                                  const cairo_matrix_t   *ctm,
142                                  const cairo_matrix_t   *ctm_inverse,
143                                  double                  tolerance,
144                                  cairo_antialias_t       antialias,
145                                  const cairo_clip_t             *clip);
146
147     cairo_warn cairo_int_status_t
148     (*fill)                     (void                   *surface,
149                                  cairo_operator_t        op,
150                                  const cairo_pattern_t  *source,
151                                  const cairo_path_fixed_t       *path,
152                                  cairo_fill_rule_t       fill_rule,
153                                  double                  tolerance,
154                                  cairo_antialias_t       antialias,
155                                  const cairo_clip_t           *clip);
156
157     cairo_warn cairo_int_status_t
158     (*fill_stroke)              (void                   *surface,
159                                  cairo_operator_t        fill_op,
160                                  const cairo_pattern_t  *fill_source,
161                                  cairo_fill_rule_t       fill_rule,
162                                  double                  fill_tolerance,
163                                  cairo_antialias_t       fill_antialias,
164                                  const cairo_path_fixed_t*path,
165                                  cairo_operator_t        stroke_op,
166                                  const cairo_pattern_t  *stroke_source,
167                                  const cairo_stroke_style_t     *stroke_style,
168                                  const cairo_matrix_t   *stroke_ctm,
169                                  const cairo_matrix_t   *stroke_ctm_inverse,
170                                  double                  stroke_tolerance,
171                                  cairo_antialias_t       stroke_antialias,
172                                  const cairo_clip_t     *clip);
173
174     cairo_warn cairo_int_status_t
175     (*show_glyphs)              (void                   *surface,
176                                  cairo_operator_t        op,
177                                  const cairo_pattern_t  *source,
178                                  cairo_glyph_t          *glyphs,
179                                  int                     num_glyphs,
180                                  cairo_scaled_font_t    *scaled_font,
181                                  const cairo_clip_t     *clip);
182
183     cairo_bool_t
184     (*has_show_text_glyphs)     (void                       *surface);
185
186     cairo_warn cairo_int_status_t
187     (*show_text_glyphs)         (void                       *surface,
188                                  cairo_operator_t            op,
189                                  const cairo_pattern_t      *source,
190                                  const char                 *utf8,
191                                  int                         utf8_len,
192                                  cairo_glyph_t              *glyphs,
193                                  int                         num_glyphs,
194                                  const cairo_text_cluster_t *clusters,
195                                  int                         num_clusters,
196                                  cairo_text_cluster_flags_t  cluster_flags,
197                                  cairo_scaled_font_t        *scaled_font,
198                                  const cairo_clip_t               *clip);
199
200     const char **
201     (*get_supported_mime_types) (void                       *surface);
202 };
203
204 cairo_private cairo_status_t
205 _cairo_surface_default_acquire_source_image (void                    *surface,
206                                              cairo_image_surface_t  **image_out,
207                                              void                   **image_extra);
208
209 cairo_private void
210 _cairo_surface_default_release_source_image (void                   *surface,
211                                              cairo_image_surface_t  *image,
212                                              void                   *image_extra);
213
214 cairo_private cairo_surface_t *
215 _cairo_surface_default_source (void *surface,
216                                cairo_rectangle_int_t *extents);
217
218 CAIRO_END_DECLS
219
220 #endif /* CAIRO_SURFACE_BACKEND_PRIVATE_H */