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);
14 return CAIRO_STATUS_SUCCESS
;
16 printf("is it an error ?");
17 // CAIRO_STATUS_WRITE_ERROR;
22 _read_func(void *closure
, const unsigned char *data
, unsigned int length
)
25 php_stream
*zs
= (php_stream
*)closure
;
26 //data = emalloc(length);
27 read
= php_stream_read(zs
, data
, length
);
29 return CAIRO_STATUS_SUCCESS
;
31 printf("is it an error");
38 typedef struct _surface_object {
40 cairo_surface_t *surface;
47 /* {{{ proto void construct()
49 PHP_METHOD(CairoSurface
, __construct
)
51 zend_class_entry
* _this_ce
;
56 if (ZEND_NUM_ARGS()>0) {
62 php_print("No direct call for this constructor");
70 /* {{{ proto object create_similar(int content, int width, int height)
72 PHP_METHOD(CairoSurface
, create_similar
)
74 zend_class_entry
* _this_ce
, *ce
;
76 zval
* _this_zval
= NULL
;
82 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Olll", &_this_zval
, CairoSurface_ce_ptr
, &content
, &width
, &height
) == FAILURE
) {
86 _this_ce
= Z_OBJCE_P(_this_zval
);
87 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
88 sur
= cairo_surface_create_similar(curr
->surface
, content
, width
, height
);
89 ce
= get_CairoSurface_ce_ptr(sur
);
90 object_init_ex(return_value
, ce
);
91 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
95 /* }}} create_similar */
98 /* {{{ proto void finish()
100 PHP_METHOD(CairoSurface
, finish
)
102 zend_class_entry
* _this_ce
;
104 zval
* _this_zval
= NULL
;
106 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
110 _this_ce
= Z_OBJCE_P(_this_zval
);
111 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
112 cairo_surface_finish(curr
->surface
);
118 /* {{{ proto void flush()
120 PHP_METHOD(CairoSurface
, flush
)
122 zend_class_entry
* _this_ce
;
124 zval
* _this_zval
= NULL
;
126 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
130 _this_ce
= Z_OBJCE_P(_this_zval
);
131 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
133 cairo_surface_flush(curr
->surface
);
140 /* {{{ proto int get_content()
142 PHP_METHOD(CairoSurface
, get_content
)
144 zend_class_entry
* _this_ce
;
146 zval
* _this_zval
= NULL
;
148 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
152 _this_ce
= Z_OBJCE_P(_this_zval
);
153 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
155 x
=cairo_surface_get_content(curr
->surface
);
158 /* }}} get_content */
162 /* {{{ proto array get_device_offset()
164 PHP_METHOD(CairoSurface
, get_device_offset
)
166 zend_class_entry
* _this_ce
;
168 zval
* _this_zval
= NULL
;
169 double x_offset
, y_offset
;
171 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
175 _this_ce
= Z_OBJCE_P(_this_zval
);
176 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
178 cairo_surface_get_device_offset(curr
->surface
, &x_offset
, &y_offset
);
180 array_init(return_value
);
181 add_assoc_double(return_value
, "x_offset", x_offset
);
182 add_assoc_double(return_value
, "y_offset", y_offset
);
185 /* }}} get_device_offset */
189 /* {{{ proto object get_font_options()
191 PHP_METHOD(CairoSurface
, get_font_options
)
193 zend_class_entry
* _this_ce
;
195 zval
* _this_zval
= NULL
;
197 cairo_font_options_t
*options
= cairo_font_options_create();
200 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurface_ce_ptr
) == FAILURE
) {
204 _this_ce
= Z_OBJCE_P(_this_zval
);
205 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
207 cairo_surface_get_font_options(curr
->surface
, options
);
208 object_init_ex(return_value
, CairoFontOptions_ce_ptr
);
209 fontoptions_object
*fobj
= (fontoptions_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
210 fobj
->fontoptions
=options
;
213 /* }}} get_font_options */
217 /* {{{ proto void mark_dirty_rectangle([int x, int y, int width, int height])
219 PHP_METHOD(CairoSurface
, mark_dirty_rectangle
)
221 zend_class_entry
* _this_ce
;
223 zval
* _this_zval
= NULL
;
231 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|llll", &_this_zval
, CairoSurface_ce_ptr
, &x
, &y
, &width
, &height
) == FAILURE
) {
234 _this_ce
= Z_OBJCE_P(_this_zval
);
235 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
236 cairo_surface_mark_dirty_rectangle(curr
->surface
, x
, y
, width
, height
);
239 /* }}} mark_dirty_rectangle */
243 /* {{{ proto void set_device_offset(float x_offset, float y_offset)
245 PHP_METHOD(CairoSurface
, set_device_offset
)
247 zend_class_entry
* _this_ce
;
249 zval
* _this_zval
= NULL
;
250 double x_offset
= 0.0;
251 double y_offset
= 0.0;
253 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_offset
, &y_offset
) == FAILURE
) {
257 _this_ce
= Z_OBJCE_P(_this_zval
);
258 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
259 cairo_surface_set_device_offset(curr
->surface
, x_offset
, y_offset
);
262 /* }}} set_device_offset */
266 /* {{{ proto void set_fallback_resolution(float x_ppi, float y_ppi)
268 PHP_METHOD(CairoSurface
, set_fallback_resolution
)
270 zend_class_entry
* _this_ce
;
272 zval
* _this_zval
= NULL
;
276 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoSurface_ce_ptr
, &x_ppi
, &y_ppi
) == FAILURE
) {
280 _this_ce
= Z_OBJCE_P(_this_zval
);
281 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
282 cairo_surface_set_fallback_resolution(curr
->surface
, x_ppi
, y_ppi
);
285 /* }}} set_fallback_resolution */
289 /* {{{ proto void write_to_png(string file)
291 PHP_METHOD(CairoSurface
, write_to_png
)
293 zend_class_entry
* _this_ce
;
295 zval
* _this_zval
= NULL
;
296 const char * file
= NULL
;
298 cairo_status_t status
;
300 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
304 _this_ce
= Z_OBJCE_P(_this_zval
);
305 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
306 status
= cairo_surface_write_to_png(curr
->surface
, file
);
309 /* }}} write_to_png */
312 /* {{{ proto void write_to_png_stream(stream file)
314 PHP_METHOD(CairoSurface
, write_to_png_stream
)
316 zend_class_entry
*_this_ce
;
318 zval
*_this_zval
= NULL
;
319 cairo_status_t status
;
324 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoSurface_ce_ptr
, &zstream
)) {
328 _this_ce
= Z_OBJCE_P(_this_zval
);
329 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
330 php_stream_from_zval(stream
, &zstream
);
331 status
= cairo_surface_write_to_png_stream(curr
->surface
, _write_func
, stream
);
338 static zend_function_entry CairoSurface_methods
[] = {
339 PHP_ME(CairoSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
340 PHP_ME(CairoSurface
, create_similar
, CairoSurface__create_similar_args
, /**/ZEND_ACC_PUBLIC
)
341 PHP_ME(CairoSurface
, finish
, NULL
, /**/ZEND_ACC_PUBLIC
)
342 PHP_ME(CairoSurface
, flush
, NULL
, /**/ZEND_ACC_PUBLIC
)
343 PHP_ME(CairoSurface
, get_content
, NULL
, /**/ZEND_ACC_PUBLIC
)
344 PHP_ME(CairoSurface
, get_device_offset
, NULL
, /**/ZEND_ACC_PUBLIC
)
345 PHP_ME(CairoSurface
, get_font_options
, NULL
, /**/ZEND_ACC_PUBLIC
)
346 PHP_ME(CairoSurface
, mark_dirty_rectangle
, CairoSurface__mark_dirty_rectangle_args
, /**/ZEND_ACC_PUBLIC
)
347 PHP_ME(CairoSurface
, set_device_offset
, CairoSurface__set_device_offset_args
, /**/ZEND_ACC_PUBLIC
)
348 PHP_ME(CairoSurface
, set_fallback_resolution
, CairoSurface__set_fallback_resolution_args
, /**/ZEND_ACC_PUBLIC
)
349 PHP_ME(CairoSurface
, write_to_png
, CairoSurface__write_to_png_args
, /**/ZEND_ACC_PUBLIC
)
350 PHP_ME(CairoSurface
, write_to_png_stream
, CairoSurface__write_to_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
357 static void CairoSurface_object_dtor(void *object
)
359 surface_object
*surface
= (surface_object
*)object
;
360 zend_hash_destroy(surface
->std
.properties
);
361 FREE_HASHTABLE(surface
->std
.properties
);
362 if(surface
->surface
){
363 cairo_surface_finish(surface
->surface
);
364 cairo_surface_destroy(surface
->surface
);
370 static zend_object_value
CairoSurface_object_new(zend_class_entry
*ce
)
372 zend_object_value retval
;
373 surface_object
*surface
;
376 surface
= emalloc(sizeof(surface_object
));
377 memset(surface
,0,sizeof(surface_object
));
381 ALLOC_HASHTABLE(surface
->std
.properties
);
382 zend_hash_init(surface
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
, 0);
383 zend_hash_copy(surface
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
,(void *) &temp
, sizeof(zval
*));
384 retval
.handle
=zend_objects_store_put(surface
, NULL
, (zend_objects_free_object_storage_t
)CairoSurface_object_dtor
, NULL TSRMLS_CC
);
385 retval
.handlers
= &CairoSurface_handlers
;
389 static void class_init_CairoSurface(void)
393 INIT_CLASS_ENTRY(ce
, "CairoSurface", CairoSurface_methods
);
394 CairoSurface_ce_ptr
= zend_register_internal_class(&ce
);
395 CairoSurface_ce_ptr
->create_object
= CairoSurface_object_new
;
396 memcpy(&CairoSurface_handlers
, zend_get_std_object_handlers(),sizeof(zend_object_handlers
));
397 CairoSurface_handlers
.clone_obj
= NULL
;
400 /* }}} Class CairoSurface */
402 /* {{{ Class CairoImageSurface -- done :)*/
404 static zend_class_entry
* CairoImageSurface_ce_ptr
= NULL
;
405 static zend_object_handlers CairoImageSurface_handlers
;
409 /* {{{ proto void construct(int format, int widthm, int height)
411 PHP_METHOD(CairoImageSurface
, __construct
)
413 zend_class_entry
* _this_ce
;
416 cairo_format_t format
= 0;
422 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "lll", &format
, &widthm
, &height
) == FAILURE
) {
426 _this_zval
= getThis();
427 _this_ce
= Z_OBJCE_P(_this_zval
);
428 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
429 curr
->surface
= cairo_image_surface_create(format
, widthm
, height
);
432 /* }}} __construct */
436 /* {{{ proto void create_from_data(string obj, int format, int width, int height [, int stride])
438 PHP_METHOD(CairoImageSurface
, create_from_data
)
440 zend_class_entry
* _this_ce
;
442 zval
* _this_zval
= NULL
;
443 const char * buffer
= NULL
;
452 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
) {
456 _this_ce
= Z_OBJCE_P(_this_zval
);
457 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
458 cairo_surface_finish(curr
->surface
);
459 cairo_surface_destroy(curr
->surface
);
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(E_ERROR
, "Unknown format");
483 if (height * stride > buffer_len) {
484 php_error(E_ERROR,"buffer is not long enough");
488 curr
->surface
= cairo_image_surface_create_for_data(buffer
, format
, width
, height
, stride
);
491 /* }}} create_from_data */
495 /* {{{ proto void create_from_png(string file)
497 PHP_METHOD(CairoImageSurface
, create_from_png
)
499 zend_class_entry
* _this_ce
;
501 zval
* _this_zval
= NULL
;
502 const char * file
= NULL
;
505 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoImageSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
509 _this_ce
= Z_OBJCE_P(_this_zval
);
510 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
512 curr
->surface
= cairo_image_surface_create_from_png(file
);
515 /* }}} create_from_png */
519 /* {{{ proto void create_from_png_stream(stream zstream)
522 PHP_METHOD(CairoImageSurface
, create_from_png_stream
)
524 zend_class_entry
*_this_ce
;
526 zval
*_this_zval
= NULL
;
527 cairo_status_t status
;
532 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoImageSurface_ce_ptr
, &zstream
)) {
536 _this_ce
= Z_OBJCE_P(_this_zval
);
537 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
539 php_stream_from_zval(stream
, &zstream
);
540 curr
->surface
= cairo_image_surface_create_from_png_stream( _read_func
, stream
);
549 /* {{{ proto string get_data() -- not required
551 PHP_METHOD(CairoImageSurface
, get_data
)
553 zend_class_entry
* _this_ce
;
555 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
);
564 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
567 str
= cairo_image_surface_get_data(curr
->surface
);
568 RETURN_STRING(str
, 0);
574 /* {{{ proto int get_format()
576 PHP_METHOD(CairoImageSurface
, get_format
)
578 zend_class_entry
* _this_ce
;
580 zval
* _this_zval
= NULL
;
582 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
585 _this_ce
= Z_OBJCE_P(_this_zval
);
586 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
588 x
= cairo_image_surface_get_format(curr
->surface
);
595 /* {{{ proto int get_height()
597 PHP_METHOD(CairoImageSurface
, get_height
)
599 zend_class_entry
* _this_ce
;
600 zval
* _this_zval
= NULL
;
603 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
607 _this_ce
= Z_OBJCE_P(_this_zval
);
608 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
609 x
= cairo_image_surface_get_height(curr
->surface
);
617 /* {{{ proto int get_stride()
619 PHP_METHOD(CairoImageSurface
, get_stride
)
621 zend_class_entry
* _this_ce
;
622 zval
* _this_zval
= NULL
;
625 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
629 _this_ce
= Z_OBJCE_P(_this_zval
);
630 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
631 x
= cairo_image_surface_get_stride(curr
->surface
);
639 /* {{{ proto int get_width()
641 PHP_METHOD(CairoImageSurface
, get_width
)
643 zend_class_entry
* _this_ce
;
644 zval
* _this_zval
= NULL
;
647 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
651 _this_ce
= Z_OBJCE_P(_this_zval
);
653 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
655 x
= cairo_image_surface_get_width(curr
->surface
);
661 static zend_function_entry CairoImageSurface_methods
[] = {
662 PHP_ME(CairoImageSurface
, __construct
, CairoImageSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
663 PHP_ME(CairoImageSurface
, create_from_data
, CairoImageSurface__create_from_data_args
, /**/ZEND_ACC_PUBLIC
)
664 PHP_ME(CairoImageSurface
, create_from_png
, CairoImageSurface__create_from_png_args
, /**/ZEND_ACC_PUBLIC
)
665 PHP_ME(CairoImageSurface
, create_from_png_stream
, CairoImageSurface__create_from_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
666 PHP_ME(CairoImageSurface
, get_data
, NULL
, /**/ZEND_ACC_PUBLIC
)
667 PHP_ME(CairoImageSurface
, get_format
, NULL
, /**/ZEND_ACC_PUBLIC
)
668 PHP_ME(CairoImageSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
669 PHP_ME(CairoImageSurface
, get_stride
, NULL
, /**/ZEND_ACC_PUBLIC
)
670 PHP_ME(CairoImageSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
676 static zend_object_value
CairoImageSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
678 zend_object_value retval
;
679 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
680 retval
.handlers
= &CairoImageSurface_handlers
;
685 static void class_init_CairoImageSurface(void)
689 INIT_CLASS_ENTRY(ce
, "CairoImageSurface", CairoImageSurface_methods
);
690 CairoImageSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
691 CairoImageSurface_ce_ptr
->create_object
= CairoImageSurface_object_new
;
692 memcpy(&CairoImageSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
695 /* }}} Class CairoImageSurface */
697 /* {{{ Class CairoPDFSurface */
699 static zend_class_entry
* CairoPDFSurface_ce_ptr
= NULL
;
700 static zend_object_handlers CairoPDFSurface_handlers
;
704 /* {{{ proto void construct(string file, float wpts, float hpts)
706 PHP_METHOD(CairoPDFSurface
, __construct
)
708 zend_class_entry
* _this_ce
;
710 zval
*zstream
= NULL
;
711 const char * file
= NULL
;
716 int argc
= ZEND_NUM_ARGS();
719 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
720 if(ZEND_NUM_ARGS()== 0 ||
721 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
728 switch(Z_TYPE_P(obj
)) {
730 wpts
= Z_DVAL_P(obj
);
733 wpts
= Z_LVAL_P(obj
);
742 switch(Z_TYPE_P(obj
)) {
744 hpts
= Z_DVAL_P(obj
);
747 hpts
= Z_LVAL_P(obj
);
755 _this_zval
= getThis();
756 _this_ce
= Z_OBJCE_P(_this_zval
);
757 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
760 if(Z_TYPE_P(obj
)==IS_STRING
) {
761 file
= Z_STRVAL_P(obj
);
762 curr
->surface
= cairo_pdf_surface_create(file
, wpts
, hpts
);
764 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
766 php_stream_from_zval(stream
, &zstream
);
767 curr
->surface
= cairo_pdf_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
775 /* }}} __construct */
779 /* {{{ proto void set_size(float wptd, float hpts)
781 PHP_METHOD(CairoPDFSurface
, set_size
)
783 zend_class_entry
* _this_ce
;
785 zval
* _this_zval
= NULL
;
791 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPDFSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
795 _this_ce
= Z_OBJCE_P(_this_zval
);
796 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
797 cairo_pdf_surface_set_size(curr
->surface
, wpts
, hpts
);
803 static zend_function_entry CairoPDFSurface_methods
[] = {
804 PHP_ME(CairoPDFSurface
, __construct
, CairoPDFSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
805 PHP_ME(CairoPDFSurface
, set_size
, CairoPDFSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
811 static zend_object_value
CairoPDFSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
813 zend_object_value retval
;
814 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
815 retval
.handlers
= &CairoPDFSurface_handlers
;
819 static void class_init_CairoPDFSurface(void)
823 INIT_CLASS_ENTRY(ce
, "CairoPDFSurface", CairoPDFSurface_methods
);
824 CairoPDFSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
825 CairoPDFSurface_ce_ptr
->create_object
= CairoPDFSurface_object_new
;
826 memcpy(&CairoPDFSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
830 /* }}} Class CairoPDFSurface */
832 /* {{{ Class CairoPSSurface */
834 static zend_class_entry
* CairoPSSurface_ce_ptr
= NULL
;
835 static zend_object_handlers CairoPSSurface_handlers
;
839 /* {{{ proto void construct(string file | stream stream, float wpts, float hpts)
841 PHP_METHOD(CairoPSSurface
, __construct
)
843 zend_class_entry
* _this_ce
;
845 zval
*zstream
= NULL
;
846 const char * file
= NULL
;
851 int argc
= ZEND_NUM_ARGS();
854 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
855 if(ZEND_NUM_ARGS()== 0 ||
856 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
863 switch(Z_TYPE_P(obj
)) {
865 wpts
= Z_DVAL_P(obj
);
868 wpts
= Z_LVAL_P(obj
);
877 switch(Z_TYPE_P(obj
)) {
879 hpts
= Z_DVAL_P(obj
);
882 hpts
= Z_LVAL_P(obj
);
890 _this_zval
= getThis();
891 _this_ce
= Z_OBJCE_P(_this_zval
);
892 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
895 if(Z_TYPE_P(obj
)==IS_STRING
) {
896 file
= Z_STRVAL_P(obj
);
897 curr
->surface
= cairo_ps_surface_create(file
, wpts
, hpts
);
899 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
901 php_stream_from_zval(stream
, &zstream
);
902 curr
->surface
= cairo_ps_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
914 /* }}} __construct */
918 /* {{{ proto void dsc_begin_page_setup()
920 PHP_METHOD(CairoPSSurface
, dsc_begin_page_setup
)
922 zend_class_entry
* _this_ce
;
924 zval
* _this_zval
= NULL
;
928 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
931 _this_ce
= Z_OBJCE_P(_this_zval
);
932 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
933 cairo_ps_surface_dsc_begin_page_setup(curr
->surface
);
934 phpCAIRO_SURFACE_ERROR(curr
->surface
);
939 /* }}} dsc_begin_page_setup */
943 /* {{{ proto void dsc_begin_setup()
945 PHP_METHOD(CairoPSSurface
, dsc_begin_setup
)
947 zend_class_entry
* _this_ce
;
949 zval
* _this_zval
= NULL
;
953 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
957 _this_ce
= Z_OBJCE_P(_this_zval
);
958 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
959 cairo_ps_surface_dsc_begin_setup(curr
->surface
);
960 phpCAIRO_SURFACE_ERROR(curr
->surface
);
963 /* }}} dsc_begin_setup */
967 /* {{{ proto void dsc_comment()
969 PHP_METHOD(CairoPSSurface
, dsc_comment
)
971 zend_class_entry
* _this_ce
;
973 zval
* _this_zval
= NULL
;
977 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
981 _this_ce
= Z_OBJCE_P(_this_zval
);
982 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
983 cairo_ps_surface_dsc_comment(curr
->surface
);
984 phpCAIRO_SURFACE_ERROR(curr
->surface
);
987 /* }}} dsc_comment */
991 /* {{{ proto array get_levels() -- cairo 1.6
993 PHP_METHOD(CairoPSSurface
, get_levels
)
995 zend_class_entry
* _this_ce
;
997 zval
* _this_zval
= NULL
;
1001 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1005 _this_ce
= Z_OBJCE_P(_this_zval
);
1006 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1009 array_init(return_value
);
1012 /* ONLY for CAIRO 1.6 */
1015 /* }}} get_levels */
1019 /* {{{ proto string get_level_string() --cairo 1.6
1021 PHP_METHOD(CairoPSSurface
, get_level_string
)
1023 zend_class_entry
* _this_ce
;
1025 zval
* _this_zval
= NULL
;
1029 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1033 _this_ce
= Z_OBJCE_P(_this_zval
);
1034 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1038 /* ONLY for CAIRO 1.6*/
1041 /* }}} get_level_string */
1045 /* {{{ proto void restrict_to_level(int level) --cairo 1.6
1047 PHP_METHOD(CairoPSSurface
, restrict_to_level
)
1049 zend_class_entry
* _this_ce
;
1051 zval
* _this_zval
= NULL
;
1056 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPSSurface_ce_ptr
, &level
) == FAILURE
) {
1060 _this_ce
= Z_OBJCE_P(_this_zval
);
1061 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1065 /* ONLY for CAIRO 1.6 */
1068 /* }}} restrict_to_level */
1072 /* {{{ proto void set_eps() --cairo 1.6
1074 PHP_METHOD(CairoPSSurface
, set_eps
)
1076 zend_class_entry
* _this_ce
;
1078 zval
* _this_zval
= NULL
;
1082 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1086 _this_ce
= Z_OBJCE_P(_this_zval
);
1087 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1091 /* ONLY for CAIRO 1.6 */
1098 /* {{{ proto void set_size(float wpts, float hpts)
1100 PHP_METHOD(CairoPSSurface
, set_size
)
1102 zend_class_entry
* _this_ce
;
1104 zval
* _this_zval
= NULL
;
1110 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPSSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
1114 _this_ce
= Z_OBJCE_P(_this_zval
);
1115 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1116 cairo_ps_surface_set_size(curr
->surface
, wpts
, hpts
);
1122 static zend_function_entry CairoPSSurface_methods
[] = {
1123 PHP_ME(CairoPSSurface
, __construct
, CairoPSSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1124 PHP_ME(CairoPSSurface
, dsc_begin_page_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1125 PHP_ME(CairoPSSurface
, dsc_begin_setup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1126 PHP_ME(CairoPSSurface
, dsc_comment
, NULL
, /**/ZEND_ACC_PUBLIC
)
1127 PHP_ME(CairoPSSurface
, get_levels
, NULL
, /**/ZEND_ACC_PUBLIC
)
1128 PHP_ME(CairoPSSurface
, get_level_string
, NULL
, /**/ZEND_ACC_PUBLIC
)
1129 PHP_ME(CairoPSSurface
, restrict_to_level
, CairoPSSurface__restrict_to_level_args
, /**/ZEND_ACC_PUBLIC
)
1130 PHP_ME(CairoPSSurface
, set_eps
, NULL
, /**/ZEND_ACC_PUBLIC
)
1131 PHP_ME(CairoPSSurface
, set_size
, CairoPSSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
1132 { NULL
, NULL
, NULL
}
1137 static zend_object_value
CairoPSSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1139 zend_object_value retval
;
1140 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1141 retval
.handlers
= &CairoPSSurface_handlers
;
1145 static void class_init_CairoPSSurface(void)
1147 zend_class_entry ce
;
1149 INIT_CLASS_ENTRY(ce
, "CairoPSSurface", CairoPSSurface_methods
);
1150 CairoPSSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1151 CairoPSSurface_ce_ptr
->create_object
= CairoPSSurface_object_new
;
1152 memcpy(&CairoPSSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1155 /* }}} Class CairoPSSurface */
1157 /* {{{ Class CairoQuartzSurface */
1159 static zend_class_entry
* CairoQuartzSurface_ce_ptr
= NULL
;
1160 static zend_object_handlers CairoQuartzSurface_handlers
;
1164 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
1166 PHP_METHOD(CairoQuartzSurface
, __construct
)
1168 zend_class_entry
* _this_ce
;
1171 double wpixels
= 0.0;
1172 double hpixels
= 0.0;
1177 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dd|l", &wpixels
, &hpixels
, &format
) == FAILURE
) {
1181 _this_zval
= getThis();
1182 _this_ce
= Z_OBJCE_P(_this_zval
);
1183 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1186 php_error(E_ERROR
, "CANNOT BE CALLED"); RETURN_FALSE
;
1189 /* }}} __construct */
1192 static zend_function_entry CairoQuartzSurface_methods
[] = {
1193 PHP_ME(CairoQuartzSurface
, __construct
, CairoQuartzSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1194 { NULL
, NULL
, NULL
}
1199 static zend_object_value
CairoQuartzSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1201 zend_object_value retval
;
1202 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1203 retval
.handlers
= &CairoQuartzSurface_handlers
;
1207 static void class_init_CairoQuartzSurface(void)
1209 zend_class_entry ce
;
1211 INIT_CLASS_ENTRY(ce
, "CairoQuartzSurface", CairoQuartzSurface_methods
);
1212 CairoQuartzSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1213 CairoQuartzSurface_ce_ptr
->create_object
= CairoQuartzSurface_object_new
;
1214 memcpy(&CairoQuartzSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1218 /* }}} Class CairoQuartzSurface */
1220 /* {{{ Class CairoSVGSurface */
1222 static zend_class_entry
* CairoSVGSurface_ce_ptr
= NULL
;
1223 static zend_object_handlers CairoSVGSurface_handlers
;
1229 /* {{{ proto void construct(string file, float wpts, float hpts)
1231 PHP_METHOD(CairoSVGSurface
, __construct
)
1233 zend_class_entry
* _this_ce
;
1235 zval
*zstream
= NULL
;
1236 const char * file
= NULL
;
1241 int argc
= ZEND_NUM_ARGS();
1244 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
1245 if(ZEND_NUM_ARGS()== 0 ||
1246 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
1253 switch(Z_TYPE_P(obj
)) {
1255 wpts
= Z_DVAL_P(obj
);
1258 wpts
= Z_LVAL_P(obj
);
1267 switch(Z_TYPE_P(obj
)) {
1269 hpts
= Z_DVAL_P(obj
);
1272 hpts
= Z_LVAL_P(obj
);
1280 _this_zval
= getThis();
1281 _this_ce
= Z_OBJCE_P(_this_zval
);
1282 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1285 if(Z_TYPE_P(obj
)==IS_STRING
) {
1286 file
= Z_STRVAL_P(obj
);
1287 curr
->surface
= cairo_svg_surface_create(file
, wpts
, hpts
);
1289 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
1291 php_stream_from_zval(stream
, &zstream
);
1292 curr
->surface
= cairo_svg_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
1302 /* }}} __construct */
1305 static zend_function_entry CairoSVGSurface_methods
[] = {
1306 PHP_ME(CairoSVGSurface
, __construct
, CairoSVGSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1307 { NULL
, NULL
, NULL
}
1312 static zend_object_value
CairoSVGSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1314 zend_object_value retval
;
1315 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1316 retval
.handlers
= &CairoSVGSurface_handlers
;
1320 static void class_init_CairoSVGSurface(void)
1322 zend_class_entry ce
;
1324 INIT_CLASS_ENTRY(ce
, "CairoSVGSurface", CairoSVGSurface_methods
);
1325 CairoSVGSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1326 CairoSVGSurface_ce_ptr
->create_object
= CairoSVGSurface_object_new
;
1327 memcpy(&CairoSVGSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1331 /* }}} Class CairoSVGSurface */
1333 /* {{{ Class CairoWin32Surface -- Have to work on this aswell */
1335 static zend_class_entry
* CairoWin32Surface_ce_ptr
= NULL
;
1336 static zend_object_handlers CairoWin32Surface_handlers
;
1341 /* {{{ proto void construct(int hdc)
1343 PHP_METHOD(CairoWin32Surface
, __construct
)
1345 zend_class_entry
* _this_ce
;
1352 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "l", &hdc
) == FAILURE
) {
1356 _this_zval
= getThis();
1357 _this_ce
= Z_OBJCE_P(_this_zval
);
1358 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1359 curr
->surface
= cairo_win32_surface_create(hdc
, NULL
);
1361 /* }}} __construct */
1364 static zend_function_entry CairoWin32Surface_methods
[] = {
1365 PHP_ME(CairoWin32Surface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1366 { NULL
, NULL
, NULL
}
1371 static zend_object_value
CairoWin32Surface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1373 zend_object_value retval
;
1374 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1375 retval
.handlers
= &CairoWin32Surface_handlers
;
1379 static void class_init_CairoWin32Surface(void)
1381 zend_class_entry ce
;
1383 INIT_CLASS_ENTRY(ce
, "CairoWin32Surface", CairoWin32Surface_methods
);
1384 CairoWin32Surface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1385 CairoWin32Surface_ce_ptr
->create_object
= CairoWin32Surface_object_new
;
1386 memcpy(&CairoWin32Surface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1390 /* }}} Class CairoWin32Surface */
1392 /* {{{ Class CairoXlibSurface */
1394 static zend_class_entry
* CairoXlibSurface_ce_ptr
= NULL
;
1395 static zend_object_handlers CairoXlibSurface_handlers
;
1399 /* {{{ proto void construct()
1401 PHP_METHOD(CairoXlibSurface
, __construct
)
1403 zend_class_entry
* _this_ce
;
1408 if (ZEND_NUM_ARGS()>0) {
1412 _this_zval
= getThis();
1413 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1415 php_error(E_WARNING
, "Cannot Be Initialized"); RETURN_FALSE
;
1418 /* }}} __construct */
1422 /* {{{ proto int get_depth()
1424 PHP_METHOD(CairoXlibSurface
, get_depth
)
1426 zend_class_entry
* _this_ce
;
1428 zval
* _this_zval
= NULL
;
1432 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1436 _this_ce
= Z_OBJCE_P(_this_zval
);
1437 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1439 depth
= cairo_xlib_surface_get_depth(curr
->surface
);
1447 /* {{{ proto int get_height()
1449 PHP_METHOD(CairoXlibSurface
, get_height
)
1451 zend_class_entry
* _this_ce
;
1453 zval
* _this_zval
= NULL
;
1457 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1461 _this_ce
= Z_OBJCE_P(_this_zval
);
1462 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1463 height
= cairo_xlib_surface_get_height(curr
->surface
);
1465 RETURN_LONG(height
);
1467 /* }}} get_height */
1471 /* {{{ proto int get_width()
1473 PHP_METHOD(CairoXlibSurface
, get_width
)
1475 zend_class_entry
* _this_ce
;
1477 zval
* _this_zval
= NULL
;
1481 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1485 _this_ce
= Z_OBJCE_P(_this_zval
);
1486 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1487 width
= cairo_xlib_surface_get_width(curr
->surface
);
1494 static zend_function_entry CairoXlibSurface_methods
[] = {
1495 PHP_ME(CairoXlibSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1496 PHP_ME(CairoXlibSurface
, get_depth
, NULL
, /**/ZEND_ACC_PUBLIC
)
1497 PHP_ME(CairoXlibSurface
, get_height
, NULL
, /**/ZEND_ACC_PUBLIC
)
1498 PHP_ME(CairoXlibSurface
, get_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
1499 { NULL
, NULL
, NULL
}
1504 static zend_object_value
CairoXlibSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1506 zend_object_value retval
;
1507 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1508 retval
.handlers
= &CairoXlibSurface_handlers
;
1512 static void class_init_CairoXlibSurface(void)
1514 zend_class_entry ce
;
1516 INIT_CLASS_ENTRY(ce
, "CairoXlibSurface", CairoXlibSurface_methods
);
1517 CairoXlibSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1518 CairoXlibSurface_ce_ptr
->create_object
= CairoXlibSurface_object_new
;
1519 memcpy(&CairoXlibSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1523 /* }}} Class CairoXlibSurface */
1525 /* {{{ Helper Functions */
1527 get_CairoSurface_ce_ptr(cairo_surface_t
*surface
)
1529 zend_class_entry
*type
;
1533 switch(cairo_surface_get_type(surface
)) {
1534 case CAIRO_SURFACE_TYPE_IMAGE
:
1535 type
= CairoImageSurface_ce_ptr
;
1537 case CAIRO_SURFACE_TYPE_PDF
:
1538 type
= CairoPDFSurface_ce_ptr
;
1540 case CAIRO_SURFACE_TYPE_PS
:
1541 type
= CairoPSSurface_ce_ptr
;
1543 case CAIRO_SURFACE_TYPE_SVG
:
1544 type
= CairoSVGSurface_ce_ptr
;
1546 case CAIRO_SURFACE_TYPE_WIN32
:
1547 type
= CairoWin32Surface_ce_ptr
;
1549 case CAIRO_SURFACE_TYPE_XLIB
:
1550 type
= CairoXlibSurface_ce_ptr
;
1552 case CAIRO_SURFACE_TYPE_QUARTZ
:
1553 type
= CairoQuartzSurface_ce_ptr
;
1556 php_error(E_ERROR
,"Unsupported Surface Type");
1562 /* }}} Helper Function*/