Subversion Repositories Scribus

Rev

Rev 14952 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14952 fschmid 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
18122 mrdocs 15
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
14952 fschmid 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 <krh@redhat.com>
34
 *      Adrian Johnson <ajohnson@redneon.com>
35
 */
36
 
37
#ifndef CAIRO_META_SURFACE_H
38
#define CAIRO_META_SURFACE_H
39
 
40
#include "cairoint.h"
41
#include "cairo-path-fixed-private.h"
42
#include "cairo-clip-private.h"
43
 
44
typedef enum {
45
    /* The 5 basic drawing operations. */
46
    CAIRO_COMMAND_PAINT,
47
    CAIRO_COMMAND_MASK,
48
    CAIRO_COMMAND_STROKE,
49
    CAIRO_COMMAND_FILL,
50
    CAIRO_COMMAND_SHOW_TEXT_GLYPHS,
51
} cairo_command_type_t;
52
 
53
typedef enum {
54
    CAIRO_META_REGION_ALL,
55
    CAIRO_META_REGION_NATIVE,
56
    CAIRO_META_REGION_IMAGE_FALLBACK
57
} cairo_meta_region_type_t;
58
 
59
typedef struct _cairo_command_header {
60
    cairo_command_type_t         type;
61
    cairo_meta_region_type_t     region;
62
    cairo_operator_t             op;
63
    cairo_clip_t                 clip;
64
} cairo_command_header_t;
65
 
66
typedef struct _cairo_command_paint {
67
    cairo_command_header_t       header;
68
    cairo_pattern_union_t        source;
69
} cairo_command_paint_t;
70
 
71
typedef struct _cairo_command_mask {
72
    cairo_command_header_t       header;
73
    cairo_pattern_union_t        source;
74
    cairo_pattern_union_t        mask;
75
} cairo_command_mask_t;
76
 
77
typedef struct _cairo_command_stroke {
78
    cairo_command_header_t       header;
79
    cairo_pattern_union_t        source;
80
    cairo_path_fixed_t           path;
81
    cairo_stroke_style_t         style;
82
    cairo_matrix_t               ctm;
83
    cairo_matrix_t               ctm_inverse;
84
    double                       tolerance;
85
    cairo_antialias_t            antialias;
86
} cairo_command_stroke_t;
87
 
88
typedef struct _cairo_command_fill {
89
    cairo_command_header_t       header;
90
    cairo_pattern_union_t        source;
91
    cairo_path_fixed_t           path;
92
    cairo_fill_rule_t            fill_rule;
93
    double                       tolerance;
94
    cairo_antialias_t            antialias;
95
} cairo_command_fill_t;
96
 
97
typedef struct _cairo_command_show_text_glyphs {
98
    cairo_command_header_t       header;
99
    cairo_pattern_union_t        source;
100
    char                        *utf8;
101
    int                          utf8_len;
102
    cairo_glyph_t               *glyphs;
103
    unsigned int                 num_glyphs;
104
    cairo_text_cluster_t        *clusters;
105
    int                          num_clusters;
106
    cairo_text_cluster_flags_t   cluster_flags;
107
    cairo_scaled_font_t         *scaled_font;
108
} cairo_command_show_text_glyphs_t;
109
 
110
typedef union _cairo_command {
111
    cairo_command_header_t      header;
112
 
113
    cairo_command_paint_t                       paint;
114
    cairo_command_mask_t                        mask;
115
    cairo_command_stroke_t                      stroke;
116
    cairo_command_fill_t                        fill;
117
    cairo_command_show_text_glyphs_t            show_text_glyphs;
118
} cairo_command_t;
119
 
120
typedef struct _cairo_meta_surface {
121
    cairo_surface_t base;
122
 
123
    cairo_content_t content;
124
 
125
    /* A meta-surface is logically unbounded, but when used as a
126
     * source we need to render it to an image, so we need a size at
127
     * which to create that image. */
128
    cairo_rectangle_t extents_pixels;
129
    cairo_rectangle_int_t extents;
130
    cairo_bool_t unbounded;
131
 
132
    cairo_clip_t clip;
133
 
134
    cairo_array_t commands;
135
    cairo_surface_t *commands_owner;
136
 
137
    int replay_start_idx;
138
} cairo_meta_surface_t;
139
 
140
slim_hidden_proto (cairo_meta_surface_create);
141
slim_hidden_proto (cairo_meta_surface_replay);
142
 
143
cairo_private cairo_int_status_t
144
_cairo_meta_surface_get_path (cairo_surface_t    *surface,
145
                              cairo_path_fixed_t *path);
146
 
147
 
148
cairo_private cairo_status_t
149
_cairo_meta_surface_replay_analyze_meta_pattern (cairo_surface_t *surface,
150
                                                 cairo_surface_t *target);
151
 
152
cairo_private cairo_status_t
153
_cairo_meta_surface_replay_and_create_regions (cairo_surface_t *surface,
154
                                               cairo_surface_t *target);
155
cairo_private cairo_status_t
156
_cairo_meta_surface_replay_region (cairo_surface_t          *surface,
157
                                   cairo_surface_t          *target,
158
                                   cairo_meta_region_type_t  region);
159
 
160
cairo_private cairo_status_t
161
_cairo_meta_surface_get_bbox (cairo_meta_surface_t *meta,
162
                              cairo_box_t *bbox,
163
                              const cairo_matrix_t *transform);
164
 
165
cairo_private cairo_bool_t
166
_cairo_surface_is_meta (const cairo_surface_t *surface);
167
 
168
#endif /* CAIRO_META_SURFACE_H */