1 /* {{{ Class CairoSurface */
3 static zend_class_entry
* CairoSurface_ce_ptr
= NULL
;
4 static zend_object_handlers CairoSurface_handlers
;
7 typedef struct _surface_object {
9 cairo_surface_t *surface;
16 /* {{{ proto void construct() -- Add error
18 PHP_METHOD(CairoSurface
, __construct
)
20 zend_class_entry
* _this_ce
;
25 if (ZEND_NUM_ARGS()>0) {
31 php_print("No direct call for this constructor");
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
;
51 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oill", &_this_zval
, CairoSurface_ce_ptr
, &content
, &width
, &height
) == FAILURE
) {
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
);
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
) {
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
);
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
) {
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
);
108 /* {{{ proto int get_content()
110 PHP_METHOD(CairoSurface
, get_content
)
112 zend_class_entry
* _this_ce
;
114 zval
* _this_zval
= NULL
;
116 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
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
);
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
) {
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
) {
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
;
199 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|llll", &_this_zval
, CairoSurface_ce_ptr
, &x
, &y
, &width
, &height
) == FAILURE
) {
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
) {
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
;
244 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_ppi
, &y_ppi
) == FAILURE
) {
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
;
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
) {
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
)
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
);
312 static zend_object_value
CairoSurface_object_new(zend_class_entry
*ce
)
314 zend_object_value retval
;
315 surface_object
*surface
;
318 surface
= emalloc(sizeof(surface_object
));
319 printf("%d",surface
);
320 memset(surface
,0,sizeof(surface_object
));
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
;
332 static void class_init_CairoSurface(void)
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
;
352 /* {{{ proto void construct(int format, int widthm, int height)
354 PHP_METHOD(CairoImageSurface
, __construct
)
356 zend_class_entry
* _this_ce
;
359 cairo_format_t format
= 0;
365 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "lll", &format
, &widthm
, &height
) == FAILURE
) {
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
;
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
) {
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
);
408 case CAIRO_FORMAT_ARGB32
:
409 case CAIRO_FORMAT_RGB24
:
412 case CAIRO_FORMAT_RGB16_565
:
415 case CAIRO_FORMAT_A8
:
418 case CAIRO_FORMAT_A1
:
419 stride
= (width
+ 1) / 8;
422 //php_error(CairoError, "Unknown format");
427 if (height
* stride
> buffer_len
) {
428 php_error(E_ERROR
,"buffer is not long enough");
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
;
447 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoImageSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
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
) {
477 _this_ce
= Z_OBJCE_P(_this_zval
);
478 php_error(E_WARNING
,"Not Implemented .. not required");
480 RETURN_STRINGL("", 0, 1);
486 /* {{{ proto int get_format()
488 PHP_METHOD(CairoImageSurface
, get_format
)
490 zend_class_entry
* _this_ce
;
492 zval
* _this_zval
= NULL
;
494 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
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
);
507 /* {{{ proto int get_height()
509 PHP_METHOD(CairoImageSurface
, get_height
)
511 zend_class_entry
* _this_ce
;
512 zval
* _this_zval
= NULL
;
515 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
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
);
529 /* {{{ proto int get_stride()
531 PHP_METHOD(CairoImageSurface
, get_stride
)
533 zend_class_entry
* _this_ce
;
534 zval
* _this_zval
= NULL
;
537 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
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
);
551 /* {{{ proto int get_width()
553 PHP_METHOD(CairoImageSurface
, get_width
)
555 zend_class_entry
* _this_ce
;
556 zval
* _this_zval
= NULL
;
559 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
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
);
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
)
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
;
596 static void class_init_CairoImageSurface(void)
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
;
615 /* {{{ proto void construct(string file, float wpts, float hpts)
617 PHP_METHOD(CairoPDFSurface
, __construct
)
619 zend_class_entry
* _this_ce
;
622 const char * file
= NULL
;
629 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "sdd", &file
, &file_len
, &wpts
, &hpts
) == FAILURE
) {
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
;
656 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPDFSurface_ce_ptr
, &wptd
, &hpts
) == FAILURE
) {
660 _this_ce
= Z_OBJCE_P(_this_zval
);
663 php_error(E_WARNING
, "set_size: not yet implemented"); RETURN_FALSE
;
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
)
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
;
685 static void class_init_CairoPDFSurface(void)
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
;
705 /* {{{ proto void construct(string file, float wpts, float hpts)
707 PHP_METHOD(CairoPSSurface
, __construct
)
709 zend_class_entry
* _this_ce
;
712 const char * file
= NULL
;
719 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "sdd", &file
, &file_len
, &wpts
, &hpts
) == FAILURE
) {
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
) {
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
) {
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
) {
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
) {
820 _this_ce
= Z_OBJCE_P(_this_zval
);
823 array_init(return_value
);
826 /* ONLY for CAIRO 1.6 */
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
) {
847 _this_ce
= Z_OBJCE_P(_this_zval
);
851 /* ONLY for CAIRO 1.6*/
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
;
869 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPSSurface_ce_ptr
, &level
) == FAILURE
) {
873 _this_ce
= Z_OBJCE_P(_this_zval
);
877 /* ONLY for CAIRO 1.6 */
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
) {
898 _this_ce
= Z_OBJCE_P(_this_zval
);
902 /* ONLY for CAIRO 1.6 */
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
;
921 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPSSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
925 _this_ce
= Z_OBJCE_P(_this_zval
);
928 php_error(E_WARNING
, "set_size: not yet implemented"); RETURN_FALSE
;
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
)
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
;
957 static void class_init_CairoPSSurface(void)
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
;
976 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
978 PHP_METHOD(CairoQuartzSurface
, __construct
)
980 zend_class_entry
* _this_ce
;
983 double wpixels
= 0.0;
984 double hpixels
= 0.0;
989 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dd|l", &wpixels
, &hpixels
, &format
) == FAILURE
) {
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
}
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
;
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
;
1038 /* {{{ proto void construct(string file, float wpts, float hpts)
1040 PHP_METHOD(CairoSVGSurface
, __construct
)
1042 zend_class_entry
* _this_ce
;
1045 const char * file
= NULL
;
1052 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "sdd", &file
, &file_len
, &wpts
, &hpts
) == FAILURE
) {
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
}
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
;
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
;
1102 /* {{{ proto void construct(int hdc)
1104 PHP_METHOD(CairoWin32Surface
, __construct
)
1106 zend_class_entry
* _this_ce
;
1113 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "l", &hdc
) == FAILURE
) {
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
}
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
;
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
;
1162 /* {{{ proto void construct()
1164 PHP_METHOD(CairoXlibSurface
, __construct
)
1166 zend_class_entry
* _this_ce
;
1171 if (ZEND_NUM_ARGS()>0) {
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
) {
1197 _this_ce
= Z_OBJCE_P(_this_zval
);
1200 php_error(E_WARNING
, "get_depth: not yet implemented"); RETURN_FALSE
;
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
) {
1222 _this_ce
= Z_OBJCE_P(_this_zval
);
1225 php_error(E_WARNING
, "get_height: not yet implemented"); RETURN_FALSE
;
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
) {
1247 _this_ce
= Z_OBJCE_P(_this_zval
);
1250 php_error(E_WARNING
, "get_width: not yet implemented"); RETURN_FALSE
;
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
}
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
;
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 */