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 getMatrix()
32 PHP_METHOD(CairoPattern
, getMatrix
)
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_ex(return_value
, CairoMatrix_ce_ptr
);
48 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
49 mobj
->matrix
= matrix
;
55 /* {{{ proto void setMatrix(object m)
57 PHP_METHOD(CairoPattern
, setMatrix
)
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 /* {{{ proto void setExtend(int extend)
80 PHP_METHOD(CairoPattern
, setExtend
)
82 zend_class_entry
* _this_ce
;
85 zval
* _this_zval
= NULL
;
86 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoPattern_ce_ptr
, &extend
) == FAILURE
) {
89 _this_ce
= Z_OBJCE_P(_this_zval
);
90 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
91 cairo_pattern_set_extend(curr
->pattern
, extend
);
92 phpCAIRO_PATTERN_ERROR(curr
->pattern
);
99 /* {{{ proto void getExtend()
101 PHP_METHOD(CairoPattern
, getExtend
)
103 zend_class_entry
* _this_ce
;
106 zval
* _this_zval
= NULL
;
107 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoPattern_ce_ptr
) == FAILURE
) {
110 _this_ce
= Z_OBJCE_P(_this_zval
);
111 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
112 extend
= cairo_pattern_get_extend(curr
->pattern
);
118 static zend_function_entry CairoPattern_methods
[] = {
119 PHP_ME(CairoPattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
120 PHP_ME(CairoPattern
, getMatrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
121 PHP_ME(CairoPattern
, setMatrix
, CairoPattern__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
122 PHP_ME(CairoPattern
, getExtend
, NULL
, /**/ZEND_ACC_PUBLIC
)
123 PHP_ME(CairoPattern
, setExtend
, CairoPattern__set_extend_args
, /**/ZEND_ACC_PUBLIC
)
129 static zend_object_handlers CairoPattern_handlers
;
131 static void CairoPattern_object_dtor(void *object
)
133 pattern_object
*pattern
= (pattern_object
*)object
;
134 zend_hash_destroy(pattern
->std
.properties
);
135 FREE_HASHTABLE(pattern
->std
.properties
);
136 if(pattern
->pattern
){
137 cairo_pattern_destroy(pattern
->pattern
);
142 static zend_object_value
CairoPattern_object_new(zend_class_entry
*ce
)
144 zend_object_value retval
;
145 pattern_object
*pattern
;
147 pattern
=emalloc(sizeof(pattern_object
));
148 memset(pattern
,0,sizeof(pattern_object
));
149 pattern
->std
.ce
= ce
;
150 ALLOC_HASHTABLE(pattern
->std
.properties
);
151 zend_hash_init(pattern
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
,0);
152 zend_hash_copy(pattern
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, (void *) &temp
, sizeof(zval
*));
153 retval
.handle
= zend_objects_store_put(pattern
, NULL
, (zend_objects_free_object_storage_t
)CairoPattern_object_dtor
, NULL TSRMLS_CC
);
154 retval
.handlers
= &CairoPattern_handlers
;
159 static void class_init_CairoPattern(void)
163 INIT_CLASS_ENTRY(ce
, "CairoPattern", CairoPattern_methods
);
164 CairoPattern_ce_ptr
= zend_register_internal_class(&ce
);
165 CairoPattern_ce_ptr
->create_object
= CairoPattern_object_new
;
166 memcpy(&CairoPattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
167 CairoPattern_handlers
.clone_obj
= NULL
;
170 /* }}} Class CairoPattern */
172 /* {{{ Class CairoGradient */
174 static zend_class_entry
* CairoGradient_ce_ptr
= NULL
;
179 /* {{{ proto void construct()
181 PHP_METHOD(CairoGradient
, __construct
)
183 zend_class_entry
* _this_ce
;
185 zval
* _this_zval
= NULL
;
189 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoGradient_ce_ptr
) == FAILURE
) {
193 _this_ce
= Z_OBJCE_P(_this_zval
);
196 php_error(E_ERROR
, "Gradient cannot be initialized"); RETURN_FALSE
;
199 /* }}} __construct */
203 /* {{{ proto void addColorStopRgb(float offset, float red, float green, float blue)
205 PHP_METHOD(CairoGradient
, addColorStopRgb
)
207 zend_class_entry
* _this_ce
;
209 zval
* _this_zval
= NULL
;
217 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
) == FAILURE
) {
221 _this_ce
= Z_OBJCE_P(_this_zval
);
222 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
223 cairo_pattern_add_color_stop_rgb(curr
->pattern
, offset
, red
, green
, blue
);
224 phpCAIRO_PATTERN_ERROR(curr
->pattern
);
226 /* }}} addColorStopRgb */
230 /* {{{ proto void addColorStopRgba(float offset, float red, float green, float blue, float alpha)
232 PHP_METHOD(CairoGradient
, addColorStopRgba
)
234 zend_class_entry
* _this_ce
;
236 zval
* _this_zval
= NULL
;
245 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoGradient_ce_ptr
, &offset
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
249 _this_ce
= Z_OBJCE_P(_this_zval
);
250 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
251 cairo_pattern_add_color_stop_rgba(curr
->pattern
, offset
, red
, green
, blue
, alpha
);
252 phpCAIRO_PATTERN_ERROR(curr
->pattern
);
254 /* }}} addColorStopRgba */
258 static zend_function_entry CairoGradient_methods
[] = {
259 PHP_ME(CairoGradient
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
260 PHP_ME(CairoGradient
, addColorStopRgb
, CairoGradient__add_color_stop_rgb_args
, /**/ZEND_ACC_PUBLIC
)
261 PHP_ME(CairoGradient
, addColorStopRgba
, CairoGradient__add_color_stop_rgba_args
, /**/ZEND_ACC_PUBLIC
)
267 static zend_object_handlers CairoGradient_handlers
;
269 static zend_object_value
CairoGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
271 zend_object_value retval
;
272 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
273 retval
.handlers
= &CairoGradient_handlers
;
277 static void class_init_CairoGradient(void)
280 INIT_CLASS_ENTRY(ce
, "CairoGradient", CairoGradient_methods
);
281 CairoGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
282 CairoGradient_ce_ptr
->create_object
= CairoGradient_object_new
;
283 memcpy(&CairoGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
287 /* }}} Class CairoGradient */
289 /* {{{ Class CairoLinearGradient */
291 static zend_class_entry
* CairoLinearGradient_ce_ptr
= NULL
;
296 /* {{{ proto void construct(float x0, float y0, float x1, float y1)
298 PHP_METHOD(CairoLinearGradient
, __construct
)
300 zend_class_entry
* _this_ce
;
310 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "dddd", &x0
, &y0
, &x1
, &y1
) == FAILURE
) {
314 _this_zval
= getThis();
315 _this_ce
= Z_OBJCE_P(_this_zval
);
316 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
317 curr
->pattern
= cairo_pattern_create_linear(x0
, y0
, x1
, y1
);
320 /* }}} __construct */
324 /* {{{ proto array getLinearPoints()
326 PHP_METHOD(CairoLinearGradient
, getLinearPoints
)
328 zend_class_entry
* _this_ce
;
330 zval
* _this_zval
= NULL
;
331 double x0
, y0
, x1
, y1
;
334 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoLinearGradient_ce_ptr
) == FAILURE
) {
338 _this_ce
= Z_OBJCE_P(_this_zval
);
339 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
340 cairo_pattern_get_linear_points(curr
->pattern
, &x0
, &y0
, &x1
, &y1
);
342 array_init(return_value
);
343 add_assoc_double(return_value
, "x0", x0
);
344 add_assoc_double(return_value
, "y0", y0
);
345 add_assoc_double(return_value
, "x1", x1
);
346 add_assoc_double(return_value
, "y1", y1
);
349 /* }}} getLinearPoints */
352 static zend_function_entry CairoLinearGradient_methods
[] = {
353 PHP_ME(CairoLinearGradient
, __construct
, CairoLinearGradient____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
354 PHP_ME(CairoLinearGradient
, getLinearPoints
, NULL
, /**/ZEND_ACC_PUBLIC
)
360 static zend_object_handlers CairoLinearGradient_handlers
;
362 static zend_object_value
CairoLinearGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
364 zend_object_value retval
;
365 retval
= CairoGradient_object_new(ce TSRMLS_CC
);
366 retval
.handlers
= &CairoLinearGradient_handlers
;
370 static void class_init_CairoLinearGradient(void)
373 INIT_CLASS_ENTRY(ce
, "CairoLinearGradient", CairoLinearGradient_methods
);
374 CairoLinearGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoGradient_ce_ptr
, "CairoGradient" TSRMLS_CC
);
375 CairoLinearGradient_ce_ptr
->create_object
= CairoLinearGradient_object_new
;
376 memcpy(&CairoLinearGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
380 /* }}} Class CairoLinearGradient */
382 /* {{{ Class CairoRadialGradient */
384 static zend_class_entry
* CairoRadialGradient_ce_ptr
= NULL
;
389 /* {{{ proto void construct(float cx0, float cy0, float radius0, float cx1, float cy1, float radius1)
391 PHP_METHOD(CairoRadialGradient
, __construct
)
393 zend_class_entry
* _this_ce
;
395 zval
* _this_zval
= NULL
;
398 double radius0
= 0.0;
401 double radius1
= 0.0;
405 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoRadialGradient_ce_ptr
, &cx0
, &cy0
, &radius0
, &cx1
, &cy1
, &radius1
) == FAILURE
) {
409 _this_ce
= Z_OBJCE_P(_this_zval
);
410 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
411 curr
->pattern
= cairo_pattern_create_radial(cx0
, cy0
, radius0
, cx1
, cy1
, radius1
);
414 /* }}} __construct */
418 /* {{{ proto array getRadialCircles()
420 PHP_METHOD(CairoRadialGradient
, getRadialCircles
)
422 zend_class_entry
* _this_ce
;
424 zval
* _this_zval
= NULL
;
425 double x0
, y0
, r0
, x1
, y1
, r1
;
428 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoRadialGradient_ce_ptr
) == FAILURE
) {
432 _this_ce
= Z_OBJCE_P(_this_zval
);
433 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
434 cairo_pattern_get_radial_circles(curr
->pattern
, &x0
, &y0
, &r0
, &x1
, &y1
, &r1
);
436 array_init(return_value
);
437 add_assoc_double(return_value
, "x0", x0
);
438 add_assoc_double(return_value
, "y0", y0
);
439 add_assoc_double(return_value
, "r0", r0
);
440 add_assoc_double(return_value
, "x1", x1
);
441 add_assoc_double(return_value
, "y1", y1
);
442 add_assoc_double(return_value
, "r1", r1
);
445 /* }}} getRadialCircles */
448 static zend_function_entry CairoRadialGradient_methods
[] = {
449 PHP_ME(CairoRadialGradient
, __construct
, CairoRadialGradient____constuct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
450 PHP_ME(CairoRadialGradient
, getRadialCircles
, NULL
, /**/ZEND_ACC_PUBLIC
)
456 static zend_object_handlers CairoRadialGradient_handlers
;
458 static zend_object_value
CairoRadialGradient_object_new(zend_class_entry
*ce TSRMLS_CC
)
460 zend_object_value retval
;
461 retval
= CairoGradient_object_new(ce TSRMLS_CC
);
462 retval
.handlers
= &CairoRadialGradient_handlers
;
466 static void class_init_CairoRadialGradient(void)
469 INIT_CLASS_ENTRY(ce
, "CairoRadialGradient", CairoRadialGradient_methods
);
470 CairoRadialGradient_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoGradient_ce_ptr
, "CairoGradient" TSRMLS_CC
);
471 CairoRadialGradient_ce_ptr
->create_object
= CairoRadialGradient_object_new
;
472 memcpy(&CairoRadialGradient_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
475 /* }}} Class CairoRadialGradient */
477 /* {{{ Class CairoSolidPattern */
479 static zend_class_entry
* CairoSolidPattern_ce_ptr
= NULL
;
484 /* {{{ proto void construct(float r, float g, float b [, float a])
486 PHP_METHOD(CairoSolidPattern
, __construct
)
488 zend_class_entry
* _this_ce
;
498 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "ddd|d", &r
, &g
, &b
, &a
) == FAILURE
) {
502 _this_zval
= getThis();
503 _this_ce
= Z_OBJCE_P(_this_zval
);
504 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
505 curr
->pattern
= cairo_pattern_create_rgba(r
, g
, b
, a
);
508 /* }}} __construct */
512 /* {{{ proto array getRgba()
514 PHP_METHOD(CairoSolidPattern
, getRgba
)
516 zend_class_entry
* _this_ce
;
518 zval
* _this_zval
= NULL
;
522 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSolidPattern_ce_ptr
) == FAILURE
) {
526 _this_ce
= Z_OBJCE_P(_this_zval
);
527 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
528 cairo_pattern_get_rgba(curr
->pattern
, &r
, &g
, &b
, &a
);
530 array_init(return_value
);
531 add_assoc_double(return_value
, "red", r
);
532 add_assoc_double(return_value
, "green", g
);
533 add_assoc_double(return_value
, "blue", b
);
534 add_assoc_double(return_value
, "alpha", a
);
540 static zend_function_entry CairoSolidPattern_methods
[] = {
541 PHP_ME(CairoSolidPattern
, __construct
, CairoSolidPattern____construct_args
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
542 PHP_ME(CairoSolidPattern
, getRgba
, NULL
, /**/ZEND_ACC_PUBLIC
)
548 static zend_object_handlers CairoSolidPattern_handlers
;
550 static zend_object_value
CairoSolidPattern_object_new(zend_class_entry
*ce TSRMLS_CC
)
552 zend_object_value retval
;
553 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
554 retval
.handlers
= &CairoSolidPattern_handlers
;
559 static void class_init_CairoSolidPattern(void)
563 INIT_CLASS_ENTRY(ce
, "CairoSolidPattern", CairoSolidPattern_methods
);
564 CairoSolidPattern_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
565 CairoSolidPattern_ce_ptr
->create_object
= CairoSolidPattern_object_new
;
566 memcpy(&CairoSolidPattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
569 /* }}} Class CairoSolidPattern */
571 /* {{{ Class CairoSurfacePattern */
573 static zend_class_entry
* CairoSurfacePattern_ce_ptr
= NULL
;
578 /* {{{ proto void construct(object s)
580 PHP_METHOD(CairoSurfacePattern
, __construct
)
582 zend_class_entry
* _this_ce
;
589 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "o", &s
) == FAILURE
) {
593 _this_zval
= getThis();
594 _this_ce
= Z_OBJCE_P(_this_zval
);
595 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
596 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(s TSRMLS_CC
);
597 curr
->pattern
= cairo_pattern_create_for_surface(sobj
->surface
);
600 /* }}} __construct */
603 /* {{{ proto int getFilter()
605 PHP_METHOD(CairoSurfacePattern
, getFilter
)
607 zend_class_entry
* _this_ce
;
609 zval
* _this_zval
= NULL
;
613 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
617 _this_ce
= Z_OBJCE_P(_this_zval
);
618 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
619 filter
= cairo_pattern_get_filter(curr
->pattern
);
626 /* {{{ proto object getSurface()
628 PHP_METHOD(CairoSurfacePattern
, getSurface
)
630 zend_class_entry
* _this_ce
;
631 zend_class_entry
*surface_ce
;
632 cairo_surface_t
*surface
;
633 zval
* _this_zval
= NULL
;
637 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoSurfacePattern_ce_ptr
) == FAILURE
) {
641 _this_ce
= Z_OBJCE_P(_this_zval
);
642 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
643 cairo_pattern_get_surface(curr
->pattern
, &surface
);
644 surface_ce
= get_CairoSurface_ce_ptr(surface
);
646 object_init_ex(return_value
,surface_ce
);
647 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
648 sobj
->surface
= cairo_surface_reference(surface
);
655 /* {{{ proto void setFilter(int filter)
657 PHP_METHOD(CairoSurfacePattern
, setFilter
)
659 zend_class_entry
* _this_ce
;
661 zval
* _this_zval
= NULL
;
666 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoSurfacePattern_ce_ptr
, &filter
) == FAILURE
) {
670 _this_ce
= Z_OBJCE_P(_this_zval
);
671 pattern_object
*curr
= (pattern_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
673 cairo_pattern_set_filter(curr
->pattern
, filter
);
678 static zend_function_entry CairoSurfacePattern_methods
[] = {
679 PHP_ME(CairoSurfacePattern
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
680 PHP_ME(CairoSurfacePattern
, getFilter
, NULL
, /**/ZEND_ACC_PUBLIC
)
681 PHP_ME(CairoSurfacePattern
, getSurface
, NULL
, /**/ZEND_ACC_PUBLIC
)
682 PHP_ME(CairoSurfacePattern
, setFilter
, CairoSurfacePattern__set_filter_args
, /**/ZEND_ACC_PUBLIC
)
688 static zend_object_handlers CairoSurfacePattern_handlers
;
690 static zend_object_value
CairoSurfacePattern_object_new(zend_class_entry
*ce TSRMLS_CC
)
692 zend_object_value retval
;
693 retval
= CairoPattern_object_new(ce TSRMLS_CC
);
694 retval
.handlers
= &CairoSurfacePattern_handlers
;
698 static void class_init_CairoSurfacePattern(void)
701 INIT_CLASS_ENTRY(ce
, "CairoSurfacePattern", CairoSurfacePattern_methods
);
702 CairoSurfacePattern_ce_ptr
= zend_register_internal_class_ex(&ce
, CairoPattern_ce_ptr
, "CairoPattern" TSRMLS_CC
);
703 CairoSurfacePattern_ce_ptr
->create_object
= CairoSurfacePattern_object_new
;
704 memcpy(&CairoSurfacePattern_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
708 /* }}} Class CairoSurfacePattern */
710 /* {{{ Helper functions */
713 get_CairoPattern_ce_ptr(cairo_pattern_t
*pattern
)
715 zend_class_entry
*type
;
718 switch(cairo_pattern_get_type(pattern
)) {
719 case CAIRO_PATTERN_TYPE_SOLID
:
720 type
= CairoSolidPattern_ce_ptr
;
722 case CAIRO_PATTERN_TYPE_SURFACE
:
723 type
= CairoSurfacePattern_ce_ptr
;
725 case CAIRO_PATTERN_TYPE_LINEAR
:
726 type
= CairoLinearGradient_ce_ptr
;
728 case CAIRO_PATTERN_TYPE_RADIAL
:
729 type
= CairoRadialGradient_ce_ptr
;
732 php_error(E_ERROR
,"Unsupported Pattern");
737 /* }}} Helper functions */