added MouseWheel event support for Silverlight 3.0
[moon.git] / cairo / boilerplate / cairo-boilerplate.h
blob11fb1c3c0c844cd639922287940c10a18ffbae23
1 /*
2 * Copyright © 2004,2006 Red Hat, Inc.
4 * Permission to use, copy, modify, distribute, and sell this software
5 * and its documentation for any purpose is hereby granted without
6 * fee, provided that the above copyright notice appear in all copies
7 * and that both that copyright notice and this permission notice
8 * appear in supporting documentation, and that the name of
9 * Red Hat, Inc. not be used in advertising or publicity pertaining to
10 * distribution of the software without specific, written prior
11 * permission. Red Hat, Inc. makes no representations about the
12 * suitability of this software for any purpose. It is provided "as
13 * is" without express or implied warranty.
15 * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
16 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
18 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
19 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
20 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
21 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 * Author: Carl D. Worth <cworth@cworth.org>
26 #ifndef _CAIRO_BOILERPLATE_H_
27 #define _CAIRO_BOILERPLATE_H_
29 #if HAVE_CONFIG_H
30 #include "config.h"
31 #endif
33 #include <stdio.h>
34 #include <stdlib.h>
35 #include <math.h>
36 #include <cairo.h>
37 #include <string.h>
39 #include "cairo-compiler-private.h"
41 #if HAVE_STDINT_H
42 # include <stdint.h>
43 #elif HAVE_INTTYPES_H
44 # include <inttypes.h>
45 #elif HAVE_SYS_INT_TYPES_H
46 # include <sys/int_types.h>
47 #elif defined(_MSC_VER)
48 typedef __int8 int8_t;
49 typedef unsigned __int8 uint8_t;
50 typedef __int16 int16_t;
51 typedef unsigned __int16 uint16_t;
52 typedef __int32 int32_t;
53 typedef unsigned __int32 uint32_t;
54 typedef __int64 int64_t;
55 typedef unsigned __int64 uint64_t;
56 #else
57 #error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, etc.)
58 #endif
60 #ifndef HAVE_UINT64_T
61 # define HAVE_UINT64_T 1
62 #endif
63 #ifndef INT16_MIN
64 # define INT16_MIN (-32767-1)
65 #endif
66 #ifndef INT16_MAX
67 # define INT16_MAX (32767)
68 #endif
69 #ifndef UINT16_MAX
70 # define UINT16_MAX (65535)
71 #endif
73 #ifndef CAIRO_BOILERPLATE_LOG
74 #define CAIRO_BOILERPLATE_LOG(...) fprintf(stderr, __VA_ARGS__)
75 #endif
77 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
78 #define CAIRO_BOILERPLATE_PRINTF_FORMAT(fmt_index, va_index) \
79 __attribute__((__format__(__printf__, fmt_index, va_index)))
80 #else
81 #define CAIRO_BOILERPLATE_PRINTF_FORMAT(fmt_index, va_index)
82 #endif
84 #ifndef FALSE
85 #define FALSE 0
86 #endif
88 #ifndef TRUE
89 #define TRUE 1
90 #endif
92 #ifndef M_PI
93 #define M_PI 3.14159265358979323846
94 #endif
97 /* A fake format we use for the flattened ARGB output of the PS and
98 * PDF surfaces. */
99 #define CAIRO_TEST_CONTENT_COLOR_ALPHA_FLATTENED ((unsigned int) -1)
101 cairo_content_t
102 cairo_boilerplate_content (cairo_content_t content);
104 const char *
105 cairo_boilerplate_content_name (cairo_content_t content);
107 cairo_format_t
108 cairo_boilerplate_format_from_content (cairo_content_t content);
110 typedef enum {
111 CAIRO_BOILERPLATE_MODE_TEST,
112 CAIRO_BOILERPLATE_MODE_PERF
113 } cairo_boilerplate_mode_t;
115 typedef cairo_surface_t *
116 (*cairo_boilerplate_create_surface_t) (const char *name,
117 cairo_content_t content,
118 int width,
119 int height,
120 int max_width,
121 int max_height,
122 cairo_boilerplate_mode_t mode,
123 int id,
124 void **closure);
126 typedef void
127 (*cairo_boilerplate_force_fallbacks_t) (cairo_surface_t *surface,
128 unsigned int flags);
130 typedef cairo_status_t
131 (*cairo_boilerplate_finish_surface_t) (cairo_surface_t *surface);
133 typedef cairo_surface_t *
134 (*cairo_boilerplate_get_image_surface_t) (cairo_surface_t *surface,
135 int page,
136 int width,
137 int height);
139 typedef cairo_status_t
140 (*cairo_boilerplate_write_to_png_t) (cairo_surface_t *surface,
141 const char *filename);
143 typedef void
144 (*cairo_boilerplate_cleanup_t) (void *closure);
146 typedef void
147 (*cairo_boilerplate_wait_t) (void *closure);
149 typedef struct _cairo_boilerplate_target
151 const char *name;
152 const char *file_extension;
153 cairo_surface_type_t expected_type;
154 cairo_content_t content;
155 unsigned int error_tolerance;
156 cairo_boilerplate_create_surface_t create_surface;
157 cairo_boilerplate_force_fallbacks_t force_fallbacks;
158 cairo_boilerplate_finish_surface_t finish_surface;
159 cairo_boilerplate_get_image_surface_t get_image_surface;
160 cairo_boilerplate_write_to_png_t write_to_png;
161 cairo_boilerplate_cleanup_t cleanup;
162 cairo_boilerplate_wait_t synchronize;
163 cairo_bool_t is_vector;
164 } cairo_boilerplate_target_t;
166 cairo_boilerplate_target_t **
167 cairo_boilerplate_get_targets (int *num_targets, cairo_bool_t *limited_targets);
169 void
170 cairo_boilerplate_free_targets (cairo_boilerplate_target_t **targets);
172 cairo_surface_t *
173 _cairo_boilerplate_get_image_surface (cairo_surface_t *src,
174 int page,
175 int width,
176 int height);
177 cairo_surface_t *
178 cairo_boilerplate_get_image_surface_from_png (const char *filename,
179 int width,
180 int height,
181 cairo_bool_t flatten);
183 cairo_surface_t *
184 cairo_boilerplate_surface_create_in_error (cairo_status_t status);
186 enum {
187 CAIRO_BOILERPLATE_OPEN_NO_DAEMON = 0x1,
190 FILE *
191 cairo_boilerplate_open_any2ppm (const char *filename,
192 int page,
193 unsigned int flags);
194 cairo_surface_t *
195 cairo_boilerplate_image_surface_create_from_ppm_stream (FILE *file);
197 cairo_surface_t *
198 cairo_boilerplate_convert_to_image (const char *filename, int page);
201 cairo_boilerplate_version (void);
203 const char*
204 cairo_boilerplate_version_string (void);
206 #include "cairo-boilerplate-system.h"
208 #endif