Changed the entire file structure to remove the .c includes from cairo.c
[phpCairo.git] / src / cairo / cairo.c
blob700c3bc0d83f4a61a389c9c6ab0f83a895a41cda
1 /*
2 +----------------------------------------------------------------------+
3 | This source file is subject to version 3.01 of the PHP license, |
4 | that is bundled with this package in the file LICENSE, and is |
5 | available through the world-wide-web at the following url: |
6 | http://www.php.net/license/3_01.txt. |
7 | If you did not receive a copy of the PHP license and are unable to |
8 | obtain it through the world-wide-web, please send a note to |
9 | license@php.net so we can mail you a copy immediately. |
10 +----------------------------------------------------------------------+
11 | Authors: Akshat Gupta <g.akshat@gmail.com> |
12 +----------------------------------------------------------------------+
15 /* $ Id: 1.0.1$ */
17 #include "php_cairo_api.h"
18 #include "php_cairo.h"
19 #include "CairoExceptionMacro.h"
20 #include "php_cairo_ce_ptr.h"
22 #if HAVE_CAIRO
24 /* {{{ Class definitions */
25 /* }}} Class definitions*/
27 /* {{{ cairo_functions[] */
28 function_entry cairo_functions[] = {
29 PHP_FE(cairo_version , cairo_version_arg_info)
30 PHP_FE(cairo_version_string, cairo_version_string_arg_info)
31 { NULL, NULL, NULL }
33 /* }}} */
36 /* {{{ cairo_module_entry
38 zend_module_entry cairo_module_entry = {
39 STANDARD_MODULE_HEADER,
40 "cairo",
41 cairo_functions,
42 PHP_MINIT(cairo), /* Replace with NULL if there is nothing to do at php startup */
43 NULL, /* Replace with NULL if there is nothing to do at php shutdown */
44 NULL, /* Replace with NULL if there is nothing to do at request start */
45 NULL, /* Replace with NULL if there is nothing to do at request end */
46 PHP_MINFO(cairo),
47 PHP_CAIRO_VERSION,
48 STANDARD_MODULE_PROPERTIES
50 /* }}} */
52 #ifdef COMPILE_DL_CAIRO
53 ZEND_GET_MODULE(cairo)
54 #endif
57 /* {{{ PHP_MINIT_FUNCTION */
58 PHP_MINIT_FUNCTION(cairo)
60 class_init_CairoContext();
61 class_init_CairoFontFace();
62 class_init_CairoFontOptions();
63 class_init_CairoMatrix();
64 class_init_CairoPath();
65 class_init_CairoPattern();
66 class_init_CairoGradient();
67 class_init_CairoLinearGradient();
68 class_init_CairoRadialGradient();
69 class_init_CairoSolidPattern();
70 class_init_CairoSurfacePattern();
71 class_init_CairoScaledFont();
72 class_init_CairoSurface();
73 class_init_CairoImageSurface();
74 class_init_CairoPDFSurface();
75 class_init_CairoPSSurface();
76 class_init_CairoQuartzSurface();
77 class_init_CairoSVGSurface();
78 class_init_CairoWin32Surface();
79 class_init_CairoXlibSurface();
80 class_init_CairoException();
82 /* add your stuff here */
84 /* constants */
85 #if HAS_ATSUI_FONT
86 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 1, CONST_CS | CONST_PERSISTENT);
87 #else
88 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 0, CONST_CS | CONST_PERSISTENT);
89 #endif
90 #if HAS_FT_FONT
91 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 1, CONST_CS | CONST_PERSISTENT);
92 #else
93 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 0, CONST_CS | CONST_PERSISTENT);
94 #endif
95 #if HAS_GLITZ_SURFACE
96 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
97 #else
98 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
99 #endif
100 #if HAS_PDF_SURFACE
101 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
102 #else
103 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
104 #endif
105 #if HAS_PNG_FUNCTIONS
106 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 1, CONST_CS | CONST_PERSISTENT);
107 #else
108 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 0, CONST_CS | CONST_PERSISTENT);
109 #endif
110 #if HAS_PS_SURFACE
111 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
112 #else
113 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
114 #endif
115 #if HAS_SVG_SURFACE
116 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
117 #else
118 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
119 #endif
120 #if HAS_QUARTZ_SURFACE
121 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
122 #else
123 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
124 #endif
125 #if HAS_WIN32_FONT
126 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 1, CONST_CS | CONST_PERSISTENT);
127 #else
128 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 0, CONST_CS | CONST_PERSISTENT);
129 #endif
130 #if HAS_WIN32_SURFACE
131 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
132 #else
133 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
134 #endif
135 #if HAS_XCB_SURFACE
136 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
137 #else
138 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
139 #endif
140 #if HAS_XLIB_SURFACE
141 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
142 #else
143 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
144 #endif
146 #define CONSTANT(x) REGISTER_LONG_CONSTANT( #x, CAIRO_##x, CONST_CS | CONST_PERSISTENT)
147 CONSTANT(ANTIALIAS_DEFAULT);
148 CONSTANT(ANTIALIAS_NONE);
149 CONSTANT(ANTIALIAS_GRAY);
150 CONSTANT(ANTIALIAS_SUBPIXEL);
152 CONSTANT(CONTENT_COLOR);
153 CONSTANT(CONTENT_ALPHA);
154 CONSTANT(CONTENT_COLOR_ALPHA);
156 CONSTANT(EXTEND_NONE);
157 CONSTANT(EXTEND_REPEAT);
158 CONSTANT(EXTEND_REFLECT);
159 CONSTANT(EXTEND_PAD);
161 CONSTANT(FILL_RULE_WINDING);
162 CONSTANT(FILL_RULE_EVEN_ODD);
164 CONSTANT(FILTER_FAST);
165 CONSTANT(FILTER_GOOD);
166 CONSTANT(FILTER_BEST);
167 CONSTANT(FILTER_NEAREST);
168 CONSTANT(FILTER_BILINEAR);
169 CONSTANT(FILTER_GAUSSIAN);
171 CONSTANT(FONT_WEIGHT_NORMAL);
172 CONSTANT(FONT_WEIGHT_BOLD);
174 CONSTANT(FONT_SLANT_NORMAL);
175 CONSTANT(FONT_SLANT_ITALIC);
176 CONSTANT(FONT_SLANT_OBLIQUE);
178 CONSTANT(FORMAT_ARGB32);
179 CONSTANT(FORMAT_RGB24);
180 CONSTANT(FORMAT_A8);
181 CONSTANT(FORMAT_A1);
182 CONSTANT(FORMAT_RGB16_565);
184 CONSTANT(HINT_METRICS_DEFAULT);
185 CONSTANT(HINT_METRICS_OFF);
186 CONSTANT(HINT_METRICS_ON);
188 CONSTANT(HINT_STYLE_DEFAULT);
189 CONSTANT(HINT_STYLE_NONE);
190 CONSTANT(HINT_STYLE_SLIGHT);
191 CONSTANT(HINT_STYLE_MEDIUM);
192 CONSTANT(HINT_STYLE_FULL);
194 CONSTANT(LINE_CAP_BUTT);
195 CONSTANT(LINE_CAP_ROUND);
196 CONSTANT(LINE_CAP_SQUARE);
198 CONSTANT(LINE_JOIN_MITER);
199 CONSTANT(LINE_JOIN_ROUND);
200 CONSTANT(LINE_JOIN_BEVEL);
202 CONSTANT(OPERATOR_CLEAR);
204 CONSTANT(OPERATOR_SOURCE);
205 CONSTANT(OPERATOR_OVER);
206 CONSTANT(OPERATOR_IN);
207 CONSTANT(OPERATOR_OUT);
208 CONSTANT(OPERATOR_ATOP);
210 CONSTANT(OPERATOR_DEST);
211 CONSTANT(OPERATOR_DEST_OVER);
212 CONSTANT(OPERATOR_DEST_IN);
213 CONSTANT(OPERATOR_DEST_OUT);
214 CONSTANT(OPERATOR_DEST_ATOP);
216 CONSTANT(OPERATOR_XOR);
217 CONSTANT(OPERATOR_ADD);
218 CONSTANT(OPERATOR_SATURATE);
220 CONSTANT(PATH_MOVE_TO);
221 CONSTANT(PATH_LINE_TO);
222 CONSTANT(PATH_CURVE_TO);
223 CONSTANT(PATH_CLOSE_PATH);
225 CONSTANT(SUBPIXEL_ORDER_DEFAULT);
226 CONSTANT(SUBPIXEL_ORDER_RGB);
227 CONSTANT(SUBPIXEL_ORDER_BGR);
228 CONSTANT(SUBPIXEL_ORDER_VRGB);
229 CONSTANT(SUBPIXEL_ORDER_VBGR);
230 #undef CONSTANT
234 return SUCCESS;
236 /* }}} */
239 /* {{{ PHP_MINFO_FUNCTION */
240 PHP_MINFO_FUNCTION(cairo)
242 php_info_print_box_start(0);
243 php_printf("<p>PHP bindings for Cairo Graphic Library</p>\n");
244 php_printf(PHP_CAIRO_VERSION);
245 php_printf("<p><b>Authors:</b></p>\n");
246 php_printf("<p>Akshat Gupta &lt;g.akshat@gmail.com&gt; (lead)</p>\n");
247 php_info_print_box_end();
248 /* add your stuff here */
251 /* }}} */
254 /* {{{ proto int cairo_version()
256 PHP_FUNCTION(cairo_version)
258 if (ZEND_NUM_ARGS()>0) {
259 WRONG_PARAM_COUNT;
263 RETURN_LONG(cairo_version());
265 /* }}} cairo_version */
268 /* {{{ proto string cairo_version_string()
270 PHP_FUNCTION(cairo_version_string)
273 if (ZEND_NUM_ARGS()>0) {
274 WRONG_PARAM_COUNT;
277 RETURN_STRING(cairo_version_string(), 1);
279 /* }}} cairo_version_string */
281 #endif /* HAVE_CAIRO */
285 * Local variables:
286 * tab-width: 4
287 * c-basic-offset: 4
288 * End:
289 * vim600: noet sw = 4 ts = 4 fdm = marker
290 * vim<600: noet sw = 4 ts = 4