1
/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2
/* cairo - a vector graphics library with display and print output
3
 *
4
 * Copyright © 2002 University of Southern California
5
 * Copyright © 2005 Red Hat, Inc.
6
 * Copyright © 2009 Chris Wilson
7
 *
8
 * This library is free software; you can redistribute it and/or
9
 * modify it either under the terms of the GNU Lesser General Public
10
 * License version 2.1 as published by the Free Software Foundation
11
 * (the "LGPL") or, at your option, under the terms of the Mozilla
12
 * Public License Version 1.1 (the "MPL"). If you do not alter this
13
 * notice, a recipient may use your version of this file under either
14
 * the MPL or the LGPL.
15
 *
16
 * You should have received a copy of the LGPL along with this library
17
 * in the file COPYING-LGPL-2.1; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
19
 * You should have received a copy of the MPL along with this library
20
 * in the file COPYING-MPL-1.1
21
 *
22
 * The contents of this file are subject to the Mozilla Public License
23
 * Version 1.1 (the "License"); you may not use this file except in
24
 * compliance with the License. You may obtain a copy of the License at
25
 * http://www.mozilla.org/MPL/
26
 *
27
 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
28
 * OF ANY KIND, either express or implied. See the LGPL or the MPL for
29
 * the specific language governing rights and limitations.
30
 *
31
 * The Original Code is the cairo graphics library.
32
 *
33
 * The Initial Developer of the Original Code is University of Southern
34
 * California.
35
 *
36
 * Contributor(s):
37
 *	Chris Wilson <chris@chris-wilson.co.u>
38
 */
39

            
40
#ifndef CAIRO_SURFACE_WRAPPER_PRIVATE_H
41
#define CAIRO_SURFACE_WRAPPER_PRIVATE_H
42

            
43
#include "cairoint.h"
44
#include "cairo-types-private.h"
45
#include "cairo-recording-surface-private.h"
46
#include "cairo-surface-backend-private.h"
47

            
48
CAIRO_BEGIN_DECLS
49

            
50
struct _cairo_surface_wrapper {
51
    cairo_surface_t *target;
52

            
53
    cairo_matrix_t transform;
54

            
55
    cairo_bool_t has_extents;
56
    cairo_rectangle_int_t extents;
57
    const cairo_clip_t *clip;
58

            
59
    unsigned int source_region_id;
60
    unsigned int mask_region_id;
61

            
62
    cairo_bool_t needs_transform;
63
};
64

            
65
cairo_private void
66
_cairo_surface_wrapper_init (cairo_surface_wrapper_t *wrapper,
67
			     cairo_surface_t *target);
68

            
69
cairo_private void
70
_cairo_surface_wrapper_intersect_extents (cairo_surface_wrapper_t *wrapper,
71
					  const cairo_rectangle_int_t *extents);
72

            
73
cairo_private void
74
_cairo_surface_wrapper_set_inverse_transform (cairo_surface_wrapper_t *wrapper,
75
					      const cairo_matrix_t *transform);
76

            
77
cairo_private void
78
_cairo_surface_wrapper_set_clip (cairo_surface_wrapper_t *wrapper,
79
				 const cairo_clip_t *clip);
80

            
81
cairo_private void
82
_cairo_surface_wrapper_fini (cairo_surface_wrapper_t *wrapper);
83

            
84
static inline cairo_bool_t
85
111101
_cairo_surface_wrapper_has_fill_stroke (cairo_surface_wrapper_t *wrapper)
86
{
87
111101
    return wrapper->target->backend->fill_stroke != NULL;
88
}
89

            
90
cairo_private cairo_status_t
91
_cairo_surface_wrapper_acquire_source_image (cairo_surface_wrapper_t *wrapper,
92
					     cairo_image_surface_t  **image_out,
93
					     void                   **image_extra);
94

            
95
cairo_private void
96
_cairo_surface_wrapper_release_source_image (cairo_surface_wrapper_t *wrapper,
97
					     cairo_image_surface_t  *image,
98
					     void                   *image_extra);
99

            
100

            
101
cairo_private cairo_status_t
102
_cairo_surface_wrapper_paint (cairo_surface_wrapper_t *wrapper,
103
			      cairo_operator_t	       op,
104
			      const cairo_pattern_t   *source,
105
			      unsigned int             source_region_id,
106
			      const cairo_clip_t      *clip);
107

            
108
cairo_private cairo_status_t
109
_cairo_surface_wrapper_mask (cairo_surface_wrapper_t *wrapper,
110
			     cairo_operator_t	      op,
111
			     const cairo_pattern_t   *source,
112
			     unsigned int             source_region_id,
113
			     const cairo_pattern_t   *mask,
114
                             unsigned int             mask_region_id,
115
			     const cairo_clip_t	     *clip);
