1 /* {{{ Class CairoContext */
3 static zend_class_entry
* CairoContext_ce_ptr
= NULL
;
8 /* {{{ proto void construct(object obj)
10 PHP_METHOD(CairoContext
, __construct
)
12 zend_class_entry
* _this_ce
;
17 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, "|o", &obj
) == FAILURE
) {
21 _this_zval
= getThis();
22 _this_ce
= Z_OBJCE_P(_this_zval
);
23 cairo_surface_t
*surface
;
26 surface_object
*sobj
= (surface_object
*)zend_object_store_get_object(obj TSRMLS_CC
);
29 // surface_object *sobj = (surface_object *)malloc(surface_object);
32 surface
= sobj
->surface
;
33 context_object
*context
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
34 context
->context
=cairo_create(surface
);
36 /*php_error(E_WARNING, "__construct: not yet implemented"); RETURN_FALSE; */
43 /* {{{ proto void append_path(object p)
45 PHP_METHOD(CairoContext
, append_path
)
47 zend_class_entry
* _this_ce
;
49 zval
* _this_zval
= NULL
;
54 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &p
) == FAILURE
) {
58 _this_ce
= Z_OBJCE_P(_this_zval
);
59 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
60 path_object
*pobj
=(path_object
*)zend_objects_get_address(p TSRMLS_CC
);
61 cairo_append_path(curr
->context
,pobj
->path
);
62 phpCAIRO_CONTEXT_ERROR(curr
->context
)
69 /* {{{ proto void arc(float xc, float yc, float radius, float angle1, float angle2)
71 PHP_METHOD(CairoContext
, arc
)
73 zend_class_entry
* _this_ce
;
75 zval
* _this_zval
= NULL
;
84 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoContext_ce_ptr
, &xc
, &yc
, &radius
, &angle1
, &angle2
) == FAILURE
) {
88 _this_ce
= Z_OBJCE_P(_this_zval
);
89 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
90 cairo_arc(curr
->context
,xc
,yc
,radius
,angle1
,angle2
);
91 phpCAIRO_CONTEXT_ERROR(curr
->context
)
98 /* {{{ proto void arc_negative(float xc, float yc, float radius, float angle1, float angle2)
100 PHP_METHOD(CairoContext
, arc_negative
)
102 zend_class_entry
* _this_ce
;
104 zval
* _this_zval
= NULL
;
113 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddddd", &_this_zval
, CairoContext_ce_ptr
, &xc
, &yc
, &radius
, &angle1
, &angle2
) == FAILURE
) {
117 _this_ce
= Z_OBJCE_P(_this_zval
);
119 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
122 cairo_arc_negative(curr
->context
, xc
, yc
, radius
, angle1
, angle2
);
123 phpCAIRO_CONTEXT_ERROR(curr
->context
)
127 /* }}} arc_negative */
131 /* {{{ proto void clip()
133 PHP_METHOD(CairoContext
, clip
)
135 zend_class_entry
* _this_ce
;
137 zval
* _this_zval
= NULL
;
141 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
145 _this_ce
= Z_OBJCE_P(_this_zval
);
146 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
147 cairo_clip(curr
->context
);
148 phpCAIRO_CONTEXT_ERROR(curr
->context
)
154 /* {{{ proto array clip_extents()
156 PHP_METHOD(CairoContext
, clip_extents
)
158 zend_class_entry
* _this_ce
;
160 zval
* _this_zval
= NULL
;
162 double x1
, y1
, x2
, y2
;
164 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
168 _this_ce
= Z_OBJCE_P(_this_zval
);
169 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
171 cairo_clip_extents(curr
->context
, &x1
, &y1
, &x2
, &y2
);
172 phpCAIRO_CONTEXT_ERROR(curr
->context
)
173 array_init(return_value
);
174 add_next_index_double(return_value
, x1
);
175 add_next_index_double(return_value
, y1
);
176 add_next_index_double(return_value
, x2
);
177 add_next_index_double(return_value
, y2
);
180 /* }}} clip_extents */
184 /* {{{ proto void clip_preserve()
186 PHP_METHOD(CairoContext
, clip_preserve
)
188 zend_class_entry
* _this_ce
;
190 zval
* _this_zval
= NULL
;
194 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
198 _this_ce
= Z_OBJCE_P(_this_zval
);
200 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
202 cairo_clip_preserve(curr
->context
);
203 phpCAIRO_CONTEXT_ERROR(curr
->context
)
205 /* }}} clip_preserve */
209 /* {{{ proto void close_path()
211 PHP_METHOD(CairoContext
, close_path
)
213 zend_class_entry
* _this_ce
;
215 zval
* _this_zval
= NULL
;
219 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
223 _this_ce
= Z_OBJCE_P(_this_zval
);
224 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
226 cairo_close_path(curr
->context
);
227 phpCAIRO_CONTEXT_ERROR(curr
->context
)
234 /* {{{ proto object copy_clip_rectangle_list() --Not complete
236 PHP_METHOD(CairoContext
, copy_clip_rectangle_list
)
238 zend_class_entry
* _this_ce
;
240 zval
* _this_zval
= NULL
;
241 cairo_rectangle_t
*r
;
242 cairo_rectangle_list_t
*rlist
;
247 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
250 _this_ce
= Z_OBJCE_P(_this_zval
);
251 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
252 rlist
= cairo_copy_clip_rectangle_list(curr
->context
);
253 phpCAIRO_ERROR(rlist
->status
)
255 array_init(return_value
);
256 ALLOC_INIT_ZVAL(temp_arr
);
257 array_init(temp_arr
);
259 for(i
= 0, r
= rlist
->rectangles
; i
< rlist
->num_rectangles
; i
++, r
++) {
260 //ALLOC_INIT_ZVAL(temp_arr);
261 //array_init(temp_arr);
262 add_assoc_double(temp_arr
,"x",r
->x
);
263 add_assoc_double(temp_arr
,"y",r
->y
);
264 add_assoc_double(temp_arr
,"width",r
->width
);
265 add_assoc_double(temp_arr
,"height",r
->height
);
266 add_next_index_zval(return_value
,temp_arr
);
267 zval_ptr_dtor(temp_arr
);
270 /* Need to pass the arr to an iterator */
271 //cairo_rectangle_list_destroy(rlist);
275 /* }}} copy_clip_rectangle_list */
279 /* {{{ proto void copy_page()
281 PHP_METHOD(CairoContext
, copy_page
)
283 zend_class_entry
* _this_ce
;
285 zval
* _this_zval
= NULL
;
289 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
293 _this_ce
= Z_OBJCE_P(_this_zval
);
294 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
295 cairo_copy_page(curr
->context
);
296 phpCAIRO_CONTEXT_ERROR(curr
->context
)
303 /* {{{ proto object copy_path()
305 PHP_METHOD(CairoContext
, copy_path
)
307 zend_class_entry
* _this_ce
;
309 zval
* _this_zval
= NULL
;
313 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
317 _this_ce
= Z_OBJCE_P(_this_zval
);
318 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
320 object_init_ex(return_value
, CairoPath_ce_ptr
);
321 path_object
*pobj
= (path_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
322 pobj
->path
= cairo_copy_path(curr
->context
);
328 /* {{{ proto object copy_path_flat()
330 PHP_METHOD(CairoContext
, copy_path_flat
)
332 zend_class_entry
* _this_ce
;
334 zval
* _this_zval
= NULL
;
338 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
342 _this_ce
= Z_OBJCE_P(_this_zval
);
343 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
345 object_init_ex(return_value
, CairoPath_ce_ptr
);
346 path_object
*pobj
= (path_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
347 pobj
->path
= cairo_copy_path_flat(curr
->context
);
350 /* }}} copy_path_flat */
354 /* {{{ proto void curve_to (float x1, float y1, float x2, float y2, float x3, float y3)
356 PHP_METHOD(CairoContext
, curve_to
)
358 zend_class_entry
* _this_ce
;
360 zval
* _this_zval
= NULL
;
370 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoContext_ce_ptr
, &x1
, &y1
, &x2
, &y2
, &x3
, &y3
) == FAILURE
) {
374 _this_ce
= Z_OBJCE_P(_this_zval
);
375 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
377 cairo_curve_to(curr
->context
, x1
, y1
, x2
, y2
, x3
, y3
);
378 phpCAIRO_CONTEXT_ERROR(curr
->context
)
385 /* {{{ proto array device_to_user(float x, float y)
387 PHP_METHOD(CairoContext
, device_to_user
)
389 zend_class_entry
* _this_ce
;
391 zval
* _this_zval
= NULL
;
397 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
401 _this_ce
= Z_OBJCE_P(_this_zval
);
402 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
404 cairo_device_to_user(curr
->context
, &x
, &y
);
405 phpCAIRO_CONTEXT_ERROR(curr
->context
)
407 array_init(return_value
);
408 add_assoc_double(return_value
, "x", x
);
409 add_assoc_double(return_value
, "y", y
);
412 /* }}} device_to_user */
416 /* {{{ proto array device_to_user_distance(float x, float y)
418 PHP_METHOD(CairoContext
, device_to_user_distance
)
420 zend_class_entry
* _this_ce
;
422 zval
* _this_zval
= NULL
;
428 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
432 _this_ce
= Z_OBJCE_P(_this_zval
);
433 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
434 cairo_device_to_user_distance(curr
->context
, &x
, &y
);
435 phpCAIRO_CONTEXT_ERROR(curr
->context
)
436 array_init(return_value
);
437 add_assoc_double(return_value
, "x", x
);
438 add_assoc_double(return_value
, "y", y
);
441 /* }}} device_to_user_distance */
445 /* {{{ proto void fill()
447 PHP_METHOD(CairoContext
, fill
)
449 zend_class_entry
* _this_ce
;
451 zval
* _this_zval
= NULL
;
455 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
459 _this_ce
= Z_OBJCE_P(_this_zval
);
460 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
461 cairo_fill(curr
->context
);
462 phpCAIRO_CONTEXT_ERROR(curr
->context
)
470 /* {{{ proto array fill_extents()
472 PHP_METHOD(CairoContext
, fill_extents
)
474 zend_class_entry
* _this_ce
;
476 zval
* _this_zval
= NULL
;
477 cairo_font_extents_t e
;
480 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
484 _this_ce
= Z_OBJCE_P(_this_zval
);
485 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
486 cairo_font_extents(curr
->context
, &e
);
488 phpCAIRO_CONTEXT_ERROR(curr
->context
)
489 array_init(return_value
);
490 add_assoc_double(return_value
, "ascent", e
.ascent
);
491 add_assoc_double(return_value
, "descent", e
.descent
);
492 add_assoc_double(return_value
, "height", e
.height
);
493 add_assoc_double(return_value
, "max X advance", e
.max_x_advance
);
494 add_assoc_double(return_value
, "max Y advance", e
.max_y_advance
);
496 /* }}} fill_extents */
500 /* {{{ proto void fill_preserve()
502 PHP_METHOD(CairoContext
, fill_preserve
)
504 zend_class_entry
* _this_ce
;
506 zval
* _this_zval
= NULL
;
510 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
514 _this_ce
= Z_OBJCE_P(_this_zval
);
515 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
516 cairo_fill_preserve(curr
->context
);
517 phpCAIRO_CONTEXT_ERROR(curr
->context
)
521 /* }}} fill_preserve */
525 /* {{{ proto array font_extents()
527 PHP_METHOD(CairoContext
, font_extents
)
529 zend_class_entry
* _this_ce
;
530 zval
* _this_zval
= NULL
;
531 cairo_font_extents_t e
;
533 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
537 _this_ce
= Z_OBJCE_P(_this_zval
);
538 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
539 cairo_font_extents(curr
->context
, &e
);
540 phpCAIRO_CONTEXT_ERROR(curr
->context
)
542 array_init(return_value
);
543 add_assoc_double(return_value
, "ascent", e
.ascent
);
544 add_assoc_double(return_value
, "descent", e
.descent
);
545 add_assoc_double(return_value
, "height", e
.height
);
546 add_assoc_double(return_value
, "max X advance", e
.max_x_advance
);
547 add_assoc_double(return_value
, "max Y advance", e
.max_y_advance
);
550 /* }}} font_extents */
554 /* {{{ proto int get_antialias()
556 PHP_METHOD(CairoContext
, get_antialias
)
558 zend_class_entry
* _this_ce
;
559 zval
* _this_zval
= NULL
;
562 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
566 _this_ce
= Z_OBJCE_P(_this_zval
);
567 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
568 temp
= cairo_get_antialias(curr
->context
);
572 /* }}} get_antialias */
576 /* {{{ proto array get_current_point()
578 PHP_METHOD(CairoContext
, get_current_point
)
580 zend_class_entry
* _this_ce
;
582 zval
* _this_zval
= NULL
;
586 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
590 _this_ce
= Z_OBJCE_P(_this_zval
);
591 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
592 cairo_get_current_point(curr
->context
, &x
, &y
);
593 array_init(return_value
);
594 add_assoc_double(return_value
, "x", x
);
595 add_assoc_double(return_value
, "y", y
);
597 /* }}} get_current_point */
601 /* {{{ proto array get_dash()
603 PHP_METHOD(CairoContext
, get_dash
)
605 zend_class_entry
* _this_ce
;
607 zval
* _this_zval
= NULL
;
608 double *dashes
= NULL
, offset
;
611 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
615 _this_ce
= Z_OBJCE_P(_this_zval
);
616 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
617 count
= cairo_get_dash_count(curr
->context
);
618 dashes
= emalloc(count
* sizeof(double));
621 cairo_get_dashes(curr
->context
, dashes
, &offset
);
623 MAKE_STD_ZVAL(sub_array
);
624 array_init(sub_array
);
625 for(i
=0; i
<count
; i
++) {
626 add_next_index_double(sub_array
,dashes
[i
]);
629 array_init(return_value
);
630 add_assoc_zval(return_value
, "Dashes", sub_array
);
631 add_assoc_double(return_value
, "Offset", offset
);
637 /* {{{ proto int get_dash_count()
639 PHP_METHOD(CairoContext
, get_dash_count
)
641 zend_class_entry
* _this_ce
;
643 zval
* _this_zval
= NULL
;
647 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
651 _this_ce
= Z_OBJCE_P(_this_zval
);
652 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
653 count
= cairo_get_dash_count(curr
->context
);
657 /* }}} get_dash_count */
661 /* {{{ proto int get_fill_rule()
663 PHP_METHOD(CairoContext
, get_fill_rule
)
665 zend_class_entry
* _this_ce
;
667 zval
* _this_zval
= NULL
;
671 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
675 _this_ce
= Z_OBJCE_P(_this_zval
);
676 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
677 fill
= cairo_get_fill_rule(curr
->context
);
681 /* }}} get_fill_rule */
685 /* {{{ proto object get_font_face()
687 PHP_METHOD(CairoContext
, get_font_face
)
689 zend_class_entry
* _this_ce
;
691 zval
* _this_zval
= NULL
;
693 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
697 _this_ce
= Z_OBJCE_P(_this_zval
);
698 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
700 object_init_ex(return_value
, CairoFontFace_ce_ptr
);
701 fontface_object
*ffobj
= (fontface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
702 ffobj
->fontface
= cairo_font_face_reference (cairo_get_font_face(curr
->context
));
704 /* }}} get_font_face */
708 /* {{{ proto object get_font_matrix()
710 PHP_METHOD(CairoContext
, get_font_matrix
)
712 zend_class_entry
* _this_ce
;
714 zval
* _this_zval
= NULL
;
715 cairo_matrix_t matrix
;
718 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
722 _this_ce
= Z_OBJCE_P(_this_zval
);
723 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
724 cairo_get_font_matrix(curr
->context
, &matrix
);
726 object_init_ex(return_value
, CairoMatrix_ce_ptr
);
727 matrix_object
*matobj
= (matrix_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
728 matobj
->matrix
= matrix
;
730 /* }}} get_font_matrix */
734 /* {{{ proto object get_font_options()
736 PHP_METHOD(CairoContext
, get_font_options
)
738 zend_class_entry
* _this_ce
;
740 zval
* _this_zval
= NULL
;
741 cairo_font_options_t
*options
= cairo_font_options_create();
744 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
748 _this_ce
= Z_OBJCE_P(_this_zval
);
749 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
750 cairo_get_font_options(curr
->context
, options
);
752 object_init_ex(return_value
, CairoFontOptions_ce_ptr
);
753 fontoptions_object
*foobj
= (fontoptions_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
754 foobj
->fontoptions
= options
;
757 /* }}} get_font_options */
761 /* {{{ proto object get_group_target()
763 PHP_METHOD(CairoContext
, get_group_target
)
765 zend_class_entry
* _this_ce
, *ce
;
767 zval
* _this_zval
= NULL
;
768 cairo_surface_t
*sur
;
771 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
775 _this_ce
= Z_OBJCE_P(_this_zval
);
776 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
777 sur
= cairo_surface_reference(cairo_get_group_target(curr
->context
));
779 ce
= getCairoSurface_ce_ptr(sur
);
781 object_init_ex(return_value
, ce
);
782 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
784 sobj
->surface
= cairo_surface_reference(sur
);
786 /* }}} get_group_target */
790 /* {{{ proto int get_line_cap()
792 PHP_METHOD(CairoContext
, get_line_cap
)
794 zend_class_entry
* _this_ce
;
796 zval
* _this_zval
= NULL
;
800 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
804 _this_ce
= Z_OBJCE_P(_this_zval
);
805 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
806 line_cap
= cairo_get_line_cap(curr
->context
);
809 RETURN_LONG(line_cap
);
811 /* }}} get_line_cap */
815 /* {{{ proto int get_line_join()
817 PHP_METHOD(CairoContext
, get_line_join
)
819 zend_class_entry
* _this_ce
;
821 zval
* _this_zval
= NULL
;
825 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
829 _this_ce
= Z_OBJCE_P(_this_zval
);
830 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
832 line_join
= cairo_get_line_join(curr
->context
);
833 RETURN_LONG(line_join
);
835 /* }}} get_line_join */
839 /* {{{ proto float get_line_width()
841 PHP_METHOD(CairoContext
, get_line_width
)
843 zend_class_entry
* _this_ce
;
845 zval
* _this_zval
= NULL
;
851 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
855 _this_ce
= Z_OBJCE_P(_this_zval
);
856 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
857 width
= cairo_get_line_width(curr
->context
);
859 RETURN_DOUBLE(width
);
861 /* }}} get_line_width */
865 /* {{{ proto object get_matrix()
867 PHP_METHOD(CairoContext
, get_matrix
)
869 zend_class_entry
* _this_ce
;
871 zval
* _this_zval
= NULL
;
873 cairo_matrix_t matrix
;
875 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
879 _this_ce
= Z_OBJCE_P(_this_zval
);
880 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
882 cairo_get_matrix(curr
->context
, &matrix
);
883 object_init_ex(return_value
, CairoMatrix_ce_ptr
);
884 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
885 mobj
->matrix
= matrix
;
891 /* {{{ proto float get_miter_limit()
893 PHP_METHOD(CairoContext
, get_miter_limit
)
895 zend_class_entry
* _this_ce
;
897 zval
* _this_zval
= NULL
;
901 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
905 _this_ce
= Z_OBJCE_P(_this_zval
);
906 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
907 miter
= cairo_get_miter_limit(curr
->context
);
909 RETURN_DOUBLE(miter
);
911 /* }}} get_miter_limit */
915 /* {{{ proto int get_operator()
917 PHP_METHOD(CairoContext
, get_operator
)
919 zend_class_entry
* _this_ce
;
921 zval
* _this_zval
= NULL
;
925 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
929 _this_ce
= Z_OBJCE_P(_this_zval
);
930 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
931 operator = cairo_get_operator(curr
->context
);
933 RETURN_LONG(operator);
935 /* }}} get_operator */
939 /* {{{ proto object get_scaled_font()
941 PHP_METHOD(CairoContext
, get_scaled_font
)
943 zend_class_entry
* _this_ce
;
945 zval
* _this_zval
= NULL
;
949 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
953 _this_ce
= Z_OBJCE_P(_this_zval
);
954 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
956 object_init_ex(return_value
, CairoScaledFont_ce_ptr
);
957 scaledfont_object
*sfobj
= (scaledfont_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
959 sfobj
->scaledfont
= cairo_scaled_font_reference(cairo_get_scaled_font(curr
->context
));
962 /* }}} get_scaled_font */
966 /* {{{ proto object get_source()
968 PHP_METHOD(CairoContext
, get_source
)
970 zend_class_entry
* _this_ce
, *ce
;
972 zval
* _this_zval
= NULL
;
973 cairo_pattern_t
*pat
;
976 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
980 _this_ce
= Z_OBJCE_P(_this_zval
);
981 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
983 pat
= cairo_pattern_reference(cairo_get_source(curr
->context
));
985 ce
= getCairoPattern_ce_ptr(pat
);
986 object_init_ex(return_value
, ce
);
988 pattern_object
*ptobj
= (pattern_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
989 ptobj
->pattern
= cairo_pattern_reference(pat
);
995 /* {{{ proto object get_target()
997 PHP_METHOD(CairoContext
, get_target
)
999 zend_class_entry
* _this_ce
, *ce
;
1001 zval
* _this_zval
= NULL
;
1002 cairo_surface_t
*sur
;
1005 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1009 _this_ce
= Z_OBJCE_P(_this_zval
);
1010 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1012 sur
= cairo_surface_reference(cairo_get_target(curr
->context
));
1014 ce
= getCairoSurface_ce_ptr(sur
);
1015 object_init_ex(return_value
, ce
);
1017 surface_object
*sobj
= (surface_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
1018 sobj
->surface
= cairo_surface_reference(sur
);
1021 /* }}} get_target */
1025 /* {{{ proto float get_tolerance()
1027 PHP_METHOD(CairoContext
, get_tolerance
)
1029 zend_class_entry
* _this_ce
;
1031 zval
* _this_zval
= NULL
;
1035 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1039 _this_ce
= Z_OBJCE_P(_this_zval
);
1040 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1042 tolerance
= cairo_get_tolerance(curr
->context
);
1043 RETURN_DOUBLE(tolerance
);
1045 /* }}} get_tolerance */
1049 /* {{{ proto array glyph_extents(array obj,int num) --need to check
1051 PHP_METHOD(CairoContext
, glyph_extents
)
1053 zend_class_entry
* _this_ce
;
1055 zval
* _this_zval
= NULL
, **ppzval
;
1058 cairo_glyph_t
**glyphs
=NULL
, **glyph
;
1059 HashTable
*obj_hash
= NULL
;
1060 cairo_text_extents_t extents
;
1062 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oa/l", &_this_zval
, CairoContext_ce_ptr
, &obj
, &num
) == FAILURE
) {
1065 obj_hash
= HASH_OF(obj
);
1066 glyphs
= emalloc(num
*sizeof(cairo_glyph_t
));
1068 for(i
=0 , glyph
=glyphs
; i
<num
; i
++, glyph
++) {
1069 zend_hash_get_current_data(obj_hash
, (void **)&glyph
);
1070 zend_hash_move_forward(obj_hash
);
1072 _this_ce
= Z_OBJCE_P(_this_zval
);
1073 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1075 cairo_glyph_extents(curr
->context
, glyphs
, num
, &extents
);
1077 array_init(return_value
);
1078 add_assoc_double(return_value
, "x_bearing", extents
.x_bearing
);
1079 add_assoc_double(return_value
, "y_bearing", extents
.y_bearing
);
1080 add_assoc_double(return_value
, "width", extents
.width
);
1081 add_assoc_double(return_value
, "height", extents
.height
);
1082 add_assoc_double(return_value
, "x_advance", extents
.x_advance
);
1083 add_assoc_double(return_value
, "y_advance", extents
.y_advance
);
1087 /* }}} glyph_extents */
1091 /* {{{ proto void glyph_path(object obh , int num])
1093 PHP_METHOD(CairoContext
, glyph_path
)
1095 zend_class_entry
* _this_ce
;
1097 zval
* _this_zval
= NULL
;
1100 cairo_glyph_t
*glyphs
=NULL
, *glyph
;
1101 HashTable
*obj_hash
= NULL
;
1102 cairo_text_extents_t extents
;
1104 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oa/l", &_this_zval
, CairoContext_ce_ptr
, &obh
, &num
) == FAILURE
) {
1108 _this_ce
= Z_OBJCE_P(_this_zval
);
1109 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1110 obj_hash
= HASH_OF(obh
);
1112 glyphs
= emalloc(num
*sizeof(cairo_glyph_t
));
1113 for(i
=0 , glyph
=glyphs
; i
<num
; i
++, glyph
++) {
1114 zend_hash_get_current_data(obj_hash
, (void **)&glyph
);
1115 zend_hash_move_forward(obj_hash
);
1117 cairo_glyph_path(curr
->context
, glyphs
, num
);
1118 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1121 /* }}} glyph_path */
1125 /* {{{ proto bool has_current_point() -- Need to remove this and put it in path
1127 PHP_METHOD(CairoContext
, has_current_point
)
1129 zend_class_entry
* _this_ce
;
1131 zval
* _this_zval
= NULL
;
1135 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1139 _this_ce
= Z_OBJCE_P(_this_zval
);
1140 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1144 /* ONLY for CAIRO 1.6 */
1147 /* }}} has_current_point */
1151 /* {{{ proto void identity_matrix()
1153 PHP_METHOD(CairoContext
, identity_matrix
)
1155 zend_class_entry
* _this_ce
;
1157 zval
* _this_zval
= NULL
;
1161 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1165 _this_ce
= Z_OBJCE_P(_this_zval
);
1166 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1167 cairo_identity_matrix(curr
->context
);
1169 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1172 /* }}} identity_matrix */
1176 /* {{{ proto bool in_fill(float x, float y)
1178 PHP_METHOD(CairoContext
, in_fill
)
1180 zend_class_entry
* _this_ce
;
1182 zval
* _this_zval
= NULL
;
1188 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1192 _this_ce
= Z_OBJCE_P(_this_zval
);
1193 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1195 result
= cairo_in_fill(curr
->context
, x
, y
);
1198 zval_bool(return_value
,1);
1200 zval_bool(return_value
,0);
1208 /* {{{ proto bool in_stroke(float x, float y)
1210 PHP_METHOD(CairoContext
, in_stroke
)
1212 zend_class_entry
* _this_ce
;
1214 zval
* _this_zval
= NULL
;
1220 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1224 _this_ce
= Z_OBJCE_P(_this_zval
);
1225 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1227 result
= cairo_in_stroke(curr
->context
, x
, y
);
1230 zval_bool(return_value
,1);
1232 zval_bool(return_value
,0);
1239 /* {{{ proto void line_to(float x, float y)
1241 PHP_METHOD(CairoContext
, line_to
)
1243 zend_class_entry
* _this_ce
;
1245 zval
* _this_zval
= NULL
;
1251 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1255 _this_ce
= Z_OBJCE_P(_this_zval
);
1256 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1258 cairo_line_to(curr
->context
, x
, y
);
1259 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1266 /* {{{ proto void mask(object p)
1268 PHP_METHOD(CairoContext
, mask
)
1270 zend_class_entry
* _this_ce
;
1272 zval
* _this_zval
= NULL
;
1277 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &p
) == FAILURE
) {
1281 _this_ce
= Z_OBJCE_P(_this_zval
);
1282 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1284 pattern_object
*ptobj
= (pattern_object
*)zend_objects_get_address(p TSRMLS_CC
);
1285 cairo_mask(curr
->context
, ptobj
->pattern
);
1286 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1293 /* {{{ proto void mask_surface(object s[,float surface_x, float surface_y])
1295 PHP_METHOD(CairoContext
, mask_surface
)
1297 zend_class_entry
* _this_ce
;
1299 zval
* _this_zval
= NULL
;
1301 double surface_x
= 0.0;
1302 double surface_y
= 0.0;
1306 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo|dd", &_this_zval
, CairoContext_ce_ptr
, &s
, &surface_x
, &surface_y
) == FAILURE
) {
1310 _this_ce
= Z_OBJCE_P(_this_zval
);
1311 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1312 surface_object
*sobj
=(surface_object
*)zend_objects_get_address(s TSRMLS_CC
);
1313 cairo_mask_surface(curr
->context
, sobj
->surface
, surface_x
, surface_y
);
1314 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1318 /* }}} mask_surface */
1322 /* {{{ proto void move_to(float x, float y)
1324 PHP_METHOD(CairoContext
, move_to
)
1326 zend_class_entry
* _this_ce
;
1328 zval
* _this_zval
= NULL
;
1334 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1338 _this_ce
= Z_OBJCE_P(_this_zval
);
1339 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1341 cairo_move_to(curr
->context
, x
, y
);
1342 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1349 /* {{{ proto void new_path()
1351 PHP_METHOD(CairoContext
, new_path
)
1353 zend_class_entry
* _this_ce
;
1355 zval
* _this_zval
= NULL
;
1359 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1363 _this_ce
= Z_OBJCE_P(_this_zval
);
1364 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1365 cairo_new_path(curr
->context
);
1366 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1373 /* {{{ proto void new_sub_path()
1375 PHP_METHOD(CairoContext
, new_sub_path
)
1377 zend_class_entry
* _this_ce
;
1379 zval
* _this_zval
= NULL
;
1383 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1387 _this_ce
= Z_OBJCE_P(_this_zval
);
1388 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1390 cairo_new_sub_path(curr
->context
);
1391 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1393 /* }}} new_sub_path */
1397 /* {{{ proto void paint()
1399 PHP_METHOD(CairoContext
, paint
)
1401 zend_class_entry
* _this_ce
;
1403 zval
* _this_zval
= NULL
;
1407 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1411 _this_ce
= Z_OBJCE_P(_this_zval
);
1412 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1413 cairo_paint(curr
->context
);
1414 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1422 /* {{{ proto void paint_with_alpha(float alpha)
1424 PHP_METHOD(CairoContext
, paint_with_alpha
)
1426 zend_class_entry
* _this_ce
;
1428 zval
* _this_zval
= NULL
;
1433 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &alpha
) == FAILURE
) {
1437 _this_ce
= Z_OBJCE_P(_this_zval
);
1438 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1439 cairo_paint_with_alpha(curr
->context
, alpha
);
1443 /* }}} paint_with_alpha */
1447 /* {{{ proto array path_extents([object path]) --- need to shift it to path --
1449 PHP_METHOD(CairoContext
, path_extents
)
1451 zend_class_entry
* _this_ce
;
1453 zval
* _this_zval
= NULL
;
1458 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|o", &_this_zval
, CairoContext_ce_ptr
, &path
) == FAILURE
) {
1462 _this_ce
= Z_OBJCE_P(_this_zval
);
1463 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1466 array_init(return_value
);
1469 /* ONLY for CAIRO 1.6 */
1472 /* }}} path_extents */
1476 /* {{{ proto object pop_group()
1478 PHP_METHOD(CairoContext
, pop_group
)
1480 zend_class_entry
* _this_ce
, *ce
;
1482 zval
* _this_zval
= NULL
;
1483 cairo_pattern_t
*pat
;
1486 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1490 _this_ce
= Z_OBJCE_P(_this_zval
);
1491 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1493 pat
= cairo_pop_group(curr
->context
);
1494 ce
= getCairoPattern_ce_ptr(pat
);
1495 object_init_ex(return_value
, ce
);
1496 pattern_object
*ptobj
=(pattern_object
*)zend_objects_get_address(return_value TSRMLS_CC
);
1497 ptobj
->pattern
= pat
;
1504 /* {{{ proto void pop_group_to_source()
1506 PHP_METHOD(CairoContext
, pop_group_to_source
)
1508 zend_class_entry
* _this_ce
;
1510 zval
* _this_zval
= NULL
;
1514 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1518 _this_ce
= Z_OBJCE_P(_this_zval
);
1519 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1520 cairo_pop_group_to_source(curr
->context
);
1521 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1525 /* }}} pop_group_to_source */
1529 /* {{{ proto void push_group()
1531 PHP_METHOD(CairoContext
, push_group
)
1533 zend_class_entry
* _this_ce
;
1535 zval
* _this_zval
= NULL
;
1539 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1543 _this_ce
= Z_OBJCE_P(_this_zval
);
1544 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1545 cairo_push_group(curr
->context
);
1546 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1550 /* }}} push_group */
1554 /* {{{ proto void push_group_with_content(int content)
1556 PHP_METHOD(CairoContext
, push_group_with_content
)
1558 zend_class_entry
* _this_ce
;
1560 zval
* _this_zval
= NULL
;
1561 cairo_content_t content
;
1565 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &content
) == FAILURE
) {
1569 _this_ce
= Z_OBJCE_P(_this_zval
);
1570 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1571 cairo_push_group_with_content(curr
->context
, content
);
1572 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1575 /* }}} push_group_with_content */
1579 /* {{{ proto void rectangle(float x, float y, float width, float height)
1581 PHP_METHOD(CairoContext
, rectangle
)
1583 zend_class_entry
* _this_ce
;
1585 zval
* _this_zval
= NULL
;
1589 double height
= 0.0;
1593 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
, &width
, &height
) == FAILURE
) {
1597 _this_ce
= Z_OBJCE_P(_this_zval
);
1598 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1599 cairo_rectangle(curr
->context
, x
, y
, width
, height
);
1600 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1608 /* {{{ proto void rel_curve_to(float x1, float y1, float x2, float y2, float x3, float y3)
1610 PHP_METHOD(CairoContext
, rel_curve_to
)
1612 zend_class_entry
* _this_ce
;
1614 zval
* _this_zval
= NULL
;
1624 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odddddd", &_this_zval
, CairoContext_ce_ptr
, &x1
, &y1
, &x2
, &y2
, &x3
, &y3
) == FAILURE
) {
1628 _this_ce
= Z_OBJCE_P(_this_zval
);
1629 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1630 cairo_rel_curve_to(curr
->context
, x1
, y1
, x2
, y2
, x3
, y3
);
1631 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1634 /* }}} rel_curve_to */
1638 /* {{{ proto void rel_line_to(float x, float y)
1640 PHP_METHOD(CairoContext
, rel_line_to
)
1642 zend_class_entry
* _this_ce
;
1644 zval
* _this_zval
= NULL
;
1650 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1654 _this_ce
= Z_OBJCE_P(_this_zval
);
1655 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1656 cairo_rel_line_to(curr
->context
, x
, y
);
1657 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1660 /* }}} rel_line_to */
1664 /* {{{ proto void rel_move_to(float x, float y)
1666 PHP_METHOD(CairoContext
, rel_move_to
)
1668 zend_class_entry
* _this_ce
;
1670 zval
* _this_zval
= NULL
;
1676 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1680 _this_ce
= Z_OBJCE_P(_this_zval
);
1681 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1682 cairo_rel_move_to(curr
->context
, x
, y
);
1683 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1685 /* }}} rel_move_to */
1689 /* {{{ proto void reset_clip()
1691 PHP_METHOD(CairoContext
, reset_clip
)
1693 zend_class_entry
* _this_ce
;
1695 zval
* _this_zval
= NULL
;
1699 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1703 _this_ce
= Z_OBJCE_P(_this_zval
);
1704 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1705 cairo_reset_clip(curr
->context
);
1706 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1710 /* }}} reset_clip */
1714 /* {{{ proto void restore()
1716 PHP_METHOD(CairoContext
, restore
)
1718 zend_class_entry
* _this_ce
;
1720 zval
* _this_zval
= NULL
;
1724 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1728 _this_ce
= Z_OBJCE_P(_this_zval
);
1729 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1731 cairo_restore(curr
->context
);
1732 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1740 /* {{{ proto void rotate(float angle)
1742 PHP_METHOD(CairoContext
, rotate
)
1744 zend_class_entry
* _this_ce
;
1746 zval
* _this_zval
= NULL
;
1751 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &angle
) == FAILURE
) {
1755 _this_ce
= Z_OBJCE_P(_this_zval
);
1756 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1757 cairo_rotate(curr
->context
, angle
);
1758 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1765 /* {{{ proto void save()
1767 PHP_METHOD(CairoContext
, save
)
1769 zend_class_entry
* _this_ce
;
1771 zval
* _this_zval
= NULL
;
1775 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
1779 _this_ce
= Z_OBJCE_P(_this_zval
);
1780 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1782 cairo_save(curr
->context
);
1783 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1790 /* {{{ proto void scale(float x, float y)
1792 PHP_METHOD(CairoContext
, scale
)
1794 zend_class_entry
* _this_ce
;
1796 zval
* _this_zval
= NULL
;
1802 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
1806 _this_ce
= Z_OBJCE_P(_this_zval
);
1807 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1809 cairo_scale(curr
->context
, x
, y
);
1810 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1818 /* {{{ proto void select_font_face(object string[, int slant, int weight])
1820 PHP_METHOD(CairoContext
, select_font_face
)
1822 zend_class_entry
* _this_ce
;
1824 zval
* _this_zval
= NULL
;
1825 const char * family
= NULL
;
1827 cairo_font_slant_t slant
= CAIRO_FONT_SLANT_NORMAL
;
1828 cairo_font_weight_t weight
= CAIRO_FONT_WEIGHT_NORMAL
;
1832 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os|ll", &_this_zval
, CairoContext_ce_ptr
, &family
, &family_len
, &slant
, &weight
) == FAILURE
) {
1836 _this_ce
= Z_OBJCE_P(_this_zval
);
1837 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1838 cairo_select_font_face(curr
->context
, family
, slant
, weight
);
1839 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1842 /* }}} select_font_face */
1846 /* {{{ proto void set_antialias([int antialias])
1848 PHP_METHOD(CairoContext
, set_antialias
)
1850 zend_class_entry
* _this_ce
;
1852 zval
* _this_zval
= NULL
;
1853 cairo_antialias_t antialias
= CAIRO_ANTIALIAS_DEFAULT
;
1857 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|l", &_this_zval
, CairoContext_ce_ptr
, &antialias
) == FAILURE
) {
1861 _this_ce
= Z_OBJCE_P(_this_zval
);
1862 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1863 cairo_set_antialias(curr
->context
, antialias
);
1864 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1867 /* }}} set_antialias */
1871 /* {{{ proto void set_dash(array dashes, int num_dashes [,float offset])
1873 PHP_METHOD(CairoContext
, set_dash
)
1875 zend_class_entry
* _this_ce
;
1877 zval
* _this_zval
= NULL
;
1878 zval
* dashes
= NULL
, **ppzval
;
1879 long num_dashes
= 0;
1880 HashTable
*dashes_hash
= NULL
;
1881 double offset
= 0.0;
1885 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oa/l|d", &_this_zval
, CairoContext_ce_ptr
, &dashes
, &num_dashes
, &offset
) == FAILURE
) {
1888 dashes_hash
= Z_ARRVAL_P(dashes
);
1889 das
= emalloc(num_dashes
* sizeof(double));
1890 _this_ce
= Z_OBJCE_P(_this_zval
);
1891 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1892 i
= zend_hash_num_elements(dashes_hash
);
1895 for(zend_hash_internal_pointer_reset(dashes_hash
); zend_hash_has_more_elements(dashes_hash
) == SUCCESS
; zend_hash_move_forward(dashes_hash
)) {
1896 if (zend_hash_get_current_data(dashes_hash
, (void **)&ppzval
) == FAILURE
) {
1900 das
[i
++] = Z_DVAL_PP(ppzval
);
1902 cairo_set_dash(curr
->context
, das
, num_dashes
, offset
);
1903 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1912 /* {{{ proto void set_fill_rule(int fill_rule)
1914 PHP_METHOD(CairoContext
, set_fill_rule
)
1916 zend_class_entry
* _this_ce
;
1918 zval
* _this_zval
= NULL
;
1919 cairo_fill_rule_t fill_rule
= 0;
1923 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &fill_rule
) == FAILURE
) {
1927 _this_ce
= Z_OBJCE_P(_this_zval
);
1928 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1929 cairo_set_fill_rule(curr
->context
, fill_rule
);
1930 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1932 /* }}} set_fill_rule */
1936 /* {{{ proto void set_font_face([object obj])
1938 PHP_METHOD(CairoContext
, set_font_face
)
1940 zend_class_entry
* _this_ce
;
1942 zval
* _this_zval
= NULL
;
1947 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|o", &_this_zval
, CairoContext_ce_ptr
, &obj
) == FAILURE
) {
1951 _this_ce
= Z_OBJCE_P(_this_zval
);
1952 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1954 fontface_object
*ffobj
= (fontface_object
*)zend_objects_get_address(obj TSRMLS_CC
);
1955 cairo_set_font_face(curr
->context
, ffobj
->fontface
);
1958 cairo_set_font_face(curr
->context
, NULL
);
1959 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1963 /* }}} set_font_face */
1967 /* {{{ proto void set_font_matrix(object matrix)
1969 PHP_METHOD(CairoContext
, set_font_matrix
)
1971 zend_class_entry
* _this_ce
;
1973 zval
* _this_zval
= NULL
;
1974 zval
* matrix
= NULL
;
1978 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matrix
) == FAILURE
) {
1982 _this_ce
= Z_OBJCE_P(_this_zval
);
1983 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1984 matrix_object
*mobj
=(matrix_object
*)zend_objects_get_address(matrix TSRMLS_CC
);
1985 cairo_set_font_matrix(curr
->context
, &mobj
->matrix
);
1986 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1989 /* }}} set_font_matrix */
1993 /* {{{ proto void set_font_options(object options)
1995 PHP_METHOD(CairoContext
, set_font_options
)
1997 zend_class_entry
* _this_ce
;
1999 zval
* _this_zval
= NULL
;
2000 zval
* options
= NULL
;
2004 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &options
) == FAILURE
) {
2008 _this_ce
= Z_OBJCE_P(_this_zval
);
2009 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2010 fontoptions_object
*foobj
=(fontoptions_object
*)zend_objects_get_address(options TSRMLS_CC
);
2011 cairo_set_font_options(curr
->context
, foobj
->fontoptions
);
2012 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2016 /* }}} set_font_options */
2020 /* {{{ proto void set_font_size(float size)
2022 PHP_METHOD(CairoContext
, set_font_size
)
2024 zend_class_entry
* _this_ce
;
2026 zval
* _this_zval
= NULL
;
2031 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &size
) == FAILURE
) {
2035 _this_ce
= Z_OBJCE_P(_this_zval
);
2036 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2037 cairo_set_font_size(curr
->context
, size
);
2038 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2041 /* }}} set_font_size */
2045 /* {{{ proto void set_line_cap(int line_cap)
2047 PHP_METHOD(CairoContext
, set_line_cap
)
2049 zend_class_entry
* _this_ce
;
2051 zval
* _this_zval
= NULL
;
2056 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &line_cap
) == FAILURE
) {
2060 _this_ce
= Z_OBJCE_P(_this_zval
);
2061 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2062 cairo_set_line_cap(curr
->context
, line_cap
);
2063 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2068 /* }}} set_line_cap */
2072 /* {{{ proto void set_line_join(int line_join)
2074 PHP_METHOD(CairoContext
, set_line_join
)
2076 zend_class_entry
* _this_ce
;
2078 zval
* _this_zval
= NULL
;
2083 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &line_join
) == FAILURE
) {
2087 _this_ce
= Z_OBJCE_P(_this_zval
);
2088 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2090 cairo_set_line_join(curr
->context
, line_join
);
2091 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2094 /* }}} set_line_join */
2098 /* {{{ proto void set_line_width(float width)
2100 PHP_METHOD(CairoContext
, set_line_width
)
2102 zend_class_entry
* _this_ce
;
2104 zval
* _this_zval
= NULL
;
2109 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &width
) == FAILURE
) {
2113 _this_ce
= Z_OBJCE_P(_this_zval
);
2114 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2115 cairo_set_line_width(curr
->context
, width
);
2117 /* }}} set_line_width */
2121 /* {{{ proto void set_matrix(object matix)
2123 PHP_METHOD(CairoContext
, set_matrix
)
2125 zend_class_entry
* _this_ce
;
2127 zval
* _this_zval
= NULL
;
2128 zval
* matix
= NULL
;
2132 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matix
) == FAILURE
) {
2136 _this_ce
= Z_OBJCE_P(_this_zval
);
2137 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2138 matrix_object
*mobj
=(matrix_object
*)zend_objects_get_address(matix TSRMLS_CC
);
2139 cairo_set_matrix(curr
->context
, &mobj
->matrix
);
2140 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2143 /* }}} set_matrix */
2147 /* {{{ proto void set_miter_limit(float limit)
2149 PHP_METHOD(CairoContext
, set_miter_limit
)
2151 zend_class_entry
* _this_ce
;
2153 zval
* _this_zval
= NULL
;
2158 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &limit
) == FAILURE
) {
2162 _this_ce
= Z_OBJCE_P(_this_zval
);
2163 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2164 cairo_set_mitter_limit(curr
->context
, limit
);
2165 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2168 /* }}} set_miter_limit */
2172 /* {{{ proto void set_operator(int op)
2174 PHP_METHOD(CairoContext
, set_operator
)
2176 zend_class_entry
* _this_ce
;
2178 zval
* _this_zval
= NULL
;
2183 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &op
) == FAILURE
) {
2187 _this_ce
= Z_OBJCE_P(_this_zval
);
2188 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2189 cairo_set_operator(curr
->context
, op
);
2190 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2193 /* }}} set_operator */
2197 /* {{{ proto void set_source(object p)
2199 PHP_METHOD(CairoContext
, set_source
)
2201 zend_class_entry
* _this_ce
;
2203 zval
* _this_zval
= NULL
;
2208 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &p
) == FAILURE
) {
2212 _this_ce
= Z_OBJCE_P(_this_zval
);
2213 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2214 pattern_object
*ptobj
=(pattern_object
*)zend_objects_get_address(p TSRMLS_CC
);
2215 cairo_set_source(curr
->context
, ptobj
->pattern
);
2216 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2219 /* }}} set_source */
2223 /* {{{ proto void set_source_rgb(float red, float green, float blue)
2225 PHP_METHOD(CairoContext
, set_source_rgb
)
2227 zend_class_entry
* _this_ce
;
2229 zval
* _this_zval
= NULL
;
2236 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddd", &_this_zval
, CairoContext_ce_ptr
, &red
, &green
, &blue
) == FAILURE
) {
2240 _this_ce
= Z_OBJCE_P(_this_zval
);
2241 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2242 cairo_set_source_rgb(curr
->context
, red
, green
, blue
);
2243 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2246 /* }}} set_source_rgb */
2250 /* {{{ proto void set_source_rgba(float red, float green, float blue [,float alpha])
2252 PHP_METHOD(CairoContext
, set_source_rgba
)
2254 zend_class_entry
* _this_ce
;
2256 zval
* _this_zval
= NULL
;
2264 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddd|d", &_this_zval
, CairoContext_ce_ptr
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
2268 _this_ce
= Z_OBJCE_P(_this_zval
);
2269 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2270 cairo_set_source_rgba(curr
->context
, red
, green
, blue
, alpha
);
2271 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2274 /* }}} set_source_rgba */
2278 /* {{{ proto void set_source_surface(object surface [,float x, float y])
2280 PHP_METHOD(CairoContext
, set_source_surface
)
2282 zend_class_entry
* _this_ce
;
2284 zval
* _this_zval
= NULL
;
2285 zval
* surface
= NULL
;
2291 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo|dd", &_this_zval
, CairoContext_ce_ptr
, &surface
, &x
, &y
) == FAILURE
) {
2295 _this_ce
= Z_OBJCE_P(_this_zval
);
2296 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2297 surface_object
*sobj
=(surface_object
*)zend_objects_get_address(surface TSRMLS_CC
);
2298 cairo_set_source_surface(curr
->context
, sobj
->surface
, x
, y
);
2299 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2302 /* }}} set_source_surface */
2306 /* {{{ proto void set_tolerance(float tolerance)
2308 PHP_METHOD(CairoContext
, set_tolerance
)
2310 zend_class_entry
* _this_ce
;
2312 zval
* _this_zval
= NULL
;
2313 double tolerance
= 0.0;
2317 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &tolerance
) == FAILURE
) {
2321 _this_ce
= Z_OBJCE_P(_this_zval
);
2322 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2323 cairo_set_tolerance(curr
->context
, tolerance
);
2324 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2327 /* }}} set_tolerance */
2331 /* {{{ proto void show_glyphs(array obj ,int num_glyphs)
2333 PHP_METHOD(CairoContext
, show_glyphs
)
2335 zend_class_entry
* _this_ce
;
2337 zval
* _this_zval
= NULL
, **ppzval
;
2339 long num_glyphs
= 0;
2340 HashTable
*obj_hash
= NULL
;
2341 cairo_glyph_t
*glyphs
=NULL
, *glyph
;
2345 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oa/l", &_this_zval
, CairoContext_ce_ptr
, &obj
, &num_glyphs
) == FAILURE
) {
2349 _this_ce
= Z_OBJCE_P(_this_zval
);
2350 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2351 obj_hash
= HASH_OF(obj
);
2353 glyphs
= emalloc(num_glyphs
*sizeof(cairo_glyph_t
));
2355 for(zend_hash_internal_pointer_reset(obj_hash
); zend_hash_has_more_elements(obj_hash
) == SUCCESS
; zend_hash_move_forward(obj_hash
)) {
2356 if (zend_hash_get_current_data(obj_hash
, (void **)&ppzval
) == FAILURE
) {
2359 // glyphs[i++] = Z_RESVAL_PP(ppzval);
2363 /* for(i=0 , glyph=glyphs; i<num_glyphs; i++, glyph++) {
2364 zend_hash_get_current_data(obj_hash, (void **)&glyph);
2365 zend_hash_move_forward(obj_hash);
2368 cairo_show_glyphs(curr
->context
, glyphs
, num_glyphs
);
2369 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2372 /* }}} show_glyphs */
2376 /* {{{ proto void show_page()
2378 PHP_METHOD(CairoContext
, show_page
)
2380 zend_class_entry
* _this_ce
;
2382 zval
* _this_zval
= NULL
;
2386 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2390 _this_ce
= Z_OBJCE_P(_this_zval
);
2391 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2392 cairo_show_page(curr
->context
);
2393 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2400 /* {{{ proto void show_text(string obj)
2402 PHP_METHOD(CairoContext
, show_text
)
2404 zend_class_entry
* _this_ce
;
2406 zval
* _this_zval
= NULL
;
2407 const char * obj
= NULL
;
2412 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &obj
, &obj_len
) == FAILURE
) {
2416 _this_ce
= Z_OBJCE_P(_this_zval
);
2417 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2418 cairo_show_text(curr
->context
, obj
);
2419 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2426 /* {{{ proto void stroke()
2428 PHP_METHOD(CairoContext
, stroke
)
2430 zend_class_entry
* _this_ce
;
2432 zval
* _this_zval
= NULL
;
2436 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2440 _this_ce
= Z_OBJCE_P(_this_zval
);
2441 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2442 cairo_stroke(curr
->context
);
2443 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2451 /* {{{ proto array stroke_extents()
2453 PHP_METHOD(CairoContext
, stroke_extents
)
2455 zend_class_entry
* _this_ce
;
2457 zval
* _this_zval
= NULL
;
2458 double x1
=0, x2
=0, y1
=0, y2
=0;
2462 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2466 _this_ce
= Z_OBJCE_P(_this_zval
);
2467 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2468 cairo_stroke_extents(curr
->context
, &x1
, &y1
, &x2
, &y2
);
2470 array_init(return_value
);
2471 add_assoc_double(return_value
, "x1", x1
);
2472 add_assoc_double(return_value
, "y1", y1
);
2473 add_assoc_double(return_value
, "x2", x2
);
2474 add_assoc_double(return_value
, "y2", y2
);
2477 /* }}} stroke_extents */
2481 /* {{{ proto void stroke_preserve()
2483 PHP_METHOD(CairoContext
, stroke_preserve
)
2485 zend_class_entry
* _this_ce
;
2487 zval
* _this_zval
= NULL
;
2491 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2495 _this_ce
= Z_OBJCE_P(_this_zval
);
2496 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2497 cairo_stroke_preserve(curr
->context
);
2498 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2501 /* }}} stroke_preserve */
2505 /* {{{ proto array text_extents(string str)
2507 PHP_METHOD(CairoContext
, text_extents
)
2509 zend_class_entry
* _this_ce
;
2511 zval
* _this_zval
= NULL
;
2512 const char * str
= NULL
;
2514 cairo_text_extents_t extents
;
2517 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &str
, &str_len
) == FAILURE
) {
2521 _this_ce
= Z_OBJCE_P(_this_zval
);
2522 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2524 cairo_text_extents(curr
->context
, str
, &extents
);
2526 array_init(return_value
);
2527 add_assoc_double(return_value
, "x_bearing", extents
.x_bearing
);
2528 add_assoc_double(return_value
, "y_bearing", extents
.y_bearing
);
2529 add_assoc_double(return_value
, "width", extents
.width
);
2530 add_assoc_double(return_value
, "height", extents
.height
);
2531 add_assoc_double(return_value
, "x_advance", extents
.x_advance
);
2532 add_assoc_double(return_value
, "y_advance", extents
.y_advance
);
2535 /* }}} text_extents */
2539 /* {{{ proto void text_path(string obj)
2541 PHP_METHOD(CairoContext
, text_path
)
2543 zend_class_entry
* _this_ce
;
2545 zval
* _this_zval
= NULL
;
2546 const char * obj
= NULL
;
2551 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &obj
, &obj_len
) == FAILURE
) {
2555 _this_ce
= Z_OBJCE_P(_this_zval
);
2556 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2557 cairo_text_path(curr
->context
, obj
);
2558 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2565 /* {{{ proto void transform(object matrix)
2567 PHP_METHOD(CairoContext
, transform
)
2569 zend_class_entry
* _this_ce
;
2571 zval
* _this_zval
= NULL
;
2572 zval
* matrix
= NULL
;
2576 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matrix
) == FAILURE
) {
2580 _this_ce
= Z_OBJCE_P(_this_zval
);
2581 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2582 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(matrix TSRMLS_CC
);
2583 cairo_transform(curr
->context
, &mobj
->matrix
);
2584 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2591 /* {{{ proto void translate(float tx, float ty)
2593 PHP_METHOD(CairoContext
, translate
)
2595 zend_class_entry
* _this_ce
;
2597 zval
* _this_zval
= NULL
;
2603 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &tx
, &ty
) == FAILURE
) {
2607 _this_ce
= Z_OBJCE_P(_this_zval
);
2608 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2610 cairo_translate(curr
->context
, tx
, ty
);
2611 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2618 /* {{{ proto array user_to_device(float x, float y)
2620 PHP_METHOD(CairoContext
, user_to_device
)
2622 zend_class_entry
* _this_ce
;
2624 zval
* _this_zval
= NULL
;
2630 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
2634 _this_ce
= Z_OBJCE_P(_this_zval
);
2635 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2637 cairo_user_to_device(curr
->context
, &x
, &y
);
2638 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2640 array_init(return_value
);
2641 add_assoc_double(return_value
, "x", x
);
2642 add_assoc_double(return_value
, "y", y
);
2645 /* }}} user_to_device */
2649 /* {{{ proto array user_to_device_distance(float dx, float dy)
2651 PHP_METHOD(CairoContext
, user_to_device_distance
)
2653 zend_class_entry
* _this_ce
;
2655 zval
* _this_zval
= NULL
;
2661 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &dx
, &dy
) == FAILURE
) {
2665 _this_ce
= Z_OBJCE_P(_this_zval
);
2666 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2667 cairo_user_to_device_distance(curr
->context
, &dx
, &dy
);
2668 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2670 array_init(return_value
);
2671 add_assoc_double(return_value
, "x", dx
);
2672 add_assoc_double(return_value
, "y", dy
);
2675 /* }}} user_to_device_distance */
2678 static zend_function_entry CairoContext_methods
[] = {
2679 PHP_ME(CairoContext
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
2680 PHP_ME(CairoContext
, append_path
, CairoContext__append_path_args
, /**/ZEND_ACC_PUBLIC
)
2681 PHP_ME(CairoContext
, arc
, CairoContext__arc_args
, /**/ZEND_ACC_PUBLIC
)
2682 PHP_ME(CairoContext
, arc_negative
, CairoContext__arc_negative_args
, /**/ZEND_ACC_PUBLIC
)
2683 PHP_ME(CairoContext
, clip
, NULL
, /**/ZEND_ACC_PUBLIC
)
2684 PHP_ME(CairoContext
, clip_extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2685 PHP_ME(CairoContext
, clip_preserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2686 PHP_ME(CairoContext
, close_path
, NULL
, /**/ZEND_ACC_PUBLIC
)
2687 PHP_ME(CairoContext
, copy_clip_rectangle_list
, NULL
, /**/ZEND_ACC_PUBLIC
)
2688 PHP_ME(CairoContext
, copy_page
, NULL
, /**/ZEND_ACC_PUBLIC
)
2689 PHP_ME(CairoContext
, copy_path
, NULL
, /**/ZEND_ACC_PUBLIC
)
2690 PHP_ME(CairoContext
, copy_path_flat
, NULL
, /**/ZEND_ACC_PUBLIC
)
2691 PHP_ME(CairoContext
, curve_to
, CairoContext__curve_to_args
, /**/ZEND_ACC_PUBLIC
)
2692 PHP_ME(CairoContext
, device_to_user
, CairoContext__device_to_user_args
, /**/ZEND_ACC_PUBLIC
)
2693 PHP_ME(CairoContext
, device_to_user_distance
, CairoContext__device_to_user_distance_args
, /**/ZEND_ACC_PUBLIC
)
2694 PHP_ME(CairoContext
, fill
, NULL
, /**/ZEND_ACC_PUBLIC
)
2695 PHP_ME(CairoContext
, fill_extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2696 PHP_ME(CairoContext
, fill_preserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2697 PHP_ME(CairoContext
, font_extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2698 PHP_ME(CairoContext
, get_antialias
, NULL
, /**/ZEND_ACC_PUBLIC
)
2699 PHP_ME(CairoContext
, get_current_point
, NULL
, /**/ZEND_ACC_PUBLIC
)
2700 PHP_ME(CairoContext
, get_dash
, NULL
, /**/ZEND_ACC_PUBLIC
)
2701 PHP_ME(CairoContext
, get_dash_count
, NULL
, /**/ZEND_ACC_PUBLIC
)
2702 PHP_ME(CairoContext
, get_fill_rule
, NULL
, /**/ZEND_ACC_PUBLIC
)
2703 PHP_ME(CairoContext
, get_font_face
, NULL
, /**/ZEND_ACC_PUBLIC
)
2704 PHP_ME(CairoContext
, get_font_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2705 PHP_ME(CairoContext
, get_font_options
, NULL
, /**/ZEND_ACC_PUBLIC
)
2706 PHP_ME(CairoContext
, get_group_target
, NULL
, /**/ZEND_ACC_PUBLIC
)
2707 PHP_ME(CairoContext
, get_line_cap
, NULL
, /**/ZEND_ACC_PUBLIC
)
2708 PHP_ME(CairoContext
, get_line_join
, NULL
, /**/ZEND_ACC_PUBLIC
)
2709 PHP_ME(CairoContext
, get_line_width
, NULL
, /**/ZEND_ACC_PUBLIC
)
2710 PHP_ME(CairoContext
, get_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2711 PHP_ME(CairoContext
, get_miter_limit
, NULL
, /**/ZEND_ACC_PUBLIC
)
2712 PHP_ME(CairoContext
, get_operator
, NULL
, /**/ZEND_ACC_PUBLIC
)
2713 PHP_ME(CairoContext
, get_scaled_font
, NULL
, /**/ZEND_ACC_PUBLIC
)
2714 PHP_ME(CairoContext
, get_source
, NULL
, /**/ZEND_ACC_PUBLIC
)
2715 PHP_ME(CairoContext
, get_target
, NULL
, /**/ZEND_ACC_PUBLIC
)
2716 PHP_ME(CairoContext
, get_tolerance
, NULL
, /**/ZEND_ACC_PUBLIC
)
2717 PHP_ME(CairoContext
, glyph_extents
, CairoContext__glyph_extents_args
, /**/ZEND_ACC_PUBLIC
)
2718 PHP_ME(CairoContext
, glyph_path
, CairoContext__glyph_path_args
, /**/ZEND_ACC_PUBLIC
)
2719 PHP_ME(CairoContext
, has_current_point
, NULL
, /**/ZEND_ACC_PUBLIC
)
2720 PHP_ME(CairoContext
, identity_matrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2721 PHP_ME(CairoContext
, in_fill
, CairoContext__in_fill_args
, /**/ZEND_ACC_PUBLIC
)
2722 PHP_ME(CairoContext
, in_stroke
, CairoContext__in_stroke_args
, /**/ZEND_ACC_PUBLIC
)
2723 PHP_ME(CairoContext
, line_to
, CairoContext__line_to_args
, /**/ZEND_ACC_PUBLIC
)
2724 PHP_ME(CairoContext
, mask
, CairoContext__mask_args
, /**/ZEND_ACC_PUBLIC
)
2725 PHP_ME(CairoContext
, mask_surface
, CairoContext__mask_surface_args
, /**/ZEND_ACC_PUBLIC
)
2726 PHP_ME(CairoContext
, move_to
, CairoContext__move_to_args
, /**/ZEND_ACC_PUBLIC
)
2727 PHP_ME(CairoContext
, new_path
, NULL
, /**/ZEND_ACC_PUBLIC
)
2728 PHP_ME(CairoContext
, new_sub_path
, NULL
, /**/ZEND_ACC_PUBLIC
)
2729 PHP_ME(CairoContext
, paint
, NULL
, /**/ZEND_ACC_PUBLIC
)
2730 PHP_ME(CairoContext
, paint_with_alpha
, CairoContext__paint_with_alpha_args
, /**/ZEND_ACC_PUBLIC
)
2731 PHP_ME(CairoContext
, path_extents
, CairoContext__path_extents_args
, /**/ZEND_ACC_PUBLIC
)
2732 PHP_ME(CairoContext
, pop_group
, NULL
, /**/ZEND_ACC_PUBLIC
)
2733 PHP_ME(CairoContext
, pop_group_to_source
, NULL
, /**/ZEND_ACC_PUBLIC
)
2734 PHP_ME(CairoContext
, push_group
, NULL
, /**/ZEND_ACC_PUBLIC
)
2735 PHP_ME(CairoContext
, push_group_with_content
, CairoContext__push_group_with_content_args
, /**/ZEND_ACC_PUBLIC
)
2736 PHP_ME(CairoContext
, rectangle
, CairoContext__rectangle_args
, /**/ZEND_ACC_PUBLIC
)
2737 PHP_ME(CairoContext
, rel_curve_to
, CairoContext__rel_curve_to_args
, /**/ZEND_ACC_PUBLIC
)
2738 PHP_ME(CairoContext
, rel_line_to
, CairoContext__rel_line_to_args
, /**/ZEND_ACC_PUBLIC
)
2739 PHP_ME(CairoContext
, rel_move_to
, CairoContext__rel_move_to_args
, /**/ZEND_ACC_PUBLIC
)
2740 PHP_ME(CairoContext
, reset_clip
, NULL
, /**/ZEND_ACC_PUBLIC
)
2741 PHP_ME(CairoContext
, restore
, NULL
, /**/ZEND_ACC_PUBLIC
)
2742 PHP_ME(CairoContext
, rotate
, CairoContext__rotate_args
, /**/ZEND_ACC_PUBLIC
)
2743 PHP_ME(CairoContext
, save
, NULL
, /**/ZEND_ACC_PUBLIC
)
2744 PHP_ME(CairoContext
, scale
, CairoContext__scale_args
, /**/ZEND_ACC_PUBLIC
)
2745 PHP_ME(CairoContext
, select_font_face
, CairoContext__select_font_face_args
, /**/ZEND_ACC_PUBLIC
)
2746 PHP_ME(CairoContext
, set_antialias
, CairoContext__set_antialias_args
, /**/ZEND_ACC_PUBLIC
)
2747 PHP_ME(CairoContext
, set_dash
, CairoContext__set_dash_args
, /**/ZEND_ACC_PUBLIC
)
2748 PHP_ME(CairoContext
, set_fill_rule
, CairoContext__set_fill_rule_args
, /**/ZEND_ACC_PUBLIC
)
2749 PHP_ME(CairoContext
, set_font_face
, CairoContext__set_font_face_args
, /**/ZEND_ACC_PUBLIC
)
2750 PHP_ME(CairoContext
, set_font_matrix
, CairoContext__set_font_matrix_args
, /**/ZEND_ACC_PUBLIC
)
2751 PHP_ME(CairoContext
, set_font_options
, CairoContext__set_font_options_args
, /**/ZEND_ACC_PUBLIC
)
2752 PHP_ME(CairoContext
, set_font_size
, CairoContext__set_font_size_args
, /**/ZEND_ACC_PUBLIC
)
2753 PHP_ME(CairoContext
, set_line_cap
, CairoContext__set_line_cap_args
, /**/ZEND_ACC_PUBLIC
)
2754 PHP_ME(CairoContext
, set_line_join
, CairoContext__set_line_join_args
, /**/ZEND_ACC_PUBLIC
)
2755 PHP_ME(CairoContext
, set_line_width
, CairoContext__set_line_width_args
, /**/ZEND_ACC_PUBLIC
)
2756 PHP_ME(CairoContext
, set_matrix
, CairoContext__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
2757 PHP_ME(CairoContext
, set_miter_limit
, CairoContext__set_miter_limit_args
, /**/ZEND_ACC_PUBLIC
)
2758 PHP_ME(CairoContext
, set_operator
, CairoContext__set_operator_args
, /**/ZEND_ACC_PUBLIC
)
2759 PHP_ME(CairoContext
, set_source
, CairoContext__set_source_args
, /**/ZEND_ACC_PUBLIC
)
2760 PHP_ME(CairoContext
, set_source_rgb
, CairoContext__set_source_rgb_args
, /**/ZEND_ACC_PUBLIC
)
2761 PHP_ME(CairoContext
, set_source_rgba
, CairoContext__set_source_rgba_args
, /**/ZEND_ACC_PUBLIC
)
2762 PHP_ME(CairoContext
, set_source_surface
, CairoContext__set_source_surface_args
, /**/ZEND_ACC_PUBLIC
)
2763 PHP_ME(CairoContext
, set_tolerance
, CairoContext__set_tolerance_args
, /**/ZEND_ACC_PUBLIC
)
2764 PHP_ME(CairoContext
, show_glyphs
, CairoContext__show_glyphs_args
, /**/ZEND_ACC_PUBLIC
)
2765 PHP_ME(CairoContext
, show_page
, NULL
, /**/ZEND_ACC_PUBLIC
)
2766 PHP_ME(CairoContext
, show_text
, CairoContext__show_text_args
, /**/ZEND_ACC_PUBLIC
)
2767 PHP_ME(CairoContext
, stroke
, NULL
, /**/ZEND_ACC_PUBLIC
)
2768 PHP_ME(CairoContext
, stroke_extents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2769 PHP_ME(CairoContext
, stroke_preserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2770 PHP_ME(CairoContext
, text_extents
, CairoContext__text_extents_args
, /**/ZEND_ACC_PUBLIC
)
2771 PHP_ME(CairoContext
, text_path
, CairoContext__text_path_args
, /**/ZEND_ACC_PUBLIC
)
2772 PHP_ME(CairoContext
, transform
, CairoContext__transform_args
, /**/ZEND_ACC_PUBLIC
)
2773 PHP_ME(CairoContext
, translate
, CairoContext__translate_args
, /**/ZEND_ACC_PUBLIC
)
2774 PHP_ME(CairoContext
, user_to_device
, CairoContext__user_to_device_args
, /**/ZEND_ACC_PUBLIC
)
2775 PHP_ME(CairoContext
, user_to_device_distance
, CairoContext__user_to_device_distance_args
, /**/ZEND_ACC_PUBLIC
)
2776 { NULL
, NULL
, NULL
}
2781 static zend_object_handlers CairoContext_handlers
;
2784 typedef struct _context_object {
2790 static void CairoContext_object_dtor(void *object
)
2792 context_object
*context
= (context_object
*)object
;
2793 zend_hash_destroy(context
->std
.properties
);
2794 FREE_HASHTABLE(context
->std
.properties
);
2796 if(context
->context
){
2797 cairo_destroy(context
->context
);
2802 static zend_object_value
CairoContext_object_new(zend_class_entry
*ce
)
2804 zend_object_value retval
;
2805 context_object
*context
;
2808 context
=emalloc(sizeof(context_object
));
2809 memset(context
,0,sizeof(context_object
));
2810 context
->std
.ce
= ce
;
2811 ALLOC_HASHTABLE(context
->std
.properties
);
2812 zend_hash_init(context
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
,0);
2813 zend_hash_copy(context
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, (void *) &temp
, sizeof(zval
*));
2814 retval
.handle
= zend_objects_store_put(context
, NULL
, (zend_objects_free_object_storage_t
)CairoContext_object_dtor
, NULL TSRMLS_CC
);
2815 retval
.handlers
= &CairoContext_handlers
;
2821 static void class_init_CairoContext(void)
2823 zend_class_entry ce
;
2824 INIT_CLASS_ENTRY(ce
, "CairoContext", CairoContext_methods
);
2825 CairoContext_ce_ptr
= zend_register_internal_class(&ce
);
2826 CairoContext_ce_ptr
->create_object
= CairoContext_object_new
;
2827 memcpy(&CairoContext_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
2828 CairoContext_handlers
.clone_obj
=NULL
;
2831 /* }}} Class CairoContext */