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 "phpCairoExceptionMacro.c"
19 #include "phpCairoException.c"
20 #include "phpCairoSurface.c"
21 #include "phpCairoContext.c"
24 /* {{{ Class definitions */
27 /* {{{ Class CairoFontFace */
29 static zend_class_entry
* CairoFontFace_ce_ptr
= NULL
;
34 /* {{{ proto void construct()
36 PHP_METHOD(CairoFontFace
, __construct
)
38 zend_class_entry
* _this_ce
;
43 if (ZEND_NUM_ARGS()>0) {
49 /* not allowede to create an object directly*/
56 /* {{{ proto void destruct()
58 PHP_METHOD(CairoFontFace
, __destruct
)
60 zend_class_entry
* _this_ce
;
62 zval
* _this_zval
= NULL
;
66 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontFace_ce_ptr
) == FAILURE
) {
70 _this_ce
= Z_OBJCE_P(_this_zval
);
73 php_error(E_WARNING
, "__destruct: not yet implemented"); RETURN_FALSE
;
79 static zend_function_entry CairoFontFace_methods
[] = {
80 PHP_ME(CairoFontFace
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
81 PHP_ME(CairoFontFace
, __destruct
, NULL
, /**/ZEND_ACC_PUBLIC
)
87 static void class_init_CairoFontFace(void)
91 INIT_CLASS_ENTRY(ce
, "CairoFontFace", CairoFontFace_methods
);
92 CairoFontFace_ce_ptr
= zend_register_internal_class(&ce
);
95 /* }}} Class CairoFontFace */
97 /* {{{ Class CairoFontOptions */
99 static zend_class_entry
* CairoFontOptions_ce_ptr
= NULL
;
104 /* {{{ proto void construct()
106 PHP_METHOD(CairoFontOptions
, __construct
)
108 zend_class_entry
* _this_ce
;
113 if (ZEND_NUM_ARGS()>0) {
118 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
121 /* }}} __construct */
125 /* {{{ proto int get_antialias()
127 PHP_METHOD(CairoFontOptions
, get_antialias
)
129 zend_class_entry
* _this_ce
;
131 zval
* _this_zval
= NULL
;
135 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
139 _this_ce
= Z_OBJCE_P(_this_zval
);
142 php_error(E_WARNING
, "get_antialias: not yet implemented"); RETURN_FALSE
;
146 /* }}} get_antialias */
150 /* {{{ proto int get_hint_metrics()
152 PHP_METHOD(CairoFontOptions
, get_hint_metrics
)
154 zend_class_entry
* _this_ce
;
156 zval
* _this_zval
= NULL
;
160 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
164 _this_ce
= Z_OBJCE_P(_this_zval
);
167 php_error(E_WARNING
, "get_hint_metrics: not yet implemented"); RETURN_FALSE
;
171 /* }}} get_hint_metrics */
175 /* {{{ proto int get_hint_style()
177 PHP_METHOD(CairoFontOptions
, get_hint_style
)
179 zend_class_entry
* _this_ce
;
181 zval
* _this_zval
= NULL
;
185 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
189 _this_ce
= Z_OBJCE_P(_this_zval
);
192 php_error(E_WARNING
, "get_hint_style: not yet implemented"); RETURN_FALSE
;
196 /* }}} get_hint_style */
200 /* {{{ proto int get_subpixel_order()
202 PHP_METHOD(CairoFontOptions
, get_subpixel_order
)
204 zend_class_entry
* _this_ce
;
206 zval
* _this_zval
= NULL
;
210 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoFontOptions_ce_ptr
) == FAILURE
) {
214 _this_ce
= Z_OBJCE_P(_this_zval
);
217 php_error(E_WARNING
, "get_subpixel_order: not yet implemented"); RETURN_FALSE
;
221 /* }}} get_subpixel_order */
225 /* {{{ proto void set_antialias([int aa])
227 PHP_METHOD(CairoFontOptions
, set_antialias
)
229 zend_class_entry
* _this_ce
;
231 zval
* _this_zval
= NULL
;
236 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &aa
) == FAILURE
) {
240 _this_ce
= Z_OBJCE_P(_this_zval
);
243 php_error(E_WARNING
, "set_antialias: not yet implemented"); RETURN_FALSE
;
246 /* }}} set_antialias */
250 /* {{{ proto void set_hint_metrics([int hm])
252 PHP_METHOD(CairoFontOptions
, set_hint_metrics
)
254 zend_class_entry
* _this_ce
;
256 zval
* _this_zval
= NULL
;
261 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &hm
) == FAILURE
) {
265 _this_ce
= Z_OBJCE_P(_this_zval
);
268 php_error(E_WARNING
, "set_hint_metrics: not yet implemented"); RETURN_FALSE
;
271 /* }}} set_hint_metrics */
275 /* {{{ proto void set_hint_style([int hs])
277 PHP_METHOD(CairoFontOptions
, set_hint_style
)
279 zend_class_entry
* _this_ce
;
281 zval
* _this_zval
= NULL
;
286 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &hs
) == FAILURE
) {
290 _this_ce
= Z_OBJCE_P(_this_zval
);
293 php_error(E_WARNING
, "set_hint_style: not yet implemented"); RETURN_FALSE
;
296 /* }}} set_hint_style */
300 /* {{{ proto void set_subpixel_order([int so])
302 PHP_METHOD(CairoFontOptions
, set_subpixel_order
)
304 zend_class_entry
* _this_ce
;
306 zval
* _this_zval
= NULL
;
311 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoFontOptions_ce_ptr
, &so
) == FAILURE
) {
315 _this_ce
= Z_OBJCE_P(_this_zval
);
318 php_error(E_WARNING
, "set_subpixel_order: not yet implemented"); RETURN_FALSE
;
321 /* }}} set_subpixel_order */
324 static zend_function_entry CairoFontOptions_methods
[] = {
325 PHP_ME(CairoFontOptions
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
326 PHP_ME(CairoFontOptions
, get_antialias
, NULL
, /**/ZEND_ACC_PUBLIC
)
327 PHP_ME(CairoFontOptions
, get_hint_metrics
, NULL
, /**/ZEND_ACC_PUBLIC
)
328 PHP_ME(CairoFontOptions
, get_hint_style
, NULL
, /**/ZEND_ACC_PUBLIC
)
329 PHP_ME(CairoFontOptions
, get_subpixel_order
, NULL
, /**/ZEND_ACC_PUBLIC
)
330 PHP_ME(CairoFontOptions
, set_antialias
, CairoFontOptions__set_antialias_args
, /**/ZEND_ACC_PUBLIC
)
331 PHP_ME(CairoFontOptions
, set_hint_metrics
, CairoFontOptions__set_hint_metrics_args
, /**/ZEND_ACC_PUBLIC
)
332 PHP_ME(CairoFontOptions
, set_hint_style
, CairoFontOptions__set_hint_style_args
, /**/ZEND_ACC_PUBLIC
)
333 PHP_ME(CairoFontOptions
, set_subpixel_order
, CairoFontOptions__set_subpixel_order_args
, /**/ZEND_ACC_PUBLIC
)
339 static void class_init_CairoFontOptions(void)
343 INIT_CLASS_ENTRY(ce
, "CairoFontOptions", CairoFontOptions_methods
);
344 CairoFontOptions_ce_ptr
= zend_register_internal_class(&ce
);
347 /* }}} Class CairoFontOptions */
349 /* {{{ Class CairoMatrix */
351 static zend_class_entry
* CairoMatrix_ce_ptr
= NULL
;
356 /* {{{ proto void construct([float xx, float yx, float xy, float yy, float x0, float y0])
358 PHP_METHOD(CairoMatrix
, __construct
)
360 zend_class_entry
* _this_ce
;
372 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "|dddddd", &xx
, &yx
, &xy
, &yy
, &x0
, &y0
) == FAILURE
) {
376 _this_zval
= getThis();
377 _this_ce
= Z_OBJCE_P(_this_zval
);
380 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
383 /* }}} __construct */
387 /* {{{ proto object inti_rotate(float radians)
389 PHP_METHOD(CairoMatrix
, init_rotate
)
391 zend_class_entry
* _this_ce
;
393 zval
* _this_zval
= NULL
;
394 double radians
= 0.0;
398 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoMatrix_ce_ptr
, &radians
) == FAILURE
) {
402 _this_ce
= Z_OBJCE_P(_this_zval
);
405 php_error(E_WARNING
, "init_rotate: not yet implemented"); RETURN_FALSE
;
407 object_init(return_value
);
409 /* }}} init_rotate */
413 /* {{{ proto void invert()
415 PHP_METHOD(CairoMatrix
, invert
)
417 zend_class_entry
* _this_ce
;
419 zval
* _this_zval
= NULL
;
423 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoMatrix_ce_ptr
) == FAILURE
) {
427 _this_ce
= Z_OBJCE_P(_this_zval
);
430 php_error(E_WARNING
, "invert: not yet implemented"); RETURN_FALSE
;
437 /* {{{ proto object multiply(object o2)
439 PHP_METHOD(CairoMatrix
, multiply
)
441 zend_class_entry
* _this_ce
;
443 zval
* _this_zval
= NULL
;
448 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoMatrix_ce_ptr
, &o2
) == FAILURE
) {
452 _this_ce
= Z_OBJCE_P(_this_zval
);
455 php_error(E_WARNING
, "multiply: not yet implemented"); RETURN_FALSE
;
457 object_init(return_value
);
463 /* {{{ proto void rotate(float radians)
465 PHP_METHOD(CairoMatrix
, rotate
)
467 zend_class_entry
* _this_ce
;
469 zval
* _this_zval
= NULL
;
470 double radians
= 0.0;
474 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoMatrix_ce_ptr
, &radians
) == FAILURE
) {
478 _this_ce
= Z_OBJCE_P(_this_zval
);
481 php_error(E_WARNING
, "rotate: not yet implemented"); RETURN_FALSE
;
488 /* {{{ proto void scale(float sx, float xy)
490 PHP_METHOD(CairoMatrix
, scale
)
492 zend_class_entry
* _this_ce
;
494 zval
* _this_zval
= NULL
;
500 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &sx
, &xy
) == FAILURE
) {
504 _this_ce
= Z_OBJCE_P(_this_zval
);
507 php_error(E_WARNING
, "scale: not yet implemented"); RETURN_FALSE
;
514 /* {{{ proto array transform_distance(float dx, float dy)
516 PHP_METHOD(CairoMatrix
, transform_distance
)
518 zend_class_entry
* _this_ce
;
520 zval
* _this_zval
= NULL
;
526 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &dx
, &dy
) == FAILURE
) {
530 _this_ce
= Z_OBJCE_P(_this_zval
);
533 array_init(return_value
);
535 php_error(E_WARNING
, "transform_distance: not yet implemented"); RETURN_FALSE
;
537 array_init(return_value
);
539 /* }}} transform_distance */
543 /* {{{ proto array transform_point(float x, float y)
545 PHP_METHOD(CairoMatrix
, transform_point
)
547 zend_class_entry
* _this_ce
;
549 zval
* _this_zval
= NULL
;
555 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &x
, &y
) == FAILURE
) {
559 _this_ce
= Z_OBJCE_P(_this_zval
);
562 array_init(return_value
);
564 php_error(E_WARNING
, "transform_point: not yet implemented"); RETURN_FALSE
;
566 array_init(return_value
);
568 /* }}} transform_point */
572 /* {{{ proto void translate(float tx, float ty)
574 PHP_METHOD(CairoMatrix
, translate
)
576 zend_class_entry
* _this_ce
;
578 zval
* _this_zval
= NULL
;
584 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoMatrix_ce_ptr
, &tx
, &ty
) == FAILURE
) {
588 _this_ce
= Z_OBJCE_P(_this_zval
);
591 php_error(E_WARNING
, "translate: not yet implemented"); RETURN_FALSE
;
597 static zend_function_entry CairoMatrix_methods
[] = {
598 PHP_ME(CairoMatrix
, __construct
, CairoMatrix____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
599 PHP_ME(CairoMatrix
, init_rotate
, CairoMatrix__init_rotate_args
, /**/ZEND_ACC_PRIVATE
)
600 PHP_ME(CairoMatrix
, invert
, NULL
, /**/ZEND_ACC_PUBLIC
)
601 PHP_ME(CairoMatrix
, multiply
, CairoMatrix__multiply_args
, /**/ZEND_ACC_PUBLIC
)
602 PHP_ME(CairoMatrix
, rotate
, CairoMatrix__rotate_args
, /**/ZEND_ACC_PUBLIC
)
603 PHP_ME(CairoMatrix
, scale
, CairoMatrix__scale_args
, /**/ZEND_ACC_PUBLIC
)
604 PHP_ME(CairoMatrix
, transform_distance
, CairoMatrix__transform_distance_args
, /**/ZEND_ACC_PUBLIC
)
605 PHP_ME(CairoMatrix
, transform_point
, CairoMatrix__transform_point_args
, /**/ZEND_ACC_PUBLIC
)
606 PHP_ME(CairoMatrix
, translate
, CairoMatrix__translate_args
, /**/ZEND_ACC_PUBLIC
)
612 static void class_init_CairoMatrix(void)
616 INIT_CLASS_ENTRY(ce
, "CairoMatrix", CairoMatrix_methods
);
617 CairoMatrix_ce_ptr
= zend_register_internal_class(&ce
);
620 /* }}} Class CairoMatrix */
622 /* {{{ Class CairoPath */
624 static zend_class_entry
* CairoPath_ce_ptr
= NULL
;
629 /* {{{ proto void construct()
631 PHP_METHOD(CairoPath
, __construct
)
633 zend_class_entry
* _this_ce
;
638 if (ZEND_NUM_ARGS()>0) {
643 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
646 /* }}} __construct */
650 /* {{{ proto string str()
652 PHP_METHOD(CairoPath
, str
)
654 zend_class_entry
* _this_ce
;
656 zval
* _this_zval
= NULL
;
660 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPath_ce_ptr
) == FAILURE
) {
664 _this_ce
= Z_OBJCE_P(_this_zval
);
667 php_error(E_WARNING
, "str: not yet implemented"); RETURN_FALSE
;
669 RETURN_STRINGL("", 0, 1);
674 static zend_function_entry CairoPath_methods
[] = {
675 PHP_ME(CairoPath
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
676 PHP_ME(CairoPath
, str
, NULL
, /**/ZEND_ACC_PUBLIC
)
682 static void class_init_CairoPath(void)
686 INIT_CLASS_ENTRY(ce
, "CairoPath", CairoPath_methods
);
687 CairoPath_ce_ptr
= zend_register_internal_class(&ce
);
690 /* }}} Class CairoPath */
692 /* {{{ Class CairoPattern */
694 static zend_class_entry
* CairoPattern_ce_ptr
= NULL
;
699 /* {{{ proto void contruct()
701 PHP_METHOD(CairoPattern
, __construct
)
703 zend_class_entry
* _this_ce
;
708 if (ZEND_NUM_ARGS()>0) {
713 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
716 /* }}} __construct */
720 /* {{{ proto object get_matrix()
722 PHP_METHOD(CairoPattern
, get_matrix
)
724 zend_class_entry
* _this_ce
;
726 zval
* _this_zval
= NULL
;
730 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPattern_ce_ptr
) == FAILURE
) {
734 _this_ce
= Z_OBJCE_P(_this_zval
);
737 php_error(E_WARNING
, "get_matrix: not yet implemented"); RETURN_FALSE
;
739 object_init(return_value
);
745 /* {{{ proto void set_matrix(object m)
747 PHP_METHOD(CairoPattern
, set_matrix
)
749 zend_class_entry
* _this_ce
;
751 zval
* _this_zval
= NULL
;
756 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoPattern_ce_ptr
, &m
) == FAILURE
) {
760 _this_ce
= Z_OBJCE_P(_this_zval
);
763 php_error(E_WARNING
, "set_matrix: not yet implemented"); RETURN_FALSE
;
769 static zend_function_entry CairoPattern_methods
[] = {
770 PHP_ME(CairoPattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
771 PHP_ME(CairoPattern
, get_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
772 PHP_ME(CairoPattern
, set_matrix
, CairoPattern__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
778 static void class_init_CairoPattern(void)
782 INIT_CLASS_ENTRY(ce
, "CairoPattern", CairoPattern_methods
);
783 CairoPattern_ce_ptr
= zend_register_internal_class(&ce
);
786 /* }}} Class CairoPattern */
788 /* {{{ Class CairoGradient */
790 static zend_class_entry
* CairoGradient_ce_ptr
= NULL
;
795 /* {{{ proto void construct()
797 PHP_METHOD(CairoGradient
, __contruct
)
799 zend_class_entry
* _this_ce
;
801 zval
* _this_zval
= NULL
;
805 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoGradient_ce_ptr
) == FAILURE
) {
809 _this_ce
= Z_OBJCE_P(_this_zval
);
812 php_error(E_WARNING
, "__contruct: not yet implemented"); RETURN_FALSE
;
819 /* {{{ proto void add_color_stop_rgb(float offset, float red, float green, float blue)
821 PHP_METHOD(CairoGradient
, add_color_stop_rgb
)
823 zend_class_entry
* _this_ce
;
825 zval
* _this_zval
= NULL
;
833 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
) == FAILURE
) {
837 _this_ce
= Z_OBJCE_P(_this_zval
);
840 php_error(E_WARNING
, "add_color_stop_rgb: not yet implemented"); RETURN_FALSE
;
843 /* }}} add_color_stop_rgb */
847 /* {{{ proto void add_color_stop_rgba(float offset, float red, float green, float blue, float alpha)
849 PHP_METHOD(CairoGradient
, add_color_stop_rgba
)
851 zend_class_entry
* _this_ce
;
853 zval
* _this_zval
= NULL
;
862 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
866 _this_ce
= Z_OBJCE_P(_this_zval
);
869 php_error(E_WARNING
, "add_color_stop_rgba: not yet implemented"); RETURN_FALSE
;
872 /* }}} add_color_stop_rgba */
875 static zend_function_entry CairoGradient_methods
[] = {
876 PHP_ME(CairoGradient
, __contruct
, NULL
, /**/ZEND_ACC_PUBLIC
)
877 PHP_ME(CairoGradient
, add_color_stop_rgb
, CairoGradient__add_color_stop_rgb_args
, /**/ZEND_ACC_PUBLIC
)
878 PHP_ME(CairoGradient
, add_color_stop_rgba
, CairoGradient__add_color_stop_rgba_args
, /**/ZEND_ACC_PUBLIC
)
884 static void class_init_CairoGradient(void)
888 INIT_CLASS_ENTRY(ce
, "CairoGradient", CairoGradient_methods
);
889 CairoGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
892 /* }}} Class CairoGradient */
894 /* {{{ Class CairoLinearGradient */
896 static zend_class_entry
* CairoLinearGradient_ce_ptr
= NULL
;
901 /* {{{ proto void construct(float x0, float y0, float x1, float y1)
903 PHP_METHOD(CairoLinearGradient
, __construct
)
905 zend_class_entry
* _this_ce
;
915 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dddd", &x0
, &y0
, &x1
, &y1
) == FAILURE
) {
919 _this_zval
= getThis();
920 _this_ce
= Z_OBJCE_P(_this_zval
);
923 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
926 /* }}} __construct */
930 /* {{{ proto array get_linear_points()
932 PHP_METHOD(CairoLinearGradient
, get_linear_points
)
934 zend_class_entry
* _this_ce
;
936 zval
* _this_zval
= NULL
;
940 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoLinearGradient_ce_ptr
) == FAILURE
) {
944 _this_ce
= Z_OBJCE_P(_this_zval
);
947 array_init(return_value
);
949 php_error(E_WARNING
, "get_linear_points: not yet implemented"); RETURN_FALSE
;
951 array_init(return_value
);
953 /* }}} get_linear_points */
956 static zend_function_entry CairoLinearGradient_methods
[] = {
957 PHP_ME(CairoLinearGradient
, __construct
, CairoLinearGradient____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
958 PHP_ME(CairoLinearGradient
, get_linear_points
, NULL
, /**/ZEND_ACC_PUBLIC
)
964 static void class_init_CairoLinearGradient(void)
968 INIT_CLASS_ENTRY(ce
, "CairoLinearGradient", CairoLinearGradient_methods
);
969 CairoLinearGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoGradient" TSRMLS_CC
);
972 /* }}} Class CairoLinearGradient */
974 /* {{{ Class CairoRadialGradient */
976 static zend_class_entry
* CairoRadialGradient_ce_ptr
= NULL
;
981 /* {{{ proto void construct(float cx0, float cy0, float radius0, float cx1, float cy1, float radius1)
983 PHP_METHOD(CairoRadialGradient
, __constuct
)
985 zend_class_entry
* _this_ce
;
987 zval
* _this_zval
= NULL
;
990 double radius0
= 0.0;
993 double radius1
= 0.0;
997 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoRadialGradient_ce_ptr
, &cx0
, &cy0
, &radius0
, &cx1
, &cy1
, &radius1
) == FAILURE
) {
1001 _this_ce
= Z_OBJCE_P(_this_zval
);
1004 php_error(E_WARNING
, "__constuct: not yet implemented"); RETURN_FALSE
;
1007 /* }}} __constuct */
1011 /* {{{ proto array get_radial_circles()
1013 PHP_METHOD(CairoRadialGradient
, get_radial_circles
)
1015 zend_class_entry
* _this_ce
;
1017 zval
* _this_zval
= NULL
;
1021 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoRadialGradient_ce_ptr
) == FAILURE
) {
1025 _this_ce
= Z_OBJCE_P(_this_zval
);
1028 array_init(return_value
);
1030 php_error(E_WARNING
, "get_radial_circles: not yet implemented"); RETURN_FALSE
;
1032 array_init(return_value
);
1034 /* }}} get_radial_circles */
1037 static zend_function_entry CairoRadialGradient_methods
[] = {
1038 PHP_ME(CairoRadialGradient
, __constuct
, CairoRadialGradient____constuct_args
, /**/ZEND_ACC_PUBLIC
)
1039 PHP_ME(CairoRadialGradient
, get_radial_circles
, NULL
, /**/ZEND_ACC_PUBLIC
)
1040 { NULL
, NULL
, NULL
}
1045 static void class_init_CairoRadialGradient(void)
1047 zend_class_entry ce
;
1049 INIT_CLASS_ENTRY(ce
, "CairoRadialGradient", CairoRadialGradient_methods
);
1050 CairoRadialGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoGradient" TSRMLS_CC
);
1053 /* }}} Class CairoRadialGradient */
1055 /* {{{ Class CairoSolidPattern */
1057 static zend_class_entry
* CairoSolidPattern_ce_ptr
= NULL
;
1062 /* {{{ proto void construct(float r, float g, float b [, float a])
1064 PHP_METHOD(CairoSolidPattern
, __construct
)
1066 zend_class_entry
* _this_ce
;
1076 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "ddd|d", &r
, &g
, &b
, &a
) == FAILURE
) {
1080 _this_zval
= getThis();
1081 _this_ce
= Z_OBJCE_P(_this_zval
);
1084 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1087 /* }}} __construct */
1091 /* {{{ proto array get_rgba()
1093 PHP_METHOD(CairoSolidPattern
, get_rgba
)
1095 zend_class_entry
* _this_ce
;
1097 zval
* _this_zval
= NULL
;
1101 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSolidPattern_ce_ptr
) == FAILURE
) {
1105 _this_ce
= Z_OBJCE_P(_this_zval
);
1108 array_init(return_value
);
1110 php_error(E_WARNING
, "get_rgba: not yet implemented"); RETURN_FALSE
;
1112 array_init(return_value
);
1117 static zend_function_entry CairoSolidPattern_methods
[] = {
1118 PHP_ME(CairoSolidPattern
, __construct
, CairoSolidPattern____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1119 PHP_ME(CairoSolidPattern
, get_rgba
, NULL
, /**/ZEND_ACC_PUBLIC
)
1120 { NULL
, NULL
, NULL
}
1125 static void class_init_CairoSolidPattern(void)
1127 zend_class_entry ce
;
1129 INIT_CLASS_ENTRY(ce
, "CairoSolidPattern", CairoSolidPattern_methods
);
1130 CairoSolidPattern_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
1133 /* }}} Class CairoSolidPattern */
1135 /* {{{ Class CairoSurfacePattern */
1137 static zend_class_entry
* CairoSurfacePattern_ce_ptr
= NULL
;
1142 /* {{{ proto void construct(object s)
1144 PHP_METHOD(CairoSurfacePattern
, __construct
)
1146 zend_class_entry
* _this_ce
;
1153 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "o", &s
) == FAILURE
) {
1157 _this_zval
= getThis();
1158 _this_ce
= Z_OBJCE_P(_this_zval
);
1161 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1164 /* }}} __construct */
1168 /* {{{ proto int get_extend()
1170 PHP_METHOD(CairoSurfacePattern
, get_extend
)
1172 zend_class_entry
* _this_ce
;
1174 zval
* _this_zval
= NULL
;
1178 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1182 _this_ce
= Z_OBJCE_P(_this_zval
);
1185 php_error(E_WARNING
, "get_extend: not yet implemented"); RETURN_FALSE
;
1189 /* }}} get_extend */
1193 /* {{{ proto int get_filter()
1195 PHP_METHOD(CairoSurfacePattern
, get_filter
)
1197 zend_class_entry
* _this_ce
;
1199 zval
* _this_zval
= NULL
;
1203 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1207 _this_ce
= Z_OBJCE_P(_this_zval
);
1210 php_error(E_WARNING
, "get_filter: not yet implemented"); RETURN_FALSE
;
1214 /* }}} get_filter */
1218 /* {{{ proto object get_surface()
1220 PHP_METHOD(CairoSurfacePattern
, get_surface
)
1222 zend_class_entry
* _this_ce
;
1224 zval
* _this_zval
= NULL
;
1228 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
1232 _this_ce
= Z_OBJCE_P(_this_zval
);
1235 php_error(E_WARNING
, "get_surface: not yet implemented"); RETURN_FALSE
;
1237 object_init(return_value
);
1239 /* }}} get_surface */
1243 /* {{{ proto void set_extend(int extend)
1245 PHP_METHOD(CairoSurfacePattern
, set_extend
)
1247 zend_class_entry
* _this_ce
;
1249 zval
* _this_zval
= NULL
;
1254 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &extend
) == FAILURE
) {
1258 _this_ce
= Z_OBJCE_P(_this_zval
);
1261 php_error(E_WARNING
, "set_extend: not yet implemented"); RETURN_FALSE
;
1264 /* }}} set_extend */
1268 /* {{{ proto void set_filter(int filter)
1270 PHP_METHOD(CairoSurfacePattern
, set_filter
)
1272 zend_class_entry
* _this_ce
;
1274 zval
* _this_zval
= NULL
;
1279 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &filter
) == FAILURE
) {
1283 _this_ce
= Z_OBJCE_P(_this_zval
);
1286 php_error(E_WARNING
, "set_filter: not yet implemented"); RETURN_FALSE
;
1289 /* }}} set_filter */
1292 static zend_function_entry CairoSurfacePattern_methods
[] = {
1293 PHP_ME(CairoSurfacePattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1294 PHP_ME(CairoSurfacePattern
, get_extend
, NULL
, /**/ZEND_ACC_PUBLIC
)
1295 PHP_ME(CairoSurfacePattern
, get_filter
, NULL
, /**/ZEND_ACC_PUBLIC
)
1296 PHP_ME(CairoSurfacePattern
, get_surface
, NULL
, /**/ZEND_ACC_PUBLIC
)
1297 PHP_ME(CairoSurfacePattern
, set_extend
, CairoSurfacePattern__set_extend_args
, /**/ZEND_ACC_PUBLIC
)
1298 PHP_ME(CairoSurfacePattern
, set_filter
, CairoSurfacePattern__set_filter_args
, /**/ZEND_ACC_PUBLIC
)
1299 { NULL
, NULL
, NULL
}
1304 static void class_init_CairoSurfacePattern(void)
1306 zend_class_entry ce
;
1308 INIT_CLASS_ENTRY(ce
, "CairoSurfacePattern", CairoSurfacePattern_methods
);
1309 CairoSurfacePattern_ce_ptr
= zend_register_internal_class_ex(&ce
, NULL
, "CairoPattern" TSRMLS_CC
);
1312 /* }}} Class CairoSurfacePattern */
1314 /* {{{ Class CairoScaledFont */
1316 static zend_class_entry
* CairoScaledFont_ce_ptr
= NULL
;
1321 /* {{{ proto void construct(object ff, object mx1, object mx2, object fo)
1323 PHP_METHOD(CairoScaledFont
, __construct
)
1325 zend_class_entry
* _this_ce
;
1335 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "oooo", &ff
, &mx1
, &mx2
, &fo
) == FAILURE
) {
1339 _this_zval
= getThis();
1340 _this_ce
= Z_OBJCE_P(_this_zval
);
1343 php_error(E_WARNING
, "__construct: not yet implemented"); RETURN_FALSE
;
1346 /* }}} __construct */
1350 /* {{{ proto array extents()
1352 PHP_METHOD(CairoScaledFont
, extents
)
1354 zend_class_entry
* _this_ce
;
1356 zval
* _this_zval
= NULL
;
1360 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoScaledFont_ce_ptr
) == FAILURE
) {
1364 _this_ce
= Z_OBJCE_P(_this_zval
);
1367 array_init(return_value
);
1369 php_error(E_WARNING
, "extents: not yet implemented"); RETURN_FALSE
;
1371 array_init(return_value
);
1377 /* {{{ proto object get_font_face()
1379 PHP_METHOD(CairoScaledFont
, get_font_face
)
1381 zend_class_entry
* _this_ce
;
1383 zval
* _this_zval
= NULL
;
1387 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoScaledFont_ce_ptr
) == FAILURE
) {
1391 _this_ce
= Z_OBJCE_P(_this_zval
);
1394 php_error(E_WARNING
, "get_font_face: not yet implemented"); RETURN_FALSE
;
1396 object_init(return_value
);
1398 /* }}} get_font_face */
1402 /* {{{ proto array text_extents(string str)
1404 PHP_METHOD(CairoScaledFont
, text_extents
)
1406 zend_class_entry
* _this_ce
;
1408 zval
* _this_zval
= NULL
;
1409 const char * str
= NULL
;
1414 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoScaledFont_ce_ptr
, &str
, &str_len
) == FAILURE
) {
1418 _this_ce
= Z_OBJCE_P(_this_zval
);
1421 array_init(return_value
);
1423 php_error(E_WARNING
, "text_extents: not yet implemented"); RETURN_FALSE
;
1425 array_init(return_value
);
1427 /* }}} text_extents */
1430 static zend_function_entry CairoScaledFont_methods
[] = {
1431 PHP_ME(CairoScaledFont
, __construct
, CairoScaledFont____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
1432 PHP_ME(CairoScaledFont
, extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
1433 PHP_ME(CairoScaledFont
, get_font_face
, NULL
, /**/ZEND_ACC_PUBLIC
)
1434 PHP_ME(CairoScaledFont
, text_extents
, CairoScaledFont__text_extents_args
, /**/ZEND_ACC_PUBLIC
)
1435 { NULL
, NULL
, NULL
}
1440 static void class_init_CairoScaledFont(void)
1442 zend_class_entry ce
;
1444 INIT_CLASS_ENTRY(ce
, "CairoScaledFont", CairoScaledFont_methods
);
1445 CairoScaledFont_ce_ptr
= zend_register_internal_class(&ce
);
1448 /* }}} Class CairoScaledFont */
1451 /* }}} Class definitions*/
1453 /* {{{ phpCairo_functions[] */
1454 function_entry phpCairo_functions
[] = {
1455 PHP_FE(cairo_version
, cairo_version_arg_info
)
1456 PHP_FE(cairo_version_string
, cairo_version_string_arg_info
)
1457 { NULL
, NULL
, NULL
}
1462 /* {{{ phpCairo_module_entry
1464 zend_module_entry phpCairo_module_entry
= {
1465 STANDARD_MODULE_HEADER
,
1468 PHP_MINIT(phpCairo
), /* Replace with NULL if there is nothing to do at php startup */
1469 PHP_MSHUTDOWN(phpCairo
), /* Replace with NULL if there is nothing to do at php shutdown */
1470 PHP_RINIT(phpCairo
), /* Replace with NULL if there is nothing to do at request start */
1471 PHP_RSHUTDOWN(phpCairo
), /* Replace with NULL if there is nothing to do at request end */
1472 PHP_MINFO(phpCairo
),
1474 STANDARD_MODULE_PROPERTIES
1478 #ifdef COMPILE_DL_PHPCAIRO
1479 ZEND_GET_MODULE(phpCairo
)
1483 /* {{{ PHP_MINIT_FUNCTION */
1484 PHP_MINIT_FUNCTION(phpCairo
)
1486 class_init_CairoContext();
1487 class_init_CairoFontFace();
1488 class_init_CairoFontOptions();
1489 class_init_CairoMatrix();
1490 class_init_CairoPath();
1491 class_init_CairoPattern();
1492 class_init_CairoGradient();
1493 class_init_CairoLinearGradient();
1494 class_init_CairoRadialGradient();
1495 class_init_CairoSolidPattern();
1496 class_init_CairoSurfacePattern();
1497 class_init_CairoScaledFont();
1498 class_init_CairoSurface();
1499 class_init_CairoImageSurface();
1500 class_init_CairoPDFSurface();
1501 class_init_CairoPSSurface();
1502 class_init_CairoQuartzSurface();
1503 class_init_CairoSVGSurface();
1504 class_init_CairoWin32Surface();
1505 class_init_CairoXlibSurface();
1506 class_init_CairoException();
1508 /* add your stuff here */
1515 /* {{{ PHP_MSHUTDOWN_FUNCTION */
1516 PHP_MSHUTDOWN_FUNCTION(phpCairo
)
1519 /* add your stuff here */
1526 /* {{{ PHP_RINIT_FUNCTION */
1527 PHP_RINIT_FUNCTION(phpCairo
)
1529 /* add your stuff here */
1536 /* {{{ PHP_RSHUTDOWN_FUNCTION */
1537 PHP_RSHUTDOWN_FUNCTION(phpCairo
)
1539 /* add your stuff here */
1546 /* {{{ PHP_MINFO_FUNCTION */
1547 PHP_MINFO_FUNCTION(phpCairo
)
1549 php_info_print_box_start(0);
1550 php_printf("<p>PHP bindings for Cairo Graphic Library</p>\n");
1551 php_printf("<p>Version 0.0.1devel (2008-05-22)</p>\n");
1552 php_printf("<p><b>Authors:</b></p>\n");
1553 php_printf("<p>Akshat Gupta <g.akshat@gmail.com> (lead)</p>\n");
1554 php_info_print_box_end();
1555 /* add your stuff here */
1561 /* {{{ proto int cairo_version()
1563 PHP_FUNCTION(cairo_version
)
1568 if (ZEND_NUM_ARGS()>0) {
1573 php_error(E_WARNING
, "cairo_version: not yet implemented"); RETURN_FALSE
;
1577 /* }}} cairo_version */
1580 /* {{{ proto string cairo_version_string()
1582 PHP_FUNCTION(cairo_version_string
)
1587 if (ZEND_NUM_ARGS()>0) {
1592 php_error(E_WARNING
, "cairo_version_string: not yet implemented"); RETURN_FALSE
;
1594 RETURN_STRINGL("", 0, 1);
1596 /* }}} cairo_version_string */
1598 #endif /* HAVE_PHPCAIRO */
1606 * vim600: noet sw=4 ts=4 fdm=marker
1607 * vim<600: noet sw=4 ts=4