1
/* cairo - a vector graphics library with display and print output
3
* Copyright © 2005 Red Hat, Inc
5
* This library is free software; you can redistribute it and/or
6
* modify it either under the terms of the GNU Lesser General Public
7
* License version 2.1 as published by the Free Software Foundation
8
* (the "LGPL") or, at your option, under the terms of the Mozilla
9
* Public License Version 1.1 (the "MPL"). If you do not alter this
10
* notice, a recipient may use your version of this file under either
11
* the MPL or the LGPL.
13
* You should have received a copy of the LGPL along with this library
14
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
15
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
* You should have received a copy of the MPL along with this library
17
* in the file COPYING-MPL-1.1
19
* The contents of this file are subject to the Mozilla Public License
20
* Version 1.1 (the "License"); you may not use this file except in
21
* compliance with the License. You may obtain a copy of the License at
22
* http://www.mozilla.org/MPL/
24
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
25
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
26
* the specific language governing rights and limitations.
28
* The Original Code is the cairo graphics library.
30
* The Initial Developer of the Original Code is Red Hat, Inc.
33
* Kristian Høgsberg <krh@redhat.com>
34
* Adrian Johnson <ajohnson@redneon.com>
37
#ifndef CAIRO_META_SURFACE_H
38
#define CAIRO_META_SURFACE_H
41
#include "cairo-path-fixed-private.h"
44
/* The 5 basic drawing operations. */
49
CAIRO_COMMAND_SHOW_GLYPHS,
51
/* Other junk. For most of these, we should be able to assert that
52
* they never get called except as part of fallbacks for the 5
53
* basic drawing operations (which we implement already so the
54
* fallbacks should never get triggered). So the plan is to
55
* eliminate as many of these as possible. */
57
CAIRO_COMMAND_INTERSECT_CLIP_PATH
59
} cairo_command_type_t;
62
CAIRO_META_REGION_ALL,
63
CAIRO_META_REGION_NATIVE,
64
CAIRO_META_REGION_IMAGE_FALLBACK
65
} cairo_meta_region_type_t;
67
typedef struct _cairo_command_header {
68
cairo_command_type_t type;
69
cairo_meta_region_type_t region;
70
} cairo_command_header_t;
72
typedef struct _cairo_command_paint {
73
cairo_command_header_t header;
75
cairo_pattern_union_t source;
76
} cairo_command_paint_t;
78
typedef struct _cairo_command_mask {
79
cairo_command_header_t header;
81
cairo_pattern_union_t source;
82
cairo_pattern_union_t mask;
83
} cairo_command_mask_t;
85
typedef struct _cairo_command_stroke {
86
cairo_command_header_t header;
88
cairo_pattern_union_t source;
89
cairo_path_fixed_t path;
90
cairo_stroke_style_t style;
92
cairo_matrix_t ctm_inverse;
94
cairo_antialias_t antialias;
95
} cairo_command_stroke_t;
97
typedef struct _cairo_command_fill {
98
cairo_command_header_t header;
100
cairo_pattern_union_t source;
101
cairo_path_fixed_t path;
102
cairo_fill_rule_t fill_rule;
104
cairo_antialias_t antialias;
105
} cairo_command_fill_t;
107
typedef struct _cairo_command_show_glyphs {
108
cairo_command_header_t header;
110
cairo_pattern_union_t source;
111
cairo_glyph_t *glyphs;
112
unsigned int num_glyphs;
113
cairo_scaled_font_t *scaled_font;
114
} cairo_command_show_glyphs_t;
116
typedef struct _cairo_command_intersect_clip_path {
117
cairo_command_header_t header;
118
cairo_path_fixed_t *path_pointer;
119
cairo_path_fixed_t path;
120
cairo_fill_rule_t fill_rule;
122
cairo_antialias_t antialias;
123
} cairo_command_intersect_clip_path_t;
125
typedef union _cairo_command {
126
cairo_command_header_t header;
128
/* The 5 basic drawing operations. */
129
cairo_command_paint_t paint;
130
cairo_command_mask_t mask;
131
cairo_command_stroke_t stroke;
132
cairo_command_fill_t fill;
133
cairo_command_show_glyphs_t show_glyphs;
135
/* The other junk. */
136
cairo_command_intersect_clip_path_t intersect_clip_path;
139
typedef struct _cairo_meta_surface {
140
cairo_surface_t base;
142
cairo_content_t content;
144
/* A meta-surface is logically unbounded, but when used as a
145
* source we need to render it to an image, so we need a size at
146
* which to create that image. */
150
cairo_array_t commands;
151
cairo_surface_t *commands_owner;
153
cairo_bool_t is_clipped;
154
int replay_start_idx;
155
} cairo_meta_surface_t;
157
cairo_private cairo_surface_t *
158
_cairo_meta_surface_create (cairo_content_t content,
162
cairo_private cairo_status_t
163
_cairo_meta_surface_replay (cairo_surface_t *surface,
164
cairo_surface_t *target);
166
cairo_private cairo_status_t
167
_cairo_meta_surface_replay_analyze_meta_pattern (cairo_surface_t *surface,
168
cairo_surface_t *target);
170
cairo_private cairo_status_t
171
_cairo_meta_surface_replay_and_create_regions (cairo_surface_t *surface,
172
cairo_surface_t *target);
173
cairo_private cairo_status_t
174
_cairo_meta_surface_replay_region (cairo_surface_t *surface,
175
cairo_surface_t *target,
176
cairo_meta_region_type_t region);
178
cairo_private cairo_bool_t
179
_cairo_surface_is_meta (const cairo_surface_t *surface);
181
#endif /* CAIRO_META_SURFACE_H */