1 /* {{{ Class CairoSurface */
3 PHP_CAIRO_API
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 createSimilar(int content, int width, int height)
72 PHP_METHOD(CairoSurface
, createSimilar
)
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 /* }}} createSimilar */
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 getContent()
142 PHP_METHOD(CairoSurface
, getContent
)
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
);
162 /* {{{ proto array getDeviceOffset()
164 PHP_METHOD(CairoSurface
, getDeviceOffset
)
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", x_offset
);
182 add_assoc_double(return_value
, "y", y_offset
);
185 /* }}} getDeviceOffset */
189 /* {{{ proto object getFontOptions()
191 PHP_METHOD(CairoSurface
, getFontOptions
)
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 /* }}} getFontOptions */
217 /* {{{ proto void markDirtyRectangle([int x, int y, int width, int height])
219 PHP_METHOD(CairoSurface
, markDirtyRectangle
)
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 /* }}} markDirtyRectangle */
243 /* {{{ proto void setDeviceOffset(float x_offset, float y_offset)
245 PHP_METHOD(CairoSurface
, setDeviceOffset
)
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 /* }}} setDeviceOffset */
266 /* {{{ proto void setFallbackResolution(float x_ppi, float y_ppi)
268 PHP_METHOD(CairoSurface
, setFallbackResolution
)
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 /* }}} setFallbackResolution */
289 /* {{{ proto void writeToPng(string file)
291 PHP_METHOD(CairoSurface
, writeToPng
)
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
);
312 /* {{{ proto void writeToPngStream(stream file)
314 PHP_METHOD(CairoSurface
, writeToPngStream
)
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
);
335 /* }}} writeToPngStream*/
338 static zend_function_entry CairoSurface_methods
[] = {
339 PHP_ME(CairoSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
340 PHP_ME(CairoSurface
, createSimilar
, 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
, getContent
, NULL
, /**/ZEND_ACC_PUBLIC
)
344 PHP_ME(CairoSurface
, getDeviceOffset
, NULL
, /**/ZEND_ACC_PUBLIC
)
345 PHP_ME(CairoSurface
, getFontOptions
, NULL
, /**/ZEND_ACC_PUBLIC
)
346 PHP_ME(CairoSurface
, markDirtyRectangle
, CairoSurface__mark_dirty_rectangle_args
, /**/ZEND_ACC_PUBLIC
)
347 PHP_ME(CairoSurface
, setDeviceOffset
, CairoSurface__set_device_offset_args
, /**/ZEND_ACC_PUBLIC
)
348 PHP_ME(CairoSurface
, setFallbackResolution
, CairoSurface__set_fallback_resolution_args
, /**/ZEND_ACC_PUBLIC
)
349 PHP_ME(CairoSurface
, writeToPng
, CairoSurface__write_to_png_args
, /**/ZEND_ACC_PUBLIC
)
350 PHP_ME(CairoSurface
, writeToPngStream
, 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
;
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 createFromData(string obj, int format, int width, int height [, int stride])
440 PHP_METHOD(CairoImageSurface
, createFromData
)
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
);
460 cairo_surface_finish(curr
->surface
);
461 cairo_surface_destroy(curr
->surface
);
465 case CAIRO_FORMAT_ARGB32
:
466 case CAIRO_FORMAT_RGB24
:
469 case CAIRO_FORMAT_RGB16_565
:
472 case CAIRO_FORMAT_A8
:
475 case CAIRO_FORMAT_A1
:
476 stride
= (width
+ 1) / 8;
479 php_error(E_ERROR
, "Unknown format");
485 if (height * stride > buffer_len) {
486 php_error(E_ERROR,"buffer is not long enough");
490 curr
->surface
= cairo_image_surface_create_for_data(buffer
, format
, width
, height
, stride
);
493 /* }}} createFromData */
497 /* {{{ proto void createFromPng(string file)
499 PHP_METHOD(CairoImageSurface
, createFromPng
)
501 zend_class_entry
* _this_ce
;
503 zval
* _this_zval
= NULL
;
504 const char * file
= NULL
;
507 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoImageSurface_ce_ptr
, &file
, &file_len
) == FAILURE
) {
511 _this_ce
= Z_OBJCE_P(_this_zval
);
512 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
514 curr
->surface
= cairo_image_surface_create_from_png(file
);
517 /* }}} createFromPng */
521 /* {{{ proto void createFromPngStream(stream zstream)
524 PHP_METHOD(CairoImageSurface
, createFromPngStream
)
526 zend_class_entry
*_this_ce
;
528 zval
*_this_zval
= NULL
;
529 cairo_status_t status
;
534 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Or", &_this_zval
, CairoImageSurface_ce_ptr
, &zstream
)) {
538 _this_ce
= Z_OBJCE_P(_this_zval
);
539 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
541 php_stream_from_zval(stream
, &zstream
);
542 curr
->surface
= cairo_image_surface_create_from_png_stream( _read_func
, stream
);
547 /* }}} createFromPngStream*/
551 /* {{{ proto string getData() -- not required
553 PHP_METHOD(CairoImageSurface
, getData
)
555 zend_class_entry
* _this_ce
;
557 zval
* _this_zval
= NULL
;
561 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
565 _this_ce
= Z_OBJCE_P(_this_zval
);
566 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
569 str
= cairo_image_surface_get_data(curr
->surface
);
570 RETURN_STRING(str
, 0);
576 /* {{{ proto int getFormat()
578 PHP_METHOD(CairoImageSurface
, getFormat
)
580 zend_class_entry
* _this_ce
;
582 zval
* _this_zval
= NULL
;
584 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
587 _this_ce
= Z_OBJCE_P(_this_zval
);
588 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
590 x
= cairo_image_surface_get_format(curr
->surface
);
597 /* {{{ proto int getHeight()
599 PHP_METHOD(CairoImageSurface
, getHeight
)
601 zend_class_entry
* _this_ce
;
602 zval
* _this_zval
= NULL
;
605 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
609 _this_ce
= Z_OBJCE_P(_this_zval
);
610 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
611 x
= cairo_image_surface_get_height(curr
->surface
);
619 /* {{{ proto int getStride()
621 PHP_METHOD(CairoImageSurface
, getStride
)
623 zend_class_entry
* _this_ce
;
624 zval
* _this_zval
= NULL
;
627 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
631 _this_ce
= Z_OBJCE_P(_this_zval
);
632 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
633 x
= cairo_image_surface_get_stride(curr
->surface
);
641 /* {{{ proto int getWidth()
643 PHP_METHOD(CairoImageSurface
, getWidth
)
645 zend_class_entry
* _this_ce
;
646 zval
* _this_zval
= NULL
;
649 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoImageSurface_ce_ptr
) == FAILURE
) {
653 _this_ce
= Z_OBJCE_P(_this_zval
);
655 surface_object
*curr
= (surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
657 x
= cairo_image_surface_get_width(curr
->surface
);
663 static zend_function_entry CairoImageSurface_methods
[] = {
664 PHP_ME(CairoImageSurface
, __construct
, CairoImageSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
665 PHP_ME(CairoImageSurface
, createFromData
, CairoImageSurface__create_from_data_args
, /**/ZEND_ACC_PUBLIC
)
666 PHP_ME(CairoImageSurface
, createFromPng
, CairoImageSurface__create_from_png_args
, /**/ZEND_ACC_PUBLIC
)
667 PHP_ME(CairoImageSurface
, createFromPngStream
, CairoImageSurface__create_from_png_stream_args
, /**/ZEND_ACC_PUBLIC
)
668 PHP_ME(CairoImageSurface
, getData
, NULL
, /**/ZEND_ACC_PUBLIC
)
669 PHP_ME(CairoImageSurface
, getFormat
, NULL
, /**/ZEND_ACC_PUBLIC
)
670 PHP_ME(CairoImageSurface
, getHeight
, NULL
, /**/ZEND_ACC_PUBLIC
)
671 PHP_ME(CairoImageSurface
, getStride
, NULL
, /**/ZEND_ACC_PUBLIC
)
672 PHP_ME(CairoImageSurface
, getWidth
, NULL
, /**/ZEND_ACC_PUBLIC
)
678 static zend_object_value
CairoImageSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
680 zend_object_value retval
;
681 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
682 retval
.handlers
= &CairoImageSurface_handlers
;
687 static void class_init_CairoImageSurface(void)
691 INIT_CLASS_ENTRY(ce
, "CairoImageSurface", CairoImageSurface_methods
);
692 CairoImageSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
693 CairoImageSurface_ce_ptr
->create_object
= CairoImageSurface_object_new
;
694 memcpy(&CairoImageSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
697 /* }}} Class CairoImageSurface */
699 /* {{{ Class CairoPDFSurface */
701 static zend_class_entry
* CairoPDFSurface_ce_ptr
= NULL
;
702 static zend_object_handlers CairoPDFSurface_handlers
;
706 /* {{{ proto void construct(string file, float wpts, float hpts)
708 PHP_METHOD(CairoPDFSurface
, __construct
)
710 zend_class_entry
* _this_ce
;
712 zval
*zstream
= NULL
;
713 const char * file
= NULL
;
718 int argc
= ZEND_NUM_ARGS();
721 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
722 if(ZEND_NUM_ARGS()== 0 ||
723 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
730 switch(Z_TYPE_P(obj
)) {
732 wpts
= Z_DVAL_P(obj
);
735 wpts
= Z_LVAL_P(obj
);
744 switch(Z_TYPE_P(obj
)) {
746 hpts
= Z_DVAL_P(obj
);
749 hpts
= Z_LVAL_P(obj
);
757 _this_zval
= getThis();
758 _this_ce
= Z_OBJCE_P(_this_zval
);
759 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
762 if(Z_TYPE_P(obj
)==IS_STRING
) {
763 file
= Z_STRVAL_P(obj
);
764 curr
->surface
= cairo_pdf_surface_create(file
, wpts
, hpts
);
766 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
768 php_stream_from_zval(stream
, &zstream
);
769 curr
->surface
= cairo_pdf_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
777 /* }}} __construct */
781 /* {{{ proto void setSize(float wptd, float hpts)
783 PHP_METHOD(CairoPDFSurface
, setSize
)
785 zend_class_entry
* _this_ce
;
787 zval
* _this_zval
= NULL
;
793 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPDFSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
797 _this_ce
= Z_OBJCE_P(_this_zval
);
798 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
799 cairo_pdf_surface_set_size(curr
->surface
, wpts
, hpts
);
805 static zend_function_entry CairoPDFSurface_methods
[] = {
806 PHP_ME(CairoPDFSurface
, __construct
, CairoPDFSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
807 PHP_ME(CairoPDFSurface
, setSize
, CairoPDFSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
813 static zend_object_value
CairoPDFSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
815 zend_object_value retval
;
816 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
817 retval
.handlers
= &CairoPDFSurface_handlers
;
821 static void class_init_CairoPDFSurface(void)
825 INIT_CLASS_ENTRY(ce
, "CairoPDFSurface", CairoPDFSurface_methods
);
826 CairoPDFSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
827 CairoPDFSurface_ce_ptr
->create_object
= CairoPDFSurface_object_new
;
828 memcpy(&CairoPDFSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
832 /* }}} Class CairoPDFSurface */
834 /* {{{ Class CairoPSSurface */
836 static zend_class_entry
* CairoPSSurface_ce_ptr
= NULL
;
837 static zend_object_handlers CairoPSSurface_handlers
;
841 /* {{{ proto void construct(string file | stream stream, float wpts, float hpts)
843 PHP_METHOD(CairoPSSurface
, __construct
)
845 zend_class_entry
* _this_ce
;
847 zval
*zstream
= NULL
;
848 const char * file
= NULL
;
853 int argc
= ZEND_NUM_ARGS();
856 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
857 if(ZEND_NUM_ARGS()== 0 ||
858 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
865 switch(Z_TYPE_P(obj
)) {
867 wpts
= Z_DVAL_P(obj
);
870 wpts
= Z_LVAL_P(obj
);
879 switch(Z_TYPE_P(obj
)) {
881 hpts
= Z_DVAL_P(obj
);
884 hpts
= Z_LVAL_P(obj
);
892 _this_zval
= getThis();
893 _this_ce
= Z_OBJCE_P(_this_zval
);
894 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
897 if(Z_TYPE_P(obj
)==IS_STRING
) {
898 file
= Z_STRVAL_P(obj
);
899 curr
->surface
= cairo_ps_surface_create(file
, wpts
, hpts
);
901 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
903 php_stream_from_zval(stream
, &zstream
);
904 curr
->surface
= cairo_ps_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
916 /* }}} __construct */
920 /* {{{ proto void dscBeginPageSetup()
922 PHP_METHOD(CairoPSSurface
, dscBeginPageSetup
)
924 zend_class_entry
* _this_ce
;
926 zval
* _this_zval
= NULL
;
930 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
933 _this_ce
= Z_OBJCE_P(_this_zval
);
934 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
935 cairo_ps_surface_dsc_begin_page_setup(curr
->surface
);
936 phpCAIRO_SURFACE_ERROR(curr
->surface
);
941 /* }}} dscBeginPageSetup */
945 /* {{{ proto void dscBeginSetup()
947 PHP_METHOD(CairoPSSurface
, dscBeginSetup
)
949 zend_class_entry
* _this_ce
;
951 zval
* _this_zval
= NULL
;
955 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
959 _this_ce
= Z_OBJCE_P(_this_zval
);
960 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
961 cairo_ps_surface_dsc_begin_setup(curr
->surface
);
962 phpCAIRO_SURFACE_ERROR(curr
->surface
);
965 /* }}} dscBeginSetup */
969 /* {{{ proto void dscComment()
971 PHP_METHOD(CairoPSSurface
, dscComment
)
973 zend_class_entry
* _this_ce
;
975 zval
* _this_zval
= NULL
;
979 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
983 _this_ce
= Z_OBJCE_P(_this_zval
);
984 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
985 cairo_ps_surface_dsc_comment(curr
->surface
);
986 phpCAIRO_SURFACE_ERROR(curr
->surface
);
993 /* {{{ proto array getLevels() -- cairo 1.6
995 PHP_METHOD(CairoPSSurface
, getLevels
)
997 zend_class_entry
* _this_ce
;
999 zval
* _this_zval
= NULL
;
1003 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1007 _this_ce
= Z_OBJCE_P(_this_zval
);
1008 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1011 array_init(return_value
);
1014 /* ONLY for CAIRO 1.6 */
1021 /* {{{ proto string getLevelString() --cairo 1.6
1023 PHP_METHOD(CairoPSSurface
, getLevelString
)
1025 zend_class_entry
* _this_ce
;
1027 zval
* _this_zval
= NULL
;
1031 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1035 _this_ce
= Z_OBJCE_P(_this_zval
);
1036 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1040 /* ONLY for CAIRO 1.6*/
1043 /* }}} getLevelString */
1047 /* {{{ proto void restrictToLevel(int level) --cairo 1.6
1049 PHP_METHOD(CairoPSSurface
, restrictToLevel
)
1051 zend_class_entry
* _this_ce
;
1053 zval
* _this_zval
= NULL
;
1058 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPSSurface_ce_ptr
, &level
) == FAILURE
) {
1062 _this_ce
= Z_OBJCE_P(_this_zval
);
1063 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1067 /* ONLY for CAIRO 1.6 */
1070 /* }}} restrictToLevel */
1074 /* {{{ proto void setEps() --cairo 1.6
1076 PHP_METHOD(CairoPSSurface
, setEps
)
1078 zend_class_entry
* _this_ce
;
1080 zval
* _this_zval
= NULL
;
1084 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPSSurface_ce_ptr
) == FAILURE
) {
1088 _this_ce
= Z_OBJCE_P(_this_zval
);
1089 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1093 /* ONLY for CAIRO 1.6 */
1100 /* {{{ proto void setSize(float wpts, float hpts)
1102 PHP_METHOD(CairoPSSurface
, setSize
)
1104 zend_class_entry
* _this_ce
;
1106 zval
* _this_zval
= NULL
;
1112 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoPSSurface_ce_ptr
, &wpts
, &hpts
) == FAILURE
) {
1116 _this_ce
= Z_OBJCE_P(_this_zval
);
1117 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1118 cairo_ps_surface_set_size(curr
->surface
, wpts
, hpts
);
1124 static zend_function_entry CairoPSSurface_methods
[] = {
1125 PHP_ME(CairoPSSurface
, __construct
, CairoPSSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1126 PHP_ME(CairoPSSurface
, dscBeginPageSetup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1127 PHP_ME(CairoPSSurface
, dscBeginSetup
, NULL
, /**/ZEND_ACC_PUBLIC
)
1128 PHP_ME(CairoPSSurface
, dscComment
, NULL
, /**/ZEND_ACC_PUBLIC
)
1129 PHP_ME(CairoPSSurface
, getLevels
, NULL
, /**/ZEND_ACC_PUBLIC
)
1130 PHP_ME(CairoPSSurface
, getLevelString
, NULL
, /**/ZEND_ACC_PUBLIC
)
1131 PHP_ME(CairoPSSurface
, restrictToLevel
, CairoPSSurface__restrict_to_level_args
, /**/ZEND_ACC_PUBLIC
)
1132 PHP_ME(CairoPSSurface
, setEps
, NULL
, /**/ZEND_ACC_PUBLIC
)
1133 PHP_ME(CairoPSSurface
, setSize
, CairoPSSurface__set_size_args
, /**/ZEND_ACC_PUBLIC
)
1134 { NULL
, NULL
, NULL
}
1139 static zend_object_value
CairoPSSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1141 zend_object_value retval
;
1142 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1143 retval
.handlers
= &CairoPSSurface_handlers
;
1147 static void class_init_CairoPSSurface(void)
1149 zend_class_entry ce
;
1151 INIT_CLASS_ENTRY(ce
, "CairoPSSurface", CairoPSSurface_methods
);
1152 CairoPSSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1153 CairoPSSurface_ce_ptr
->create_object
= CairoPSSurface_object_new
;
1154 memcpy(&CairoPSSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1157 /* }}} Class CairoPSSurface */
1159 /* {{{ Class CairoQuartzSurface */
1161 static zend_class_entry
* CairoQuartzSurface_ce_ptr
= NULL
;
1162 static zend_object_handlers CairoQuartzSurface_handlers
;
1166 /* {{{ proto void construct(float wpixels, float hpixels [, int format])
1168 PHP_METHOD(CairoQuartzSurface
, __construct
)
1170 zend_class_entry
* _this_ce
;
1173 double wpixels
= 0.0;
1174 double hpixels
= 0.0;
1179 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dd|l", &wpixels
, &hpixels
, &format
) == FAILURE
) {
1183 _this_zval
= getThis();
1184 _this_ce
= Z_OBJCE_P(_this_zval
);
1185 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1188 php_error(E_ERROR
, "CANNOT BE CALLED"); RETURN_FALSE
;
1191 /* }}} __construct */
1194 static zend_function_entry CairoQuartzSurface_methods
[] = {
1195 PHP_ME(CairoQuartzSurface
, __construct
, CairoQuartzSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1196 { NULL
, NULL
, NULL
}
1201 static zend_object_value
CairoQuartzSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1203 zend_object_value retval
;
1204 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1205 retval
.handlers
= &CairoQuartzSurface_handlers
;
1209 static void class_init_CairoQuartzSurface(void)
1211 zend_class_entry ce
;
1213 INIT_CLASS_ENTRY(ce
, "CairoQuartzSurface", CairoQuartzSurface_methods
);
1214 CairoQuartzSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1215 CairoQuartzSurface_ce_ptr
->create_object
= CairoQuartzSurface_object_new
;
1216 memcpy(&CairoQuartzSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1220 /* }}} Class CairoQuartzSurface */
1222 /* {{{ Class CairoSVGSurface */
1224 static zend_class_entry
* CairoSVGSurface_ce_ptr
= NULL
;
1225 static zend_object_handlers CairoSVGSurface_handlers
;
1231 /* {{{ proto void construct(string file, float wpts, float hpts)
1233 PHP_METHOD(CairoSVGSurface
, __construct
)
1235 zend_class_entry
* _this_ce
;
1237 zval
*zstream
= NULL
;
1238 const char * file
= NULL
;
1243 int argc
= ZEND_NUM_ARGS();
1246 args
= (zval
**)safe_emalloc(argc
, sizeof(zval
*),0);
1247 if(ZEND_NUM_ARGS()== 0 ||
1248 zend_get_parameters_array_ex(argc
, args
)== FAILURE
) {
1255 switch(Z_TYPE_P(obj
)) {
1257 wpts
= Z_DVAL_P(obj
);
1260 wpts
= Z_LVAL_P(obj
);
1269 switch(Z_TYPE_P(obj
)) {
1271 hpts
= Z_DVAL_P(obj
);
1274 hpts
= Z_LVAL_P(obj
);
1282 _this_zval
= getThis();
1283 _this_ce
= Z_OBJCE_P(_this_zval
);
1284 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1287 if(Z_TYPE_P(obj
)==IS_STRING
) {
1288 file
= Z_STRVAL_P(obj
);
1289 curr
->surface
= cairo_svg_surface_create(file
, wpts
, hpts
);
1291 else if(Z_TYPE_P(obj
)==IS_RESOURCE
) {
1293 php_stream_from_zval(stream
, &zstream
);
1294 curr
->surface
= cairo_svg_surface_create_for_stream(_write_func
, stream
, wpts
, hpts
);
1304 /* }}} __construct */
1307 static zend_function_entry CairoSVGSurface_methods
[] = {
1308 PHP_ME(CairoSVGSurface
, __construct
, CairoSVGSurface____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1309 { NULL
, NULL
, NULL
}
1314 static zend_object_value
CairoSVGSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1316 zend_object_value retval
;
1317 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1318 retval
.handlers
= &CairoSVGSurface_handlers
;
1322 static void class_init_CairoSVGSurface(void)
1324 zend_class_entry ce
;
1326 INIT_CLASS_ENTRY(ce
, "CairoSVGSurface", CairoSVGSurface_methods
);
1327 CairoSVGSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1328 CairoSVGSurface_ce_ptr
->create_object
= CairoSVGSurface_object_new
;
1329 memcpy(&CairoSVGSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1333 /* }}} Class CairoSVGSurface */
1335 /* {{{ Class CairoWin32Surface -- Have to work on this aswell */
1337 static zend_class_entry
* CairoWin32Surface_ce_ptr
= NULL
;
1338 static zend_object_handlers CairoWin32Surface_handlers
;
1343 /* {{{ proto void construct(int hdc)
1345 PHP_METHOD(CairoWin32Surface
, __construct
)
1347 zend_class_entry
* _this_ce
;
1354 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "l", &hdc
) == FAILURE
) {
1358 _this_zval
= getThis();
1359 _this_ce
= Z_OBJCE_P(_this_zval
);
1360 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1361 curr
->surface
= cairo_win32_surface_create(hdc
, NULL
);
1363 /* }}} __construct */
1366 static zend_function_entry CairoWin32Surface_methods
[] = {
1367 PHP_ME(CairoWin32Surface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1368 { NULL
, NULL
, NULL
}
1373 static zend_object_value
CairoWin32Surface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1375 zend_object_value retval
;
1376 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1377 retval
.handlers
= &CairoWin32Surface_handlers
;
1381 static void class_init_CairoWin32Surface(void)
1383 zend_class_entry ce
;
1385 INIT_CLASS_ENTRY(ce
, "CairoWin32Surface", CairoWin32Surface_methods
);
1386 CairoWin32Surface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1387 CairoWin32Surface_ce_ptr
->create_object
= CairoWin32Surface_object_new
;
1388 memcpy(&CairoWin32Surface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1392 /* }}} Class CairoWin32Surface */
1394 /* {{{ Class CairoXlibSurface */
1396 static zend_class_entry
* CairoXlibSurface_ce_ptr
= NULL
;
1397 static zend_object_handlers CairoXlibSurface_handlers
;
1401 /* {{{ proto void construct()
1403 PHP_METHOD(CairoXlibSurface
, __construct
)
1405 zend_class_entry
* _this_ce
;
1410 if (ZEND_NUM_ARGS()>0) {
1414 _this_zval
= getThis();
1415 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1417 php_error(E_WARNING
, "Cannot Be Initialized"); RETURN_FALSE
;
1420 /* }}} __construct */
1424 /* {{{ proto int getDepth()
1426 PHP_METHOD(CairoXlibSurface
, getDepth
)
1428 zend_class_entry
* _this_ce
;
1430 zval
* _this_zval
= NULL
;
1434 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1438 _this_ce
= Z_OBJCE_P(_this_zval
);
1439 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1441 depth
= cairo_xlib_surface_get_depth(curr
->surface
);
1449 /* {{{ proto int getHeight()
1451 PHP_METHOD(CairoXlibSurface
, getHeight
)
1453 zend_class_entry
* _this_ce
;
1455 zval
* _this_zval
= NULL
;
1459 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1463 _this_ce
= Z_OBJCE_P(_this_zval
);
1464 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1465 height
= cairo_xlib_surface_get_height(curr
->surface
);
1467 RETURN_LONG(height
);
1473 /* {{{ proto int getWidth()
1475 PHP_METHOD(CairoXlibSurface
, getWidth
)
1477 zend_class_entry
* _this_ce
;
1479 zval
* _this_zval
= NULL
;
1483 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoXlibSurface_ce_ptr
) == FAILURE
) {
1487 _this_ce
= Z_OBJCE_P(_this_zval
);
1488 surface_object
*curr
=(surface_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1489 width
= cairo_xlib_surface_get_width(curr
->surface
);
1496 static zend_function_entry CairoXlibSurface_methods
[] = {
1497 PHP_ME(CairoXlibSurface
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1498 PHP_ME(CairoXlibSurface
, getDepth
, NULL
, /**/ZEND_ACC_PUBLIC
)
1499 PHP_ME(CairoXlibSurface
, getHeight
, NULL
, /**/ZEND_ACC_PUBLIC
)
1500 PHP_ME(CairoXlibSurface
, getWidth
, NULL
, /**/ZEND_ACC_PUBLIC
)
1501 { NULL
, NULL
, NULL
}
1506 static zend_object_value
CairoXlibSurface_object_new(zend_class_entry
*ce TSRMLS_DC
)
1508 zend_object_value retval
;
1509 retval
=CairoSurface_object_new(ce TSRMLS_CC
);
1510 retval
.handlers
= &CairoXlibSurface_handlers
;
1514 static void class_init_CairoXlibSurface(void)
1516 zend_class_entry ce
;
1518 INIT_CLASS_ENTRY(ce
, "CairoXlibSurface", CairoXlibSurface_methods
);
1519 CairoXlibSurface_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoSurface_ce_ptr
, "CairoSurface" TSRMLS_CC
);
1520 CairoXlibSurface_ce_ptr
->create_object
= CairoXlibSurface_object_new
;
1521 memcpy(&CairoXlibSurface_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
1525 /* }}} Class CairoXlibSurface */
1527 /* {{{ Helper Functions */
1529 get_CairoSurface_ce_ptr(cairo_surface_t
*surface
)
1531 zend_class_entry
*type
;
1535 switch(cairo_surface_get_type(surface
)) {
1536 case CAIRO_SURFACE_TYPE_IMAGE
:
1537 type
= CairoImageSurface_ce_ptr
;
1539 case CAIRO_SURFACE_TYPE_PDF
:
1540 type
= CairoPDFSurface_ce_ptr
;
1542 case CAIRO_SURFACE_TYPE_PS
:
1543 type
= CairoPSSurface_ce_ptr
;
1545 case CAIRO_SURFACE_TYPE_SVG
:
1546 type
= CairoSVGSurface_ce_ptr
;
1548 case CAIRO_SURFACE_TYPE_WIN32
:
1549 type
= CairoWin32Surface_ce_ptr
;
1551 case CAIRO_SURFACE_TYPE_XLIB
:
1552 type
= CairoXlibSurface_ce_ptr
;
1554 case CAIRO_SURFACE_TYPE_QUARTZ
:
1555 type
= CairoQuartzSurface_ce_ptr
;
1558 php_error(E_ERROR
,"Unsupported Surface Type");
1564 /* }}} Helper Function*/