1 /* {{{ Class CairoSurface */
3 static zend_class_entry
* CairoSurface_ce_ptr
= NULL
;
4 static zend_object_handlers CairoSurface_handlers
;
7 _write_func(void *closure
, const unsigned char *data
, unsigned int length
)
10 php_stream
*zs
= (php_stream
*)closure
;
11 written
= php_stream_write(zs
, data
, length
);
12 //written = php_stream_write_string(zs, data);
13 printf("%d %d",written
, length
);
15 return CAIRO_STATUS_SUCCESS
;
17 printf("is it an error ?");
18 // CAIRO_STATUS_WRITE_ERROR;
23 _read_func(void *closure
, const unsigned char *data
, unsigned int length
)
26 php_stream
*zs
= (php_stream
*)closure
;
27 //data = emalloc(length);
28 read
= php_stream_read(zs
, data
, length
);
29 printf("%d %d", read
, length
);
31 return CAIRO_STATUS_SUCCESS
;
33 printf("is it an error");
40 typedef struct _surface_object {
42 cairo_surface_t *surface;
49 /* {{{ proto void construct()
51 PHP_METHOD(CairoSurface
, __construct
)
53 zend_class_entry
* _this_ce
;
58 if (ZEND_NUM_ARGS()>0) {
64 php_print("No direct call for this constructor");
72 /* {{{ proto object create_similar(int content, int width, int height)
74 PHP_METHOD(CairoSurface
, create_similar
)
76 zend_class_entry
* _this_ce
;
78 zval
* _this_zval
= NULL
;
84 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oill", &_this_zval
, CairoSurface_ce_ptr
, &content
, &width
, &height
) == FAILURE
) {
88 _this_ce
= Z_OBJCE_P(_this_zval
);
89 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
90 sur
= cairo_surface_create_similar(curr
->surface
, content
, width
, height
);
91 object_init(return_value
);
92 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
96 /* }}} create_similar */
99 /* {{{ proto void finish()
101 PHP_METHOD(CairoSurface
, finish
)
103 zend_class_entry
* _this_ce
;
105 zval
* _this_zval
= NULL
;
107 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
111 _this_ce
= Z_OBJCE_P(_this_zval
);
112 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
113 cairo_surface_finish(curr
->surface
);
119 /* {{{ proto void flush()
121 PHP_METHOD(CairoSurface
, flush
)
123 zend_class_entry
* _this_ce
;
125 zval
* _this_zval
= NULL
;
127 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
131 _this_ce
= Z_OBJCE_P(_this_zval
);
132 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
134 cairo_surface_flush(curr
->surface
);
141 /* {{{ proto int get_content()
143 PHP_METHOD(CairoSurface
, get_content
)
145 zend_class_entry
* _this_ce
;
147 zval
* _this_zval
= NULL
;
149 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
153 _this_ce
= Z_OBJCE_P(_this_zval
);
154 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
156 x
=cairo_surface_get_content(curr
->surface
);
159 /* }}} get_content */
163 /* {{{ proto array get_device_offset()
165 PHP_METHOD(CairoSurface
, get_device_offset
)
167 zend_class_entry
* _this_ce
;
169 zval
* _this_zval
= NULL
;
170 double x_offset
, y_offset
;
172 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
176 _this_ce
= Z_OBJCE_P(_this_zval
);
177 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
179 cairo_surface_get_device_offset(curr
->surface
, &x_offset
, &y_offset
);
181 array_init(return_value
);
182 add_assoc_double(return_value
, "x_offset", x_offset
);
183 add_assoc_double(return_value
, "y_offset", y_offset
);
186 /* }}} get_device_offset */
190 /* {{{ proto object get_font_options()
192 PHP_METHOD(CairoSurface
, get_font_options
)
194 zend_class_entry
* _this_ce
;
196 zval
* _this_zval
= NULL
;
198 cairo_font_options_t
*options
= cairo_font_options_create();
201 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
205 _this_ce
= Z_OBJCE_P(_this_zval
);
206 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
208 cairo_surface_get_font_options(curr
->surface
, options
);
209 object_init(return_value
);
210 fontoptions_object
*fobj
= (fontoptions_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
211 fobj
->fontoptions
=options
;
214 /* }}} get_font_options */
218 /* {{{ proto void mark_dirty_rectangle([int x, int y, int width, int height])
220 PHP_METHOD(CairoSurface
, mark_dirty_rectangle
)
222 zend_class_entry
* _this_ce
;
224 zval
* _this_zval
= NULL
;
232 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|llll", &_this_zval
, CairoSurface_ce_ptr
, &x
, &y
, &width
, &height
) == FAILURE
) {
235 _this_ce
= Z_OBJCE_P(_this_zval
);
236 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
237 cairo_surface_mark_dirty_rectangle(curr
->surface
, x
, y
, width
, height
);
240 /* }}} mark_dirty_rectangle */
244 /* {{{ proto void set_device_offset(float x_offset, float y_offset)
246 PHP_METHOD(CairoSurface
, set_device_offset
)
248 zend_class_entry
* _this_ce
;
250 zval
* _this_zval
= NULL
;
251 double x_offset
= 0.0;
252 double y_offset
= 0.0;
254 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_offset
, &y_offset
) == FAILURE
) {
258 _this_ce
= Z_OBJCE_P(_this_zval
);
259 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
260 cairo_surface_set_device_offset(curr
->surface
, x_offset
, y_offset
);
263 /* }}} set_device_offset */
267 /* {{{ proto void set_fallback_resolution(float x_ppi, float y_ppi)
269 PHP_METHOD(CairoSurface
, set_fallback_resolution
)
271 zend_class_entry
* _this_ce
;
273 zval
* _this_zval
= NULL
;
277 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_ppi
, &y_ppi
) == FAILURE
) {
281 _this_ce
= Z_OBJCE_P(_this_zval
);
282 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
283 cairo_surface_set_fallback_resolution(curr
->surface
, x_ppi
, y_ppi
);
286 /* }}} set_fallback_resolution */
290 /* {{{ proto void write_to_png(string file)
292 PHP_METHOD(CairoSurface
, write_to_png
)
294 zend_class_entry
* _this_ce
;
296 zval
* _this_zval
= NULL
;
297 const char * file
= NULL
;
299 cairo_status_t status
;
301 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
305 _this_ce
= Z_OBJCE_P(_this_zval
);
306 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
307 status
= cairo_surface_write_to_png(curr
->surface
, file
);
310 /* }}} write_to_png */
313 /* {{{ proto void write_to_png_stream(stream file)
315 PHP_METHOD(CairoSurface
, write_to_png_stream
)
317 zend_class_entry
*_this_ce
;
319 zval
*_this_zval
= NULL
;
320 cairo_status_t status
;
325 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoSurface_ce_ptr
, &zstream
)) {
329 _this_ce
= Z_OBJCE_P(_this_zval
);
330 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
331 php_stream_from_zval(stream
, &zstream
);
332 status
= cairo_surface_write_to_png_stream(curr
->surface
, _write_func
, stream
);
339 static zend_function_entry CairoSurface_methods
[] = {
340 PHP_ME(CairoSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
341 PHP_ME(CairoSurface
, create_similar
, CairoSurface__create_similar_args
, /**/ZEND_ACC_PUBLIC
)
342 PHP_ME(CairoSurface
, finish
, NULL
, /**/ZEND_ACC_PUBLIC
)
343 PHP_ME(CairoSurface
, flush
, NULL
, /**/ZEND_ACC_PUBLIC
)
344 PHP_ME(CairoSurface
, get_content
, NULL
, /**/ZEND_ACC_PUBLIC
)
345 PHP_ME(CairoSurface
, get_device_offset
, NULL
, /**/ZEND_ACC_PUBLIC
)
346 PHP_ME(CairoSurface
, get_font_options
, NULL
, /**/ZEND_ACC_PUBLIC
)
347 PHP_ME(CairoSurface
, mark_dirty_rectangle
, CairoSurface__mark_dirty_rectangle_args
, /**/ZEND_ACC_PUBLIC
)
348 PHP_ME(CairoSurface
, set_device_offset
, CairoSurface__set_device_offset_args
, /**/ZEND_ACC_PUBLIC
)
349 PHP_ME(CairoSurface
, set_fallback_resolution
, CairoSurface__set_fallback_resolution_args
, /**/ZEND_ACC_PUBLIC
)
350 PHP_ME(CairoSurface
, write_to_png
, CairoSurface__write_to_png_args
, /**/ZEND_ACC_PUBLIC
)
351 PHP_ME(CairoSurface
, write_to_png_stream
, CairoSurface__write_to_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
358 static void CairoSurface_object_dtor(void *object
)
360 surface_object
*surface
= (surface_object
*)object
;
361 zend_hash_destroy(surface
->std
.properties
);
362 FREE_HASHTABLE(surface
->std
.properties
);
363 if(surface
->surface
){
364 cairo_surface_finish(surface
->surface
);
365 cairo_surface_destroy(surface
->surface
);
371 static zend_object_value
CairoSurface_object_new(zend_class_entry
*ce
)
373 zend_object_value retval
;
374 surface_object
*surface
;
377 surface
= emalloc(sizeof(surface_object
));
378 memset(surface
,0,sizeof(surface_object
));
382 ALLOC_HASHTABLE(surface
->std
.properties
);
383 zend_hash_init(surface
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
, 0);
384 zend_hash_copy(surface
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
,(void *) &temp
, sizeof(zval
*));
385 retval
.handle
=zend_objects_store_put(surface
, NULL
, (zend_objects_free_object_storage_t
)CairoSurface_object_dtor
, NULL TSRMLS_CC
);
386 retval
.handlers
= &CairoSurface_handlers
;
390 static void class_init_CairoSurface(void)
394 INIT_CLASS_ENTRY(ce
, "CairoSurface", CairoSurface_methods
);
395 CairoSurface_ce_ptr
= zend_register_internal_class(&ce
);
396 CairoSurface_ce_ptr
->create_object
= CairoSurface_object_new
;
397 memcpy(&CairoSurface_handlers
, zend_get_std_object_handlers(),sizeof(zend_object_handlers
));
398 CairoSurface_handlers
.clone_obj
= NULL
;
401 /* }}} Class CairoSurface */
403 /* {{{ Class CairoImageSurface -- done :)*/
405 static zend_class_entry
* CairoImageSurface_ce_ptr
= NULL
;
406 static zend_object_handlers CairoImageSurface_handlers
;
410 /* {{{ proto void construct(int format, int widthm, int height)
412 PHP_METHOD(CairoImageSurface
, __construct
)
414 zend_class_entry
* _this_ce
;
417 cairo_format_t format
= 0;
423 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "lll", &format
, &widthm
, &height
) == FAILURE
) {
427 _this_zval
= getThis();
428 _this_ce
= Z_OBJCE_P(_this_zval
);
429 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
430 curr
->surface
= cairo_image_surface_create(format
, widthm
, height
);
433 /* }}} __construct */
437 /* {{{ proto void create_from_data(object obj, int format, int width, int height [, int stride])
439 PHP_METHOD(CairoImageSurface
, create_from_data
)
441 zend_class_entry
* _this_ce
;
443 zval
* _this_zval
= NULL
;
444 const char * buffer
= NULL
;
453 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
) {
457 _this_ce
= Z_OBJCE_P(_this_zval
);
458 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
462 case CAIRO_FORMAT_ARGB32
:
463 case CAIRO_FORMAT_RGB24
:
466 case CAIRO_FORMAT_RGB16_565
:
469 case CAIRO_FORMAT_A8
:
472 case CAIRO_FORMAT_A1
:
473 stride
= (width
+ 1) / 8;
476 //php_error(CairoError, "Unknown format");
481 if (height
* stride
> buffer_len
) {
482 php_error(E_ERROR
,"buffer is not long enough");
485 curr
->surface
= cairo_image_surface_create_for_data(buffer
, format
, width
, height
, stride
);
487 /* }}} create_from_data */
491 /* {{{ proto void create_from_png(string file)
493 PHP_METHOD(CairoImageSurface
, create_from_png
)
495 zend_class_entry
* _this_ce
;
497 zval
* _this_zval
= NULL
;
498 const char * file
= NULL
;
501 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoImageSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
505 _this_ce
= Z_OBJCE_P(_this_zval
);
506 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
508 curr
->surface
= cairo_image_surface_create_from_png(file
);
511 /* }}} create_from_png */
515 /* {{{ proto void create_from_png_stream(stream zstream)
518 PHP_METHOD(CairoImageSurface
, create_from_png_stream
)
520 zend_class_entry
*_this_ce
;
522 zval
*_this_zval
= NULL
;
523 cairo_status_t status
;
528 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoImageSurface_ce_ptr
, &zstream
)) {
532 _this_ce
= Z_OBJCE_P(_this_zval
);
533 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
535 php_stream_from_zval(stream
, &zstream
);
536 curr
->surface
= cairo_image_surface_create_from_png_stream( _read_func
, stream
);
545 /* {{{ proto string get_data() -- not required
547 PHP_METHOD(CairoImageSurface
, get_data
)
549 zend_class_entry
* _this_ce
;
551 zval
* _this_zval
= NULL
;
555 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
559 _this_ce
= Z_OBJCE_P(_this_zval
);
560 php_error(E_WARNING
,"Not Implemented .. not required");
562 RETURN_STRINGL("", 0, 1);
568 /* {{{ proto int get_format()
570 PHP_METHOD(CairoImageSurface
, get_format
)
572 zend_class_entry
* _this_ce
;
574 zval
* _this_zval
= NULL
;
576 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
579 _this_ce
= Z_OBJCE_P(_this_zval
);
580 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
582 x
= cairo_image_surface_get_format(curr
->surface
);
589 /* {{{ proto int get_height()
591 PHP_METHOD(CairoImageSurface
, get_height
)
593 zend_class_entry
* _this_ce
;
594 zval
* _this_zval
= NULL
;
597 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
601 _this_ce
= Z_OBJCE_P(_this_zval
);
602 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
603 x
= cairo_image_surface_get_height(curr
->surface
);
611 /* {{{ proto int get_stride()
613 PHP_METHOD(CairoImageSurface
, get_stride
)
615 zend_class_entry
* _this_ce
;
616 zval
* _this_zval
= NULL
;
619 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
623 _this_ce
= Z_OBJCE_P(_this_zval
);
624 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
625 x
= cairo_image_surface_get_stride(curr
->surface
);
633 /* {{{ proto int get_width()
635 PHP_METHOD(CairoImageSurface
, get_width
)
637 zend_class_entry
* _this_ce
;
638 zval
* _this_zval
= NULL
;
641 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
645 _this_ce
= Z_OBJCE_P(_this_zval
);
647 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
649 x
= cairo_image_surface_get_width(curr
->surface
);
655 static zend_function_entry CairoImageSurface_methods
[] = {
656 PHP_ME(CairoImageSurface
, __construct
, CairoImageSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
657 PHP_ME(CairoImageSurface
, create_from_data
, CairoImageSurface__create_from_data_args
, /**/ZEND_ACC_PUBLIC
)
658 PHP_ME(CairoImageSurface
, create_from_png
, CairoImageSurface__create_from_png_args
, /**/ZEND_ACC_PUBLIC
)
659 PHP_ME(CairoImageSurface
, create_from_png_stream
, CairoImageSurface__create_from_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
660 PHP_ME(CairoImageSurface
, get_data
, NULL
, /**/ZEND_ACC_PUBLIC
)
661 PHP_ME(CairoImageSurface
, get_format
, NULL
, /**/ZEND_ACC_PUBLIC
)
662 PHP_ME(CairoImageSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
663 PHP_ME(CairoImageSurface
, get_stride
, NULL
, /**/ZEND_ACC_PUBLIC
)
664 PHP_ME(CairoImageSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
670 static zend_object_value
CairoImageSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
672 zend_object_value retval
;
673 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
674 retval
.handlers
= &CairoImageSurface_handlers
;
679 static void class_init_CairoImageSurface(void)
683 INIT_CLASS_ENTRY(ce
, "CairoImageSurface", CairoImageSurface_methods
);
684 CairoImageSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
685 CairoImageSurface_ce_ptr
->create_object
= CairoImageSurface_object_new
;
686 memcpy(&CairoImageSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
689 /* }}} Class CairoImageSurface */
691 /* {{{ Class CairoPDFSurface */
693 static zend_class_entry
* CairoPDFSurface_ce_ptr
= NULL
;
694 static zend_object_handlers CairoPDFSurface_handlers
;
698 /* {{{ proto void construct(string file, float wpts, float hpts)
700 PHP_METHOD(CairoPDFSurface
, __construct
)
702 zend_class_entry
* _this_ce
;
704 zval
*zstream
= NULL
;
705 const char * file
= NULL
;
710 int argc
= ZEND_NUM_ARGS();
713 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
714 if(ZEND_NUM_ARGS()== 0 ||
715 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
722 switch(Z_TYPE_P(obj
)) {
724 wpts
= Z_DVAL_P(obj
);
727 wpts
= Z_LVAL_P(obj
);
736 switch(Z_TYPE_P(obj
)) {
738 hpts
= Z_DVAL_P(obj
);
741 hpts
= Z_LVAL_P(obj
);
749 _this_zval
= getThis();
750 _this_ce
= Z_OBJCE_P(_this_zval
);
751 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
754 if(Z_TYPE_P(obj
)==IS_STRING
) {
755 file
= Z_STRVAL_P(obj
);
756 curr
->surface
= cairo_pdf_surface_create(file
, wpts
, hpts
);
758 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
760 php_stream_from_zval(stream
, &zstream
);
761 curr
->surface
= cairo_pdf_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
769 /* }}} __construct */
773 /* {{{ proto void set_size(float wptd, float hpts)
775 PHP_METHOD(CairoPDFSurface
, set_size
)
777 zend_class_entry
* _this_ce
;
779 zval
* _this_zval
= NULL
;
785 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPDFSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
789 _this_ce
= Z_OBJCE_P(_this_zval
);
790 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
791 cairo_pdf_surface_set_size(curr
->surface
, wpts
, hpts
);
797 static zend_function_entry CairoPDFSurface_methods
[] = {
798 PHP_ME(CairoPDFSurface
, __construct
, CairoPDFSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
799 PHP_ME(CairoPDFSurface
, set_size
, CairoPDFSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
805 static zend_object_value
CairoPDFSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
807 zend_object_value retval
;
808 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
809 retval
.handlers
= &CairoPDFSurface_handlers
;
813 static void class_init_CairoPDFSurface(void)
817 INIT_CLASS_ENTRY(ce
, "CairoPDFSurface", CairoPDFSurface_methods
);
818 CairoPDFSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
819 CairoPDFSurface_ce_ptr
->create_object
= CairoPDFSurface_object_new
;
820 memcpy(&CairoPDFSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
824 /* }}} Class CairoPDFSurface */
826 /* {{{ Class CairoPSSurface */
828 static zend_class_entry
* CairoPSSurface_ce_ptr
= NULL
;
829 static zend_object_handlers CairoPSSurface_handlers
;
833 /* {{{ proto void construct(string file | stream stream, float wpts, float hpts)
835 PHP_METHOD(CairoPSSurface
, __construct
)
837 zend_class_entry
* _this_ce
;
839 zval
*zstream
= NULL
;
840 const char * file
= NULL
;
845 int argc
= ZEND_NUM_ARGS();
848 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
849 if(ZEND_NUM_ARGS()== 0 ||
850 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
857 switch(Z_TYPE_P(obj
)) {
859 wpts
= Z_DVAL_P(obj
);
862 wpts
= Z_LVAL_P(obj
);
871 switch(Z_TYPE_P(obj
)) {
873 hpts
= Z_DVAL_P(obj
);
876 hpts
= Z_LVAL_P(obj
);
884 _this_zval
= getThis();
885 _this_ce
= Z_OBJCE_P(_this_zval
);
886 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
889 if(Z_TYPE_P(obj
)==IS_STRING
) {
890 file
= Z_STRVAL_P(obj
);
891 curr
->surface
= cairo_ps_surface_create(file
, wpts
, hpts
);
893 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
895 php_stream_from_zval(stream
, &zstream
);
896 curr
->surface
= cairo_ps_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
908 /* }}} __construct */
912 /* {{{ proto void dsc_begin_page_setup()
914 PHP_METHOD(CairoPSSurface
, dsc_begin_page_setup
)
916 zend_class_entry
* _this_ce
;
918 zval
* _this_zval
= NULL
;
922 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
925 _this_ce
= Z_OBJCE_P(_this_zval
);
926 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
927 cairo_ps_surface_dsc_begin_page_setup(curr
->surface
);
928 phpCAIRO_SURFACE_ERROR(curr
->surface
);
933 /* }}} dsc_begin_page_setup */
937 /* {{{ proto void dsc_begin_setup()
939 PHP_METHOD(CairoPSSurface
, dsc_begin_setup
)
941 zend_class_entry
* _this_ce
;
943 zval
* _this_zval
= NULL
;
947 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
951 _this_ce
= Z_OBJCE_P(_this_zval
);
952 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
953 cairo_ps_surface_dsc_begin_setup(curr
->surface
);
954 phpCAIRO_SURFACE_ERROR(curr
->surface
);
957 /* }}} dsc_begin_setup */
961 /* {{{ proto void dsc_comment()
963 PHP_METHOD(CairoPSSurface
, dsc_comment
)
965 zend_class_entry
* _this_ce
;
967 zval
* _this_zval
= NULL
;
971 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
975 _this_ce
= Z_OBJCE_P(_this_zval
);
976 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
977 cairo_ps_surface_dsc_comment(curr
->surface
);
978 phpCAIRO_SURFACE_ERROR(curr
->surface
);
981 /* }}} dsc_comment */
985 /* {{{ proto array get_levels() -- cairo 1.6
987 PHP_METHOD(CairoPSSurface
, get_levels
)
989 zend_class_entry
* _this_ce
;
991 zval
* _this_zval
= NULL
;
995 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
999 _this_ce
= Z_OBJCE_P(_this_zval
);
1000 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1003 array_init(return_value
);
1006 /* ONLY for CAIRO 1.6 */
1009 /* }}} get_levels */
1013 /* {{{ proto string get_level_string() --cairo 1.6
1015 PHP_METHOD(CairoPSSurface
, get_level_string
)
1017 zend_class_entry
* _this_ce
;
1019 zval
* _this_zval
= NULL
;
1023 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1027 _this_ce
= Z_OBJCE_P(_this_zval
);
1028 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1032 /* ONLY for CAIRO 1.6*/
1035 /* }}} get_level_string */
1039 /* {{{ proto void restrict_to_level(int level) --cairo 1.6
1041 PHP_METHOD(CairoPSSurface
, restrict_to_level
)
1043 zend_class_entry
* _this_ce
;
1045 zval
* _this_zval
= NULL
;
1050 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPSSurface_ce_ptr
, &level
) == FAILURE
) {
1054 _this_ce
= Z_OBJCE_P(_this_zval
);
1055 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1059 /* ONLY for CAIRO 1.6 */
1062 /* }}} restrict_to_level */
1066 /* {{{ proto void set_eps() --cairo 1.6
1068 PHP_METHOD(CairoPSSurface
, set_eps
)
1070 zend_class_entry
* _this_ce
;
1072 zval
* _this_zval
= NULL
;
1076 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1080 _this_ce
= Z_OBJCE_P(_this_zval
);
1081 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1085 /* ONLY for CAIRO 1.6 */
1092 /* {{{ proto void set_size(float wpts, float hpts)
1094 PHP_METHOD(CairoPSSurface
, set_size
)
1096 zend_class_entry
* _this_ce
;
1098 zval
* _this_zval
= NULL
;
1104 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPSSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
1108 _this_ce
= Z_OBJCE_P(_this_zval
);
1109 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1110 cairo_ps_surface_set_size(curr
->surface
, wpts
, hpts
);
1116 static zend_function_entry CairoPSSurface_methods
[] = {
1117 PHP_ME(CairoPSSurface
, __construct
, CairoPSSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1118 PHP_ME(CairoPSSurface
, dsc_begin_page_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1119 PHP_ME(CairoPSSurface
, dsc_begin_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1120 PHP_ME(CairoPSSurface
, dsc_comment
, NULL
, /**/ZEND_ACC_PUBLIC
)
1121 PHP_ME(CairoPSSurface
, get_levels
, NULL
, /**/ZEND_ACC_PUBLIC
)
1122 PHP_ME(CairoPSSurface
, get_level_string
, NULL
, /**/ZEND_ACC_PUBLIC
)
1123 PHP_ME(CairoPSSurface
, restrict_to_level
, CairoPSSurface__restrict_to_level_args
, /**/ZEND_ACC_PUBLIC
)
1124 PHP_ME(CairoPSSurface
, set_eps
, NULL
, /**/ZEND_ACC_PUBLIC
)
1125 PHP_ME(CairoPSSurface
, set_size
, CairoPSSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
1126 { NULL
, NULL
, NULL
}
1131 static zend_object_value
CairoPSSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1133 zend_object_value retval
;
1134 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1135 retval
.handlers
= &CairoPSSurface_handlers
;
1139 static void class_init_CairoPSSurface(void)
1141 zend_class_entry ce
;
1143 INIT_CLASS_ENTRY(ce
, "CairoPSSurface", CairoPSSurface_methods
);
1144 CairoPSSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1145 CairoPSSurface_ce_ptr
->create_object
= CairoPSSurface_object_new
;
1146 memcpy(&CairoPSSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1149 /* }}} Class CairoPSSurface */
1151 /* {{{ Class CairoQuartzSurface */
1153 static zend_class_entry
* CairoQuartzSurface_ce_ptr
= NULL
;
1154 static zend_object_handlers CairoQuartzSurface_handlers
;
1158 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
1160 PHP_METHOD(CairoQuartzSurface
, __construct
)
1162 zend_class_entry
* _this_ce
;
1165 double wpixels
= 0.0;
1166 double hpixels
= 0.0;
1171 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dd|l", &wpixels
, &hpixels
, &format
) == FAILURE
) {
1175 _this_zval
= getThis();
1176 _this_ce
= Z_OBJCE_P(_this_zval
);
1177 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1180 php_error(E_ERROR
, "CANNOT BE CALLED"); RETURN_FALSE
;
1183 /* }}} __construct */
1186 static zend_function_entry CairoQuartzSurface_methods
[] = {
1187 PHP_ME(CairoQuartzSurface
, __construct
, CairoQuartzSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1188 { NULL
, NULL
, NULL
}
1193 static zend_object_value
CairoQuartzSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1195 zend_object_value retval
;
1196 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1197 retval
.handlers
= &CairoQuartzSurface_handlers
;
1201 static void class_init_CairoQuartzSurface(void)
1203 zend_class_entry ce
;
1205 INIT_CLASS_ENTRY(ce
, "CairoQuartzSurface", CairoQuartzSurface_methods
);
1206 CairoQuartzSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1207 CairoQuartzSurface_ce_ptr
->create_object
= CairoQuartzSurface_object_new
;
1208 memcpy(&CairoQuartzSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1212 /* }}} Class CairoQuartzSurface */
1214 /* {{{ Class CairoSVGSurface */
1216 static zend_class_entry
* CairoSVGSurface_ce_ptr
= NULL
;
1217 static zend_object_handlers CairoSVGSurface_handlers
;
1223 /* {{{ proto void construct(string file, float wpts, float hpts)
1225 PHP_METHOD(CairoSVGSurface
, __construct
)
1227 zend_class_entry
* _this_ce
;
1229 zval
*zstream
= NULL
;
1230 const char * file
= NULL
;
1235 int argc
= ZEND_NUM_ARGS();
1238 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
1239 if(ZEND_NUM_ARGS()== 0 ||
1240 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
1247 switch(Z_TYPE_P(obj
)) {
1249 wpts
= Z_DVAL_P(obj
);
1252 wpts
= Z_LVAL_P(obj
);
1261 switch(Z_TYPE_P(obj
)) {
1263 hpts
= Z_DVAL_P(obj
);
1266 hpts
= Z_LVAL_P(obj
);
1274 _this_zval
= getThis();
1275 _this_ce
= Z_OBJCE_P(_this_zval
);
1276 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1279 if(Z_TYPE_P(obj
)==IS_STRING
) {
1280 file
= Z_STRVAL_P(obj
);
1281 curr
->surface
= cairo_svg_surface_create(file
, wpts
, hpts
);
1283 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
1285 php_stream_from_zval(stream
, &zstream
);
1286 curr
->surface
= cairo_svg_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
1296 /* }}} __construct */
1299 static zend_function_entry CairoSVGSurface_methods
[] = {
1300 PHP_ME(CairoSVGSurface
, __construct
, CairoSVGSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1301 { NULL
, NULL
, NULL
}
1306 static zend_object_value
CairoSVGSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1308 zend_object_value retval
;
1309 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1310 retval
.handlers
= &CairoSVGSurface_handlers
;
1314 static void class_init_CairoSVGSurface(void)
1316 zend_class_entry ce
;
1318 INIT_CLASS_ENTRY(ce
, "CairoSVGSurface", CairoSVGSurface_methods
);
1319 CairoSVGSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1320 CairoSVGSurface_ce_ptr
->create_object
= CairoSVGSurface_object_new
;
1321 memcpy(&CairoSVGSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1325 /* }}} Class CairoSVGSurface */
1327 /* {{{ Class CairoWin32Surface -- Have to work on this aswell */
1329 static zend_class_entry
* CairoWin32Surface_ce_ptr
= NULL
;
1330 static zend_object_handlers CairoWin32Surface_handlers
;
1335 /* {{{ proto void construct(int hdc)
1337 PHP_METHOD(CairoWin32Surface
, __construct
)
1339 zend_class_entry
* _this_ce
;
1346 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "l", &hdc
) == FAILURE
) {
1350 _this_zval
= getThis();
1351 _this_ce
= Z_OBJCE_P(_this_zval
);
1352 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1353 curr
->surface
= cairo_win32_surface_create(hdc
, NULL
);
1355 /* }}} __construct */
1358 static zend_function_entry CairoWin32Surface_methods
[] = {
1359 PHP_ME(CairoWin32Surface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1360 { NULL
, NULL
, NULL
}
1365 static zend_object_value
CairoWin32Surface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1367 zend_object_value retval
;
1368 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1369 retval
.handlers
= &CairoWin32Surface_handlers
;
1373 static void class_init_CairoWin32Surface(void)
1375 zend_class_entry ce
;
1377 INIT_CLASS_ENTRY(ce
, "CairoWin32Surface", CairoWin32Surface_methods
);
1378 CairoWin32Surface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1379 CairoWin32Surface_ce_ptr
->create_object
= CairoWin32Surface_object_new
;
1380 memcpy(&CairoWin32Surface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1384 /* }}} Class CairoWin32Surface */
1386 /* {{{ Class CairoXlibSurface */
1388 static zend_class_entry
* CairoXlibSurface_ce_ptr
= NULL
;
1389 static zend_object_handlers CairoXlibSurface_handlers
;
1393 /* {{{ proto void construct()
1395 PHP_METHOD(CairoXlibSurface
, __construct
)
1397 zend_class_entry
* _this_ce
;
1402 if (ZEND_NUM_ARGS()>0) {
1406 _this_zval
= getThis();
1407 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1409 php_error(E_WARNING
, "Cannot Be Initialized"); RETURN_FALSE
;
1412 /* }}} __construct */
1416 /* {{{ proto int get_depth()
1418 PHP_METHOD(CairoXlibSurface
, get_depth
)
1420 zend_class_entry
* _this_ce
;
1422 zval
* _this_zval
= NULL
;
1426 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1430 _this_ce
= Z_OBJCE_P(_this_zval
);
1431 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1433 depth
= cairo_xlib_surface_get_depth(curr
->surface
);
1441 /* {{{ proto int get_height()
1443 PHP_METHOD(CairoXlibSurface
, get_height
)
1445 zend_class_entry
* _this_ce
;
1447 zval
* _this_zval
= NULL
;
1451 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1455 _this_ce
= Z_OBJCE_P(_this_zval
);
1456 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1457 height
= cairo_xlib_surface_get_height(curr
->surface
);
1459 RETURN_LONG(height
);
1461 /* }}} get_height */
1465 /* {{{ proto int get_width()
1467 PHP_METHOD(CairoXlibSurface
, get_width
)
1469 zend_class_entry
* _this_ce
;
1471 zval
* _this_zval
= NULL
;
1475 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1479 _this_ce
= Z_OBJCE_P(_this_zval
);
1480 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1481 width
= cairo_xlib_surface_get_width(curr
->surface
);
1488 static zend_function_entry CairoXlibSurface_methods
[] = {
1489 PHP_ME(CairoXlibSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1490 PHP_ME(CairoXlibSurface
, get_depth
, NULL
, /**/ZEND_ACC_PUBLIC
)
1491 PHP_ME(CairoXlibSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
1492 PHP_ME(CairoXlibSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
1493 { NULL
, NULL
, NULL
}
1498 static zend_object_value
CairoXlibSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1500 zend_object_value retval
;
1501 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1502 retval
.handlers
= &CairoXlibSurface_handlers
;
1506 static void class_init_CairoXlibSurface(void)
1508 zend_class_entry ce
;
1510 INIT_CLASS_ENTRY(ce
, "CairoXlibSurface", CairoXlibSurface_methods
);
1511 CairoXlibSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1512 CairoXlibSurface_ce_ptr
->create_object
= CairoXlibSurface_object_new
;
1513 memcpy(&CairoXlibSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1517 /* }}} Class CairoXlibSurface */
1519 /* {{{ Helper Functions */
1521 get_CairoSurface_ce_ptr(cairo_surface_t
*surface
)
1523 zend_class_entry
*type
;
1527 switch(cairo_surface_get_type(surface
)) {
1528 case CAIRO_SURFACE_TYPE_IMAGE
:
1529 type
= CairoImageSurface_ce_ptr
;
1531 case CAIRO_SURFACE_TYPE_PDF
:
1532 type
= CairoPDFSurface_ce_ptr
;
1534 case CAIRO_SURFACE_TYPE_PS
:
1535 type
= CairoPSSurface_ce_ptr
;
1537 case CAIRO_SURFACE_TYPE_SVG
:
1538 type
= CairoSVGSurface_ce_ptr
;
1540 case CAIRO_SURFACE_TYPE_WIN32
:
1541 type
= CairoWin32Surface_ce_ptr
;
1543 case CAIRO_SURFACE_TYPE_XLIB
:
1544 type
= CairoXlibSurface_ce_ptr
;
1546 case CAIRO_SURFACE_TYPE_QUARTZ
:
1547 type
= CairoQuartzSurface_ce_ptr
;
1550 php_error(E_ERROR
,"Unsupported Surface Type");
1556 /* }}} Helper Function*/