d23fc05301bf61b465dfc788e897257c2280c3c5
[framework/graphics/cairo.git] / src / cairo-surface-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_PRIVATE_H
39 #define CAIRO_SURFACE_PRIVATE_H
40
41 #include "cairo.h"
42
43 #include "cairo-types-private.h"
44 #include "cairo-list-private.h"
45 #include "cairo-reference-count-private.h"
46 #include "cairo-clip-private.h"
47 #include "cairo-surface-backend-private.h"
48
49 typedef void (*cairo_surface_func_t) (cairo_surface_t *);
50
51 struct _cairo_surface {
52     const cairo_surface_backend_t *backend;
53     cairo_device_t *device;
54
55     /* We allow surfaces to override the backend->type by shoving something
56      * else into surface->type. This is for "wrapper" surfaces that want to
57      * hide their internal type from the user-level API. */
58     cairo_surface_type_t type;
59
60     cairo_content_t content;
61
62     cairo_reference_count_t ref_count;
63     cairo_status_t status;
64     unsigned int unique_id;
65     unsigned int serial;
66     cairo_damage_t *damage;
67
68     unsigned _finishing : 1;
69     unsigned finished : 1;
70     unsigned is_clear : 1;
71     unsigned has_font_options : 1;
72     unsigned owns_device : 1;
73
74     cairo_user_data_array_t user_data;
75     cairo_user_data_array_t mime_data;
76
77     cairo_matrix_t device_transform;
78     cairo_matrix_t device_transform_inverse;
79     cairo_list_t device_transform_observers;
80
81     /* The actual resolution of the device, in dots per inch. */
82     double x_resolution;
83     double y_resolution;
84
85     /* The resolution that should be used when generating image-based
86      * fallback; generally only used by the analysis/paginated
87      * surfaces
88      */
89     double x_fallback_resolution;
90     double y_fallback_resolution;
91
92     /* A "snapshot" surface is immutable. See _cairo_surface_snapshot. */
93     cairo_surface_t *snapshot_of;
94     cairo_surface_func_t snapshot_detach;
95     /* current snapshots of this surface*/
96     cairo_list_t snapshots;
97     /* place upon snapshot list */
98     cairo_list_t snapshot;
99
100     /*
101      * Surface font options, falling back to backend's default options,
102      * and set using _cairo_surface_set_font_options(), and propagated by
103      * cairo_surface_create_similar().
104      */
105     cairo_font_options_t font_options;
106 };
107
108 cairo_private cairo_surface_t *
109 _cairo_int_surface_create_in_error (cairo_int_status_t status);
110
111 cairo_private cairo_surface_t *
112 _cairo_surface_get_source (cairo_surface_t *surface,
113                            cairo_rectangle_int_t *extents);
114
115 #endif /* CAIRO_SURFACE_PRIVATE_H */