Rev 1892 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1892 | serge | 1 | /* cairo - a vector graphics library with display and print output |
2 | * |
||
3 | * Copyright © 2005 Red Hat, Inc |
||
4 | * |
||
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. |
||
12 | * |
||
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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
||
16 | * You should have received a copy of the MPL along with this library |
||
17 | * in the file COPYING-MPL-1.1 |
||
18 | * |
||
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/ |
||
23 | * |
||
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. |
||
27 | * |
||
28 | * The Original Code is the cairo graphics library. |
||
29 | * |
||
30 | * The Initial Developer of the Original Code is Red Hat, Inc. |
||
31 | * |
||
32 | * Contributor(s): |
||
33 | * Kristian Høgsberg |
||
34 | * Adrian Johnson |
||
35 | */ |
||
36 | |||
37 | #ifndef CAIRO_RECORDING_SURFACE_H |
||
38 | #define CAIRO_RECORDING_SURFACE_H |
||
39 | |||
40 | #include "cairoint.h" |
||
41 | #include "cairo-path-fixed-private.h" |
||
3959 | Serge | 42 | #include "cairo-pattern-private.h" |
43 | #include "cairo-surface-backend-private.h" |
||
1892 | serge | 44 | |
45 | typedef enum { |
||
46 | /* The 5 basic drawing operations. */ |
||
47 | CAIRO_COMMAND_PAINT, |
||
48 | CAIRO_COMMAND_MASK, |
||
49 | CAIRO_COMMAND_STROKE, |
||
50 | CAIRO_COMMAND_FILL, |
||
51 | CAIRO_COMMAND_SHOW_TEXT_GLYPHS, |
||
52 | } cairo_command_type_t; |
||
53 | |||
54 | typedef enum { |
||
55 | CAIRO_RECORDING_REGION_ALL, |
||
56 | CAIRO_RECORDING_REGION_NATIVE, |
||
57 | CAIRO_RECORDING_REGION_IMAGE_FALLBACK |
||
58 | } cairo_recording_region_type_t; |
||
59 | |||
60 | typedef struct _cairo_command_header { |
||
61 | cairo_command_type_t type; |
||
3959 | Serge | 62 | cairo_recording_region_type_t region; |
1892 | serge | 63 | cairo_operator_t op; |
3959 | Serge | 64 | cairo_rectangle_int_t extents; |
65 | cairo_clip_t *clip; |
||
66 | |||
67 | int index; |
||
68 | struct _cairo_command_header *chain; |
||
1892 | serge | 69 | } cairo_command_header_t; |
70 | |||
71 | typedef struct _cairo_command_paint { |
||
72 | cairo_command_header_t header; |
||
73 | cairo_pattern_union_t source; |
||
74 | } cairo_command_paint_t; |
||
75 | |||
76 | typedef struct _cairo_command_mask { |
||
77 | cairo_command_header_t header; |
||
78 | cairo_pattern_union_t source; |
||
79 | cairo_pattern_union_t mask; |
||
80 | } cairo_command_mask_t; |
||
81 | |||
82 | typedef struct _cairo_command_stroke { |
||
83 | cairo_command_header_t header; |
||
84 | cairo_pattern_union_t source; |
||
85 | cairo_path_fixed_t path; |
||
86 | cairo_stroke_style_t style; |
||
87 | cairo_matrix_t ctm; |
||
88 | cairo_matrix_t ctm_inverse; |
||
89 | double tolerance; |
||
90 | cairo_antialias_t antialias; |
||
91 | } cairo_command_stroke_t; |
||
92 | |||
93 | typedef struct _cairo_command_fill { |
||
94 | cairo_command_header_t header; |
||
95 | cairo_pattern_union_t source; |
||
96 | cairo_path_fixed_t path; |
||
97 | cairo_fill_rule_t fill_rule; |
||
98 | double tolerance; |
||
99 | cairo_antialias_t antialias; |
||
100 | } cairo_command_fill_t; |
||
101 | |||
102 | typedef struct _cairo_command_show_text_glyphs { |
||
103 | cairo_command_header_t header; |
||
104 | cairo_pattern_union_t source; |
||
105 | char *utf8; |
||
106 | int utf8_len; |
||
107 | cairo_glyph_t *glyphs; |
||
108 | unsigned int num_glyphs; |
||
109 | cairo_text_cluster_t *clusters; |
||
110 | int num_clusters; |
||
111 | cairo_text_cluster_flags_t cluster_flags; |
||
112 | cairo_scaled_font_t *scaled_font; |
||
113 | } cairo_command_show_text_glyphs_t; |
||
114 | |||
115 | typedef union _cairo_command { |
||
116 | cairo_command_header_t header; |
||
117 | |||
118 | cairo_command_paint_t paint; |
||
119 | cairo_command_mask_t mask; |
||
120 | cairo_command_stroke_t stroke; |
||
121 | cairo_command_fill_t fill; |
||
122 | cairo_command_show_text_glyphs_t show_text_glyphs; |
||
123 | } cairo_command_t; |
||
124 | |||
125 | typedef struct _cairo_recording_surface { |
||
126 | cairo_surface_t base; |
||
127 | |||
128 | /* A recording-surface is logically unbounded, but when used as a |
||
129 | * source we need to render it to an image, so we need a size at |
||
130 | * which to create that image. */ |
||
131 | cairo_rectangle_t extents_pixels; |
||
132 | cairo_rectangle_int_t extents; |
||
133 | cairo_bool_t unbounded; |
||
134 | |||
135 | cairo_array_t commands; |
||
3959 | Serge | 136 | unsigned int *indices; |
137 | unsigned int num_indices; |
||
138 | cairo_bool_t optimize_clears; |
||
1892 | serge | 139 | |
3959 | Serge | 140 | struct bbtree { |
141 | cairo_box_t extents; |
||
142 | struct bbtree *left, *right; |
||
143 | cairo_command_header_t *chain; |
||
144 | } bbtree; |
||
1892 | serge | 145 | } cairo_recording_surface_t; |
146 | |||
147 | slim_hidden_proto (cairo_recording_surface_create); |
||
148 | |||
149 | cairo_private cairo_int_status_t |
||
150 | _cairo_recording_surface_get_path (cairo_surface_t *surface, |
||
151 | cairo_path_fixed_t *path); |
||
152 | |||
153 | cairo_private cairo_status_t |
||
3959 | Serge | 154 | _cairo_recording_surface_replay_one (cairo_recording_surface_t *surface, |
155 | long unsigned index, |
||
156 | cairo_surface_t *target); |
||
157 | |||
158 | cairo_private cairo_status_t |
||
1892 | serge | 159 | _cairo_recording_surface_replay (cairo_surface_t *surface, |
160 | cairo_surface_t *target); |
||
161 | |||
162 | cairo_private cairo_status_t |
||
3959 | Serge | 163 | _cairo_recording_surface_replay_with_clip (cairo_surface_t *surface, |
164 | const cairo_matrix_t *surface_transform, |
||
165 | cairo_surface_t *target, |
||
166 | const cairo_clip_t *target_clip); |
||
1892 | serge | 167 | |
168 | cairo_private cairo_status_t |
||
169 | _cairo_recording_surface_replay_and_create_regions (cairo_surface_t *surface, |
||
170 | cairo_surface_t *target); |
||
171 | cairo_private cairo_status_t |
||
172 | _cairo_recording_surface_replay_region (cairo_surface_t *surface, |
||
173 | const cairo_rectangle_int_t *surface_extents, |
||
174 | cairo_surface_t *target, |
||
175 | cairo_recording_region_type_t region); |
||
176 | |||
177 | cairo_private cairo_status_t |
||
178 | _cairo_recording_surface_get_bbox (cairo_recording_surface_t *recording, |
||
179 | cairo_box_t *bbox, |
||
180 | const cairo_matrix_t *transform); |
||
181 | |||
3959 | Serge | 182 | cairo_private cairo_status_t |
183 | _cairo_recording_surface_get_ink_bbox (cairo_recording_surface_t *surface, |
||
184 | cairo_box_t *bbox, |
||
185 | const cairo_matrix_t *transform); |
||
1892 | serge | 186 | |
187 | #endif /* CAIRO_RECORDING_SURFACE_H */ |