2 +----------------------------------------------------------------------+
3 | This source file is subject to version 3.0 of the PHP license, |
4 | that is bundled with this package in the file LICENSE, and is |
5 | available through the world-wide-web at the following url: |
6 | http://www.php.net/license/3_0.txt. |
7 | If you did not receive a copy of the PHP license and are unable to |
8 | obtain it through the world-wide-web, please send a note to |
9 | license@php.net so we can mail you a copy immediately. |
10 +----------------------------------------------------------------------+
11 | Authors: Akshat Gupta <g.akshat@gmail.com> |
12 +----------------------------------------------------------------------+
17 #include "php_phpCairo.h"
18 #include "phpCairoSurface.c"
19 #include "phpCairoContext.c"
22 /* {{{ Class definitions */
25 /* {{{ Class CairoFontFace */
27 static zend_class_entry
* CairoFontFace_ce_ptr
= NULL
;
32 /* {{{ proto void construct()
34 PHP_METHOD(CairoFontFace
, __construct
)
36 zend_class_entry
* _this_ce
;
41 if (ZEND_NUM_ARGS()>0) {
47 /* not allowede to create an object directly*/
54 /* {{{ proto void destruct()
56 PHP_METHOD(CairoFontFace
, __destruct
)
58 zend_class_entry
* _this_ce
;
60 zval
* _this_zval
= NULL
;
64 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontFace_ce_ptr
) == FAILURE
) {
68 _this_ce
= Z_OBJCE_P(_this_zval
);
71 php_error(E_WARNING
, "__destruct: not yet implemented"); RETURN_FALSE
;
77 static zend_function_entry CairoFontFace_methods
[] = {
78 PHP_ME(CairoFontFace
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
79 PHP_ME(CairoFontFace
, __destruct
, NULL
, /**/ZEND_ACC_PUBLIC
)
85 static void class_init_CairoFontFace(void)
89 INIT_CLASS_ENTRY(ce
, "CairoFontFace", CairoFontFace_methods
);
90 CairoFontFace_ce_ptr
= zend_register_internal_class(&ce
);
93 /* }}} Class CairoFontFace */
95 /* {{{ Class CairoFontOptions */
97 static zend_class_entry
* CairoFontOptions_ce_ptr
= NULL
;
102 /* {{{ proto void construct()
104 PHP_METHOD(CairoFontOptions
, __construct
)
106 zend_class_entry
* _this_ce
;
111 if (ZEND_NUM_ARGS()>0) {
116 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
119 /* }}} __construct */
123 /* {{{ proto int get_antialias()
125 PHP_METHOD(CairoFontOptions
, get_antialias
)
127 zend_class_entry
* _this_ce
;
129 zval
* _this_zval
= NULL
;
133 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
137 _this_ce
= Z_OBJCE_P(_this_zval
);
140 php_error(E_WARNING
, "get_antialias: not yet implemented"); RETURN_FALSE
;
144 /* }}} get_antialias */
148 /* {{{ proto int get_hint_metrics()
150 PHP_METHOD(CairoFontOptions
, get_hint_metrics
)
152 zend_class_entry
* _this_ce
;
154 zval
* _this_zval
= NULL
;
158 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
162 _this_ce
= Z_OBJCE_P(_this_zval
);
165 php_error(E_WARNING
, "get_hint_metrics: not yet implemented"); RETURN_FALSE
;
169 /* }}} get_hint_metrics */
173 /* {{{ proto int get_hint_style()
175 PHP_METHOD(CairoFontOptions
, get_hint_style
)
177 zend_class_entry
* _this_ce
;
179 zval
* _this_zval
= NULL
;
183 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
187 _this_ce
= Z_OBJCE_P(_this_zval
);
190 php_error(E_WARNING
, "get_hint_style: not yet implemented"); RETURN_FALSE
;
194 /* }}} get_hint_style */
198 /* {{{ proto int get_subpixel_order()
200 PHP_METHOD(CairoFontOptions
, get_subpixel_order
)
202 zend_class_entry
* _this_ce
;
204 zval
* _this_zval
= NULL
;
208 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
212 _this_ce
= Z_OBJCE_P(_this_zval
);
215 php_error(E_WARNING
, "get_subpixel_order: not yet implemented"); RETURN_FALSE
;
219 /* }}} get_subpixel_order */
223 /* {{{ proto void set_antialias([int aa])
225 PHP_METHOD(CairoFontOptions
, set_antialias
)
227 zend_class_entry
* _this_ce
;
229 zval
* _this_zval
= NULL
;
234 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &aa
) == FAILURE
) {
238 _this_ce
= Z_OBJCE_P(_this_zval
);
241 php_error(E_WARNING
, "set_antialias: not yet implemented"); RETURN_FALSE
;
244 /* }}} set_antialias */
248 /* {{{ proto void set_hint_metrics([int hm])
250 PHP_METHOD(CairoFontOptions
, set_hint_metrics
)
252 zend_class_entry
* _this_ce
;
254 zval
* _this_zval
= NULL
;
259 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &hm
) == FAILURE
) {
263 _this_ce
= Z_OBJCE_P(_this_zval
);
266 php_error(E_WARNING
, "set_hint_metrics: not yet implemented"); RETURN_FALSE
;
269 /* }}} set_hint_metrics */
273 /* {{{ proto void set_hint_style([int hs])
275 PHP_METHOD(CairoFontOptions
, set_hint_style
)
277 zend_class_entry
* _this_ce
;
279 zval
* _this_zval
= NULL
;
284 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &hs
) == FAILURE
) {
288 _this_ce
= Z_OBJCE_P(_this_zval
);
291 php_error(E_WARNING
, "set_hint_style: not yet implemented"); RETURN_FALSE
;
294 /* }}} set_hint_style */
298 /* {{{ proto void set_subpixel_order([int so])
300 PHP_METHOD(CairoFontOptions
, set_subpixel_order
)
302 zend_class_entry
* _this_ce
;
304 zval
* _this_zval
= NULL
;
309 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &so
) == FAILURE
) {
313 _this_ce
= Z_OBJCE_P(_this_zval
);
316 php_error(E_WARNING
, "set_subpixel_order: not yet implemented"); RETURN_FALSE
;
319 /* }}} set_subpixel_order */
322 static zend_function_entry CairoFontOptions_methods
[] = {
323 PHP_ME(CairoFontOptions
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
324 PHP_ME(CairoFontOptions
, get_antialias
, NULL
, /**/ZEND_ACC_PUBLIC
)
325 PHP_ME(CairoFontOptions
, get_hint_metrics
, NULL
, /**/ZEND_ACC_PUBLIC
)
326 PHP_ME(CairoFontOptions
, get_hint_style
, NULL
, /**/ZEND_ACC_PUBLIC
)
327 PHP_ME(CairoFontOptions
, get_subpixel_order
, NULL
, /**/ZEND_ACC_PUBLIC
)
328 PHP_ME(CairoFontOptions
, set_antialias
, CairoFontOptions__set_antialias_args
, /**/ZEND_ACC_PUBLIC
)
329 PHP_ME(CairoFontOptions
, set_hint_metrics
, CairoFontOptions__set_hint_metrics_args
, /**/ZEND_ACC_PUBLIC
)
330 PHP_ME(CairoFontOptions
, set_hint_style
, CairoFontOptions__set_hint_style_args
, /**/ZEND_ACC_PUBLIC
)
331 PHP_ME(CairoFontOptions
, set_subpixel_order
, CairoFontOptions__set_subpixel_order_args
, /**/ZEND_ACC_PUBLIC
)
337 static void class_init_CairoFontOptions(void)
341 INIT_CLASS_ENTRY(ce
, "CairoFontOptions", CairoFontOptions_methods
);
342 CairoFontOptions_ce_ptr
= zend_register_internal_class(&ce
);
345 /* }}} Class CairoFontOptions */
347 /* {{{ Class CairoMatrix */
349 static zend_class_entry
* CairoMatrix_ce_ptr
= NULL
;
354 /* {{{ proto void construct([float xx, float yx, float xy, float yy, float x0, float y0])
356 PHP_METHOD(CairoMatrix
, __construct
)
358 zend_class_entry
* _this_ce
;
370 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "|dddddd", &xx
, &yx
, &xy
, &yy
, &x0
, &y0
) == FAILURE
) {
374 _this_zval
= getThis();
375 _this_ce
= Z_OBJCE_P(_this_zval
);
378 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
381 /* }}} __construct */
385 /* {{{ proto object inti_rotate(float radians)
387 PHP_METHOD(CairoMatrix
, init_rotate
)
389 zend_class_entry
* _this_ce
;
391 zval
* _this_zval
= NULL
;
392 double radians
= 0.0;
396 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoMatrix_ce_ptr
, &radians
) == FAILURE
) {
400 _this_ce
= Z_OBJCE_P(_this_zval
);
403 php_error(E_WARNING
, "init_rotate: not yet implemented"); RETURN_FALSE
;
405 object_init(return_value
);
407 /* }}} init_rotate */
411 /* {{{ proto void invert()
413 PHP_METHOD(CairoMatrix
, invert
)
415 zend_class_entry
* _this_ce
;
417 zval
* _this_zval
= NULL
;
421 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoMatrix_ce_ptr
) == FAILURE
) {
425 _this_ce
= Z_OBJCE_P(_this_zval
);
428 php_error(E_WARNING
, "invert: not yet implemented"); RETURN_FALSE
;
435 /* {{{ proto object multiply(object o2)
437 PHP_METHOD(CairoMatrix
, multiply
)
439 zend_class_entry
* _this_ce
;
441 zval
* _this_zval
= NULL
;
446 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoMatrix_ce_ptr
, &o2
) == FAILURE
) {
450 _this_ce
= Z_OBJCE_P(_this_zval
);
453 php_error(E_WARNING
, "multiply: not yet implemented"); RETURN_FALSE
;
455 object_init(return_value
);
461 /* {{{ proto void rotate(float radians)
463 PHP_METHOD(CairoMatrix
, rotate
)
465 zend_class_entry
* _this_ce
;
467 zval
* _this_zval
= NULL
;
468 double radians
= 0.0;
472 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoMatrix_ce_ptr
, &radians
) == FAILURE
) {
476 _this_ce
= Z_OBJCE_P(_this_zval
);
479 php_error(E_WARNING
, "rotate: not yet implemented"); RETURN_FALSE
;
486 /* {{{ proto void scale(float sx, float xy)
488 PHP_METHOD(CairoMatrix
, scale
)
490 zend_class_entry
* _this_ce
;
492 zval
* _this_zval
= NULL
;
498 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &sx
, &xy
) == FAILURE
) {
502 _this_ce
= Z_OBJCE_P(_this_zval
);
505 php_error(E_WARNING
, "scale: not yet implemented"); RETURN_FALSE
;
512 /* {{{ proto array transform_distance(float dx, float dy)
514 PHP_METHOD(CairoMatrix
, transform_distance
)
516 zend_class_entry
* _this_ce
;
518 zval
* _this_zval
= NULL
;
524 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &dx
, &dy
) == FAILURE
) {
528 _this_ce
= Z_OBJCE_P(_this_zval
);
531 array_init(return_value
);
533 php_error(E_WARNING
, "transform_distance: not yet implemented"); RETURN_FALSE
;
535 array_init(return_value
);
537 /* }}} transform_distance */
541 /* {{{ proto array transform_point(float x, float y)
543 PHP_METHOD(CairoMatrix
, transform_point
)
545 zend_class_entry
* _this_ce
;
547 zval
* _this_zval
= NULL
;
553 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &x
, &y
) == FAILURE
) {
557 _this_ce
= Z_OBJCE_P(_this_zval
);
560 array_init(return_value
);
562 php_error(E_WARNING
, "transform_point: not yet implemented"); RETURN_FALSE
;
564 array_init(return_value
);
566 /* }}} transform_point */
570 /* {{{ proto void translate(float tx, float ty)
572 PHP_METHOD(CairoMatrix
, translate
)
574 zend_class_entry
* _this_ce
;
576 zval
* _this_zval
= NULL
;
582 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &tx
, &ty
) == FAILURE
) {
586 _this_ce
= Z_OBJCE_P(_this_zval
);
589 php_error(E_WARNING
, "translate: not yet implemented"); RETURN_FALSE
;
595 static zend_function_entry CairoMatrix_methods
[] = {
596 PHP_ME(CairoMatrix
, __construct
, CairoMatrix____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
597 PHP_ME(CairoMatrix
, init_rotate
, CairoMatrix__init_rotate_args
, /**/ZEND_ACC_PRIVATE
)
598 PHP_ME(CairoMatrix
, invert
, NULL
, /**/ZEND_ACC_PUBLIC
)
599 PHP_ME(CairoMatrix
, multiply
, CairoMatrix__multiply_args
, /**/ZEND_ACC_PUBLIC
)
600 PHP_ME(CairoMatrix
, rotate
, CairoMatrix__rotate_args
, /**/ZEND_ACC_PUBLIC
)
601 PHP_ME(CairoMatrix
, scale
, CairoMatrix__scale_args
, /**/ZEND_ACC_PUBLIC
)
602 PHP_ME(CairoMatrix
, transform_distance
, CairoMatrix__transform_distance_args
, /**/ZEND_ACC_PUBLIC
)
603 PHP_ME(CairoMatrix
, transform_point
, CairoMatrix__transform_point_args
, /**/ZEND_ACC_PUBLIC
)
604 PHP_ME(CairoMatrix
, translate
, CairoMatrix__translate_args
, /**/ZEND_ACC_PUBLIC
)
610 static void class_init_CairoMatrix(void)
614 INIT_CLASS_ENTRY(ce
, "CairoMatrix", CairoMatrix_methods
);
615 CairoMatrix_ce_ptr
= zend_register_internal_class(&ce
);
618 /* }}} Class CairoMatrix */
620 /* {{{ Class CairoPath */
622 static zend_class_entry
* CairoPath_ce_ptr
= NULL
;
627 /* {{{ proto void construct()
629 PHP_METHOD(CairoPath
, __construct
)
631 zend_class_entry
* _this_ce
;
636 if (ZEND_NUM_ARGS()>0) {
641 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
644 /* }}} __construct */
648 /* {{{ proto string str()
650 PHP_METHOD(CairoPath
, str
)
652 zend_class_entry
* _this_ce
;
654 zval
* _this_zval
= NULL
;
658 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPath_ce_ptr
) == FAILURE
) {
662 _this_ce
= Z_OBJCE_P(_this_zval
);
665 php_error(E_WARNING
, "str: not yet implemented"); RETURN_FALSE
;
667 RETURN_STRINGL("", 0, 1);
672 static zend_function_entry CairoPath_methods
[] = {
673 PHP_ME(CairoPath
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
674 PHP_ME(CairoPath
, str
, NULL
, /**/ZEND_ACC_PUBLIC
)
680 static void class_init_CairoPath(void)
684 INIT_CLASS_ENTRY(ce
, "CairoPath", CairoPath_methods
);
685 CairoPath_ce_ptr
= zend_register_internal_class(&ce
);
688 /* }}} Class CairoPath */
690 /* {{{ Class CairoPattern */
692 static zend_class_entry
* CairoPattern_ce_ptr
= NULL
;
697 /* {{{ proto void contruct()
699 PHP_METHOD(CairoPattern
, __construct
)
701 zend_class_entry
* _this_ce
;
706 if (ZEND_NUM_ARGS()>0) {
711 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
714 /* }}} __construct */
718 /* {{{ proto object get_matrix()
720 PHP_METHOD(CairoPattern
, get_matrix
)
722 zend_class_entry
* _this_ce
;
724 zval
* _this_zval
= NULL
;
728 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPattern_ce_ptr
) == FAILURE
) {
732 _this_ce
= Z_OBJCE_P(_this_zval
);
735 php_error(E_WARNING
, "get_matrix: not yet implemented"); RETURN_FALSE
;
737 object_init(return_value
);
743 /* {{{ proto void set_matrix(object m)
745 PHP_METHOD(CairoPattern
, set_matrix
)
747 zend_class_entry
* _this_ce
;
749 zval
* _this_zval
= NULL
;
754 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoPattern_ce_ptr
, &m
) == FAILURE
) {
758 _this_ce
= Z_OBJCE_P(_this_zval
);
761 php_error(E_WARNING
, "set_matrix: not yet implemented"); RETURN_FALSE
;
767 static zend_function_entry CairoPattern_methods
[] = {
768 PHP_ME(CairoPattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
769 PHP_ME(CairoPattern
, get_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
770 PHP_ME(CairoPattern
, set_matrix
, CairoPattern__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
776 static void class_init_CairoPattern(void)
780 INIT_CLASS_ENTRY(ce
, "CairoPattern", CairoPattern_methods
);
781 CairoPattern_ce_ptr
= zend_register_internal_class(&ce
);
784 /* }}} Class CairoPattern */
786 /* {{{ Class CairoGradient */
788 static zend_class_entry
* CairoGradient_ce_ptr
= NULL
;
793 /* {{{ proto void construct()
795 PHP_METHOD(CairoGradient
, __contruct
)
797 zend_class_entry
* _this_ce
;
799 zval
* _this_zval
= NULL
;
803 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoGradient_ce_ptr
) == FAILURE
) {
807 _this_ce
= Z_OBJCE_P(_this_zval
);
810 php_error(E_WARNING
, "__contruct: not yet implemented"); RETURN_FALSE
;
817 /* {{{ proto void add_color_stop_rgb(float offset, float red, float green, float blue)
819 PHP_METHOD(CairoGradient
, add_color_stop_rgb
)
821 zend_class_entry
* _this_ce
;
823 zval
* _this_zval
= NULL
;
831 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
) == FAILURE
) {
835 _this_ce
= Z_OBJCE_P(_this_zval
);
838 php_error(E_WARNING
, "add_color_stop_rgb: not yet implemented"); RETURN_FALSE
;
841 /* }}} add_color_stop_rgb */
845 /* {{{ proto void add_color_stop_rgba(float offset, float red, float green, float blue, float alpha)
847 PHP_METHOD(CairoGradient
, add_color_stop_rgba
)
849 zend_class_entry
* _this_ce
;
851 zval
* _this_zval
= NULL
;
860 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
864 _this_ce
= Z_OBJCE_P(_this_zval
);
867 php_error(E_WARNING
, "add_color_stop_rgba: not yet implemented"); RETURN_FALSE
;
870 /* }}} add_color_stop_rgba */
873 static zend_function_entry CairoGradient_methods
[] = {
874 PHP_ME(CairoGradient
, __contruct
, NULL
, /**/ZEND_ACC_PUBLIC
)
875 PHP_ME(CairoGradient
, add_color_stop_rgb
, CairoGradient__add_color_stop_rgb_args
, /**/ZEND_ACC_PUBLIC
)
876 PHP_ME(CairoGradient
, add_color_stop_rgba
, CairoGradient__add_color_stop_rgba_args
, /**/ZEND_ACC_PUBLIC
)
882 static void class_init_CairoGradient(void)
886 INIT_CLASS_ENTRY(ce
, "CairoGradient", CairoGradient_methods
);
887 CairoGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
890 /* }}} Class CairoGradient */
892 /* {{{ Class CairoLinearGradient */
894 static zend_class_entry
* CairoLinearGradient_ce_ptr
= NULL
;
899 /* {{{ proto void construct(float x0, float y0, float x1, float y1)
901 PHP_METHOD(CairoLinearGradient
, __construct
)
903 zend_class_entry
* _this_ce
;
913 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dddd", &x0
, &y0
, &x1
, &y1
) == FAILURE
) {
917 _this_zval
= getThis();
918 _this_ce
= Z_OBJCE_P(_this_zval
);
921 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
924 /* }}} __construct */
928 /* {{{ proto array get_linear_points()
930 PHP_METHOD(CairoLinearGradient
, get_linear_points
)
932 zend_class_entry
* _this_ce
;
934 zval
* _this_zval
= NULL
;
938 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoLinearGradient_ce_ptr
) == FAILURE
) {
942 _this_ce
= Z_OBJCE_P(_this_zval
);
945 array_init(return_value
);
947 php_error(E_WARNING
, "get_linear_points: not yet implemented"); RETURN_FALSE
;
949 array_init(return_value
);
951 /* }}} get_linear_points */
954 static zend_function_entry CairoLinearGradient_methods
[] = {
955 PHP_ME(CairoLinearGradient
, __construct
, CairoLinearGradient____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
956 PHP_ME(CairoLinearGradient
, get_linear_points
, NULL
, /**/ZEND_ACC_PUBLIC
)
962 static void class_init_CairoLinearGradient(void)
966 INIT_CLASS_ENTRY(ce
, "CairoLinearGradient", CairoLinearGradient_methods
);
967 CairoLinearGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoGradient" TSRMLS_CC
);
970 /* }}} Class CairoLinearGradient */
972 /* {{{ Class CairoRadialGradient */
974 static zend_class_entry
* CairoRadialGradient_ce_ptr
= NULL
;
979 /* {{{ proto void construct(float cx0, float cy0, float radius0, float cx1, float cy1, float radius1)
981 PHP_METHOD(CairoRadialGradient
, __constuct
)
983 zend_class_entry
* _this_ce
;
985 zval
* _this_zval
= NULL
;
988 double radius0
= 0.0;
991 double radius1
= 0.0;
995 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoRadialGradient_ce_ptr
, &cx0
, &cy0
, &radius0
, &cx1
, &cy1
, &radius1
) == FAILURE
) {
999 _this_ce
= Z_OBJCE_P(_this_zval
);
1002 php_error(E_WARNING
, "__constuct: not yet implemented"); RETURN_FALSE
;
1005 /* }}} __constuct */
1009 /* {{{ proto array get_radial_circles()
1011 PHP_METHOD(CairoRadialGradient
, get_radial_circles
)
1013 zend_class_entry
* _this_ce
;
1015 zval
* _this_zval
= NULL
;
1019 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoRadialGradient_ce_ptr
) == FAILURE
) {
1023 _this_ce
= Z_OBJCE_P(_this_zval
);
1026 array_init(return_value
);
1028 php_error(E_WARNING
, "get_radial_circles: not yet implemented"); RETURN_FALSE
;
1030 array_init(return_value
);
1032 /* }}} get_radial_circles */
1035 static zend_function_entry CairoRadialGradient_methods
[] = {
1036 PHP_ME(CairoRadialGradient
, __constuct
, CairoRadialGradient____constuct_args
, /**/ZEND_ACC_PUBLIC
)
1037 PHP_ME(CairoRadialGradient
, get_radial_circles
, NULL
, /**/ZEND_ACC_PUBLIC
)
1038 { NULL
, NULL
, NULL
}
1043 static void class_init_CairoRadialGradient(void)
1045 zend_class_entry ce
;
1047 INIT_CLASS_ENTRY(ce
, "CairoRadialGradient", CairoRadialGradient_methods
);
1048 CairoRadialGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoGradient" TSRMLS_CC
);
1051 /* }}} Class CairoRadialGradient */
1053 /* {{{ Class CairoSolidPattern */
1055 static zend_class_entry
* CairoSolidPattern_ce_ptr
= NULL
;
1060 /* {{{ proto void construct(float r, float g, float b [, float a])
1062 PHP_METHOD(CairoSolidPattern
, __construct
)
1064 zend_class_entry
* _this_ce
;
1074 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "ddd|d", &r
, &g
, &b
, &a
) == FAILURE
) {
1078 _this_zval
= getThis();
1079 _this_ce
= Z_OBJCE_P(_this_zval
);
1082 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1085 /* }}} __construct */
1089 /* {{{ proto array get_rgba()
1091 PHP_METHOD(CairoSolidPattern
, get_rgba
)
1093 zend_class_entry
* _this_ce
;
1095 zval
* _this_zval
= NULL
;
1099 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSolidPattern_ce_ptr
) == FAILURE
) {
1103 _this_ce
= Z_OBJCE_P(_this_zval
);
1106 array_init(return_value
);
1108 php_error(E_WARNING
, "get_rgba: not yet implemented"); RETURN_FALSE
;
1110 array_init(return_value
);
1115 static zend_function_entry CairoSolidPattern_methods
[] = {
1116 PHP_ME(CairoSolidPattern
, __construct
, CairoSolidPattern____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1117 PHP_ME(CairoSolidPattern
, get_rgba
, NULL
, /**/ZEND_ACC_PUBLIC
)
1118 { NULL
, NULL
, NULL
}
1123 static void class_init_CairoSolidPattern(void)
1125 zend_class_entry ce
;
1127 INIT_CLASS_ENTRY(ce
, "CairoSolidPattern", CairoSolidPattern_methods
);
1128 CairoSolidPattern_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
1131 /* }}} Class CairoSolidPattern */
1133 /* {{{ Class CairoSurfacePattern */
1135 static zend_class_entry
* CairoSurfacePattern_ce_ptr
= NULL
;
1140 /* {{{ proto void construct(object s)
1142 PHP_METHOD(CairoSurfacePattern
, __construct
)
1144 zend_class_entry
* _this_ce
;
1151 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "o", &s
) == FAILURE
) {
1155 _this_zval
= getThis();
1156 _this_ce
= Z_OBJCE_P(_this_zval
);
1159 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1162 /* }}} __construct */
1166 /* {{{ proto int get_extend()
1168 PHP_METHOD(CairoSurfacePattern
, get_extend
)
1170 zend_class_entry
* _this_ce
;
1172 zval
* _this_zval
= NULL
;
1176 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1180 _this_ce
= Z_OBJCE_P(_this_zval
);
1183 php_error(E_WARNING
, "get_extend: not yet implemented"); RETURN_FALSE
;
1187 /* }}} get_extend */
1191 /* {{{ proto int get_filter()
1193 PHP_METHOD(CairoSurfacePattern
, get_filter
)
1195 zend_class_entry
* _this_ce
;
1197 zval
* _this_zval
= NULL
;
1201 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1205 _this_ce
= Z_OBJCE_P(_this_zval
);
1208 php_error(E_WARNING
, "get_filter: not yet implemented"); RETURN_FALSE
;
1212 /* }}} get_filter */
1216 /* {{{ proto object get_surface()
1218 PHP_METHOD(CairoSurfacePattern
, get_surface
)
1220 zend_class_entry
* _this_ce
;
1222 zval
* _this_zval
= NULL
;
1226 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1230 _this_ce
= Z_OBJCE_P(_this_zval
);
1233 php_error(E_WARNING
, "get_surface: not yet implemented"); RETURN_FALSE
;
1235 object_init(return_value
);
1237 /* }}} get_surface */
1241 /* {{{ proto void set_extend(int extend)
1243 PHP_METHOD(CairoSurfacePattern
, set_extend
)
1245 zend_class_entry
* _this_ce
;
1247 zval
* _this_zval
= NULL
;
1252 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &extend
) == FAILURE
) {
1256 _this_ce
= Z_OBJCE_P(_this_zval
);
1259 php_error(E_WARNING
, "set_extend: not yet implemented"); RETURN_FALSE
;
1262 /* }}} set_extend */
1266 /* {{{ proto void set_filter(int filter)
1268 PHP_METHOD(CairoSurfacePattern
, set_filter
)
1270 zend_class_entry
* _this_ce
;
1272 zval
* _this_zval
= NULL
;
1277 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &filter
) == FAILURE
) {
1281 _this_ce
= Z_OBJCE_P(_this_zval
);
1284 php_error(E_WARNING
, "set_filter: not yet implemented"); RETURN_FALSE
;
1287 /* }}} set_filter */
1290 static zend_function_entry CairoSurfacePattern_methods
[] = {
1291 PHP_ME(CairoSurfacePattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1292 PHP_ME(CairoSurfacePattern
, get_extend
, NULL
, /**/ZEND_ACC_PUBLIC
)
1293 PHP_ME(CairoSurfacePattern
, get_filter
, NULL
, /**/ZEND_ACC_PUBLIC
)
1294 PHP_ME(CairoSurfacePattern
, get_surface
, NULL
, /**/ZEND_ACC_PUBLIC
)
1295 PHP_ME(CairoSurfacePattern
, set_extend
, CairoSurfacePattern__set_extend_args
, /**/ZEND_ACC_PUBLIC
)
1296 PHP_ME(CairoSurfacePattern
, set_filter
, CairoSurfacePattern__set_filter_args
, /**/ZEND_ACC_PUBLIC
)
1297 { NULL
, NULL
, NULL
}
1302 static void class_init_CairoSurfacePattern(void)
1304 zend_class_entry ce
;
1306 INIT_CLASS_ENTRY(ce
, "CairoSurfacePattern", CairoSurfacePattern_methods
);
1307 CairoSurfacePattern_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
1310 /* }}} Class CairoSurfacePattern */
1312 /* {{{ Class CairoScaledFont */
1314 static zend_class_entry
* CairoScaledFont_ce_ptr
= NULL
;
1319 /* {{{ proto void construct(object ff, object mx1, object mx2, object fo)
1321 PHP_METHOD(CairoScaledFont
, __construct
)
1323 zend_class_entry
* _this_ce
;
1333 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "oooo", &ff
, &mx1
, &mx2
, &fo
) == FAILURE
) {
1337 _this_zval
= getThis();
1338 _this_ce
= Z_OBJCE_P(_this_zval
);
1341 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1344 /* }}} __construct */
1348 /* {{{ proto array extents()
1350 PHP_METHOD(CairoScaledFont
, extents
)
1352 zend_class_entry
* _this_ce
;
1354 zval
* _this_zval
= NULL
;
1358 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoScaledFont_ce_ptr
) == FAILURE
) {
1362 _this_ce
= Z_OBJCE_P(_this_zval
);
1365 array_init(return_value
);
1367 php_error(E_WARNING
, "extents: not yet implemented"); RETURN_FALSE
;
1369 array_init(return_value
);
1375 /* {{{ proto object get_font_face()
1377 PHP_METHOD(CairoScaledFont
, get_font_face
)
1379 zend_class_entry
* _this_ce
;
1381 zval
* _this_zval
= NULL
;
1385 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoScaledFont_ce_ptr
) == FAILURE
) {
1389 _this_ce
= Z_OBJCE_P(_this_zval
);
1392 php_error(E_WARNING
, "get_font_face: not yet implemented"); RETURN_FALSE
;
1394 object_init(return_value
);
1396 /* }}} get_font_face */
1400 /* {{{ proto array text_extents(string str)
1402 PHP_METHOD(CairoScaledFont
, text_extents
)
1404 zend_class_entry
* _this_ce
;
1406 zval
* _this_zval
= NULL
;
1407 const char * str
= NULL
;
1412 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoScaledFont_ce_ptr
, &str
, &str_len
) == FAILURE
) {
1416 _this_ce
= Z_OBJCE_P(_this_zval
);
1419 array_init(return_value
);
1421 php_error(E_WARNING
, "text_extents: not yet implemented"); RETURN_FALSE
;
1423 array_init(return_value
);
1425 /* }}} text_extents */
1428 static zend_function_entry CairoScaledFont_methods
[] = {
1429 PHP_ME(CairoScaledFont
, __construct
, CairoScaledFont____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1430 PHP_ME(CairoScaledFont
, extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
1431 PHP_ME(CairoScaledFont
, get_font_face
, NULL
, /**/ZEND_ACC_PUBLIC
)
1432 PHP_ME(CairoScaledFont
, text_extents
, CairoScaledFont__text_extents_args
, /**/ZEND_ACC_PUBLIC
)
1433 { NULL
, NULL
, NULL
}
1438 static void class_init_CairoScaledFont(void)
1440 zend_class_entry ce
;
1442 INIT_CLASS_ENTRY(ce
, "CairoScaledFont", CairoScaledFont_methods
);
1443 CairoScaledFont_ce_ptr
= zend_register_internal_class(&ce
);
1446 /* }}} Class CairoScaledFont */
1449 /* {{{ Class CairoException */
1451 static zend_class_entry
* CairoException_ce_ptr
= NULL
;
1455 static zend_function_entry CairoException_methods
[] = {
1456 { NULL
, NULL
, NULL
}
1461 static void class_init_CairoException(void)
1463 zend_class_entry ce
;
1465 INIT_CLASS_ENTRY(ce
, "CairoException", CairoException_methods
);
1466 CairoException_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "Exception" TSRMLS_CC
);
1469 /* }}} Class CairoException */
1471 /* }}} Class definitions*/
1473 /* {{{ phpCairo_functions[] */
1474 function_entry phpCairo_functions
[] = {
1475 PHP_FE(cairo_version
, cairo_version_arg_info
)
1476 PHP_FE(cairo_version_string
, cairo_version_string_arg_info
)
1477 { NULL
, NULL
, NULL
}
1482 /* {{{ phpCairo_module_entry
1484 zend_module_entry phpCairo_module_entry
= {
1485 STANDARD_MODULE_HEADER
,
1488 PHP_MINIT(phpCairo
), /* Replace with NULL if there is nothing to do at php startup */
1489 PHP_MSHUTDOWN(phpCairo
), /* Replace with NULL if there is nothing to do at php shutdown */
1490 PHP_RINIT(phpCairo
), /* Replace with NULL if there is nothing to do at request start */
1491 PHP_RSHUTDOWN(phpCairo
), /* Replace with NULL if there is nothing to do at request end */
1492 PHP_MINFO(phpCairo
),
1494 STANDARD_MODULE_PROPERTIES
1498 #ifdef COMPILE_DL_PHPCAIRO
1499 ZEND_GET_MODULE(phpCairo
)
1503 /* {{{ PHP_MINIT_FUNCTION */
1504 PHP_MINIT_FUNCTION(phpCairo
)
1506 class_init_CairoContext();
1507 class_init_CairoFontFace();
1508 class_init_CairoFontOptions();
1509 class_init_CairoMatrix();
1510 class_init_CairoPath();
1511 class_init_CairoPattern();
1512 class_init_CairoGradient();
1513 class_init_CairoLinearGradient();
1514 class_init_CairoRadialGradient();
1515 class_init_CairoSolidPattern();
1516 class_init_CairoSurfacePattern();
1517 class_init_CairoScaledFont();
1518 class_init_CairoSurface();
1519 class_init_CairoImageSurface();
1520 class_init_CairoPDFSurface();
1521 class_init_CairoPSSurface();
1522 class_init_CairoQuartzSurface();
1523 class_init_CairoSVGSurface();
1524 class_init_CairoWin32Surface();
1525 class_init_CairoXlibSurface();
1526 class_init_CairoException();
1528 /* add your stuff here */
1535 /* {{{ PHP_MSHUTDOWN_FUNCTION */
1536 PHP_MSHUTDOWN_FUNCTION(phpCairo
)
1539 /* add your stuff here */
1546 /* {{{ PHP_RINIT_FUNCTION */
1547 PHP_RINIT_FUNCTION(phpCairo
)
1549 /* add your stuff here */
1556 /* {{{ PHP_RSHUTDOWN_FUNCTION */
1557 PHP_RSHUTDOWN_FUNCTION(phpCairo
)
1559 /* add your stuff here */
1566 /* {{{ PHP_MINFO_FUNCTION */
1567 PHP_MINFO_FUNCTION(phpCairo
)
1569 php_info_print_box_start(0);
1570 php_printf("<p>PHP bindings for Cairo Graphic Library</p>\n");
1571 php_printf("<p>Version 0.0.1devel (2008-05-22)</p>\n");
1572 php_printf("<p><b>Authors:</b></p>\n");
1573 php_printf("<p>Akshat Gupta <g.akshat@gmail.com> (lead)</p>\n");
1574 php_info_print_box_end();
1575 /* add your stuff here */
1581 /* {{{ proto int cairo_version()
1583 PHP_FUNCTION(cairo_version
)
1588 if (ZEND_NUM_ARGS()>0) {
1593 php_error(E_WARNING
, "cairo_version: not yet implemented"); RETURN_FALSE
;
1597 /* }}} cairo_version */
1600 /* {{{ proto string cairo_version_string()
1602 PHP_FUNCTION(cairo_version_string
)
1607 if (ZEND_NUM_ARGS()>0) {
1612 php_error(E_WARNING
, "cairo_version_string: not yet implemented"); RETURN_FALSE
;
1614 RETURN_STRINGL("", 0, 1);
1616 /* }}} cairo_version_string */
1618 #endif /* HAVE_PHPCAIRO */
1626 * vim600: noet sw=4 ts=4 fdm=marker
1627 * vim<600: noet sw=4 ts=4