diff --git a/configure.in b/configure.in index 1335e4c..5a5e922 100644 --- a/configure.in +++ b/configure.in @@ -709,6 +709,15 @@ fi dnl =========================================================================== +CAIRO_BACKEND_ENABLE(combined, Combined, no, []) +AM_CONDITIONAL(CAIRO_HAS_COMBINED_SURFACE, test "x$use_combined" = "xyes") +if test "x$use_combined" = "xyes"; then + COMBINED_SURFACE_FEATURE="#define CAIRO_HAS_COMBINED_SURFACE 1" +fi +AC_SUBST(COMBINED_SURFACE_FEATURE) + +dnl =========================================================================== + AC_ARG_ENABLE(test-surfaces, AS_HELP_STRING([--enable-test-surfaces], [Add backends for more test suite coverage (no additional public functionality)]), @@ -749,6 +758,7 @@ echo " SVG: $use_svg" echo " glitz: $use_glitz" echo " BeOS: $use_beos" echo " DirectFB: $use_directfb" +echo " Combined: $use_combined" echo "" echo "the following font backends:" echo " FreeType: $use_freetype" diff --git a/src/Makefile.am b/src/Makefile.am index 42ae71f..996fdb4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -100,6 +100,12 @@ cairo_win32_api_headers += \ $(srcdir)/cairo-ps.h endif +if CAIRO_HAS_COMBINED_SURFACE +libcairo_combined_headers = cairo-combined.h +libcairo_combined_sources = cairo-combined-surface.c +endif + + # These names match automake style variable definition conventions so # without these lines, automake will complain during the handling of # the libcairo_la_LIBADD below. (The INCLUDES is an autoconf only @@ -122,7 +128,8 @@ cairoinclude_HEADERS = \ $(libcairo_beos_headers) \ $(libcairo_xcb_headers) \ $(libcairo_xlib_headers) \ - $(libcairo_directfb_headers) + $(libcairo_directfb_headers) \ + $(libcairo_combined_headers) lib_LTLIBRARIES = libcairo.la @@ -195,6 +202,7 @@ libcairo_la_SOURCES = \ $(libcairo_glitz_sources) \ $(libcairo_win32_sources) \ $(libcairo_directfb_sources) \ + $(libcairo_combined_sources) \ cairoint.h libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined $(export_symbols) diff --git a/src/cairo-combined-surface.c b/src/cairo-combined-surface.c new file mode 100644 index 0000000..e11ad76 --- /dev/null +++ b/src/cairo-combined-surface.c @@ -0,0 +1,680 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2006 Kouhei Sutou + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + */ + +#include "cairoint.h" +#include "cairo-combined.h" + +typedef struct _cairo_combined_surface +{ + cairo_surface_t base; + + cairo_array_t surfaces; +} cairo_combined_surface_t; + +static const cairo_surface_backend_t cairo_combined_surface_backend; + + +static cairo_surface_t * +_cairo_combined_surface_create_array (cairo_array_t *surfaces) +{ + int i, n; + cairo_combined_surface_t *surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_content_t content = CAIRO_CONTENT_COLOR; + + n = _cairo_array_num_elements (surfaces); + child_surfaces = _cairo_array_index (surfaces, 0); + for (i = 0; i < n; i++) { + child_surface = child_surfaces[i]; + if (child_surface->status) { + _cairo_error (child_surface->status); + return (cairo_surface_t*) &_cairo_surface_nil; + } + content |= cairo_surface_get_content (child_surface); + } + + surface = malloc (sizeof (cairo_combined_surface_t)); + if (surface == NULL) { + _cairo_error (CAIRO_STATUS_NO_MEMORY); + return (cairo_surface_t*) &_cairo_surface_nil; + } + + _cairo_surface_init (&surface->base, &cairo_combined_surface_backend, + content); + + _cairo_array_init (&surface->surfaces, sizeof (cairo_surface_t *)); + + child_surfaces = _cairo_array_index (surfaces, 0); + for (i = 0; i < n; i++) { + child_surface = child_surfaces[i]; + cairo_surface_reference (child_surface); + _cairo_array_append (&surface->surfaces, &child_surface); + } + + return &surface->base; +} + +/** + * cairo_combined_surface_create: + * @child_surface1: a surface to combined + * @...: other surfaces to combined. NULL terminate. + * + * Creates a combined surface with the specified surfaces. + * + * Return value: a pointer to the newly created surface. The caller + * owns the surface and should call cairo_surface_destroy when done + * with it. + * + * This function always returns a valid pointer, but it will return a + * pointer to a "nil" surface if an error such as out of memory + * occurs. You can use cairo_surface_status() to check for this. + **/ +cairo_surface_t * +cairo_combined_surface_create (cairo_surface_t *child_surface1, ...) +{ + va_list ap; + cairo_array_t surfaces; + cairo_surface_t *surface; + cairo_surface_t *child_surface_n; + + _cairo_array_init (&surfaces, sizeof (cairo_surface_t *)); + + va_start (ap, child_surface1); + for (child_surface_n = child_surface1; + child_surface_n; + child_surface_n = (cairo_surface_t *) va_arg (ap, cairo_surface_t *)) { + _cairo_array_append (&surfaces, &child_surface_n); + } + va_end (ap); + + surface = _cairo_combined_surface_create_array (&surfaces); + _cairo_array_fini (&surfaces); + return surface; +} + +/** + * cairo_combined_surface_create2: + * @n_surface: number of surfaces. + * @child_surfaces: surfaces to combined. + * + * Creates a combined surface with the specified surfaces. + * + * Return value: a pointer to the newly created surface. The caller + * owns the surface and should call cairo_surface_destroy when done + * with it. + * + * This function always returns a valid pointer, but it will return a + * pointer to a "nil" surface if an error such as out of memory + * occurs. You can use cairo_surface_status() to check for this. + **/ +cairo_surface_t * +cairo_combined_surface_create2 (int n_surfaces, + cairo_surface_t **child_surfaces) +{ + cairo_array_t surfaces; + cairo_surface_t *surface; + + if (n_surfaces < 1) + return (cairo_surface_t *) &_cairo_surface_nil; + + _cairo_array_init (&surfaces, sizeof (cairo_surface_t *)); + _cairo_array_append_multiple (&surfaces, child_surfaces, n_surfaces); + surface = _cairo_combined_surface_create_array (&surfaces); + _cairo_array_fini (&surfaces); + return surface; +} + + + +static cairo_surface_t * +_cairo_combined_surface_create_similar (void *abstract_surface, + cairo_content_t content, + int width, + int height) +{ + cairo_combined_surface_t *other_surface = abstract_surface; + + if (((cairo_surface_t *)other_surface)->status) + return (cairo_surface_t *) &_cairo_surface_nil; + + if (! CAIRO_CONTENT_VALID (content)) { + _cairo_error (CAIRO_STATUS_INVALID_CONTENT); + return (cairo_surface_t *) &_cairo_surface_nil; + } + + return _cairo_combined_surface_create_array (&other_surface->surfaces); +} + +static cairo_status_t +_cairo_combined_surface_finish (void *abstract_surface) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; i < n; i++) { + child_surface = child_surfaces[i]; + cairo_surface_finish (child_surface); + } + _cairo_array_fini (&surface->surfaces); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_cairo_combined_surface_clone_similar (void *abstract_surface, + cairo_surface_t *src, + cairo_surface_t **clone_out) +{ + cairo_combined_surface_t *surface = abstract_surface; + + if (src->backend == surface->base.backend) { + *clone_out = cairo_surface_reference (src); + + return CAIRO_STATUS_SUCCESS; + } + + return CAIRO_INT_STATUS_UNSUPPORTED; +} + +static cairo_int_status_t +_cairo_combined_surface_composite (cairo_operator_t op, + cairo_pattern_t *src_pattern, + cairo_pattern_t *mask_pattern, + void *abstract_dst, + int src_x, + int src_y, + int mask_x, + int mask_y, + int fdst_x, + int dst_y, + unsigned int width, + unsigned int height) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_dst; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_composite (op, src_pattern, mask_pattern, + child_surface, src_x, src_y, + mask_x, mask_y, fdst_x, dst_y, + width, height); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_fill_rectangles (void *abstract_surface, + cairo_operator_t op, + const cairo_color_t *color, + cairo_rectangle_fixed_t *rects, + int num_rects) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_fill_rectangles (child_surface, op, color, + rects, num_rects); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_composite_trapezoids (cairo_operator_t op, + cairo_pattern_t *pattern, + void *abstract_dst, + cairo_antialias_t antialias, + int src_x, + int src_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height, + cairo_trapezoid_t *traps, + int num_traps) +{ + int i, n; + cairo_combined_surface_t *dst = abstract_dst; + cairo_surface_t *child_dst; + cairo_surface_t **child_dsts; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&dst->surfaces); + child_dsts = _cairo_array_index (&dst->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_dst = child_dsts[i]; + status = _cairo_surface_composite_trapezoids (op, pattern, + child_dst, antialias, + src_x, src_y, + dst_x, dst_y, + width, height, + traps, num_traps); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_copy_page (void *abstract_surface) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_copy_page (child_surface); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_show_page (void *abstract_surface) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_show_page (child_surface); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_set_clip_region (void *abstract_surface, + pixman_region16_t *region) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + unsigned int serial; + + serial = _cairo_surface_get_current_clip_serial(&surface->base); + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_set_clip_region (child_surface, region, serial); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_intersect_clip_path (void *abstract_surface, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance, + cairo_antialias_t antialias) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_intersect_clip_path (child_surface, path, + fill_rule, tolerance, + antialias); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_get_extents (void *abstract_surface, + cairo_rectangle_fixed_t *rectangle) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + if (n < 1) + return CAIRO_INT_STATUS_UNSUPPORTED; + + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + status = _cairo_surface_get_extents (child_surfaces[0], rectangle); + + for (i = 1; !status && i < n; i++) { + cairo_rectangle_fixed_t tmp_rectangle; + child_surface = child_surfaces[i]; + status = _cairo_surface_get_extents (child_surface, &tmp_rectangle); + if (tmp_rectangle.x != rectangle->x || + tmp_rectangle.y != rectangle->y || + tmp_rectangle.width != rectangle->width || + tmp_rectangle.height != rectangle->height) + status = CAIRO_INT_STATUS_UNSUPPORTED; + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_old_show_glyphs (cairo_scaled_font_t *font, + cairo_operator_t op, + cairo_pattern_t *pattern, + void *abstract_surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_old_show_glyphs (font, op, pattern, + child_surface, + source_x, source_y, + dest_x, dest_y, + width, height, + glyphs, num_glyphs); + } + + return status; +} + +static void +_cairo_combined_surface_get_font_options (void *abstract_surface, + cairo_font_options_t *options) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_bool_t got = FALSE; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; i < n; i++) { + child_surface = child_surfaces[i]; + if (!child_surface->finished && + child_surface->backend->get_font_options) { + child_surface->backend->get_font_options (child_surface, options); + got = TRUE; + break; + } + } + + if (!got) + _cairo_font_options_init_default (options); +} + +static cairo_status_t +_cairo_combined_surface_flush (void *abstract_surface) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + cairo_surface_flush (child_surface); + status = cairo_surface_status (child_surface); + } + + return status; +} + +static cairo_status_t +_cairo_combined_surface_mark_dirty_rectangle (void *abstract_surface, + int x, + int y, + int width, + int height) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + cairo_surface_mark_dirty_rectangle (child_surface, x, y, width, height); + status = cairo_surface_status (child_surface); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_paint (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_paint (child_surface, op, source); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_mask (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + cairo_pattern_t *mask) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_mask (child_surface, op, source, mask); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_stroke (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + cairo_path_fixed_t *path, + cairo_stroke_style_t *style, + cairo_matrix_t *ctm, + cairo_matrix_t *ctm_inverse, + double tolerance, + cairo_antialias_t antialias) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_stroke (child_surface, op, source, path, style, + ctm, ctm_inverse, tolerance, antialias); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_fill (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance, + cairo_antialias_t antialias) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_fill (child_surface, op, source, path, + fill_rule, tolerance, antialias); + } + + return status; +} + +static cairo_int_status_t +_cairo_combined_surface_show_glyphs (void *abstract_surface, + cairo_operator_t op, + cairo_pattern_t *source, + const cairo_glyph_t *glyphs, + int num_glyphs, + cairo_scaled_font_t *scaled_font) +{ + int i, n; + cairo_combined_surface_t *surface = abstract_surface; + cairo_surface_t *child_surface; + cairo_surface_t **child_surfaces; + cairo_int_status_t status = CAIRO_STATUS_SUCCESS; + + n = _cairo_array_num_elements (&surface->surfaces); + child_surfaces = _cairo_array_index (&surface->surfaces, 0); + for (i = 0; !status && i < n; i++) { + child_surface = child_surfaces[i]; + status = _cairo_surface_show_glyphs (child_surface, op, source, + glyphs, num_glyphs, scaled_font); + } + + return status; +} + +static const cairo_surface_backend_t cairo_combined_surface_backend = { + CAIRO_SURFACE_TYPE_COMBINED, + _cairo_combined_surface_create_similar, + _cairo_combined_surface_finish, + NULL, /* acquire_source_image */ + NULL, /* release_source_image */ + NULL, /* acquire_dest_image */ + NULL, /* release_dest_image */ + _cairo_combined_surface_clone_similar, + _cairo_combined_surface_composite, + _cairo_combined_surface_fill_rectangles, + _cairo_combined_surface_composite_trapezoids, + _cairo_combined_surface_copy_page, + _cairo_combined_surface_show_page, + _cairo_combined_surface_set_clip_region, + _cairo_combined_surface_intersect_clip_path, + _cairo_combined_surface_get_extents, + _cairo_combined_surface_old_show_glyphs, + _cairo_combined_surface_get_font_options, + _cairo_combined_surface_flush, + _cairo_combined_surface_mark_dirty_rectangle, + NULL, /* scaled_font_fini */ + NULL, /* scaled_glyph_fini */ + _cairo_combined_surface_paint, + _cairo_combined_surface_mask, + _cairo_combined_surface_stroke, + _cairo_combined_surface_fill, + _cairo_combined_surface_show_glyphs, + NULL, /* snapshot */ +}; diff --git a/src/cairo-combined.h b/src/cairo-combined.h new file mode 100644 index 0000000..6766927 --- /dev/null +++ b/src/cairo-combined.h @@ -0,0 +1,57 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2006 Kouhei Sutou + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is University of Southern + * California. + * + * Contributor(s): + */ + +#ifndef CAIRO_COMBINED_H +#define CAIRO_COMBINED_H + +#include + +#if CAIRO_HAS_COMBINED_SURFACE + +CAIRO_BEGIN_DECLS + +cairo_public cairo_surface_t * +cairo_combined_surface_create (cairo_surface_t *surface, ...); + +cairo_public cairo_surface_t * +cairo_combined_surface_create2 (int n_surface, cairo_surface_t **child_surfaces); + +CAIRO_END_DECLS + +#else /* CAIRO_HAS_COMBINED_SURFACE */ +# error Cairo was not compiled with support for the combined backend +#endif /* CAIRO_HAS_COMBINED_SURFACE */ + +#endif /* CAIRO_COMBINED_H */ diff --git a/src/cairo-features.h.in b/src/cairo-features.h.in index 4b845bf..9d640b5 100644 --- a/src/cairo-features.h.in +++ b/src/cairo-features.h.in @@ -75,6 +75,8 @@ @DIRECTFB_SURFACE_FEATURE@ +@COMBINED_SURFACE_FEATURE@ + @FT_FONT_FEATURE@ @WIN32_FONT_FEATURE@ diff --git a/src/cairo.h b/src/cairo.h index 980ecc0..abd1c23 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -1260,7 +1260,8 @@ typedef enum _cairo_surface_type { CAIRO_SURFACE_TYPE_WIN32, CAIRO_SURFACE_TYPE_BEOS, CAIRO_SURFACE_TYPE_DIRECTFB, - CAIRO_SURFACE_TYPE_SVG + CAIRO_SURFACE_TYPE_SVG, + CAIRO_SURFACE_TYPE_COMBINED } cairo_surface_type_t; cairo_public cairo_surface_type_t