Examples updated to the latest Camel Case .. Was a pain converting them
[phpCairo.git] / individual_files / phpCairo.c
blob3b53a40746f937db1c702382cfec678b7679300b
1 /*
2 +----------------------------------------------------------------------+
3 | This source file is subject to version 3.0 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_0.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: $ */
17 #include "php_phpCairo.h"
18 #include "phpCairoExceptionMacro.c"
19 #include "phpCairoException.c"
20 #include "phpCairoFont.c"
21 #include "phpCairoMatrix.c"
22 #include "phpCairoPath.c"
23 #include "phpCairoSurface.c"
24 #include "phpCairoPattern.c"
25 #include "phpCairoContext.c"
26 #if HAVE_PHPCAIRO
28 /* {{{ Class definitions */
29 /* }}} Class definitions*/
31 /* {{{ phpCairo_functions[] */
32 function_entry phpCairo_functions[] = {
33 PHP_FE(cairoVersion , cairo_version_arg_info)
34 PHP_FE(cairoVersionString, cairo_version_string_arg_info)
35 { NULL, NULL, NULL }
37 /* }}} */
40 /* {{{ phpCairo_module_entry
42 zend_module_entry phpCairo_module_entry = {
43 STANDARD_MODULE_HEADER,
44 "phpCairo",
45 phpCairo_functions,
46 PHP_MINIT(phpCairo), /* Replace with NULL if there is nothing to do at php startup */
47 PHP_MSHUTDOWN(phpCairo), /* Replace with NULL if there is nothing to do at php shutdown */
48 PHP_RINIT(phpCairo), /* Replace with NULL if there is nothing to do at request start */
49 PHP_RSHUTDOWN(phpCairo), /* Replace with NULL if there is nothing to do at request end */
50 PHP_MINFO(phpCairo),
51 "0.0.1",
52 STANDARD_MODULE_PROPERTIES
54 /* }}} */
56 #ifdef COMPILE_DL_PHPCAIRO
57 ZEND_GET_MODULE(phpCairo)
58 #endif
61 /* {{{ PHP_MINIT_FUNCTION */
62 PHP_MINIT_FUNCTION(phpCairo)
64 class_init_CairoContext();
65 class_init_CairoFontFace();
66 class_init_CairoFontOptions();
67 class_init_CairoMatrix();
68 class_init_CairoPath();
69 class_init_CairoPattern();
70 class_init_CairoGradient();
71 class_init_CairoLinearGradient();
72 class_init_CairoRadialGradient();
73 class_init_CairoSolidPattern();
74 class_init_CairoSurfacePattern();
75 class_init_CairoScaledFont();
76 class_init_CairoSurface();
77 class_init_CairoImageSurface();
78 class_init_CairoPDFSurface();
79 class_init_CairoPSSurface();
80 class_init_CairoQuartzSurface();
81 class_init_CairoSVGSurface();
82 class_init_CairoWin32Surface();
83 class_init_CairoXlibSurface();
84 class_init_CairoException();
86 /* add your stuff here */
88 /* constants */
89 #if HAS_ATSUI_FONT
90 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 1, CONST_CS | CONST_PERSISTENT);
91 #else
92 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 0, CONST_CS | CONST_PERSISTENT);
93 #endif
94 #if HAS_FT_FONT
95 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 1, CONST_CS | CONST_PERSISTENT);
96 #else
97 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 0, CONST_CS | CONST_PERSISTENT);
98 #endif
99 #if HAS_GLITZ_SURFACE
100 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
101 #else
102 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
103 #endif
104 #if HAS_PDF_SURFACE
105 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
106 #else
107 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
108 #endif
109 #if HAS_PNG_FUNCTIONS
110 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 1, CONST_CS | CONST_PERSISTENT);
111 #else
112 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 0, CONST_CS | CONST_PERSISTENT);
113 #endif
114 #if HAS_PS_SURFACE
115 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
116 #else
117 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
118 #endif
119 #if HAS_SVG_SURFACE
120 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
121 #else
122 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
123 #endif
124 #if HAS_QUARTZ_SURFACE
125 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
126 #else
127 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
128 #endif
129 #if HAS_WIN32_FONT
130 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 1, CONST_CS | CONST_PERSISTENT);
131 #else
132 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 0, CONST_CS | CONST_PERSISTENT);
133 #endif
134 #if HAS_WIN32_SURFACE
135 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
136 #else
137 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
138 #endif
139 #if HAS_XCB_SURFACE
140 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
141 #else
142 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
143 #endif
144 #if HAS_XLIB_SURFACE
145 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 1, CONST_CS | CONST_PERSISTENT);
146 #else
147 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 0, CONST_CS | CONST_PERSISTENT);
148 #endif
150 #define CONSTANT(x) REGISTER_LONG_CONSTANT( #x, CAIRO_##x, CONST_CS | CONST_PERSISTENT)
151 CONSTANT(ANTIALIAS_DEFAULT);
152 CONSTANT(ANTIALIAS_NONE);
153 CONSTANT(ANTIALIAS_GRAY);
154 CONSTANT(ANTIALIAS_SUBPIXEL);
156 CONSTANT(CONTENT_COLOR);
157 CONSTANT(CONTENT_ALPHA);
158 CONSTANT(CONTENT_COLOR_ALPHA);
160 CONSTANT(EXTEND_NONE);
161 CONSTANT(EXTEND_REPEAT);
162 CONSTANT(EXTEND_REFLECT);
163 CONSTANT(EXTEND_PAD);
165 CONSTANT(FILL_RULE_WINDING);
166 CONSTANT(FILL_RULE_EVEN_ODD);
168 CONSTANT(FILTER_FAST);
169 CONSTANT(FILTER_GOOD);
170 CONSTANT(FILTER_BEST);
171 CONSTANT(FILTER_NEAREST);
172 CONSTANT(FILTER_BILINEAR);
173 CONSTANT(FILTER_GAUSSIAN);
175 CONSTANT(FONT_WEIGHT_NORMAL);
176 CONSTANT(FONT_WEIGHT_BOLD);
178 CONSTANT(FONT_SLANT_NORMAL);
179 CONSTANT(FONT_SLANT_ITALIC);
180 CONSTANT(FONT_SLANT_OBLIQUE);
182 CONSTANT(FORMAT_ARGB32);
183 CONSTANT(FORMAT_RGB24);
184 CONSTANT(FORMAT_A8);
185 CONSTANT(FORMAT_A1);
186 CONSTANT(FORMAT_RGB16_565);
188 CONSTANT(HINT_METRICS_DEFAULT);
189 CONSTANT(HINT_METRICS_OFF);
190 CONSTANT(HINT_METRICS_ON);
192 CONSTANT(HINT_STYLE_DEFAULT);
193 CONSTANT(HINT_STYLE_NONE);
194 CONSTANT(HINT_STYLE_SLIGHT);
195 CONSTANT(HINT_STYLE_MEDIUM);
196 CONSTANT(HINT_STYLE_FULL);
198 CONSTANT(LINE_CAP_BUTT);
199 CONSTANT(LINE_CAP_ROUND);
200 CONSTANT(LINE_CAP_SQUARE);
202 CONSTANT(LINE_JOIN_MITER);
203 CONSTANT(LINE_JOIN_ROUND);
204 CONSTANT(LINE_JOIN_BEVEL);
206 CONSTANT(OPERATOR_CLEAR);
208 CONSTANT(OPERATOR_SOURCE);
209 CONSTANT(OPERATOR_OVER);
210 CONSTANT(OPERATOR_IN);
211 CONSTANT(OPERATOR_OUT);
212 CONSTANT(OPERATOR_ATOP);
214 CONSTANT(OPERATOR_DEST);
215 CONSTANT(OPERATOR_DEST_OVER);
216 CONSTANT(OPERATOR_DEST_IN);
217 CONSTANT(OPERATOR_DEST_OUT);
218 CONSTANT(OPERATOR_DEST_ATOP);
220 CONSTANT(OPERATOR_XOR);
221 CONSTANT(OPERATOR_ADD);
222 CONSTANT(OPERATOR_SATURATE);
224 CONSTANT(PATH_MOVE_TO);
225 CONSTANT(PATH_LINE_TO);
226 CONSTANT(PATH_CURVE_TO);
227 CONSTANT(PATH_CLOSE_PATH);
229 CONSTANT(SUBPIXEL_ORDER_DEFAULT);
230 CONSTANT(SUBPIXEL_ORDER_RGB);
231 CONSTANT(SUBPIXEL_ORDER_BGR);
232 CONSTANT(SUBPIXEL_ORDER_VRGB);
233 CONSTANT(SUBPIXEL_ORDER_VBGR);
234 #undef CONSTANT
238 return SUCCESS;
240 /* }}} */
243 /* {{{ PHP_MSHUTDOWN_FUNCTION */
244 PHP_MSHUTDOWN_FUNCTION(phpCairo)
247 /* add your stuff here */
249 return SUCCESS;
251 /* }}} */
254 /* {{{ PHP_RINIT_FUNCTION */
255 PHP_RINIT_FUNCTION(phpCairo)
257 /* add your stuff here */
259 return SUCCESS;
261 /* }}} */
264 /* {{{ PHP_RSHUTDOWN_FUNCTION */
265 PHP_RSHUTDOWN_FUNCTION(phpCairo)
267 /* add your stuff here */
269 return SUCCESS;
271 /* }}} */
274 /* {{{ PHP_MINFO_FUNCTION */
275 PHP_MINFO_FUNCTION(phpCairo)
277 php_info_print_box_start(0);
278 php_printf("<p>PHP bindings for Cairo Graphic Library</p>\n");
279 php_printf("<p>Version 0.0.1devel (2008-05-22)</p>\n");
280 php_printf("<p><b>Authors:</b></p>\n");
281 php_printf("<p>Akshat Gupta &lt;g.akshat@gmail.com&gt; (lead)</p>\n");
282 php_info_print_box_end();
283 /* add your stuff here */
286 /* }}} */
289 /* {{{ proto int cairoVersion()
291 PHP_FUNCTION(cairoVersion)
296 if (ZEND_NUM_ARGS()>0) {
297 WRONG_PARAM_COUNT;
301 RETURN_LONG(cairo_version());
303 /* }}} cairo_version */
306 /* {{{ proto string cairVersionString()
308 PHP_FUNCTION(cairoVersionString)
311 char *a;
313 if (ZEND_NUM_ARGS()>0) {
314 WRONG_PARAM_COUNT;
317 RETURN_STRING(cairo_version_string(), 1);
319 /* }}} cairo_version_string */
321 #endif /* HAVE_PHPCAIRO */
325 * Local variables:
326 * tab-width: 4
327 * c-basic-offset: 4
328 * End:
329 * vim600: noet sw=4 ts=4 fdm=marker
330 * vim<600: noet sw=4 ts=4