2 /* {{{ Class CairoPattern */
4 static zend_class_entry
* CairoPattern_ce_ptr
= NULL
;
9 /* {{{ proto void contruct()
11 PHP_METHOD(CairoPattern
, __construct
)
13 zend_class_entry
* _this_ce
;
18 if (ZEND_NUM_ARGS()>0) {
23 php_error(E_ERROR
, "Pattern Cannot be initialized"); RETURN_FALSE
;
30 /* {{{ proto object get_matrix()
32 PHP_METHOD(CairoPattern
, get_matrix
)
34 zend_class_entry
* _this_ce
;
36 zval
* _this_zval
= NULL
;
37 cairo_matrix_t matrix
;
39 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPattern_ce_ptr
) == FAILURE
) {
43 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
44 _this_ce
= Z_OBJCE_P(_this_zval
);
46 cairo_pattern_get_matrix(curr
->pattern
, &matrix
);
47 object_init(return_value
);
48 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
49 mobj
->matrix
= matrix
;
55 /* {{{ proto void set_matrix(object m)
57 PHP_METHOD(CairoPattern
, set_matrix
)
59 zend_class_entry
* _this_ce
;
61 zval
* _this_zval
= NULL
;
66 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoPattern_ce_ptr
, &m
) == FAILURE
) {
70 _this_ce
= Z_OBJCE_P(_this_zval
);
71 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
72 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(m TSRMLS_CC
);
73 cairo_pattern_set_matrix(curr
->pattern
, &mobj
->matrix
);
78 static zend_function_entry CairoPattern_methods
[] = {
79 PHP_ME(CairoPattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
80 PHP_ME(CairoPattern
, get_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
81 PHP_ME(CairoPattern
, set_matrix
, CairoPattern__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
87 static zend_object_handlers CairoPattern_handlers
;
89 static void CairoPattern_object_dtor(void *object
)
91 pattern_object
*pattern
= (pattern_object
*)object
;
92 zend_hash_destroy(pattern
->std
.properties
);
93 FREE_HASHTABLE(pattern
->std
.properties
);
95 cairo_pattern_destroy(pattern
->pattern
);
100 static zend_object_value
CairoPattern_object_new(zend_class_entry
*ce
)
102 zend_object_value retval
;
103 pattern_object
*pattern
;
105 pattern
=emalloc(sizeof(pattern_object
));
106 memset(pattern
,0,sizeof(pattern_object
));
107 pattern
->std
.ce
= ce
;
108 ALLOC_HASHTABLE(pattern
->std
.properties
);
109 zend_hash_init(pattern
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
,0);
110 zend_hash_copy(pattern
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, (void *) &temp
, sizeof(zval
*));
111 retval
.handle
= zend_objects_store_put(pattern
, NULL
, (zend_objects_free_object_storage_t
)CairoPattern_object_dtor
, NULL TSRMLS_CC
);
112 retval
.handlers
= &CairoPattern_handlers
;
117 static void class_init_CairoPattern(void)
121 INIT_CLASS_ENTRY(ce
, "CairoPattern", CairoPattern_methods
);
122 CairoPattern_ce_ptr
= zend_register_internal_class(&ce
);
123 CairoPattern_ce_ptr
->create_object
= CairoPattern_object_new
;
124 memcpy(&CairoPattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
125 CairoPattern_handlers
.clone_obj
= NULL
;
128 /* }}} Class CairoPattern */
130 /* {{{ Class CairoGradient */
132 static zend_class_entry
* CairoGradient_ce_ptr
= NULL
;
137 /* {{{ proto void construct()
139 PHP_METHOD(CairoGradient
, __contruct
)
141 zend_class_entry
* _this_ce
;
143 zval
* _this_zval
= NULL
;
147 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoGradient_ce_ptr
) == FAILURE
) {
151 _this_ce
= Z_OBJCE_P(_this_zval
);
154 php_error(E_ERROR
, "Gradient cannot be initialized"); RETURN_FALSE
;
161 /* {{{ proto void add_color_stop_rgb(float offset, float red, float green, float blue)
163 PHP_METHOD(CairoGradient
, add_color_stop_rgb
)
165 zend_class_entry
* _this_ce
;
167 zval
* _this_zval
= NULL
;
175 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
) == FAILURE
) {
179 _this_ce
= Z_OBJCE_P(_this_zval
);
180 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
181 cairo_pattern_add_color_stop_rgb(curr
->pattern
, offset
, red
, green
, blue
);
182 php_CAIRO_PATTERN_ERROR(curr
->pattern
);
184 /* }}} add_color_stop_rgb */
188 /* {{{ proto void add_color_stop_rgba(float offset, float red, float green, float blue, float alpha)
190 PHP_METHOD(CairoGradient
, add_color_stop_rgba
)
192 zend_class_entry
* _this_ce
;
194 zval
* _this_zval
= NULL
;
203 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
207 _this_ce
= Z_OBJCE_P(_this_zval
);
208 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
209 cairo_pattern_add_color_stop_rgba(curr
->pattern
, offset
, red
, green
, blue
, alpha
);
210 php_CAIRO_PATTERN_ERROR(curr
->pattern
);
212 /* }}} add_color_stop_rgba */
215 static zend_function_entry CairoGradient_methods
[] = {
216 PHP_ME(CairoGradient
, __contruct
, NULL
, /**/ZEND_ACC_PUBLIC
)
217 PHP_ME(CairoGradient
, add_color_stop_rgb
, CairoGradient__add_color_stop_rgb_args
, /**/ZEND_ACC_PUBLIC
)
218 PHP_ME(CairoGradient
, add_color_stop_rgba
, CairoGradient__add_color_stop_rgba_args
, /**/ZEND_ACC_PUBLIC
)
224 static zend_object_handlers CairoGradient_handlers
;
226 static zend_object_value
CairoGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
228 zend_object_value retval
;
229 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
230 retval
.handlers
= &CairoGradient_handlers
;
234 static void class_init_CairoGradient(void)
237 INIT_CLASS_ENTRY(ce
, "CairoGradient", CairoGradient_methods
);
238 CairoGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
239 CairoGradient_ce_ptr
->create_object
= CairoGradient_object_new
;
240 memcpy(&CairoGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
244 /* }}} Class CairoGradient */
246 /* {{{ Class CairoLinearGradient */
248 static zend_class_entry
* CairoLinearGradient_ce_ptr
= NULL
;
253 /* {{{ proto void construct(float x0, float y0, float x1, float y1)
255 PHP_METHOD(CairoLinearGradient
, __construct
)
257 zend_class_entry
* _this_ce
;
267 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dddd", &x0
, &y0
, &x1
, &y1
) == FAILURE
) {
271 _this_zval
= getThis();
272 _this_ce
= Z_OBJCE_P(_this_zval
);
273 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
274 curr
->pattern
= cairo_pattern_create_linear(x0
, y0
, x1
, y1
);
277 /* }}} __construct */
281 /* {{{ proto array get_linear_points()
283 PHP_METHOD(CairoLinearGradient
, get_linear_points
)
285 zend_class_entry
* _this_ce
;
287 zval
* _this_zval
= NULL
;
288 double x0
, y0
, x1
, y1
;
291 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoLinearGradient_ce_ptr
) == FAILURE
) {
295 _this_ce
= Z_OBJCE_P(_this_zval
);
296 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
297 cairo_pattern_get_linear_points(curr
->pattern
, &x0
, &y0
, &x1
, &y1
);
299 array_init(return_value
);
300 add_assoc_double(return_value
, "x0", x0
);
301 add_assoc_double(return_value
, "y0", y0
);
302 add_assoc_double(return_value
, "x1", x1
);
303 add_assoc_double(return_value
, "y1", y1
);
306 /* }}} get_linear_points */
309 static zend_function_entry CairoLinearGradient_methods
[] = {
310 PHP_ME(CairoLinearGradient
, __construct
, CairoLinearGradient____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
311 PHP_ME(CairoLinearGradient
, get_linear_points
, NULL
, /**/ZEND_ACC_PUBLIC
)
317 static zend_object_handlers CairoLinearGradient_handlers
;
319 static zend_object_value
CairoLinearGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
321 zend_object_value retval
;
322 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
323 retval
.handlers
= &CairoLinearGradient_handlers
;
327 static void class_init_CairoLinearGradient(void)
330 INIT_CLASS_ENTRY(ce
, "CairoLinearGradient", CairoLinearGradient_methods
);
331 CairoLinearGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoGradient_ce_ptr
, "CairoGradient" TSRMLS_CC
);
332 CairoLinearGradient_ce_ptr
->create_object
= CairoLinearGradient_object_new
;
333 memcpy(&CairoLinearGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
337 /* }}} Class CairoLinearGradient */
339 /* {{{ Class CairoRadialGradient */
341 static zend_class_entry
* CairoRadialGradient_ce_ptr
= NULL
;
346 /* {{{ proto void construct(float cx0, float cy0, float radius0, float cx1, float cy1, float radius1)
348 PHP_METHOD(CairoRadialGradient
, __constuct
)
350 zend_class_entry
* _this_ce
;
352 zval
* _this_zval
= NULL
;
355 double radius0
= 0.0;
358 double radius1
= 0.0;
362 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoRadialGradient_ce_ptr
, &cx0
, &cy0
, &radius0
, &cx1
, &cy1
, &radius1
) == FAILURE
) {
366 _this_ce
= Z_OBJCE_P(_this_zval
);
367 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
368 curr
->pattern
= cairo_pattern_create_radial(cx0
, cy0
, radius0
, cx1
, cy1
, radius1
);
375 /* {{{ proto array get_radial_circles()
377 PHP_METHOD(CairoRadialGradient
, get_radial_circles
)
379 zend_class_entry
* _this_ce
;
381 zval
* _this_zval
= NULL
;
382 double x0
, y0
, r0
, x1
, y1
, r1
;
385 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoRadialGradient_ce_ptr
) == FAILURE
) {
389 _this_ce
= Z_OBJCE_P(_this_zval
);
390 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
391 cairo_pattern_get_radial_circles(curr
->pattern
, &x0
, &y0
, &r0
, &x1
, &y1
, &r1
);
393 array_init(return_value
);
394 add_assoc_double(return_value
, "x0", x0
);
395 add_assoc_double(return_value
, "y0", y0
);
396 add_assoc_double(return_value
, "r0", r0
);
397 add_assoc_double(return_value
, "x1", x1
);
398 add_assoc_double(return_value
, "y1", y1
);
399 add_assoc_double(return_value
, "r1", r1
);
402 /* }}} get_radial_circles */
405 static zend_function_entry CairoRadialGradient_methods
[] = {
406 PHP_ME(CairoRadialGradient
, __constuct
, CairoRadialGradient____constuct_args
, /**/ZEND_ACC_PUBLIC
)
407 PHP_ME(CairoRadialGradient
, get_radial_circles
, NULL
, /**/ZEND_ACC_PUBLIC
)
413 static zend_object_handlers CairoRadialGradient_handlers
;
415 static zend_object_value
CairoRadialGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
417 zend_object_value retval
;
418 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
419 retval
.handlers
= &CairoRadialGradient_handlers
;
423 static void class_init_CairoRadialGradient(void)
426 INIT_CLASS_ENTRY(ce
, "CairoRadialGradient", CairoRadialGradient_methods
);
427 CairoRadialGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoGradient_ce_ptr
, "CairoGradient" TSRMLS_CC
);
428 CairoRadialGradient_ce_ptr
->create_object
= CairoRadialGradient_object_new
;
429 memcpy(&CairoRadialGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
432 /* }}} Class CairoRadialGradient */
434 /* {{{ Class CairoSolidPattern */
436 static zend_class_entry
* CairoSolidPattern_ce_ptr
= NULL
;
441 /* {{{ proto void construct(float r, float g, float b [, float a])
443 PHP_METHOD(CairoSolidPattern
, __construct
)
445 zend_class_entry
* _this_ce
;
455 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "ddd|d", &r
, &g
, &b
, &a
) == FAILURE
) {
459 _this_zval
= getThis();
460 _this_ce
= Z_OBJCE_P(_this_zval
);
461 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
462 curr
->pattern
= cairo_pattern_create_rgba(r
, g
, b
, a
);
465 /* }}} __construct */
469 /* {{{ proto array get_rgba()
471 PHP_METHOD(CairoSolidPattern
, get_rgba
)
473 zend_class_entry
* _this_ce
;
475 zval
* _this_zval
= NULL
;
479 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSolidPattern_ce_ptr
) == FAILURE
) {
483 _this_ce
= Z_OBJCE_P(_this_zval
);
484 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
485 cairo_pattern_get_rgba(curr
->pattern
, &r
, &g
, &b
, &a
);
487 array_init(return_value
);
488 add_assoc_double(return_value
, "red", r
);
489 add_assoc_double(return_value
, "green", g
);
490 add_assoc_double(return_value
, "blue", b
);
491 add_assoc_double(return_value
, "alpha", a
);
497 static zend_function_entry CairoSolidPattern_methods
[] = {
498 PHP_ME(CairoSolidPattern
, __construct
, CairoSolidPattern____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
499 PHP_ME(CairoSolidPattern
, get_rgba
, NULL
, /**/ZEND_ACC_PUBLIC
)
505 static zend_object_handlers CairoSolidPattern_handlers
;
507 static zend_object_value
CairoSolidPattern_object_new(zend_class_entry
*ce TSRMLS_CC
)
509 zend_object_value retval
;
510 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
511 retval
.handlers
= &CairoSolidPattern_handlers
;
516 static void class_init_CairoSolidPattern(void)
520 INIT_CLASS_ENTRY(ce
, "CairoSolidPattern", CairoSolidPattern_methods
);
521 CairoSolidPattern_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
522 CairoSolidPattern_ce_ptr
->create_object
= CairoSolidPattern_object_new
;
523 memcpy(&CairoSolidPattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
526 /* }}} Class CairoSolidPattern */
528 /* {{{ Class CairoSurfacePattern */
530 static zend_class_entry
* CairoSurfacePattern_ce_ptr
= NULL
;
535 /* {{{ proto void construct(object s)
537 PHP_METHOD(CairoSurfacePattern
, __construct
)
539 zend_class_entry
* _this_ce
;
546 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "o", &s
) == FAILURE
) {
550 _this_zval
= getThis();
551 _this_ce
= Z_OBJCE_P(_this_zval
);
552 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
553 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(s TSRMLS_CC
);
554 curr
->pattern
= cairo_pattern_create_for_surface(sobj
->surface
);
557 /* }}} __construct */
561 /* {{{ proto int get_extend()
563 PHP_METHOD(CairoSurfacePattern
, get_extend
)
565 zend_class_entry
* _this_ce
;
567 zval
* _this_zval
= NULL
;
571 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
575 _this_ce
= Z_OBJCE_P(_this_zval
);
576 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
578 extend
= cairo_pattern_get_extend(curr
->pattern
);
586 /* {{{ proto int get_filter()
588 PHP_METHOD(CairoSurfacePattern
, get_filter
)
590 zend_class_entry
* _this_ce
;
592 zval
* _this_zval
= NULL
;
596 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
600 _this_ce
= Z_OBJCE_P(_this_zval
);
601 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
602 filter
= cairo_pattern_get_filter(curr
->pattern
);
609 /* {{{ proto object get_surface()
611 PHP_METHOD(CairoSurfacePattern
, get_surface
)
613 zend_class_entry
* _this_ce
;
614 zend_class_entry
*surface_ce
;
615 cairo_surface_t
*surface
;
616 zval
* _this_zval
= NULL
;
620 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
624 _this_ce
= Z_OBJCE_P(_this_zval
);
625 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
626 cairo_pattern_get_surface(curr
->pattern
, &surface
);
627 surface_ce
= get_CairoSurface_ce_ptr(surface
);
629 object_init_ex(return_value
,surface_ce
);
630 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
631 sobj
->surface
= cairo_surface_reference(surface
);
633 /* }}} get_surface */
637 /* {{{ proto void set_extend(int extend)
639 PHP_METHOD(CairoSurfacePattern
, set_extend
)
641 zend_class_entry
* _this_ce
;
643 zval
* _this_zval
= NULL
;
648 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &extend
) == FAILURE
) {
652 _this_ce
= Z_OBJCE_P(_this_zval
);
653 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
654 cairo_pattern_set_extend(curr
->pattern
, extend
);
661 /* {{{ proto void set_filter(int filter)
663 PHP_METHOD(CairoSurfacePattern
, set_filter
)
665 zend_class_entry
* _this_ce
;
667 zval
* _this_zval
= NULL
;
672 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &filter
) == FAILURE
) {
676 _this_ce
= Z_OBJCE_P(_this_zval
);
677 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
679 cairo_pattern_set_filter(curr
->pattern
, filter
);
684 static zend_function_entry CairoSurfacePattern_methods
[] = {
685 PHP_ME(CairoSurfacePattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
686 PHP_ME(CairoSurfacePattern
, get_extend
, NULL
, /**/ZEND_ACC_PUBLIC
)
687 PHP_ME(CairoSurfacePattern
, get_filter
, NULL
, /**/ZEND_ACC_PUBLIC
)
688 PHP_ME(CairoSurfacePattern
, get_surface
, NULL
, /**/ZEND_ACC_PUBLIC
)
689 PHP_ME(CairoSurfacePattern
, set_extend
, CairoSurfacePattern__set_extend_args
, /**/ZEND_ACC_PUBLIC
)
690 PHP_ME(CairoSurfacePattern
, set_filter
, CairoSurfacePattern__set_filter_args
, /**/ZEND_ACC_PUBLIC
)
696 static zend_object_handlers CairoSurfacePattern_handlers
;
698 static zend_object_value
CairoSurfacePattern_object_new(zend_class_entry
*ce TSRMLS_CC
)
700 zend_object_value retval
;
701 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
702 retval
.handlers
= &CairoSurfacePattern_handlers
;
706 static void class_init_CairoSurfacePattern(void)
709 INIT_CLASS_ENTRY(ce
, "CairoSurfacePattern", CairoSurfacePattern_methods
);
710 CairoSurfacePattern_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
711 CairoSurfacePattern_ce_ptr
->create_object
= CairoSurfacePattern_object_new
;
712 memcpy(&CairoSurfacePattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
716 /* }}} Class CairoSurfacePattern */
718 /* {{{ Helper functions */
721 get_CairoPattern_ce_ptr(cairo_pattern_t
*pattern
)
723 zend_class_entry
*type
;
726 switch(cairo_pattern_get_type(pattern
)) {
727 case CAIRO_PATTERN_TYPE_SOLID
:
728 type
= CairoSolidPattern_ce_ptr
;
730 case CAIRO_PATTERN_TYPE_SURFACE
:
731 type
= CairoSurfacePattern_ce_ptr
;
733 case CAIRO_PATTERN_TYPE_LINEAR
:
734 type
= CairoLinearGradient_ce_ptr
;
736 case CAIRO_PATTERN_TYPE_RADIAL
:
737 type
= CairoRadialGradient_ce_ptr
;
740 php_error(E_ERROR
,"Unsupported Pattern");
745 /* }}} Helper functions */