config.m4 ....
[phpCairo.git] / individual_files / phpCairoSurface.c
blob65c6588fa182f4b9da934578be22d0e74f04d668
1 /* {{{ Class CairoSurface */
3 static zend_class_entry * CairoSurface_ce_ptr = NULL;
4 static zend_object_handlers CairoSurface_handlers;
6 typedef struct _surface_object {
7 zend_object std;
8 cairo_surface_t *surface;
9 } surface_object;
12 /* {{{ Methods */
15 /* {{{ proto void construct() -- Add error
17 PHP_METHOD(CairoSurface, __construct)
19 zend_class_entry * _this_ce;
20 zval * _this_zval;
24 if (ZEND_NUM_ARGS()>0) {
25 WRONG_PARAM_COUNT;
28 php_print("No direct call for this constructor");
32 /* }}} __construct */
36 /* {{{ proto object create_similar(int content, int width, int height)
38 PHP_METHOD(CairoSurface, create_similar)
40 zend_class_entry * _this_ce;
42 zval * _this_zval = NULL;
43 cairo_surface_t *sur;
44 long width = 0;
45 long height = 0;
46 cairo_surface_t sur;
48 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oill", &_this_zval, CairoSurface_ce_ptr, &content, &width, &height) == FAILURE) {
49 return;
52 _this_ce = Z_OBJCE_P(_this_zval);
53 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
54 sur = cairo_surface_create_similar(curr->surface, content, width, height);
55 object_init(return_value)
56 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
57 sobj->surface=sur;
60 /* }}} create_similar */
63 /* {{{ proto void finish()
65 PHP_METHOD(CairoSurface, finish)
67 zend_class_entry * _this_ce;
69 zval * _this_zval = NULL;
71 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
72 return;
75 _this_ce = Z_OBJCE_P(_this_zval);
76 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
77 cairo_surface_finish(curr->surface);
79 /* }}} finish */
83 /* {{{ proto void flush()
85 PHP_METHOD(CairoSurface, flush)
87 zend_class_entry * _this_ce;
89 zval * _this_zval = NULL;
91 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
92 return;
95 _this_ce = Z_OBJCE_P(_this_zval);
96 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
98 cairo_surface_flush(curr->surface);
101 /* }}} flush */
105 /* {{{ proto int get_content()
107 PHP_METHOD(CairoSurface, get_content)
109 zend_class_entry * _this_ce;
111 zval * _this_zval = NULL;
112 long x;
113 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
114 return;
117 _this_ce = Z_OBJCE_P(_this_zval);
118 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
120 x=cairo_surface_get_content(curr->surface);
121 RETURN_LONG(x);
123 /* }}} get_content */
127 /* {{{ proto array get_device_offset()
129 PHP_METHOD(CairoSurface, get_device_offset)
131 zend_class_entry * _this_ce;
133 zval * _this_zval = NULL;
134 double x_offset, y_offset;
136 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
137 return;
140 _this_ce = Z_OBJCE_P(_this_zval);
141 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
143 cairo_surface_get_device_offset(curr->surface, &x_offset, &y_offset);
145 array_init(return_value);
146 add_assoc_zval(return_value, "x_offset", x_offset);
147 ass_assoc_zval(return_value, "y_offset", y_offset);
150 /* }}} get_device_offset */
154 /* {{{ proto object get_font_options()
156 PHP_METHOD(CairoSurface, get_font_options)
158 zend_class_entry * _this_ce;
160 zval * _this_zval = NULL;
162 cairo_font_options_t *options = cairo_font_options_create();
165 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
166 return;
169 _this_ce = Z_OBJCE_P(_this_zval);
170 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
172 cairo_surface_get_font_options(curr->surface, options);
173 object_init(return_value)
174 fontoptions_object *fobj = (fontoptions_object *)zend_objects_get_address(return_value TSRMLS_CC);
175 fobj->options=options;
178 /* }}} get_font_options */
182 /* {{{ proto void mark_dirty_rectangle([int x, int y, int width, int height])
184 PHP_METHOD(CairoSurface, mark_dirty_rectangle)
186 zend_class_entry * _this_ce;
188 zval * _this_zval = NULL;
189 long x = 0;
190 long y = 0;
191 long width = -1;
192 long height = -1;
196 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|llll", &_this_zval, CairoSurface_ce_ptr, &x, &y, &width, &height) == FAILURE) {
197 return;
199 _this_ce = Z_OBJCE_P(_this_zval);
200 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
201 cairo_surface_mark_dirty_rectangle(curr->surface, x, y, width, height);
204 /* }}} mark_dirty_rectangle */
208 /* {{{ proto void set_device_offset(float x_offset, float y_offset)
210 PHP_METHOD(CairoSurface, set_device_offset)
212 zend_class_entry * _this_ce;
214 zval * _this_zval = NULL;
215 double x_offset = 0.0;
216 double y_offset = 0.0;
218 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoSurface_ce_ptr, &x_offset, &y_offset) == FAILURE) {
219 return;
222 _this_ce = Z_OBJCE_P(_this_zval);
223 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
224 cairo_surface_set_device_offset(curr->surface, x_offset, y_offset);
227 /* }}} set_device_offset */
231 /* {{{ proto void set_fallback_resolution(float x_ppi, float y_ppi)
233 PHP_METHOD(CairoSurface, set_fallback_resolution)
235 zend_class_entry * _this_ce;
237 zval * _this_zval = NULL;
238 double x_ppi = 0.0;
239 double y_ppi = 0.0;
241 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoSurface_ce_ptr, &x_ppi, &y_ppi) == FAILURE) {
242 return;
245 _this_ce = Z_OBJCE_P(_this_zval);
246 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
247 cairo_surface_set_fallback_resolution(curr->surface, x_ppi, y_ppi);
250 /* }}} set_fallback_resolution */
254 /* {{{ proto void write_to_png(string file)
256 PHP_METHOD(CairoSurface, write_to_png)
258 zend_class_entry * _this_ce;
260 zval * _this_zval = NULL;
261 const char * file = NULL;
262 int file_len = 0;
263 cairo_status_t status;
265 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &_this_zval, CairoSurface_ce_ptr, &file, &file_len) == FAILURE) {
266 return;
269 _this_ce = Z_OBJCE_P(_this_zval);
270 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
271 status = cairo_write_to_png(curr->surface, file);
275 /* }}} write_to_png */
278 static zend_function_entry CairoSurface_methods[] = {
279 PHP_ME(CairoSurface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
280 PHP_ME(CairoSurface, create_similar, CairoSurface__create_similar_args, /**/ZEND_ACC_PUBLIC)
281 PHP_ME(CairoSurface, finish, NULL, /**/ZEND_ACC_PUBLIC)
282 PHP_ME(CairoSurface, flush, NULL, /**/ZEND_ACC_PUBLIC)
283 PHP_ME(CairoSurface, get_content, NULL, /**/ZEND_ACC_PUBLIC)
284 PHP_ME(CairoSurface, get_device_offset, NULL, /**/ZEND_ACC_PUBLIC)
285 PHP_ME(CairoSurface, get_font_options, NULL, /**/ZEND_ACC_PUBLIC)
286 PHP_ME(CairoSurface, mark_dirty_rectangle, CairoSurface__mark_dirty_rectangle_args, /**/ZEND_ACC_PUBLIC)
287 PHP_ME(CairoSurface, set_device_offset, CairoSurface__set_device_offset_args, /**/ZEND_ACC_PUBLIC)
288 PHP_ME(CairoSurface, set_fallback_resolution, CairoSurface__set_fallback_resolution_args, /**/ZEND_ACC_PUBLIC)
289 PHP_ME(CairoSurface, write_to_png, CairoSurface__write_to_png_args, /**/ZEND_ACC_PUBLIC)
290 { NULL, NULL, NULL }
293 /* }}} Methods */
296 static void CairoSurface_object_dtor(void *object)
298 surface_object *surface = (surface_object *)object;
299 zend_hash_destroy(surface->std.properties);
300 FREE_HASHTABLE(surface->std.properties);
301 if(surface->surface){
302 cairo_surface_finish(surface->surface);
303 cairo_surface_destroy(surface->surface);
306 efree(object);
309 static zend_object_value CairoSurface_object_new(zend_class_entry *ce)
311 zend_object_value retval;
312 surface_object *surface;
313 zval *temp;
315 surface = emalloc(sizeof(surface_object));
316 memcpy(surface,0,sizeof(surface_object));
318 surface->std.ce=ce;
320 ALLOC_HASHTABLE(surface->std.properties);
321 zend_hash_init(surface->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
322 zend_hash_copy(surface->std.properites, &ce->default_properties, copy_ctor_func_t zval_add_ref,(void *) &temp, sizeof(zval *));
323 retval.handle=zend_objects_store_put(surface, NULL, (zend_object_free_storage_t)CairoSurface_object_dtor, NULL TSRMLS_CC);
324 retval.handlers = &CarioSurface_handlers;
325 return retval
328 static void class_init_CairoSurface(void)
330 zend_class_entry ce;
332 INIT_CLASS_ENTRY(ce, "CairoSurface", CairoSurface_methods);
333 CairoSurface_ce_ptr = zend_register_internal_class(&ce);
334 CairoSurface_ce_ptr->create_object = CairoSurface_object_new;
335 memcpy(&CairoSurface_handlers, zend_get_std_object_handlers(),sizeof(zend_object_handlers));
336 CairoSurface_handlers.clone_obj = NULL;
339 /* }}} Class CairoSurface */
341 /* {{{ Class CairoImageSurface -- allmost done (-stream) */
343 static zend_class_entry * CairoImageSurface_ce_ptr = NULL;
344 static zend_object_hanlers CairoImageSurface_handlers;
345 /* {{{ Methods */
348 /* {{{ proto void construct(int format, int widthm, int height)
350 PHP_METHOD(CairoImageSurface, __construct)
352 zend_class_entry * _this_ce;
353 zval * _this_zval;
355 cairo_format_t format = 0;
356 long widthm = 0;
357 long height = 0;
361 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &format, &widthm, &height) == FAILURE) {
362 return;
365 _this_zval = getThis();
366 _this_ce = Z_OBJCE_P(_this_zval);
367 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
368 curr->surface = cairo_image_surface_create(format, widthm, height);
371 /* }}} __construct */
375 /* {{{ proto object create_from_data(object obj, int format, int width, int height [, int stride])
377 PHP_METHOD(CairoImageSurface, create_from_data)
379 zend_class_entry * _this_ce;
381 zval * _this_zval = NULL;
382 const char * buffer = NULL;
383 int buffer_len = 0;
384 long format = 0;
385 long width = 0;
386 long height = 0;
387 long stride = -1;
391 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oslll|l", &_this_zval, CairoImageSurface_ce_ptr, &buffer, &buffer_len, &format, &width, &height, &stride) == FAILURE) {
392 return;
395 _this_ce = Z_OBJCE_P(_this_zval);
396 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
398 object_init(return_value)
399 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
400 if(stride < 0 ){
401 switch(format) {
402 case CAIRO_FORMAT_ARGB32:
403 case CAIRO_FORMAT_RGB24:
404 stride = width * 4;
405 break;
406 case CAIRO_FORMAT_RGB16_565:
407 stride = width * 2;
408 break;
409 case CAIRO_FORMAT_A8:
410 stride = width;
411 break;
412 case CAIRO_FORMAT_A1:
413 stride = (width + 1) / 8;
414 break;
415 default:
416 php_error(CairoError, "Unknown format");
417 return NULL;
421 if (height * stride > buffer_len) {
422 php_error(E_ERROR,"buffer is not long enough");
423 return NULL;
425 sobj->surface = cairo_image_surface_create_for_data(buffer, format, width, height, stride);
427 /* }}} create_from_data */
431 /* {{{ proto object create_from_png(string file)
433 PHP_METHOD(CairoImageSurface, create_from_png)
435 zend_class_entry * _this_ce;
437 zval * _this_zval = NULL;
438 const char * file = NULL;
439 int file_len = 0;
441 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &_this_zval, CairoImageSurface_ce_ptr, &file, &file_len) == FAILURE) {
442 return;
445 _this_ce = Z_OBJCE_P(_this_zval);
446 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
448 object_init(return_value)
449 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
450 sobj->surface = cairo_image_surface_create_from_png(file);
453 /* }}} create_from_png */
457 /* {{{ proto string get_data() -- not required
459 PHP_METHOD(CairoImageSurface, get_data)
461 zend_class_entry * _this_ce;
463 zval * _this_zval = NULL;
467 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
468 return;
471 _this_ce = Z_OBJCE_P(_this_zval);
472 php_error(E_WARNING,"Not Implemented .. not required");
474 RETURN_STRINGL("", 0, 1);
476 /* }}} get_data */
480 /* {{{ proto int get_format()
482 PHP_METHOD(CairoImageSurface, get_format)
484 zend_class_entry * _this_ce;
485 long x;
486 zval * _this_zval = NULL;
488 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
489 return;
491 _this_ce = Z_OBJCE_P(_this_zval);
492 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
494 x = cairo_image_surface_get_format(curr->surface);
495 RETURN_LONG(x);
497 /* }}} get_format */
501 /* {{{ proto int get_height()
503 PHP_METHOD(CairoImageSurface, get_height)
505 zend_class_entry * _this_ce;
506 zval * _this_zval = NULL;
507 long x;
509 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
510 return;
513 _this_ce = Z_OBJCE_P(_this_zval);
514 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
515 x = cairo_image_surface_get_height(curr->surface);
517 RETURN_LONG(x);
519 /* }}} get_height */
523 /* {{{ proto int get_stride()
525 PHP_METHOD(CairoImageSurface, get_stride)
527 zend_class_entry * _this_ce;
528 zval * _this_zval = NULL;
529 long x;
531 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
532 return;
535 _this_ce = Z_OBJCE_P(_this_zval);
536 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
537 x = cairo_image_surface_get_stride(curr->surface);
539 RETURN_LONG(x);
541 /* }}} get_stride */
545 /* {{{ proto int get_width()
547 PHP_METHOD(CairoImageSurface, get_width)
549 zend_class_entry * _this_ce;
550 zval * _this_zval = NULL;
551 long x;
553 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
554 return;
557 _this_ce = Z_OBJCE_P(_this_zval);
559 surface_object *curr = (surface_object *)zend_objects_get_address(_this_val TSRMLS_CC);
561 x = cairo_image_surface_get_width(curr->surface);
562 RETURN_LONG(x);
564 /* }}} get_width */
567 static zend_function_entry CairoImageSurface_methods[] = {
568 PHP_ME(CairoImageSurface, __construct, CairoImageSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
569 PHP_ME(CairoImageSurface, create_from_data, CairoImageSurface__create_from_data_args, /**/ZEND_ACC_PRIVATE)
570 PHP_ME(CairoImageSurface, create_from_png, CairoImageSurface__create_from_png_args, /**/ZEND_ACC_PRIVATE)
571 PHP_ME(CairoImageSurface, get_data, NULL, /**/ZEND_ACC_PUBLIC)
572 PHP_ME(CairoImageSurface, get_format, NULL, /**/ZEND_ACC_PUBLIC)
573 PHP_ME(CairoImageSurface, get_height, NULL, /**/ZEND_ACC_PUBLIC)
574 PHP_ME(CairoImageSurface, get_stride, NULL, /**/ZEND_ACC_PUBLIC)
575 PHP_ME(CairoImageSurface, get_width, NULL, /**/ZEND_ACC_PUBLIC)
576 { NULL, NULL, NULL }
579 /* }}} Methods */
581 static zend_object_value CairoImageSurface_object_new(zend_class_entry *ce TSRMLS_DC)
583 zend_object_value retval;
584 retval=CairoSurface_object_new(ce TSRMLS_CC);
585 retval.handlers = &CairoImageSurface_handlers;
586 return retval;
590 static void class_init_CairoImageSurface(void)
592 zend_class_entry ce;
594 INIT_CLASS_ENTRY(ce, "CairoImageSurface", CairoImageSurface_methods);
595 CairoImageSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
596 CairoImageSurface_ce_ptr->create_object = CairoImageSurface_object_new;
597 memcpy(&CairoImageSurface_handlers, zend_get_std_object_handlers(). sizeof(zend_object_handlers));
600 /* }}} Class CairoImageSurface */
602 /* {{{ Class CairoPDFSurface */
604 static zend_class_entry * CairoPDFSurface_ce_ptr = NULL;
605 static zend_object_handlers CairoPDFSurface_handlers;
606 /* {{{ Methods */
609 /* {{{ proto void construct(string file, float wpts, float hpts)
611 PHP_METHOD(CairoPDFSurface, __construct)
613 zend_class_entry * _this_ce;
614 zval * _this_zval;
616 const char * file = NULL;
617 int file_len = 0;
618 double wpts = 0.0;
619 double hpts = 0.0;
623 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
624 return;
627 _this_zval = getThis();
628 _this_ce = Z_OBJCE_P(_this_zval);
631 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
634 /* }}} __construct */
638 /* {{{ proto void set_size(float wptd, float hpts)
640 PHP_METHOD(CairoPDFSurface, set_size)
642 zend_class_entry * _this_ce;
644 zval * _this_zval = NULL;
645 double wptd = 0.0;
646 double hpts = 0.0;
650 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoPDFSurface_ce_ptr, &wptd, &hpts) == FAILURE) {
651 return;
654 _this_ce = Z_OBJCE_P(_this_zval);
657 php_error(E_WARNING, "set_size: not yet implemented"); RETURN_FALSE;
660 /* }}} set_size */
663 static zend_function_entry CairoPDFSurface_methods[] = {
664 PHP_ME(CairoPDFSurface, __construct, CairoPDFSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
665 PHP_ME(CairoPDFSurface, set_size, CairoPDFSurface__set_size_args, /**/ZEND_ACC_PUBLIC)
666 { NULL, NULL, NULL }
669 /* }}} Methods */
671 static zend_object_value CairoPDFSurface_object_new(zend_class_entry *ce TSRMLS_DC)
673 zend_object_value retval;
674 retval=CairoSurface_object_new(ce TSRMLS_CC);
675 retval.handlers = &CairoPDFSurface_handlers;
676 return retval;
679 static void class_init_CairoPDFSurface(void)
681 zend_class_entry ce;
683 INIT_CLASS_ENTRY(ce, "CairoPDFSurface", CairoPDFSurface_methods);
684 CairoPDFSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
685 CairoPDFSurface_ce_ptr->create_object = CairoPDFSurface_object_new;
686 memcpy(&CairoPDFSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
690 /* }}} Class CairoPDFSurface */
692 /* {{{ Class CairoPSSurface */
694 static zend_class_entry * CairoPSSurface_ce_ptr = NULL;
695 static zend_object_handlers CairoPSSurface_handlers;
696 /* {{{ Methods */
699 /* {{{ proto void construct(string file, float wpts, float hpts)
701 PHP_METHOD(CairoPSSurface, __construct)
703 zend_class_entry * _this_ce;
704 zval * _this_zval;
706 const char * file = NULL;
707 int file_len = 0;
708 double wpts = 0.0;
709 double hpts = 0.0;
713 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
714 return;
717 _this_zval = getThis();
718 _this_ce = Z_OBJCE_P(_this_zval);
721 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
724 /* }}} __construct */
728 /* {{{ proto void dsc_begin_page_setup()
730 PHP_METHOD(CairoPSSurface, dsc_begin_page_setup)
732 zend_class_entry * _this_ce;
734 zval * _this_zval = NULL;
738 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
739 return;
742 _this_ce = Z_OBJCE_P(_this_zval);
745 php_error(E_WARNING, "dsc_begin_page_setup: not yet implemented"); RETURN_FALSE;
748 /* }}} dsc_begin_page_setup */
752 /* {{{ proto void dsc_begin_setup()
754 PHP_METHOD(CairoPSSurface, dsc_begin_setup)
756 zend_class_entry * _this_ce;
758 zval * _this_zval = NULL;
762 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
763 return;
766 _this_ce = Z_OBJCE_P(_this_zval);
769 php_error(E_WARNING, "dsc_begin_setup: not yet implemented"); RETURN_FALSE;
772 /* }}} dsc_begin_setup */
776 /* {{{ proto void dsc_comment()
778 PHP_METHOD(CairoPSSurface, dsc_comment)
780 zend_class_entry * _this_ce;
782 zval * _this_zval = NULL;
786 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
787 return;
790 _this_ce = Z_OBJCE_P(_this_zval);
793 php_error(E_WARNING, "dsc_comment: not yet implemented"); RETURN_FALSE;
796 /* }}} dsc_comment */
800 /* {{{ proto array get_levels()
802 PHP_METHOD(CairoPSSurface, get_levels)
804 zend_class_entry * _this_ce;
806 zval * _this_zval = NULL;
810 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
811 return;
814 _this_ce = Z_OBJCE_P(_this_zval);
817 array_init(return_value);
819 do {
820 /* ONLY for CAIRO 1.6
821 } while (0);
823 /* }}} get_levels */
827 /* {{{ proto string get_level_string()
829 PHP_METHOD(CairoPSSurface, get_level_string)
831 zend_class_entry * _this_ce;
833 zval * _this_zval = NULL;
837 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
838 return;
841 _this_ce = Z_OBJCE_P(_this_zval);
844 do {
845 /* ONLY for CAIRO 1.6*/
846 } while (0);
848 /* }}} get_level_string */
852 /* {{{ proto void restrict_to_level(int level)
854 PHP_METHOD(CairoPSSurface, restrict_to_level)
856 zend_class_entry * _this_ce;
858 zval * _this_zval = NULL;
859 long level = 0;
863 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &_this_zval, CairoPSSurface_ce_ptr, &level) == FAILURE) {
864 return;
867 _this_ce = Z_OBJCE_P(_this_zval);
870 do {
871 /* ONLY for CAIRO 1.6 */
872 } while (0);
874 /* }}} restrict_to_level */
878 /* {{{ proto void set_eps()
880 PHP_METHOD(CairoPSSurface, set_eps)
882 zend_class_entry * _this_ce;
884 zval * _this_zval = NULL;
888 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
889 return;
892 _this_ce = Z_OBJCE_P(_this_zval);
895 do {
896 /* ONLY for CAIRO 1.6 */
897 } while (0);
899 /* }}} set_eps */
903 /* {{{ proto void set_size(float wpts, float hpts)
905 PHP_METHOD(CairoPSSurface, set_size)
907 zend_class_entry * _this_ce;
909 zval * _this_zval = NULL;
910 double wpts = 0.0;
911 double hpts = 0.0;
915 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoPSSurface_ce_ptr, &wpts, &hpts) == FAILURE) {
916 return;
919 _this_ce = Z_OBJCE_P(_this_zval);
922 php_error(E_WARNING, "set_size: not yet implemented"); RETURN_FALSE;
925 /* }}} set_size */
928 static zend_function_entry CairoPSSurface_methods[] = {
929 PHP_ME(CairoPSSurface, __construct, CairoPSSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
930 PHP_ME(CairoPSSurface, dsc_begin_page_setup, NULL, /**/ZEND_ACC_PUBLIC)
931 PHP_ME(CairoPSSurface, dsc_begin_setup, NULL, /**/ZEND_ACC_PUBLIC)
932 PHP_ME(CairoPSSurface, dsc_comment, NULL, /**/ZEND_ACC_PUBLIC)
933 PHP_ME(CairoPSSurface, get_levels, NULL, /**/ZEND_ACC_PUBLIC)
934 PHP_ME(CairoPSSurface, get_level_string, NULL, /**/ZEND_ACC_PUBLIC)
935 PHP_ME(CairoPSSurface, restrict_to_level, CairoPSSurface__restrict_to_level_args, /**/ZEND_ACC_PUBLIC)
936 PHP_ME(CairoPSSurface, set_eps, NULL, /**/ZEND_ACC_PUBLIC)
937 PHP_ME(CairoPSSurface, set_size, CairoPSSurface__set_size_args, /**/ZEND_ACC_PUBLIC)
938 { NULL, NULL, NULL }
941 /* }}} Methods */
943 static zend_object_value CairoPSSurface_object_new(zend_class_entry *ce TSRMLS_DC)
945 zend_object_value retval;
946 retval=CairoSurface_object_new(ce TSRMLS_CC);
947 retval.handlers = &CairoPSSurface_handlers;
948 return retval;
951 static void class_init_CairoPSSurface(void)
953 zend_class_entry ce;
955 INIT_CLASS_ENTRY(ce, "CairoPSSurface", CairoPSSurface_methods);
956 CairoPSSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
957 CairoPSSurface_ce_ptr->create_object = CairoPSSurface_object_new;
958 memcpy(&CairoPSSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
961 /* }}} Class CairoPSSurface */
963 /* {{{ Class CairoQuartzSurface */
965 static zend_class_entry * CairoQuartzSurface_ce_ptr = NULL;
966 static zend_object_handlers CairoQuartzSurface_handlers;
967 /* {{{ Methods */
970 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
972 PHP_METHOD(CairoQuartzSurface, __construct)
974 zend_class_entry * _this_ce;
975 zval * _this_zval;
977 double wpixels = 0.0;
978 double hpixels = 0.0;
979 long format = 0;
983 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &wpixels, &hpixels, &format) == FAILURE) {
984 return;
987 _this_zval = getThis();
988 _this_ce = Z_OBJCE_P(_this_zval);
991 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
994 /* }}} __construct */
997 static zend_function_entry CairoQuartzSurface_methods[] = {
998 PHP_ME(CairoQuartzSurface, __construct, CairoQuartzSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
999 { NULL, NULL, NULL }
1002 /* }}} Methods */
1004 static zend_object_value CairoQuartzSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1006 zend_object_value retval;
1007 retval=CairoSurface_object_new(ce TSRMLS_CC);
1008 retval.handlers = &CairoQuartzSurface_handlers;
1009 return retval;
1012 static void class_init_CairoQuartzSurface(void)
1014 zend_class_entry ce;
1016 INIT_CLASS_ENTRY(ce, "CairoQuartzSurface", CairoQuartzSurface_methods);
1017 CairoQuartzSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
1018 CairoQuartzSurface_ce_ptr->create_object = CairoQuartzSurface_object_new;
1019 memcpy(&CairoQuartzSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1023 /* }}} Class CairoQuartzSurface */
1025 /* {{{ Class CairoSVGSurface */
1027 static zend_class_entry * CairoSVGSurface_ce_ptr = NULL;
1028 static zend_object_handlers CairoSVGSurface_handlers;
1029 /* {{{ Methods */
1032 /* {{{ proto void construct(string file, float wpts, float hpts)
1034 PHP_METHOD(CairoSVGSurface, __construct)
1036 zend_class_entry * _this_ce;
1037 zval * _this_zval;
1039 const char * file = NULL;
1040 int file_len = 0;
1041 double wpts = 0.0;
1042 double hpts = 0.0;
1046 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
1047 return;
1050 _this_zval = getThis();
1051 _this_ce = Z_OBJCE_P(_this_zval);
1054 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1057 /* }}} __construct */
1060 static zend_function_entry CairoSVGSurface_methods[] = {
1061 PHP_ME(CairoSVGSurface, __construct, CairoSVGSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1062 { NULL, NULL, NULL }
1065 /* }}} Methods */
1067 static zend_object_value CairoSVGSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1069 zend_object_value retval;
1070 retval=CairoSurface_object_new(ce TSRMLS_CC);
1071 retval.handlers = &CairoSVGSurface_handlers;
1072 return retval;
1075 static void class_init_CairoSVGSurface(void)
1077 zend_class_entry ce;
1079 INIT_CLASS_ENTRY(ce, "CairoSVGSurface", CairoSVGSurface_methods);
1080 CairoSVGSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
1081 CairoSVGSurface_ce_ptr->create_object = CairoSVGSurface_object_new;
1082 memcpy(&CairoSVGSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1086 /* }}} Class CairoSVGSurface */
1088 /* {{{ Class CairoWin32Surface */
1090 static zend_class_entry * CairoWin32Surface_ce_ptr = NULL;
1091 static zend_object_handlers CairoWin32Surface_handlers;
1093 /* {{{ Methods */
1096 /* {{{ proto void construct(int hdc)
1098 PHP_METHOD(CairoWin32Surface, __construct)
1100 zend_class_entry * _this_ce;
1101 zval * _this_zval;
1103 long hdc = 0;
1107 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hdc) == FAILURE) {
1108 return;
1111 _this_zval = getThis();
1112 _this_ce = Z_OBJCE_P(_this_zval);
1115 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1118 /* }}} __construct */
1121 static zend_function_entry CairoWin32Surface_methods[] = {
1122 PHP_ME(CairoWin32Surface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1123 { NULL, NULL, NULL }
1126 /* }}} Methods */
1128 static zend_object_value CairoWin32Surface_object_new(zend_class_entry *ce TSRMLS_DC)
1130 zend_object_value retval;
1131 retval=CairoSurface_object_new(ce TSRMLS_CC);
1132 retval.handlers = &CairoWin32Surface_handlers;
1133 return retval;
1136 static void class_init_CairoWin32Surface(void)
1138 zend_class_entry ce;
1140 INIT_CLASS_ENTRY(ce, "CairoWin32Surface", CairoWin32Surface_methods);
1141 CairoWin32Surface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
1142 CairoWin32Surface_ce_ptr->create_object = CairoWin32Surface_object_new;
1143 memcpy(&CairoWin32Surface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1147 /* }}} Class CairoWin32Surface */
1149 /* {{{ Class CairoXlibSurface */
1151 static zend_class_entry * CairoXlibSurface_ce_ptr = NULL;
1152 static zend_object_handlers CairoXlibSurface_handlers;
1153 /* {{{ Methods */
1156 /* {{{ proto void construct()
1158 PHP_METHOD(CairoXlibSurface, __construct)
1160 zend_class_entry * _this_ce;
1161 zval * _this_zval;
1165 if (ZEND_NUM_ARGS()>0) {
1166 WRONG_PARAM_COUNT;
1170 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1173 /* }}} __construct */
1177 /* {{{ proto int get_depth()
1179 PHP_METHOD(CairoXlibSurface, get_depth)
1181 zend_class_entry * _this_ce;
1183 zval * _this_zval = NULL;
1187 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1188 return;
1191 _this_ce = Z_OBJCE_P(_this_zval);
1194 php_error(E_WARNING, "get_depth: not yet implemented"); RETURN_FALSE;
1196 RETURN_LONG(0);
1198 /* }}} get_depth */
1202 /* {{{ proto int get_height()
1204 PHP_METHOD(CairoXlibSurface, get_height)
1206 zend_class_entry * _this_ce;
1208 zval * _this_zval = NULL;
1212 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1213 return;
1216 _this_ce = Z_OBJCE_P(_this_zval);
1219 php_error(E_WARNING, "get_height: not yet implemented"); RETURN_FALSE;
1221 RETURN_LONG(0);
1223 /* }}} get_height */
1227 /* {{{ proto int get_width()
1229 PHP_METHOD(CairoXlibSurface, get_width)
1231 zend_class_entry * _this_ce;
1233 zval * _this_zval = NULL;
1237 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1238 return;
1241 _this_ce = Z_OBJCE_P(_this_zval);
1244 php_error(E_WARNING, "get_width: not yet implemented"); RETURN_FALSE;
1246 RETURN_LONG(0);
1248 /* }}} get_width */
1251 static zend_function_entry CairoXlibSurface_methods[] = {
1252 PHP_ME(CairoXlibSurface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1253 PHP_ME(CairoXlibSurface, get_depth, NULL, /**/ZEND_ACC_PUBLIC)
1254 PHP_ME(CairoXlibSurface, get_height, NULL, /**/ZEND_ACC_PUBLIC)
1255 PHP_ME(CairoXlibSurface, get_width, NULL, /**/ZEND_ACC_PUBLIC)
1256 { NULL, NULL, NULL }
1259 /* }}} Methods */
1261 static zend_object_value CairoXlibSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1263 zend_object_value retval;
1264 retval=CairoSurface_object_new(ce TSRMLS_CC);
1265 retval.handlers = &CairoXlibSurface_handlers;
1266 return retval;
1269 static void class_init_CairoXlibSurface(void)
1271 zend_class_entry ce;
1273 INIT_CLASS_ENTRY(ce, "CairoXlibSurface", CairoXlibSurface_methods);
1274 CairoXlibSurface_ce_ptr = zend_register_internal_class_ex(&ce, NULL, "CairoSurface" TSRMLS_CC);
1275 CairoXlibSurface_ce_ptr->create_object = CairoXlibSurface_object_new;
1276 memcpy(&CairoXlibSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1280 /* }}} Class CairoXlibSurface */