build: depends on cairo-gobject if introspection is enabled
[adg.git] / src / adg / adg-cairo-fallback.c
blobeb20a6f5b49a745f6509195cbfd8080b66257317
1 /* ADG - Automatic Drawing Generation
2 * Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Nicola Fontana <ntd at entidi.it>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
21 /**
22 * SECTION:adg-cairo-fallback
23 * @title: Cairo wrappers
24 * @short_description: GObject wrappers for cairo structs.
26 * If GObject support has not been compiled in cairo, either by
27 * explicitely disabling it or because the installed cairo version
28 * does not provide them, a compatible selection of wrappers used
29 * by ADG is provided anyway.
31 * Since: 1.0
32 **/
35 #include "adg-internal.h"
36 #include <string.h>
37 #include <math.h>
39 #include "adg-cairo-fallback.h"
42 #ifdef ADG_MISSING_GBOXED_MATRIX
44 GType
45 cairo_gobject_matrix_get_type(void)
47 static GType matrix_type = 0;
49 if (G_UNLIKELY(matrix_type == 0))
50 matrix_type = g_boxed_type_register_static("CairoMatrix",
51 (GBoxedCopyFunc) cairo_gobject_cairo_matrix_copy,
52 g_free);
54 return matrix_type;
57 cairo_matrix_t *
58 cairo_gobject_cairo_matrix_copy(const cairo_matrix_t *matrix)
60 return g_memdup(matrix, sizeof(cairo_matrix_t));
63 #endif /* ADG_MISSING_GBOXED_MATRIX */
66 #ifdef ADG_MISSING_GBOXED_PATTERN
68 GType
69 cairo_gobject_pattern_get_type(void)
71 static GType pattern_type = 0;
73 if (G_UNLIKELY(pattern_type == 0))
74 pattern_type = g_boxed_type_register_static("CairoPattern",
75 (GBoxedCopyFunc) cairo_pattern_reference,
76 (GBoxedFreeFunc) cairo_pattern_destroy);
78 return pattern_type;
81 #endif /* ADG_MISSING_GBOXED_PATTERN */