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 +----------------------------------------------------------------------+
17 #include "php_cairo_api.h"
18 #include "php_cairo.h"
19 #include "CairoExceptionMacro.h"
20 #include "php_cairo_ce_ptr.h"
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
)
36 /* {{{ cairo_module_entry
38 zend_module_entry cairo_module_entry
= {
39 STANDARD_MODULE_HEADER
,
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 */
48 STANDARD_MODULE_PROPERTIES
52 #ifdef COMPILE_DL_CAIRO
53 ZEND_GET_MODULE(cairo
)
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 */
86 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 1, CONST_CS
| CONST_PERSISTENT
);
88 REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 0, CONST_CS
| CONST_PERSISTENT
);
91 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 1, CONST_CS
| CONST_PERSISTENT
);
93 REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 0, CONST_CS
| CONST_PERSISTENT
);
96 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
98 REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
101 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
103 REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
105 #if HAS_PNG_FUNCTIONS
106 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 1, CONST_CS
| CONST_PERSISTENT
);
108 REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 0, CONST_CS
| CONST_PERSISTENT
);
111 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
113 REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
116 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
118 REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
120 #if HAS_QUARTZ_SURFACE
121 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
123 REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
126 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 1, CONST_CS
| CONST_PERSISTENT
);
128 REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 0, CONST_CS
| CONST_PERSISTENT
);
130 #if HAS_WIN32_SURFACE
131 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
133 REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
136 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
138 REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
141 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 1, CONST_CS
| CONST_PERSISTENT
);
143 REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 0, CONST_CS
| CONST_PERSISTENT
);
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
);
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
);
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 <g.akshat@gmail.com> (lead)</p>\n");
247 php_info_print_box_end();
248 /* add your stuff here */
254 /* {{{ proto int cairo_version()
256 PHP_FUNCTION(cairo_version
)
258 if (ZEND_NUM_ARGS()>0) {
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) {
277 RETURN_STRING(cairo_version_string(), 1);
279 /* }}} cairo_version_string */
281 #endif /* HAVE_CAIRO */
289 * vim600: noet sw = 4 ts = 4 fdm = marker
290 * vim<600: noet sw = 4 ts = 4