added MouseWheel event support for Silverlight 3.0
[moon.git] / cairo / src / cairo-meta-surface-private.h
blob9a1b169cff19add028ec09fa3935c74327d87a5e
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.
32 * Contributor(s):
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
40 #include "cairoint.h"
41 #include "cairo-path-fixed-private.h"
43 typedef enum {
44 /* The 5 basic drawing operations. */
45 CAIRO_COMMAND_PAINT,
46 CAIRO_COMMAND_MASK,
47 CAIRO_COMMAND_STROKE,
48 CAIRO_COMMAND_FILL,
49 CAIRO_COMMAND_SHOW_TEXT_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;
61 typedef enum {
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;
74 cairo_operator_t op;
75 cairo_pattern_union_t source;
76 } cairo_command_paint_t;
78 typedef struct _cairo_command_mask {
79 cairo_command_header_t header;
80 cairo_operator_t op;
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;
87 cairo_operator_t op;
88 cairo_pattern_union_t source;
89 cairo_path_fixed_t path;
90 cairo_stroke_style_t style;
91 cairo_matrix_t ctm;
92 cairo_matrix_t ctm_inverse;
93 double tolerance;
94 cairo_antialias_t antialias;
95 } cairo_command_stroke_t;
97 typedef struct _cairo_command_fill {
98 cairo_command_header_t header;
99 cairo_operator_t op;
100 cairo_pattern_union_t source;
101 cairo_path_fixed_t path;
102 cairo_fill_rule_t fill_rule;
103 double tolerance;
104 cairo_antialias_t antialias;
105 } cairo_command_fill_t;
107 typedef struct _cairo_command_show_text_glyphs {
108 cairo_command_header_t header;
109 cairo_operator_t op;
110 cairo_pattern_union_t source;
111 char *utf8;
112 int utf8_len;
113 cairo_glyph_t *glyphs;
114 unsigned int num_glyphs;
115 cairo_text_cluster_t *clusters;
116 int num_clusters;
117 cairo_text_cluster_flags_t cluster_flags;
118 cairo_scaled_font_t *scaled_font;
119 } cairo_command_show_text_glyphs_t;
121 typedef struct _cairo_command_intersect_clip_path {
122 cairo_command_header_t header;
123 cairo_path_fixed_t *path_pointer;
124 cairo_path_fixed_t path;
125 cairo_fill_rule_t fill_rule;
126 double tolerance;
127 cairo_antialias_t antialias;
128 } cairo_command_intersect_clip_path_t;
130 typedef union _cairo_command {
131 cairo_command_header_t header;
133 /* The 5 basic drawing operations. */
134 cairo_command_paint_t paint;
135 cairo_command_mask_t mask;
136 cairo_command_stroke_t stroke;
137 cairo_command_fill_t fill;
138 cairo_command_show_text_glyphs_t show_text_glyphs;
140 /* The other junk. */
141 cairo_command_intersect_clip_path_t intersect_clip_path;
142 } cairo_command_t;
144 typedef struct _cairo_meta_surface {
145 cairo_surface_t base;
147 cairo_content_t content;
149 /* A meta-surface is logically unbounded, but when used as a
150 * source we need to render it to an image, so we need a size at
151 * which to create that image. */
152 int width_pixels;
153 int height_pixels;
155 cairo_array_t commands;
156 cairo_surface_t *commands_owner;
158 cairo_bool_t is_clipped;
159 int replay_start_idx;
160 } cairo_meta_surface_t;
162 cairo_private cairo_surface_t *
163 _cairo_meta_surface_create (cairo_content_t content,
164 int width_pixels,
165 int height_pixels);
167 cairo_private cairo_int_status_t
168 _cairo_meta_surface_get_path (cairo_surface_t *surface,
169 cairo_path_fixed_t *path);
171 cairo_private cairo_status_t
172 _cairo_meta_surface_replay (cairo_surface_t *surface,
173 cairo_surface_t *target);
175 cairo_private cairo_status_t
176 _cairo_meta_surface_replay_analyze_meta_pattern (cairo_surface_t *surface,
177 cairo_surface_t *target);
179 cairo_private cairo_status_t
180 _cairo_meta_surface_replay_and_create_regions (cairo_surface_t *surface,
181 cairo_surface_t *target);
182 cairo_private cairo_status_t
183 _cairo_meta_surface_replay_region (cairo_surface_t *surface,
184 cairo_surface_t *target,
185 cairo_meta_region_type_t region);
187 cairo_private cairo_bool_t
188 _cairo_surface_is_meta (const cairo_surface_t *surface);
190 #endif /* CAIRO_META_SURFACE_H */