Added some more functions - reached miter_limit
[phpCairo.git] / individual_files / phpCairoSurface.c
blob80b9ba2601f49a936f6fb100571061d9dac78904
1 /* {{{ Class CairoSurface */
3 static zend_class_entry * CairoSurface_ce_ptr = NULL;
4 static zend_object_handlers CairoSurface_handlers;
6 /*
7 typedef struct _surface_object {
8 zend_object std;
9 cairo_surface_t *surface;
10 } surface_object;
13 /* {{{ Methods */
16 /* {{{ proto void construct() -- Add error
18 PHP_METHOD(CairoSurface, __construct)
20 zend_class_entry * _this_ce;
21 zval * _this_zval;
25 if (ZEND_NUM_ARGS()>0) {
26 WRONG_PARAM_COUNT;
27 php_print("wtf");
28 return;
31 php_print("No direct call for this constructor");
35 /* }}} __construct */
39 /* {{{ proto object create_similar(int content, int width, int height)
41 PHP_METHOD(CairoSurface, create_similar)
43 zend_class_entry * _this_ce;
45 zval * _this_zval = NULL;
46 cairo_surface_t *sur;
47 int content;
48 long width = 0;
49 long height = 0;
51 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oill", &_this_zval, CairoSurface_ce_ptr, &content, &width, &height) == FAILURE) {
52 return;
55 _this_ce = Z_OBJCE_P(_this_zval);
56 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
57 sur = cairo_surface_create_similar(curr->surface, content, width, height);
58 object_init(return_value);
59 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
60 sobj->surface=sur;
63 /* }}} create_similar */
66 /* {{{ proto void finish()
68 PHP_METHOD(CairoSurface, finish)
70 zend_class_entry * _this_ce;
72 zval * _this_zval = NULL;
74 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
75 return;
78 _this_ce = Z_OBJCE_P(_this_zval);
79 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
80 cairo_surface_finish(curr->surface);
82 /* }}} finish */
86 /* {{{ proto void flush()
88 PHP_METHOD(CairoSurface, flush)
90 zend_class_entry * _this_ce;
92 zval * _this_zval = NULL;
94 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
95 return;
98 _this_ce = Z_OBJCE_P(_this_zval);
99 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
101 cairo_surface_flush(curr->surface);
104 /* }}} flush */
108 /* {{{ proto int get_content()
110 PHP_METHOD(CairoSurface, get_content)
112 zend_class_entry * _this_ce;
114 zval * _this_zval = NULL;
115 long x;
116 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
117 return;
120 _this_ce = Z_OBJCE_P(_this_zval);
121 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
123 x=cairo_surface_get_content(curr->surface);
124 RETURN_LONG(x);
126 /* }}} get_content */
130 /* {{{ proto array get_device_offset()
132 PHP_METHOD(CairoSurface, get_device_offset)
134 zend_class_entry * _this_ce;
136 zval * _this_zval = NULL;
137 double x_offset, y_offset;
139 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
140 return;
143 _this_ce = Z_OBJCE_P(_this_zval);
144 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
146 cairo_surface_get_device_offset(curr->surface, &x_offset, &y_offset);
148 array_init(return_value);
149 add_assoc_double(return_value, "x_offset", x_offset);
150 add_assoc_double(return_value, "y_offset", y_offset);
153 /* }}} get_device_offset */
157 /* {{{ proto object get_font_options()
159 PHP_METHOD(CairoSurface, get_font_options)
161 zend_class_entry * _this_ce;
163 zval * _this_zval = NULL;
165 cairo_font_options_t *options = cairo_font_options_create();
168 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) {
169 return;
172 _this_ce = Z_OBJCE_P(_this_zval);
173 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
175 cairo_surface_get_font_options(curr->surface, options);
176 object_init(return_value);
177 fontoptions_object *fobj = (fontoptions_object *)zend_objects_get_address(return_value TSRMLS_CC);
178 fobj->fontoptions=options;
181 /* }}} get_font_options */
185 /* {{{ proto void mark_dirty_rectangle([int x, int y, int width, int height])
187 PHP_METHOD(CairoSurface, mark_dirty_rectangle)
189 zend_class_entry * _this_ce;
191 zval * _this_zval = NULL;
192 long x = 0;
193 long y = 0;
194 long width = -1;
195 long height = -1;
199 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|llll", &_this_zval, CairoSurface_ce_ptr, &x, &y, &width, &height) == FAILURE) {
200 return;
202 _this_ce = Z_OBJCE_P(_this_zval);
203 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
204 cairo_surface_mark_dirty_rectangle(curr->surface, x, y, width, height);
207 /* }}} mark_dirty_rectangle */
211 /* {{{ proto void set_device_offset(float x_offset, float y_offset)
213 PHP_METHOD(CairoSurface, set_device_offset)
215 zend_class_entry * _this_ce;
217 zval * _this_zval = NULL;
218 double x_offset = 0.0;
219 double y_offset = 0.0;
221 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoSurface_ce_ptr, &x_offset, &y_offset) == FAILURE) {
222 return;
225 _this_ce = Z_OBJCE_P(_this_zval);
226 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
227 cairo_surface_set_device_offset(curr->surface, x_offset, y_offset);
230 /* }}} set_device_offset */
234 /* {{{ proto void set_fallback_resolution(float x_ppi, float y_ppi)
236 PHP_METHOD(CairoSurface, set_fallback_resolution)
238 zend_class_entry * _this_ce;
240 zval * _this_zval = NULL;
241 double x_ppi = 0.0;
242 double y_ppi = 0.0;
244 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoSurface_ce_ptr, &x_ppi, &y_ppi) == FAILURE) {
245 return;
248 _this_ce = Z_OBJCE_P(_this_zval);
249 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
250 cairo_surface_set_fallback_resolution(curr->surface, x_ppi, y_ppi);
253 /* }}} set_fallback_resolution */
257 /* {{{ proto void write_to_png(string file)
259 PHP_METHOD(CairoSurface, write_to_png)
261 zend_class_entry * _this_ce;
263 zval * _this_zval = NULL;
264 const char * file = NULL;
265 int file_len = 0;
266 cairo_status_t status;
268 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &_this_zval, CairoSurface_ce_ptr, &file, &file_len) == FAILURE) {
269 return;
272 _this_ce = Z_OBJCE_P(_this_zval);
273 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
274 printf("uuu%suu%d",file,curr->surface);
275 status = cairo_surface_write_to_png(curr->surface, file);
278 /* }}} write_to_png */
281 static zend_function_entry CairoSurface_methods[] = {
282 PHP_ME(CairoSurface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
283 PHP_ME(CairoSurface, create_similar, CairoSurface__create_similar_args, /**/ZEND_ACC_PUBLIC)
284 PHP_ME(CairoSurface, finish, NULL, /**/ZEND_ACC_PUBLIC)
285 PHP_ME(CairoSurface, flush, NULL, /**/ZEND_ACC_PUBLIC)
286 PHP_ME(CairoSurface, get_content, NULL, /**/ZEND_ACC_PUBLIC)
287 PHP_ME(CairoSurface, get_device_offset, NULL, /**/ZEND_ACC_PUBLIC)
288 PHP_ME(CairoSurface, get_font_options, NULL, /**/ZEND_ACC_PUBLIC)
289 PHP_ME(CairoSurface, mark_dirty_rectangle, CairoSurface__mark_dirty_rectangle_args, /**/ZEND_ACC_PUBLIC)
290 PHP_ME(CairoSurface, set_device_offset, CairoSurface__set_device_offset_args, /**/ZEND_ACC_PUBLIC)
291 PHP_ME(CairoSurface, set_fallback_resolution, CairoSurface__set_fallback_resolution_args, /**/ZEND_ACC_PUBLIC)
292 PHP_ME(CairoSurface, write_to_png, CairoSurface__write_to_png_args, /**/ZEND_ACC_PUBLIC)
293 { NULL, NULL, NULL }
296 /* }}} Methods */
299 static void CairoSurface_object_dtor(void *object)
301 surface_object *surface = (surface_object *)object;
302 zend_hash_destroy(surface->std.properties);
303 FREE_HASHTABLE(surface->std.properties);
304 if(surface->surface){
305 cairo_surface_finish(surface->surface);
306 cairo_surface_destroy(surface->surface);
309 efree(object);
312 static zend_object_value CairoSurface_object_new(zend_class_entry *ce)
314 zend_object_value retval;
315 surface_object *surface;
316 zval *temp;
318 surface = emalloc(sizeof(surface_object));
319 printf("%d",surface);
320 memset(surface,0,sizeof(surface_object));
322 surface->std.ce=ce;
324 ALLOC_HASHTABLE(surface->std.properties);
325 zend_hash_init(surface->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0);
326 zend_hash_copy(surface->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *));
327 retval.handle=zend_objects_store_put(surface, NULL, (zend_objects_free_object_storage_t)CairoSurface_object_dtor, NULL TSRMLS_CC);
328 retval.handlers = &CairoSurface_handlers;
329 return retval;
332 static void class_init_CairoSurface(void)
334 zend_class_entry ce;
336 INIT_CLASS_ENTRY(ce, "CairoSurface", CairoSurface_methods);
337 CairoSurface_ce_ptr = zend_register_internal_class(&ce);
338 CairoSurface_ce_ptr->create_object = CairoSurface_object_new;
339 memcpy(&CairoSurface_handlers, zend_get_std_object_handlers(),sizeof(zend_object_handlers));
340 CairoSurface_handlers.clone_obj = NULL;
343 /* }}} Class CairoSurface */
345 /* {{{ Class CairoImageSurface -- allmost done (-stream) */
347 static zend_class_entry * CairoImageSurface_ce_ptr = NULL;
348 static zend_object_handlers CairoImageSurface_handlers;
349 /* {{{ Methods */
352 /* {{{ proto void construct(int format, int widthm, int height)
354 PHP_METHOD(CairoImageSurface, __construct)
356 zend_class_entry * _this_ce;
357 zval * _this_zval;
359 cairo_format_t format = 0;
360 long widthm = 0;
361 long height = 0;
365 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &format, &widthm, &height) == FAILURE) {
366 return;
369 _this_zval = getThis();
370 _this_ce = Z_OBJCE_P(_this_zval);
371 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
372 printf("yy%d", curr);
373 curr->surface = cairo_image_surface_create(format, widthm, height);
374 printf("surface %d",curr->surface);
377 /* }}} __construct */
381 /* {{{ proto object create_from_data(object obj, int format, int width, int height [, int stride])
383 PHP_METHOD(CairoImageSurface, create_from_data)
385 zend_class_entry * _this_ce;
387 zval * _this_zval = NULL;
388 const char * buffer = NULL;
389 int buffer_len = 0;
390 long format = 0;
391 long width = 0;
392 long height = 0;
393 long stride = -1;
397 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) {
398 return;
401 _this_ce = Z_OBJCE_P(_this_zval);
402 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
404 object_init(return_value);
405 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
406 if(stride < 0 ){
407 switch(format) {
408 case CAIRO_FORMAT_ARGB32:
409 case CAIRO_FORMAT_RGB24:
410 stride = width * 4;
411 break;
412 case CAIRO_FORMAT_RGB16_565:
413 stride = width * 2;
414 break;
415 case CAIRO_FORMAT_A8:
416 stride = width;
417 break;
418 case CAIRO_FORMAT_A1:
419 stride = (width + 1) / 8;
420 break;
421 default:
422 //php_error(CairoError, "Unknown format");
423 return;
427 if (height * stride > buffer_len) {
428 php_error(E_ERROR,"buffer is not long enough");
429 return;
431 sobj->surface = cairo_image_surface_create_for_data(buffer, format, width, height, stride);
433 /* }}} create_from_data */
437 /* {{{ proto object create_from_png(string file)
439 PHP_METHOD(CairoImageSurface, create_from_png)
441 zend_class_entry * _this_ce;
443 zval * _this_zval = NULL;
444 const char * file = NULL;
445 int file_len = 0;
447 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &_this_zval, CairoImageSurface_ce_ptr, &file, &file_len) == FAILURE) {
448 return;
451 _this_ce = Z_OBJCE_P(_this_zval);
452 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
454 object_init(return_value);
455 surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC);
456 sobj->surface = cairo_image_surface_create_from_png(file);
459 /* }}} create_from_png */
463 /* {{{ proto string get_data() -- not required
465 PHP_METHOD(CairoImageSurface, get_data)
467 zend_class_entry * _this_ce;
469 zval * _this_zval = NULL;
473 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
474 return;
477 _this_ce = Z_OBJCE_P(_this_zval);
478 php_error(E_WARNING,"Not Implemented .. not required");
480 RETURN_STRINGL("", 0, 1);
482 /* }}} get_data */
486 /* {{{ proto int get_format()
488 PHP_METHOD(CairoImageSurface, get_format)
490 zend_class_entry * _this_ce;
491 long x;
492 zval * _this_zval = NULL;
494 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
495 return;
497 _this_ce = Z_OBJCE_P(_this_zval);
498 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
500 x = cairo_image_surface_get_format(curr->surface);
501 RETURN_LONG(x);
503 /* }}} get_format */
507 /* {{{ proto int get_height()
509 PHP_METHOD(CairoImageSurface, get_height)
511 zend_class_entry * _this_ce;
512 zval * _this_zval = NULL;
513 long x;
515 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
516 return;
519 _this_ce = Z_OBJCE_P(_this_zval);
520 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
521 x = cairo_image_surface_get_height(curr->surface);
523 RETURN_LONG(x);
525 /* }}} get_height */
529 /* {{{ proto int get_stride()
531 PHP_METHOD(CairoImageSurface, get_stride)
533 zend_class_entry * _this_ce;
534 zval * _this_zval = NULL;
535 long x;
537 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
538 return;
541 _this_ce = Z_OBJCE_P(_this_zval);
542 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
543 x = cairo_image_surface_get_stride(curr->surface);
545 RETURN_LONG(x);
547 /* }}} get_stride */
551 /* {{{ proto int get_width()
553 PHP_METHOD(CairoImageSurface, get_width)
555 zend_class_entry * _this_ce;
556 zval * _this_zval = NULL;
557 long x;
559 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) {
560 return;
563 _this_ce = Z_OBJCE_P(_this_zval);
565 surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC);
567 x = cairo_image_surface_get_width(curr->surface);
568 RETURN_LONG(x);
570 /* }}} get_width */
573 static zend_function_entry CairoImageSurface_methods[] = {
574 PHP_ME(CairoImageSurface, __construct, CairoImageSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
575 PHP_ME(CairoImageSurface, create_from_data, CairoImageSurface__create_from_data_args, /**/ZEND_ACC_PRIVATE)
576 PHP_ME(CairoImageSurface, create_from_png, CairoImageSurface__create_from_png_args, /**/ZEND_ACC_PRIVATE)
577 PHP_ME(CairoImageSurface, get_data, NULL, /**/ZEND_ACC_PUBLIC)
578 PHP_ME(CairoImageSurface, get_format, NULL, /**/ZEND_ACC_PUBLIC)
579 PHP_ME(CairoImageSurface, get_height, NULL, /**/ZEND_ACC_PUBLIC)
580 PHP_ME(CairoImageSurface, get_stride, NULL, /**/ZEND_ACC_PUBLIC)
581 PHP_ME(CairoImageSurface, get_width, NULL, /**/ZEND_ACC_PUBLIC)
582 { NULL, NULL, NULL }
585 /* }}} Methods */
587 static zend_object_value CairoImageSurface_object_new(zend_class_entry *ce TSRMLS_DC)
589 zend_object_value retval;
590 retval=CairoSurface_object_new(ce TSRMLS_CC);
591 retval.handlers = &CairoImageSurface_handlers;
592 return retval;
596 static void class_init_CairoImageSurface(void)
598 zend_class_entry ce;
600 INIT_CLASS_ENTRY(ce, "CairoImageSurface", CairoImageSurface_methods);
601 CairoImageSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
602 CairoImageSurface_ce_ptr->create_object = CairoImageSurface_object_new;
603 memcpy(&CairoImageSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
606 /* }}} Class CairoImageSurface */
608 /* {{{ Class CairoPDFSurface */
610 static zend_class_entry * CairoPDFSurface_ce_ptr = NULL;
611 static zend_object_handlers CairoPDFSurface_handlers;
612 /* {{{ Methods */
615 /* {{{ proto void construct(string file, float wpts, float hpts)
617 PHP_METHOD(CairoPDFSurface, __construct)
619 zend_class_entry * _this_ce;
620 zval * _this_zval;
622 const char * file = NULL;
623 int file_len = 0;
624 double wpts = 0.0;
625 double hpts = 0.0;
629 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
630 return;
633 _this_zval = getThis();
634 _this_ce = Z_OBJCE_P(_this_zval);
637 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
640 /* }}} __construct */
644 /* {{{ proto void set_size(float wptd, float hpts)
646 PHP_METHOD(CairoPDFSurface, set_size)
648 zend_class_entry * _this_ce;
650 zval * _this_zval = NULL;
651 double wptd = 0.0;
652 double hpts = 0.0;
656 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoPDFSurface_ce_ptr, &wptd, &hpts) == FAILURE) {
657 return;
660 _this_ce = Z_OBJCE_P(_this_zval);
663 php_error(E_WARNING, "set_size: not yet implemented"); RETURN_FALSE;
666 /* }}} set_size */
669 static zend_function_entry CairoPDFSurface_methods[] = {
670 PHP_ME(CairoPDFSurface, __construct, CairoPDFSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
671 PHP_ME(CairoPDFSurface, set_size, CairoPDFSurface__set_size_args, /**/ZEND_ACC_PUBLIC)
672 { NULL, NULL, NULL }
675 /* }}} Methods */
677 static zend_object_value CairoPDFSurface_object_new(zend_class_entry *ce TSRMLS_DC)
679 zend_object_value retval;
680 retval=CairoSurface_object_new(ce TSRMLS_CC);
681 retval.handlers = &CairoPDFSurface_handlers;
682 return retval;
685 static void class_init_CairoPDFSurface(void)
687 zend_class_entry ce;
689 INIT_CLASS_ENTRY(ce, "CairoPDFSurface", CairoPDFSurface_methods);
690 CairoPDFSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
691 CairoPDFSurface_ce_ptr->create_object = CairoPDFSurface_object_new;
692 memcpy(&CairoPDFSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
696 /* }}} Class CairoPDFSurface */
698 /* {{{ Class CairoPSSurface */
700 static zend_class_entry * CairoPSSurface_ce_ptr = NULL;
701 static zend_object_handlers CairoPSSurface_handlers;
702 /* {{{ Methods */
705 /* {{{ proto void construct(string file, float wpts, float hpts)
707 PHP_METHOD(CairoPSSurface, __construct)
709 zend_class_entry * _this_ce;
710 zval * _this_zval;
712 const char * file = NULL;
713 int file_len = 0;
714 double wpts = 0.0;
715 double hpts = 0.0;
719 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
720 return;
723 _this_zval = getThis();
724 _this_ce = Z_OBJCE_P(_this_zval);
727 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
730 /* }}} __construct */
734 /* {{{ proto void dsc_begin_page_setup()
736 PHP_METHOD(CairoPSSurface, dsc_begin_page_setup)
738 zend_class_entry * _this_ce;
740 zval * _this_zval = NULL;
744 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
745 return;
748 _this_ce = Z_OBJCE_P(_this_zval);
751 php_error(E_WARNING, "dsc_begin_page_setup: not yet implemented"); RETURN_FALSE;
754 /* }}} dsc_begin_page_setup */
758 /* {{{ proto void dsc_begin_setup()
760 PHP_METHOD(CairoPSSurface, dsc_begin_setup)
762 zend_class_entry * _this_ce;
764 zval * _this_zval = NULL;
768 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
769 return;
772 _this_ce = Z_OBJCE_P(_this_zval);
775 php_error(E_WARNING, "dsc_begin_setup: not yet implemented"); RETURN_FALSE;
778 /* }}} dsc_begin_setup */
782 /* {{{ proto void dsc_comment()
784 PHP_METHOD(CairoPSSurface, dsc_comment)
786 zend_class_entry * _this_ce;
788 zval * _this_zval = NULL;
792 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
793 return;
796 _this_ce = Z_OBJCE_P(_this_zval);
799 php_error(E_WARNING, "dsc_comment: not yet implemented"); RETURN_FALSE;
802 /* }}} dsc_comment */
806 /* {{{ proto array get_levels()
808 PHP_METHOD(CairoPSSurface, get_levels)
810 zend_class_entry * _this_ce;
812 zval * _this_zval = NULL;
816 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
817 return;
820 _this_ce = Z_OBJCE_P(_this_zval);
823 array_init(return_value);
825 do {
826 /* ONLY for CAIRO 1.6 */
827 } while (0);
829 /* }}} get_levels */
833 /* {{{ proto string get_level_string()
835 PHP_METHOD(CairoPSSurface, get_level_string)
837 zend_class_entry * _this_ce;
839 zval * _this_zval = NULL;
843 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
844 return;
847 _this_ce = Z_OBJCE_P(_this_zval);
850 do {
851 /* ONLY for CAIRO 1.6*/
852 } while (0);
854 /* }}} get_level_string */
858 /* {{{ proto void restrict_to_level(int level)
860 PHP_METHOD(CairoPSSurface, restrict_to_level)
862 zend_class_entry * _this_ce;
864 zval * _this_zval = NULL;
865 long level = 0;
869 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &_this_zval, CairoPSSurface_ce_ptr, &level) == FAILURE) {
870 return;
873 _this_ce = Z_OBJCE_P(_this_zval);
876 do {
877 /* ONLY for CAIRO 1.6 */
878 } while (0);
880 /* }}} restrict_to_level */
884 /* {{{ proto void set_eps()
886 PHP_METHOD(CairoPSSurface, set_eps)
888 zend_class_entry * _this_ce;
890 zval * _this_zval = NULL;
894 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) {
895 return;
898 _this_ce = Z_OBJCE_P(_this_zval);
901 do {
902 /* ONLY for CAIRO 1.6 */
903 } while (0);
905 /* }}} set_eps */
909 /* {{{ proto void set_size(float wpts, float hpts)
911 PHP_METHOD(CairoPSSurface, set_size)
913 zend_class_entry * _this_ce;
915 zval * _this_zval = NULL;
916 double wpts = 0.0;
917 double hpts = 0.0;
921 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoPSSurface_ce_ptr, &wpts, &hpts) == FAILURE) {
922 return;
925 _this_ce = Z_OBJCE_P(_this_zval);
928 php_error(E_WARNING, "set_size: not yet implemented"); RETURN_FALSE;
931 /* }}} set_size */
934 static zend_function_entry CairoPSSurface_methods[] = {
935 PHP_ME(CairoPSSurface, __construct, CairoPSSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
936 PHP_ME(CairoPSSurface, dsc_begin_page_setup, NULL, /**/ZEND_ACC_PUBLIC)
937 PHP_ME(CairoPSSurface, dsc_begin_setup, NULL, /**/ZEND_ACC_PUBLIC)
938 PHP_ME(CairoPSSurface, dsc_comment, NULL, /**/ZEND_ACC_PUBLIC)
939 PHP_ME(CairoPSSurface, get_levels, NULL, /**/ZEND_ACC_PUBLIC)
940 PHP_ME(CairoPSSurface, get_level_string, NULL, /**/ZEND_ACC_PUBLIC)
941 PHP_ME(CairoPSSurface, restrict_to_level, CairoPSSurface__restrict_to_level_args, /**/ZEND_ACC_PUBLIC)
942 PHP_ME(CairoPSSurface, set_eps, NULL, /**/ZEND_ACC_PUBLIC)
943 PHP_ME(CairoPSSurface, set_size, CairoPSSurface__set_size_args, /**/ZEND_ACC_PUBLIC)
944 { NULL, NULL, NULL }
947 /* }}} Methods */
949 static zend_object_value CairoPSSurface_object_new(zend_class_entry *ce TSRMLS_DC)
951 zend_object_value retval;
952 retval=CairoSurface_object_new(ce TSRMLS_CC);
953 retval.handlers = &CairoPSSurface_handlers;
954 return retval;
957 static void class_init_CairoPSSurface(void)
959 zend_class_entry ce;
961 INIT_CLASS_ENTRY(ce, "CairoPSSurface", CairoPSSurface_methods);
962 CairoPSSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
963 CairoPSSurface_ce_ptr->create_object = CairoPSSurface_object_new;
964 memcpy(&CairoPSSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
967 /* }}} Class CairoPSSurface */
969 /* {{{ Class CairoQuartzSurface */
971 static zend_class_entry * CairoQuartzSurface_ce_ptr = NULL;
972 static zend_object_handlers CairoQuartzSurface_handlers;
973 /* {{{ Methods */
976 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
978 PHP_METHOD(CairoQuartzSurface, __construct)
980 zend_class_entry * _this_ce;
981 zval * _this_zval;
983 double wpixels = 0.0;
984 double hpixels = 0.0;
985 long format = 0;
989 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "dd|l", &wpixels, &hpixels, &format) == FAILURE) {
990 return;
993 _this_zval = getThis();
994 _this_ce = Z_OBJCE_P(_this_zval);
997 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1000 /* }}} __construct */
1003 static zend_function_entry CairoQuartzSurface_methods[] = {
1004 PHP_ME(CairoQuartzSurface, __construct, CairoQuartzSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1005 { NULL, NULL, NULL }
1008 /* }}} Methods */
1010 static zend_object_value CairoQuartzSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1012 zend_object_value retval;
1013 retval=CairoSurface_object_new(ce TSRMLS_CC);
1014 retval.handlers = &CairoQuartzSurface_handlers;
1015 return retval;
1018 static void class_init_CairoQuartzSurface(void)
1020 zend_class_entry ce;
1022 INIT_CLASS_ENTRY(ce, "CairoQuartzSurface", CairoQuartzSurface_methods);
1023 CairoQuartzSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
1024 CairoQuartzSurface_ce_ptr->create_object = CairoQuartzSurface_object_new;
1025 memcpy(&CairoQuartzSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1029 /* }}} Class CairoQuartzSurface */
1031 /* {{{ Class CairoSVGSurface */
1033 static zend_class_entry * CairoSVGSurface_ce_ptr = NULL;
1034 static zend_object_handlers CairoSVGSurface_handlers;
1035 /* {{{ Methods */
1038 /* {{{ proto void construct(string file, float wpts, float hpts)
1040 PHP_METHOD(CairoSVGSurface, __construct)
1042 zend_class_entry * _this_ce;
1043 zval * _this_zval;
1045 const char * file = NULL;
1046 int file_len = 0;
1047 double wpts = 0.0;
1048 double hpts = 0.0;
1052 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sdd", &file, &file_len, &wpts, &hpts) == FAILURE) {
1053 return;
1056 _this_zval = getThis();
1057 _this_ce = Z_OBJCE_P(_this_zval);
1060 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1063 /* }}} __construct */
1066 static zend_function_entry CairoSVGSurface_methods[] = {
1067 PHP_ME(CairoSVGSurface, __construct, CairoSVGSurface____construct_args, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1068 { NULL, NULL, NULL }
1071 /* }}} Methods */
1073 static zend_object_value CairoSVGSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1075 zend_object_value retval;
1076 retval=CairoSurface_object_new(ce TSRMLS_CC);
1077 retval.handlers = &CairoSVGSurface_handlers;
1078 return retval;
1081 static void class_init_CairoSVGSurface(void)
1083 zend_class_entry ce;
1085 INIT_CLASS_ENTRY(ce, "CairoSVGSurface", CairoSVGSurface_methods);
1086 CairoSVGSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
1087 CairoSVGSurface_ce_ptr->create_object = CairoSVGSurface_object_new;
1088 memcpy(&CairoSVGSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1092 /* }}} Class CairoSVGSurface */
1094 /* {{{ Class CairoWin32Surface */
1096 static zend_class_entry * CairoWin32Surface_ce_ptr = NULL;
1097 static zend_object_handlers CairoWin32Surface_handlers;
1099 /* {{{ Methods */
1102 /* {{{ proto void construct(int hdc)
1104 PHP_METHOD(CairoWin32Surface, __construct)
1106 zend_class_entry * _this_ce;
1107 zval * _this_zval;
1109 long hdc = 0;
1113 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hdc) == FAILURE) {
1114 return;
1117 _this_zval = getThis();
1118 _this_ce = Z_OBJCE_P(_this_zval);
1121 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1124 /* }}} __construct */
1127 static zend_function_entry CairoWin32Surface_methods[] = {
1128 PHP_ME(CairoWin32Surface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1129 { NULL, NULL, NULL }
1132 /* }}} Methods */
1134 static zend_object_value CairoWin32Surface_object_new(zend_class_entry *ce TSRMLS_DC)
1136 zend_object_value retval;
1137 retval=CairoSurface_object_new(ce TSRMLS_CC);
1138 retval.handlers = &CairoWin32Surface_handlers;
1139 return retval;
1142 static void class_init_CairoWin32Surface(void)
1144 zend_class_entry ce;
1146 INIT_CLASS_ENTRY(ce, "CairoWin32Surface", CairoWin32Surface_methods);
1147 CairoWin32Surface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
1148 CairoWin32Surface_ce_ptr->create_object = CairoWin32Surface_object_new;
1149 memcpy(&CairoWin32Surface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1153 /* }}} Class CairoWin32Surface */
1155 /* {{{ Class CairoXlibSurface */
1157 static zend_class_entry * CairoXlibSurface_ce_ptr = NULL;
1158 static zend_object_handlers CairoXlibSurface_handlers;
1159 /* {{{ Methods */
1162 /* {{{ proto void construct()
1164 PHP_METHOD(CairoXlibSurface, __construct)
1166 zend_class_entry * _this_ce;
1167 zval * _this_zval;
1171 if (ZEND_NUM_ARGS()>0) {
1172 WRONG_PARAM_COUNT;
1176 php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE;
1179 /* }}} __construct */
1183 /* {{{ proto int get_depth()
1185 PHP_METHOD(CairoXlibSurface, get_depth)
1187 zend_class_entry * _this_ce;
1189 zval * _this_zval = NULL;
1193 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1194 return;
1197 _this_ce = Z_OBJCE_P(_this_zval);
1200 php_error(E_WARNING, "get_depth: not yet implemented"); RETURN_FALSE;
1202 RETURN_LONG(0);
1204 /* }}} get_depth */
1208 /* {{{ proto int get_height()
1210 PHP_METHOD(CairoXlibSurface, get_height)
1212 zend_class_entry * _this_ce;
1214 zval * _this_zval = NULL;
1218 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1219 return;
1222 _this_ce = Z_OBJCE_P(_this_zval);
1225 php_error(E_WARNING, "get_height: not yet implemented"); RETURN_FALSE;
1227 RETURN_LONG(0);
1229 /* }}} get_height */
1233 /* {{{ proto int get_width()
1235 PHP_METHOD(CairoXlibSurface, get_width)
1237 zend_class_entry * _this_ce;
1239 zval * _this_zval = NULL;
1243 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) {
1244 return;
1247 _this_ce = Z_OBJCE_P(_this_zval);
1250 php_error(E_WARNING, "get_width: not yet implemented"); RETURN_FALSE;
1252 RETURN_LONG(0);
1254 /* }}} get_width */
1257 static zend_function_entry CairoXlibSurface_methods[] = {
1258 PHP_ME(CairoXlibSurface, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
1259 PHP_ME(CairoXlibSurface, get_depth, NULL, /**/ZEND_ACC_PUBLIC)
1260 PHP_ME(CairoXlibSurface, get_height, NULL, /**/ZEND_ACC_PUBLIC)
1261 PHP_ME(CairoXlibSurface, get_width, NULL, /**/ZEND_ACC_PUBLIC)
1262 { NULL, NULL, NULL }
1265 /* }}} Methods */
1267 static zend_object_value CairoXlibSurface_object_new(zend_class_entry *ce TSRMLS_DC)
1269 zend_object_value retval;
1270 retval=CairoSurface_object_new(ce TSRMLS_CC);
1271 retval.handlers = &CairoXlibSurface_handlers;
1272 return retval;
1275 static void class_init_CairoXlibSurface(void)
1277 zend_class_entry ce;
1279 INIT_CLASS_ENTRY(ce, "CairoXlibSurface", CairoXlibSurface_methods);
1280 CairoXlibSurface_ce_ptr = zend_register_internal_class_ex(&ce, CairoSurface_ce_ptr, "CairoSurface" TSRMLS_CC);
1281 CairoXlibSurface_ce_ptr->create_object = CairoXlibSurface_object_new;
1282 memcpy(&CairoXlibSurface_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
1286 /* }}} Class CairoXlibSurface */