1 /* cairo - a vector graphics library with display and print output
3 * Copyright © 2002 University of Southern California
4 * Copyright © 2005 Red Hat, Inc.
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.
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
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/
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.
29 * The Original Code is the cairo graphics library.
31 * The Initial Developer of the Original Code is University of Southern
35 * Carl D. Worth <cworth@cworth.org>
38 #ifndef CAIRO_SURFACE_BACKEND_PRIVATE_H
39 #define CAIRO_SURFACE_BACKEND_PRIVATE_H
41 #include "cairo-compiler-private.h"
42 #include "cairo-error-private.h"
46 struct _cairo_surface_backend {
47 cairo_surface_type_t type;
49 cairo_warn cairo_status_t
50 (*finish) (void *surface);
53 (*create_context) (void *surface);
56 (*create_similar) (void *surface,
57 cairo_content_t content,
61 (*create_similar_image) (void *surface,
62 cairo_format_t format,
67 (*map_to_image) (void *surface,
68 const cairo_rectangle_int_t *extents);
70 (*unmap_image) (void *surface,
71 cairo_image_surface_t *image);
74 (*source) (void *abstract_surface,
75 cairo_rectangle_int_t *extents);
77 cairo_warn cairo_status_t
78 (*acquire_source_image) (void *abstract_surface,
79 cairo_image_surface_t **image_out,
83 (*release_source_image) (void *abstract_surface,
84 cairo_image_surface_t *image_out,
88 (*snapshot) (void *surface);
90 cairo_warn cairo_int_status_t
91 (*copy_page) (void *surface);
93 cairo_warn cairo_int_status_t
94 (*show_page) (void *surface);
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}.
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.
105 (*get_extents) (void *surface,
106 cairo_rectangle_int_t *extents);
109 (*get_font_options) (void *surface,
110 cairo_font_options_t *options);
112 cairo_warn cairo_status_t
113 (*flush) (void *surface);
115 cairo_warn cairo_status_t
116 (*mark_dirty_rectangle) (void *surface,
122 cairo_warn cairo_int_status_t
123 (*paint) (void *surface,
125 const cairo_pattern_t *source,
126 const cairo_clip_t *clip);
128 cairo_warn cairo_int_status_t
129 (*mask) (void *surface,
131 const cairo_pattern_t *source,
132 const cairo_pattern_t *mask,
133 const cairo_clip_t *clip);
135 cairo_warn cairo_int_status_t
136 (*stroke) (void *surface,
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,
144 cairo_antialias_t antialias,
145 const cairo_clip_t *clip);
147 cairo_warn cairo_int_status_t
148 (*fill) (void *surface,
150 const cairo_pattern_t *source,
151 const cairo_path_fixed_t *path,
152 cairo_fill_rule_t fill_rule,
154 cairo_antialias_t antialias,
155 const cairo_clip_t *clip);
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);
174 cairo_warn cairo_int_status_t
175 (*show_glyphs) (void *surface,
177 const cairo_pattern_t *source,
178 cairo_glyph_t *glyphs,
180 cairo_scaled_font_t *scaled_font,
181 const cairo_clip_t *clip);
184 (*has_show_text_glyphs) (void *surface);
186 cairo_warn cairo_int_status_t
187 (*show_text_glyphs) (void *surface,
189 const cairo_pattern_t *source,
192 cairo_glyph_t *glyphs,
194 const cairo_text_cluster_t *clusters,
196 cairo_text_cluster_flags_t cluster_flags,
197 cairo_scaled_font_t *scaled_font,
198 const cairo_clip_t *clip);
201 (*get_supported_mime_types) (void *surface);
204 cairo_private cairo_status_t
205 _cairo_surface_default_acquire_source_image (void *surface,
206 cairo_image_surface_t **image_out,
210 _cairo_surface_default_release_source_image (void *surface,
211 cairo_image_surface_t *image,
214 cairo_private cairo_surface_t *
215 _cairo_surface_default_source (void *surface,
216 cairo_rectangle_int_t *extents);
220 #endif /* CAIRO_SURFACE_BACKEND_PRIVATE_H */