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
, *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 ce
= getCairoSurface_ce_ptr(sur
);
92 object_init_ex(return_value
, ce
);
93 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
97 /* }}} create_similar */
100 /* {{{ proto void finish()
102 PHP_METHOD(CairoSurface
, finish
)
104 zend_class_entry
* _this_ce
;
106 zval
* _this_zval
= NULL
;
108 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
112 _this_ce
= Z_OBJCE_P(_this_zval
);
113 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
114 cairo_surface_finish(curr
->surface
);
120 /* {{{ proto void flush()
122 PHP_METHOD(CairoSurface
, flush
)
124 zend_class_entry
* _this_ce
;
126 zval
* _this_zval
= NULL
;
128 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
132 _this_ce
= Z_OBJCE_P(_this_zval
);
133 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
135 cairo_surface_flush(curr
->surface
);
142 /* {{{ proto int get_content()
144 PHP_METHOD(CairoSurface
, get_content
)
146 zend_class_entry
* _this_ce
;
148 zval
* _this_zval
= NULL
;
150 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
154 _this_ce
= Z_OBJCE_P(_this_zval
);
155 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
157 x
=cairo_surface_get_content(curr
->surface
);
160 /* }}} get_content */
164 /* {{{ proto array get_device_offset()
166 PHP_METHOD(CairoSurface
, get_device_offset
)
168 zend_class_entry
* _this_ce
;
170 zval
* _this_zval
= NULL
;
171 double x_offset
, y_offset
;
173 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
177 _this_ce
= Z_OBJCE_P(_this_zval
);
178 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
180 cairo_surface_get_device_offset(curr
->surface
, &x_offset
, &y_offset
);
182 array_init(return_value
);
183 add_assoc_double(return_value
, "x_offset", x_offset
);
184 add_assoc_double(return_value
, "y_offset", y_offset
);
187 /* }}} get_device_offset */
191 /* {{{ proto object get_font_options()
193 PHP_METHOD(CairoSurface
, get_font_options
)
195 zend_class_entry
* _this_ce
;
197 zval
* _this_zval
= NULL
;
199 cairo_font_options_t
*options
= cairo_font_options_create();
202 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
206 _this_ce
= Z_OBJCE_P(_this_zval
);
207 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
209 cairo_surface_get_font_options(curr
->surface
, options
);
210 object_init_ex(return_value
, CairoFontOptions_ce_ptr
);
211 fontoptions_object
*fobj
= (fontoptions_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
212 fobj
->fontoptions
=options
;
215 /* }}} get_font_options */
219 /* {{{ proto void mark_dirty_rectangle([int x, int y, int width, int height])
221 PHP_METHOD(CairoSurface
, mark_dirty_rectangle
)
223 zend_class_entry
* _this_ce
;
225 zval
* _this_zval
= NULL
;
233 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|llll", &_this_zval
, CairoSurface_ce_ptr
, &x
, &y
, &width
, &height
) == FAILURE
) {
236 _this_ce
= Z_OBJCE_P(_this_zval
);
237 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
238 cairo_surface_mark_dirty_rectangle(curr
->surface
, x
, y
, width
, height
);
241 /* }}} mark_dirty_rectangle */
245 /* {{{ proto void set_device_offset(float x_offset, float y_offset)
247 PHP_METHOD(CairoSurface
, set_device_offset
)
249 zend_class_entry
* _this_ce
;
251 zval
* _this_zval
= NULL
;
252 double x_offset
= 0.0;
253 double y_offset
= 0.0;
255 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_offset
, &y_offset
) == FAILURE
) {
259 _this_ce
= Z_OBJCE_P(_this_zval
);
260 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
261 cairo_surface_set_device_offset(curr
->surface
, x_offset
, y_offset
);
264 /* }}} set_device_offset */
268 /* {{{ proto void set_fallback_resolution(float x_ppi, float y_ppi)
270 PHP_METHOD(CairoSurface
, set_fallback_resolution
)
272 zend_class_entry
* _this_ce
;
274 zval
* _this_zval
= NULL
;
278 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_ppi
, &y_ppi
) == FAILURE
) {
282 _this_ce
= Z_OBJCE_P(_this_zval
);
283 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
284 cairo_surface_set_fallback_resolution(curr
->surface
, x_ppi
, y_ppi
);
287 /* }}} set_fallback_resolution */
291 /* {{{ proto void write_to_png(string file)
293 PHP_METHOD(CairoSurface
, write_to_png
)
295 zend_class_entry
* _this_ce
;
297 zval
* _this_zval
= NULL
;
298 const char * file
= NULL
;
300 cairo_status_t status
;
302 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
306 _this_ce
= Z_OBJCE_P(_this_zval
);
307 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
308 status
= cairo_surface_write_to_png(curr
->surface
, file
);
311 /* }}} write_to_png */
314 /* {{{ proto void write_to_png_stream(stream file)
316 PHP_METHOD(CairoSurface
, write_to_png_stream
)
318 zend_class_entry
*_this_ce
;
320 zval
*_this_zval
= NULL
;
321 cairo_status_t status
;
326 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoSurface_ce_ptr
, &zstream
)) {
330 _this_ce
= Z_OBJCE_P(_this_zval
);
331 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
332 php_stream_from_zval(stream
, &zstream
);
333 status
= cairo_surface_write_to_png_stream(curr
->surface
, _write_func
, stream
);
340 static zend_function_entry CairoSurface_methods
[] = {
341 PHP_ME(CairoSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
342 PHP_ME(CairoSurface
, create_similar
, CairoSurface__create_similar_args
, /**/ZEND_ACC_PUBLIC
)
343 PHP_ME(CairoSurface
, finish
, NULL
, /**/ZEND_ACC_PUBLIC
)
344 PHP_ME(CairoSurface
, flush
, NULL
, /**/ZEND_ACC_PUBLIC
)
345 PHP_ME(CairoSurface
, get_content
, NULL
, /**/ZEND_ACC_PUBLIC
)
346 PHP_ME(CairoSurface
, get_device_offset
, NULL
, /**/ZEND_ACC_PUBLIC
)
347 PHP_ME(CairoSurface
, get_font_options
, NULL
, /**/ZEND_ACC_PUBLIC
)
348 PHP_ME(CairoSurface
, mark_dirty_rectangle
, CairoSurface__mark_dirty_rectangle_args
, /**/ZEND_ACC_PUBLIC
)
349 PHP_ME(CairoSurface
, set_device_offset
, CairoSurface__set_device_offset_args
, /**/ZEND_ACC_PUBLIC
)
350 PHP_ME(CairoSurface
, set_fallback_resolution
, CairoSurface__set_fallback_resolution_args
, /**/ZEND_ACC_PUBLIC
)
351 PHP_ME(CairoSurface
, write_to_png
, CairoSurface__write_to_png_args
, /**/ZEND_ACC_PUBLIC
)
352 PHP_ME(CairoSurface
, write_to_png_stream
, CairoSurface__write_to_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
359 static void CairoSurface_object_dtor(void *object
)
361 surface_object
*surface
= (surface_object
*)object
;
362 zend_hash_destroy(surface
->std
.properties
);
363 FREE_HASHTABLE(surface
->std
.properties
);
364 if(surface
->surface
){
365 cairo_surface_finish(surface
->surface
);
366 cairo_surface_destroy(surface
->surface
);
372 static zend_object_value
CairoSurface_object_new(zend_class_entry
*ce
)
374 zend_object_value retval
;
375 surface_object
*surface
;
378 surface
= emalloc(sizeof(surface_object
));
379 memset(surface
,0,sizeof(surface_object
));
383 ALLOC_HASHTABLE(surface
->std
.properties
);
384 zend_hash_init(surface
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
, 0);
385 zend_hash_copy(surface
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
,(void *) &temp
, sizeof(zval
*));
386 retval
.handle
=zend_objects_store_put(surface
, NULL
, (zend_objects_free_object_storage_t
)CairoSurface_object_dtor
, NULL TSRMLS_CC
);
387 retval
.handlers
= &CairoSurface_handlers
;
391 static void class_init_CairoSurface(void)
395 INIT_CLASS_ENTRY(ce
, "CairoSurface", CairoSurface_methods
);
396 CairoSurface_ce_ptr
= zend_register_internal_class(&ce
);
397 CairoSurface_ce_ptr
->create_object
= CairoSurface_object_new
;
398 memcpy(&CairoSurface_handlers
, zend_get_std_object_handlers(),sizeof(zend_object_handlers
));
399 CairoSurface_handlers
.clone_obj
= NULL
;
402 /* }}} Class CairoSurface */
404 /* {{{ Class CairoImageSurface -- done :)*/
406 static zend_class_entry
* CairoImageSurface_ce_ptr
= NULL
;
407 static zend_object_handlers CairoImageSurface_handlers
;
411 /* {{{ proto void construct(int format, int widthm, int height)
413 PHP_METHOD(CairoImageSurface
, __construct
)
415 zend_class_entry
* _this_ce
;
418 cairo_format_t format
= 0;
424 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "lll", &format
, &widthm
, &height
) == FAILURE
) {
428 _this_zval
= getThis();
429 _this_ce
= Z_OBJCE_P(_this_zval
);
430 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
431 curr
->surface
= cairo_image_surface_create(format
, widthm
, height
);
434 /* }}} __construct */
438 /* {{{ proto void create_from_data(object obj, int format, int width, int height [, int stride])
440 PHP_METHOD(CairoImageSurface
, create_from_data
)
442 zend_class_entry
* _this_ce
;
444 zval
* _this_zval
= NULL
;
445 const char * buffer
= NULL
;
454 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
) {
458 _this_ce
= Z_OBJCE_P(_this_zval
);
459 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
463 case CAIRO_FORMAT_ARGB32
:
464 case CAIRO_FORMAT_RGB24
:
467 case CAIRO_FORMAT_RGB16_565
:
470 case CAIRO_FORMAT_A8
:
473 case CAIRO_FORMAT_A1
:
474 stride
= (width
+ 1) / 8;
477 //php_error(CairoError, "Unknown format");
482 if (height
* stride
> buffer_len
) {
483 php_error(E_ERROR
,"buffer is not long enough");
486 curr
->surface
= cairo_image_surface_create_for_data(buffer
, format
, width
, height
, stride
);
488 /* }}} create_from_data */
492 /* {{{ proto void create_from_png(string file)
494 PHP_METHOD(CairoImageSurface
, create_from_png
)
496 zend_class_entry
* _this_ce
;
498 zval
* _this_zval
= NULL
;
499 const char * file
= NULL
;
502 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoImageSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
506 _this_ce
= Z_OBJCE_P(_this_zval
);
507 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
509 curr
->surface
= cairo_image_surface_create_from_png(file
);
512 /* }}} create_from_png */
516 /* {{{ proto void create_from_png_stream(stream zstream)
519 PHP_METHOD(CairoImageSurface
, create_from_png_stream
)
521 zend_class_entry
*_this_ce
;
523 zval
*_this_zval
= NULL
;
524 cairo_status_t status
;
529 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoImageSurface_ce_ptr
, &zstream
)) {
533 _this_ce
= Z_OBJCE_P(_this_zval
);
534 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
536 php_stream_from_zval(stream
, &zstream
);
537 curr
->surface
= cairo_image_surface_create_from_png_stream( _read_func
, stream
);
546 /* {{{ proto string get_data() -- not required
548 PHP_METHOD(CairoImageSurface
, get_data
)
550 zend_class_entry
* _this_ce
;
552 zval
* _this_zval
= NULL
;
556 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
560 _this_ce
= Z_OBJCE_P(_this_zval
);
561 php_error(E_WARNING
,"Not Implemented .. not required");
563 RETURN_STRINGL("", 0, 1);
569 /* {{{ proto int get_format()
571 PHP_METHOD(CairoImageSurface
, get_format
)
573 zend_class_entry
* _this_ce
;
575 zval
* _this_zval
= NULL
;
577 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
580 _this_ce
= Z_OBJCE_P(_this_zval
);
581 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
583 x
= cairo_image_surface_get_format(curr
->surface
);
590 /* {{{ proto int get_height()
592 PHP_METHOD(CairoImageSurface
, get_height
)
594 zend_class_entry
* _this_ce
;
595 zval
* _this_zval
= NULL
;
598 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
602 _this_ce
= Z_OBJCE_P(_this_zval
);
603 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
604 x
= cairo_image_surface_get_height(curr
->surface
);
612 /* {{{ proto int get_stride()
614 PHP_METHOD(CairoImageSurface
, get_stride
)
616 zend_class_entry
* _this_ce
;
617 zval
* _this_zval
= NULL
;
620 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
624 _this_ce
= Z_OBJCE_P(_this_zval
);
625 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
626 x
= cairo_image_surface_get_stride(curr
->surface
);
634 /* {{{ proto int get_width()
636 PHP_METHOD(CairoImageSurface
, get_width
)
638 zend_class_entry
* _this_ce
;
639 zval
* _this_zval
= NULL
;
642 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
646 _this_ce
= Z_OBJCE_P(_this_zval
);
648 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
650 x
= cairo_image_surface_get_width(curr
->surface
);
656 static zend_function_entry CairoImageSurface_methods
[] = {
657 PHP_ME(CairoImageSurface
, __construct
, CairoImageSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
658 PHP_ME(CairoImageSurface
, create_from_data
, CairoImageSurface__create_from_data_args
, /**/ZEND_ACC_PUBLIC
)
659 PHP_ME(CairoImageSurface
, create_from_png
, CairoImageSurface__create_from_png_args
, /**/ZEND_ACC_PUBLIC
)
660 PHP_ME(CairoImageSurface
, create_from_png_stream
, CairoImageSurface__create_from_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
661 PHP_ME(CairoImageSurface
, get_data
, NULL
, /**/ZEND_ACC_PUBLIC
)
662 PHP_ME(CairoImageSurface
, get_format
, NULL
, /**/ZEND_ACC_PUBLIC
)
663 PHP_ME(CairoImageSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
664 PHP_ME(CairoImageSurface
, get_stride
, NULL
, /**/ZEND_ACC_PUBLIC
)
665 PHP_ME(CairoImageSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
671 static zend_object_value
CairoImageSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
673 zend_object_value retval
;
674 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
675 retval
.handlers
= &CairoImageSurface_handlers
;
680 static void class_init_CairoImageSurface(void)
684 INIT_CLASS_ENTRY(ce
, "CairoImageSurface", CairoImageSurface_methods
);
685 CairoImageSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
686 CairoImageSurface_ce_ptr
->create_object
= CairoImageSurface_object_new
;
687 memcpy(&CairoImageSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
690 /* }}} Class CairoImageSurface */
692 /* {{{ Class CairoPDFSurface */
694 static zend_class_entry
* CairoPDFSurface_ce_ptr
= NULL
;
695 static zend_object_handlers CairoPDFSurface_handlers
;
699 /* {{{ proto void construct(string file, float wpts, float hpts)
701 PHP_METHOD(CairoPDFSurface
, __construct
)
703 zend_class_entry
* _this_ce
;
705 zval
*zstream
= NULL
;
706 const char * file
= NULL
;
711 int argc
= ZEND_NUM_ARGS();
714 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
715 if(ZEND_NUM_ARGS()== 0 ||
716 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
723 switch(Z_TYPE_P(obj
)) {
725 wpts
= Z_DVAL_P(obj
);
728 wpts
= Z_LVAL_P(obj
);
737 switch(Z_TYPE_P(obj
)) {
739 hpts
= Z_DVAL_P(obj
);
742 hpts
= Z_LVAL_P(obj
);
750 _this_zval
= getThis();
751 _this_ce
= Z_OBJCE_P(_this_zval
);
752 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
755 if(Z_TYPE_P(obj
)==IS_STRING
) {
756 file
= Z_STRVAL_P(obj
);
757 curr
->surface
= cairo_pdf_surface_create(file
, wpts
, hpts
);
759 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
761 php_stream_from_zval(stream
, &zstream
);
762 curr
->surface
= cairo_pdf_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
770 /* }}} __construct */
774 /* {{{ proto void set_size(float wptd, float hpts)
776 PHP_METHOD(CairoPDFSurface
, set_size
)
778 zend_class_entry
* _this_ce
;
780 zval
* _this_zval
= NULL
;
786 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPDFSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
790 _this_ce
= Z_OBJCE_P(_this_zval
);
791 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
792 cairo_pdf_surface_set_size(curr
->surface
, wpts
, hpts
);
798 static zend_function_entry CairoPDFSurface_methods
[] = {
799 PHP_ME(CairoPDFSurface
, __construct
, CairoPDFSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
800 PHP_ME(CairoPDFSurface
, set_size
, CairoPDFSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
806 static zend_object_value
CairoPDFSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
808 zend_object_value retval
;
809 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
810 retval
.handlers
= &CairoPDFSurface_handlers
;
814 static void class_init_CairoPDFSurface(void)
818 INIT_CLASS_ENTRY(ce
, "CairoPDFSurface", CairoPDFSurface_methods
);
819 CairoPDFSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
820 CairoPDFSurface_ce_ptr
->create_object
= CairoPDFSurface_object_new
;
821 memcpy(&CairoPDFSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
825 /* }}} Class CairoPDFSurface */
827 /* {{{ Class CairoPSSurface */
829 static zend_class_entry
* CairoPSSurface_ce_ptr
= NULL
;
830 static zend_object_handlers CairoPSSurface_handlers
;
834 /* {{{ proto void construct(string file | stream stream, float wpts, float hpts)
836 PHP_METHOD(CairoPSSurface
, __construct
)
838 zend_class_entry
* _this_ce
;
840 zval
*zstream
= NULL
;
841 const char * file
= NULL
;
846 int argc
= ZEND_NUM_ARGS();
849 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
850 if(ZEND_NUM_ARGS()== 0 ||
851 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
858 switch(Z_TYPE_P(obj
)) {
860 wpts
= Z_DVAL_P(obj
);
863 wpts
= Z_LVAL_P(obj
);
872 switch(Z_TYPE_P(obj
)) {
874 hpts
= Z_DVAL_P(obj
);
877 hpts
= Z_LVAL_P(obj
);
885 _this_zval
= getThis();
886 _this_ce
= Z_OBJCE_P(_this_zval
);
887 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
890 if(Z_TYPE_P(obj
)==IS_STRING
) {
891 file
= Z_STRVAL_P(obj
);
892 curr
->surface
= cairo_ps_surface_create(file
, wpts
, hpts
);
894 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
896 php_stream_from_zval(stream
, &zstream
);
897 curr
->surface
= cairo_ps_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
909 /* }}} __construct */
913 /* {{{ proto void dsc_begin_page_setup()
915 PHP_METHOD(CairoPSSurface
, dsc_begin_page_setup
)
917 zend_class_entry
* _this_ce
;
919 zval
* _this_zval
= NULL
;
923 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
926 _this_ce
= Z_OBJCE_P(_this_zval
);
927 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
928 cairo_ps_surface_dsc_begin_page_setup(curr
->surface
);
929 phpCAIRO_SURFACE_ERROR(curr
->surface
);
934 /* }}} dsc_begin_page_setup */
938 /* {{{ proto void dsc_begin_setup()
940 PHP_METHOD(CairoPSSurface
, dsc_begin_setup
)
942 zend_class_entry
* _this_ce
;
944 zval
* _this_zval
= NULL
;
948 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
952 _this_ce
= Z_OBJCE_P(_this_zval
);
953 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
954 cairo_ps_surface_dsc_begin_setup(curr
->surface
);
955 phpCAIRO_SURFACE_ERROR(curr
->surface
);
958 /* }}} dsc_begin_setup */
962 /* {{{ proto void dsc_comment()
964 PHP_METHOD(CairoPSSurface
, dsc_comment
)
966 zend_class_entry
* _this_ce
;
968 zval
* _this_zval
= NULL
;
972 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
976 _this_ce
= Z_OBJCE_P(_this_zval
);
977 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
978 cairo_ps_surface_dsc_comment(curr
->surface
);
979 phpCAIRO_SURFACE_ERROR(curr
->surface
);
982 /* }}} dsc_comment */
986 /* {{{ proto array get_levels() -- cairo 1.6
988 PHP_METHOD(CairoPSSurface
, get_levels
)
990 zend_class_entry
* _this_ce
;
992 zval
* _this_zval
= NULL
;
996 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1000 _this_ce
= Z_OBJCE_P(_this_zval
);
1001 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1004 array_init(return_value
);
1007 /* ONLY for CAIRO 1.6 */
1010 /* }}} get_levels */
1014 /* {{{ proto string get_level_string() --cairo 1.6
1016 PHP_METHOD(CairoPSSurface
, get_level_string
)
1018 zend_class_entry
* _this_ce
;
1020 zval
* _this_zval
= NULL
;
1024 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1028 _this_ce
= Z_OBJCE_P(_this_zval
);
1029 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1033 /* ONLY for CAIRO 1.6*/
1036 /* }}} get_level_string */
1040 /* {{{ proto void restrict_to_level(int level) --cairo 1.6
1042 PHP_METHOD(CairoPSSurface
, restrict_to_level
)
1044 zend_class_entry
* _this_ce
;
1046 zval
* _this_zval
= NULL
;
1051 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPSSurface_ce_ptr
, &level
) == FAILURE
) {
1055 _this_ce
= Z_OBJCE_P(_this_zval
);
1056 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1060 /* ONLY for CAIRO 1.6 */
1063 /* }}} restrict_to_level */
1067 /* {{{ proto void set_eps() --cairo 1.6
1069 PHP_METHOD(CairoPSSurface
, set_eps
)
1071 zend_class_entry
* _this_ce
;
1073 zval
* _this_zval
= NULL
;
1077 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1081 _this_ce
= Z_OBJCE_P(_this_zval
);
1082 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1086 /* ONLY for CAIRO 1.6 */
1093 /* {{{ proto void set_size(float wpts, float hpts)
1095 PHP_METHOD(CairoPSSurface
, set_size
)
1097 zend_class_entry
* _this_ce
;
1099 zval
* _this_zval
= NULL
;
1105 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPSSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
1109 _this_ce
= Z_OBJCE_P(_this_zval
);
1110 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1111 cairo_ps_surface_set_size(curr
->surface
, wpts
, hpts
);
1117 static zend_function_entry CairoPSSurface_methods
[] = {
1118 PHP_ME(CairoPSSurface
, __construct
, CairoPSSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1119 PHP_ME(CairoPSSurface
, dsc_begin_page_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1120 PHP_ME(CairoPSSurface
, dsc_begin_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1121 PHP_ME(CairoPSSurface
, dsc_comment
, NULL
, /**/ZEND_ACC_PUBLIC
)
1122 PHP_ME(CairoPSSurface
, get_levels
, NULL
, /**/ZEND_ACC_PUBLIC
)
1123 PHP_ME(CairoPSSurface
, get_level_string
, NULL
, /**/ZEND_ACC_PUBLIC
)
1124 PHP_ME(CairoPSSurface
, restrict_to_level
, CairoPSSurface__restrict_to_level_args
, /**/ZEND_ACC_PUBLIC
)
1125 PHP_ME(CairoPSSurface
, set_eps
, NULL
, /**/ZEND_ACC_PUBLIC
)
1126 PHP_ME(CairoPSSurface
, set_size
, CairoPSSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
1127 { NULL
, NULL
, NULL
}
1132 static zend_object_value
CairoPSSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1134 zend_object_value retval
;
1135 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1136 retval
.handlers
= &CairoPSSurface_handlers
;
1140 static void class_init_CairoPSSurface(void)
1142 zend_class_entry ce
;
1144 INIT_CLASS_ENTRY(ce
, "CairoPSSurface", CairoPSSurface_methods
);
1145 CairoPSSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1146 CairoPSSurface_ce_ptr
->create_object
= CairoPSSurface_object_new
;
1147 memcpy(&CairoPSSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1150 /* }}} Class CairoPSSurface */
1152 /* {{{ Class CairoQuartzSurface */
1154 static zend_class_entry
* CairoQuartzSurface_ce_ptr
= NULL
;
1155 static zend_object_handlers CairoQuartzSurface_handlers
;
1159 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
1161 PHP_METHOD(CairoQuartzSurface
, __construct
)
1163 zend_class_entry
* _this_ce
;
1166 double wpixels
= 0.0;
1167 double hpixels
= 0.0;
1172 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dd|l", &wpixels
, &hpixels
, &format
) == FAILURE
) {
1176 _this_zval
= getThis();
1177 _this_ce
= Z_OBJCE_P(_this_zval
);
1178 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1181 php_error(E_ERROR
, "CANNOT BE CALLED"); RETURN_FALSE
;
1184 /* }}} __construct */
1187 static zend_function_entry CairoQuartzSurface_methods
[] = {
1188 PHP_ME(CairoQuartzSurface
, __construct
, CairoQuartzSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1189 { NULL
, NULL
, NULL
}
1194 static zend_object_value
CairoQuartzSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1196 zend_object_value retval
;
1197 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1198 retval
.handlers
= &CairoQuartzSurface_handlers
;
1202 static void class_init_CairoQuartzSurface(void)
1204 zend_class_entry ce
;
1206 INIT_CLASS_ENTRY(ce
, "CairoQuartzSurface", CairoQuartzSurface_methods
);
1207 CairoQuartzSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1208 CairoQuartzSurface_ce_ptr
->create_object
= CairoQuartzSurface_object_new
;
1209 memcpy(&CairoQuartzSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1213 /* }}} Class CairoQuartzSurface */
1215 /* {{{ Class CairoSVGSurface */
1217 static zend_class_entry
* CairoSVGSurface_ce_ptr
= NULL
;
1218 static zend_object_handlers CairoSVGSurface_handlers
;
1224 /* {{{ proto void construct(string file, float wpts, float hpts)
1226 PHP_METHOD(CairoSVGSurface
, __construct
)
1228 zend_class_entry
* _this_ce
;
1230 zval
*zstream
= NULL
;
1231 const char * file
= NULL
;
1236 int argc
= ZEND_NUM_ARGS();
1239 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
1240 if(ZEND_NUM_ARGS()== 0 ||
1241 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
1248 switch(Z_TYPE_P(obj
)) {
1250 wpts
= Z_DVAL_P(obj
);
1253 wpts
= Z_LVAL_P(obj
);
1262 switch(Z_TYPE_P(obj
)) {
1264 hpts
= Z_DVAL_P(obj
);
1267 hpts
= Z_LVAL_P(obj
);
1275 _this_zval
= getThis();
1276 _this_ce
= Z_OBJCE_P(_this_zval
);
1277 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1280 if(Z_TYPE_P(obj
)==IS_STRING
) {
1281 file
= Z_STRVAL_P(obj
);
1282 curr
->surface
= cairo_svg_surface_create(file
, wpts
, hpts
);
1284 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
1286 php_stream_from_zval(stream
, &zstream
);
1287 curr
->surface
= cairo_svg_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
1297 /* }}} __construct */
1300 static zend_function_entry CairoSVGSurface_methods
[] = {
1301 PHP_ME(CairoSVGSurface
, __construct
, CairoSVGSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1302 { NULL
, NULL
, NULL
}
1307 static zend_object_value
CairoSVGSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1309 zend_object_value retval
;
1310 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1311 retval
.handlers
= &CairoSVGSurface_handlers
;
1315 static void class_init_CairoSVGSurface(void)
1317 zend_class_entry ce
;
1319 INIT_CLASS_ENTRY(ce
, "CairoSVGSurface", CairoSVGSurface_methods
);
1320 CairoSVGSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1321 CairoSVGSurface_ce_ptr
->create_object
= CairoSVGSurface_object_new
;
1322 memcpy(&CairoSVGSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1326 /* }}} Class CairoSVGSurface */
1328 /* {{{ Class CairoWin32Surface -- Have to work on this aswell */
1330 static zend_class_entry
* CairoWin32Surface_ce_ptr
= NULL
;
1331 static zend_object_handlers CairoWin32Surface_handlers
;
1336 /* {{{ proto void construct(int hdc)
1338 PHP_METHOD(CairoWin32Surface
, __construct
)
1340 zend_class_entry
* _this_ce
;
1347 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "l", &hdc
) == FAILURE
) {
1351 _this_zval
= getThis();
1352 _this_ce
= Z_OBJCE_P(_this_zval
);
1353 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1354 curr
->surface
= cairo_win32_surface_create(hdc
, NULL
);
1356 /* }}} __construct */
1359 static zend_function_entry CairoWin32Surface_methods
[] = {
1360 PHP_ME(CairoWin32Surface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1361 { NULL
, NULL
, NULL
}
1366 static zend_object_value
CairoWin32Surface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1368 zend_object_value retval
;
1369 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1370 retval
.handlers
= &CairoWin32Surface_handlers
;
1374 static void class_init_CairoWin32Surface(void)
1376 zend_class_entry ce
;
1378 INIT_CLASS_ENTRY(ce
, "CairoWin32Surface", CairoWin32Surface_methods
);
1379 CairoWin32Surface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1380 CairoWin32Surface_ce_ptr
->create_object
= CairoWin32Surface_object_new
;
1381 memcpy(&CairoWin32Surface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1385 /* }}} Class CairoWin32Surface */
1387 /* {{{ Class CairoXlibSurface */
1389 static zend_class_entry
* CairoXlibSurface_ce_ptr
= NULL
;
1390 static zend_object_handlers CairoXlibSurface_handlers
;
1394 /* {{{ proto void construct()
1396 PHP_METHOD(CairoXlibSurface
, __construct
)
1398 zend_class_entry
* _this_ce
;
1403 if (ZEND_NUM_ARGS()>0) {
1407 _this_zval
= getThis();
1408 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1410 php_error(E_WARNING
, "Cannot Be Initialized"); RETURN_FALSE
;
1413 /* }}} __construct */
1417 /* {{{ proto int get_depth()
1419 PHP_METHOD(CairoXlibSurface
, get_depth
)
1421 zend_class_entry
* _this_ce
;
1423 zval
* _this_zval
= NULL
;
1427 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1431 _this_ce
= Z_OBJCE_P(_this_zval
);
1432 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1434 depth
= cairo_xlib_surface_get_depth(curr
->surface
);
1442 /* {{{ proto int get_height()
1444 PHP_METHOD(CairoXlibSurface
, get_height
)
1446 zend_class_entry
* _this_ce
;
1448 zval
* _this_zval
= NULL
;
1452 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1456 _this_ce
= Z_OBJCE_P(_this_zval
);
1457 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1458 height
= cairo_xlib_surface_get_height(curr
->surface
);
1460 RETURN_LONG(height
);
1462 /* }}} get_height */
1466 /* {{{ proto int get_width()
1468 PHP_METHOD(CairoXlibSurface
, get_width
)
1470 zend_class_entry
* _this_ce
;
1472 zval
* _this_zval
= NULL
;
1476 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1480 _this_ce
= Z_OBJCE_P(_this_zval
);
1481 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1482 width
= cairo_xlib_surface_get_width(curr
->surface
);
1489 static zend_function_entry CairoXlibSurface_methods
[] = {
1490 PHP_ME(CairoXlibSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1491 PHP_ME(CairoXlibSurface
, get_depth
, NULL
, /**/ZEND_ACC_PUBLIC
)
1492 PHP_ME(CairoXlibSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
1493 PHP_ME(CairoXlibSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
1494 { NULL
, NULL
, NULL
}
1499 static zend_object_value
CairoXlibSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1501 zend_object_value retval
;
1502 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1503 retval
.handlers
= &CairoXlibSurface_handlers
;
1507 static void class_init_CairoXlibSurface(void)
1509 zend_class_entry ce
;
1511 INIT_CLASS_ENTRY(ce
, "CairoXlibSurface", CairoXlibSurface_methods
);
1512 CairoXlibSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1513 CairoXlibSurface_ce_ptr
->create_object
= CairoXlibSurface_object_new
;
1514 memcpy(&CairoXlibSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1518 /* }}} Class CairoXlibSurface */
1520 /* {{{ Helper Functions */
1522 get_CairoSurface_ce_ptr(cairo_surface_t
*surface
)
1524 zend_class_entry
*type
;
1528 switch(cairo_surface_get_type(surface
)) {
1529 case CAIRO_SURFACE_TYPE_IMAGE
:
1530 type
= CairoImageSurface_ce_ptr
;
1532 case CAIRO_SURFACE_TYPE_PDF
:
1533 type
= CairoPDFSurface_ce_ptr
;
1535 case CAIRO_SURFACE_TYPE_PS
:
1536 type
= CairoPSSurface_ce_ptr
;
1538 case CAIRO_SURFACE_TYPE_SVG
:
1539 type
= CairoSVGSurface_ce_ptr
;
1541 case CAIRO_SURFACE_TYPE_WIN32
:
1542 type
= CairoWin32Surface_ce_ptr
;
1544 case CAIRO_SURFACE_TYPE_XLIB
:
1545 type
= CairoXlibSurface_ce_ptr
;
1547 case CAIRO_SURFACE_TYPE_QUARTZ
:
1548 type
= CairoQuartzSurface_ce_ptr
;
1551 php_error(E_ERROR
,"Unsupported Surface Type");
1557 /* }}} Helper Function*/