116

            
117
cairo_private cairo_status_t
118
_cairo_surface_wrapper_stroke (cairo_surface_wrapper_t    *wrapper,
119
			       cairo_operator_t		   op,
120
			       const cairo_pattern_t	  *source,
121
			       unsigned int                source_region_id,
122
			       const cairo_path_fixed_t	  *path,
123
			       const cairo_stroke_style_t *stroke_style,
124
			       const cairo_matrix_t	  *ctm,
125
			       const cairo_matrix_t	  *ctm_inverse,
126
			       double			   tolerance,
127
			       cairo_antialias_t	   antialias,
128
			       const cairo_clip_t	  *clip);
129

            
130
cairo_private cairo_status_t
131
_cairo_surface_wrapper_fill_stroke (cairo_surface_wrapper_t    *wrapper,
132
				    cairo_operator_t	        fill_op,
133
				    const cairo_pattern_t      *fill_source,
134
				    unsigned int                fill_region_id,
135
				    cairo_fill_rule_t	        fill_rule,
136
				    double		        fill_tolerance,
137
				    cairo_antialias_t	        fill_antialias,
138
				    const cairo_path_fixed_t   *path,
139
				    cairo_operator_t	        stroke_op,
140
				    const cairo_pattern_t      *stroke_source,
141
				    unsigned int                stroke_region_id,
142
				    const cairo_stroke_style_t *stroke_style,
143
				    const cairo_matrix_t       *stroke_ctm,
144
				    const cairo_matrix_t       *stroke_ctm_inverse,
145
				    double		        stroke_tolerance,
146
				    cairo_antialias_t	        stroke_antialias,
147
				    const cairo_clip_t	       *clip);
148

            
149
cairo_private cairo_status_t
150
_cairo_surface_wrapper_fill (cairo_surface_wrapper_t  *wrapper,
151
			     cairo_operator_t	       op,
152
			     const cairo_pattern_t    *source,
153
			     unsigned int              source_region_id,
154
			     const cairo_path_fixed_t *path,
155
			     cairo_fill_rule_t	       fill_rule,
156
			     double		       tolerance,
157
			     cairo_antialias_t	       antialias,
158
			     const cairo_clip_t	      *clip);
159

            
160
cairo_private cairo_status_t
161
_cairo_surface_wrapper_show_text_glyphs (cairo_surface_wrapper_t     *wrapper,
162
					 cairo_operator_t	     op,
163
					 const cairo_pattern_t	    *source,
164
					 unsigned int                source_region_id,
165
					 const char		    *utf8,
166
					 int			     utf8_len,
167
					 const cairo_glyph_t	    *glyphs,
168
					 int			     num_glyphs,
169
					 const cairo_text_cluster_t *clusters,
170
					 int			     num_clusters,
171
					 cairo_text_cluster_flags_t  cluster_flags,
172
					 cairo_scaled_font_t	    *scaled_font,
173
					 const cairo_clip_t	    *clip);
174

            
175
cairo_private cairo_status_t
176
_cairo_surface_wrapper_tag (cairo_surface_wrapper_t     *wrapper,
177
			    cairo_bool_t                 begin,
178
			    const char                  *tag_name,
179
			    const char                  *attributes);
180

            
181
cairo_private cairo_surface_t *
182
_cairo_surface_wrapper_create_similar (cairo_surface_wrapper_t *wrapper,
183
				       cairo_content_t	content,
184
				       int		width,
185
				       int		height);
186
cairo_private cairo_bool_t
187
_cairo_surface_wrapper_get_extents (cairo_surface_wrapper_t *wrapper,
188
				    cairo_rectangle_int_t   *extents);
189

            
190
cairo_private void
191
_cairo_surface_wrapper_get_font_options (cairo_surface_wrapper_t    *wrapper,
192
					 cairo_font_options_t	    *options);
193

            
194
cairo_private cairo_surface_t *
195
_cairo_surface_wrapper_snapshot (cairo_surface_wrapper_t *wrapper);
196

            
197
cairo_private cairo_bool_t
198
_cairo_surface_wrapper_has_show_text_glyphs (cairo_surface_wrapper_t *wrapper);
199

            
200
static inline cairo_bool_t
201
3
_cairo_surface_wrapper_is_active (cairo_surface_wrapper_t *wrapper)
202
{
203
3
    return wrapper->target != (cairo_surface_t *) 0;
204
}
205

            
206
cairo_private cairo_bool_t
207
_cairo_surface_wrapper_get_target_extents (cairo_surface_wrapper_t *wrapper,
208
					   cairo_bool_t surface_is_unbounded,
209
					   cairo_rectangle_int_t *extents);
210

            
211
CAIRO_END_DECLS
212

            
213
#endif /* CAIRO_SURFACE_WRAPPER_PRIVATE_H */