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 appendPath(object p)
45 PHP_METHOD(CairoContext
, appendPath
)
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 arcNegative(float xc, float yc, float radius, float angle1, float angle2)
100 PHP_METHOD(CairoContext
, arcNegative
)
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 /* }}} arcNegative */
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 clipExtents()
156 PHP_METHOD(CairoContext
, clipExtents
)
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 /* }}} clipExtents */
184 /* {{{ proto void clipPreserve()
186 PHP_METHOD(CairoContext
, clipPreserve
)
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 /* }}} clipPreserve */
209 /* {{{ proto void closePath()
211 PHP_METHOD(CairoContext
, closePath
)
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 copyClipRectangleList()
236 PHP_METHOD(CairoContext
, copyClipRectangleList
)
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);
271 cairo_rectangle_list_destroy(rlist
);
275 /* }}} copyClipRectangleList */
279 /* {{{ proto void copyPage()
281 PHP_METHOD(CairoContext
, copyPage
)
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 copyPath()
305 PHP_METHOD(CairoContext
, copyPath
)
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 copyPathFlat()
330 PHP_METHOD(CairoContext
, copyPathFlat
)
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 /* }}} copyPathFlat */
354 /* {{{ proto void curveTo (float x1, float y1, float x2, float y2, float x3, float y3)
356 PHP_METHOD(CairoContext
, curveTo
)
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 deviceToUser(float x, float y)
387 PHP_METHOD(CairoContext
, deviceToUser
)
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 /* }}} deviceToUser */
416 /* {{{ proto array deviceToUserDistance(float x, float y)
418 PHP_METHOD(CairoContext
, deviceToUserDistance
)
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 /* }}} deviceToUserDistance */
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 fillExtents()
472 PHP_METHOD(CairoContext
, fillExtents
)
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 /* }}} fillExtents */
500 /* {{{ proto void fillPreserve()
502 PHP_METHOD(CairoContext
, fillPreserve
)
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 /* }}} fillPreserve */
525 /* {{{ proto array fontExtents()
527 PHP_METHOD(CairoContext
, fontExtents
)
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 /* }}} fontExtents */
554 /* {{{ proto int getAntialias()
556 PHP_METHOD(CairoContext
, getAntialias
)
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 /* }}} getAntialias */
576 /* {{{ proto array getCurrentPoint()
578 PHP_METHOD(CairoContext
, getCurrentPoint
)
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 /* }}} getCurrentPoint */
601 /* {{{ proto array getDash()
603 PHP_METHOD(CairoContext
, getDash
)
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 getDashCount()
639 PHP_METHOD(CairoContext
, getDashCount
)
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 /* }}} getDashCount */
661 /* {{{ proto int getFillRule()
663 PHP_METHOD(CairoContext
, getFillRule
)
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 /* }}} getFillRule */
685 /* {{{ proto object getFontFace()
687 PHP_METHOD(CairoContext
, getFontFace
)
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 /* }}} getFontFace */
708 /* {{{ proto object getFontMatrix()
710 PHP_METHOD(CairoContext
, getFontMatrix
)
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 /* }}} getFontMatrix */
734 /* {{{ proto object getFontOptions()
736 PHP_METHOD(CairoContext
, getFontOptions
)
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 /* }}} getFontOptions */
761 /* {{{ proto object getGroupTarget()
763 PHP_METHOD(CairoContext
, getGroupTarget
)
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_get_group_target(curr
->context
);
779 ce
= get_CairoSurface_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 /* }}} getGroupTarget */
790 /* {{{ proto int getLineCap()
792 PHP_METHOD(CairoContext
, getLineCap
)
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
);
815 /* {{{ proto int getLineJoin()
817 PHP_METHOD(CairoContext
, getLineJoin
)
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 /* }}} getLineJoin */
839 /* {{{ proto float getLineWidth()
841 PHP_METHOD(CairoContext
, getLineWidth
)
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 /* }}} getLineWidth */
865 /* {{{ proto object getMatrix()
867 PHP_METHOD(CairoContext
, getMatrix
)
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 getMiterLimit()
893 PHP_METHOD(CairoContext
, getMiterLimit
)
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 /* }}} getMiterLimit */
915 /* {{{ proto int getOperator()
917 PHP_METHOD(CairoContext
, getOperator
)
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 /* }}} getOperator */
939 /* {{{ proto object getScaledFont()
941 PHP_METHOD(CairoContext
, getScaledFont
)
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 /* }}} getScaledFont */
966 /* {{{ proto object getSource()
968 PHP_METHOD(CairoContext
, getSource
)
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
= get_CairoPattern_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 getTarget()
997 PHP_METHOD(CairoContext
, getTarget
)
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
= get_CairoSurface_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
);
1025 /* {{{ proto float getTolerance()
1027 PHP_METHOD(CairoContext
, getTolerance
)
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 /* }}} getTolerance */
1049 /* {{{ proto array glyphExtents(array obj,int num) --need to check
1051 PHP_METHOD(CairoContext
, glyphExtents
)
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 /* }}} glyphExtents */
1091 /* {{{ proto void glyphPath(array obh , int num])
1093 PHP_METHOD(CairoContext
, glyphPath
)
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
);
1125 /* {{{ proto bool hasCurrentPoint() -- Need to remove this and put it in path
1127 PHP_METHOD(CairoContext
, hasCurrentPoint
)
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 /* }}} hasCurrentPoint */
1151 /* {{{ proto void identityMatrix()
1153 PHP_METHOD(CairoContext
, identityMatrix
)
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 /* }}} identityMatrix */
1176 /* {{{ proto bool inFill(float x, float y)
1178 PHP_METHOD(CairoContext
, inFill
)
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 inStroke(float x, float y)
1210 PHP_METHOD(CairoContext
, inStroke
)
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 lineTo(float x, float y)
1241 PHP_METHOD(CairoContext
, lineTo
)
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 maskSurface(object s[,float surface_x, float surface_y])
1295 PHP_METHOD(CairoContext
, maskSurface
)
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 /* }}} maskSurface */
1322 /* {{{ proto void moveTo(float x, float y)
1324 PHP_METHOD(CairoContext
, moveTo
)
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 newPath()
1351 PHP_METHOD(CairoContext
, newPath
)
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 newSubPath()
1375 PHP_METHOD(CairoContext
, newSubPath
)
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 /* }}} newSubPath */
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 paintWithAlpha(float alpha)
1424 PHP_METHOD(CairoContext
, paintWithAlpha
)
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 /* }}} paintWithAlpha */
1447 /* {{{ proto array pathExtents([object path]) --- need to shift it to path --
1449 PHP_METHOD(CairoContext
, pathExtents
)
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 /* }}} pathExtents */
1476 /* {{{ proto object popGroup()
1478 PHP_METHOD(CairoContext
, popGroup
)
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
= get_CairoPattern_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 popGroupToSource()
1506 PHP_METHOD(CairoContext
, popGroupToSource
)
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 /* }}} popGroupToSource */
1529 /* {{{ proto void pushGroup()
1531 PHP_METHOD(CairoContext
, pushGroup
)
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
);
1554 /* {{{ proto void pushGroupWithContent(int content)
1556 PHP_METHOD(CairoContext
, pushGroupWithContent
)
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 /* }}} pushGroupWithContent */
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 relCurveTo(float x1, float y1, float x2, float y2, float x3, float y3)
1610 PHP_METHOD(CairoContext
, relCurveTo
)
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 /* }}} relCurveTo */
1638 /* {{{ proto void relLineTo(float x, float y)
1640 PHP_METHOD(CairoContext
, relLineTo
)
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
);
1664 /* {{{ proto void relMoveTo(float x, float y)
1666 PHP_METHOD(CairoContext
, relMoveTo
)
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
);
1689 /* {{{ proto void resetClip()
1691 PHP_METHOD(CairoContext
, resetClip
)
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
);
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 selectFontFace(object string[, int slant, int weight])
1820 PHP_METHOD(CairoContext
, selectFontFace
)
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 /* }}} selectFontFace */
1846 /* {{{ proto void setAntialias([int antialias])
1848 PHP_METHOD(CairoContext
, setAntialias
)
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 /* }}} setAntialias */
1871 /* {{{ proto void setDash(array dashes, int num_dashes [,float offset])
1873 PHP_METHOD(CairoContext
, setDash
)
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
);
1894 printf("Problem !!!");
1896 for(zend_hash_internal_pointer_reset(dashes_hash
); zend_hash_has_more_elements(dashes_hash
) == SUCCESS
; zend_hash_move_forward(dashes_hash
)) {
1897 if (zend_hash_get_current_data(dashes_hash
, (void **)&ppzval
) == FAILURE
) {
1901 das
[i
++] = Z_DVAL_PP(ppzval
);
1904 cairo_set_dash(curr
->context
, das
, num_dashes
, offset
);
1905 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1914 /* {{{ proto void setFillRule(int fill_rule)
1916 PHP_METHOD(CairoContext
, setFillRule
)
1918 zend_class_entry
* _this_ce
;
1920 zval
* _this_zval
= NULL
;
1921 cairo_fill_rule_t fill_rule
= 0;
1925 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &fill_rule
) == FAILURE
) {
1929 _this_ce
= Z_OBJCE_P(_this_zval
);
1930 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1931 cairo_set_fill_rule(curr
->context
, fill_rule
);
1932 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1934 /* }}} setFillRule */
1938 /* {{{ proto void setFontFace([object obj])
1940 PHP_METHOD(CairoContext
, setFontFace
)
1942 zend_class_entry
* _this_ce
;
1944 zval
* _this_zval
= NULL
;
1949 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O|o", &_this_zval
, CairoContext_ce_ptr
, &obj
) == FAILURE
) {
1953 _this_ce
= Z_OBJCE_P(_this_zval
);
1954 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1956 fontface_object
*ffobj
= (fontface_object
*)zend_objects_get_address(obj TSRMLS_CC
);
1957 cairo_set_font_face(curr
->context
, ffobj
->fontface
);
1960 cairo_set_font_face(curr
->context
, NULL
);
1961 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1965 /* }}} setFontFace */
1969 /* {{{ proto void setFontMatrix(object matrix)
1971 PHP_METHOD(CairoContext
, setFontMatrix
)
1973 zend_class_entry
* _this_ce
;
1975 zval
* _this_zval
= NULL
;
1976 zval
* matrix
= NULL
;
1980 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matrix
) == FAILURE
) {
1984 _this_ce
= Z_OBJCE_P(_this_zval
);
1985 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
1986 matrix_object
*mobj
=(matrix_object
*)zend_objects_get_address(matrix TSRMLS_CC
);
1987 cairo_set_font_matrix(curr
->context
, &mobj
->matrix
);
1988 phpCAIRO_CONTEXT_ERROR(curr
->context
);
1991 /* }}} setFontMatrix */
1995 /* {{{ proto void setFontOptions(object options)
1997 PHP_METHOD(CairoContext
, setFontOptions
)
1999 zend_class_entry
* _this_ce
;
2001 zval
* _this_zval
= NULL
;
2002 zval
* options
= NULL
;
2006 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &options
) == FAILURE
) {
2010 _this_ce
= Z_OBJCE_P(_this_zval
);
2011 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2012 fontoptions_object
*foobj
=(fontoptions_object
*)zend_objects_get_address(options TSRMLS_CC
);
2013 cairo_set_font_options(curr
->context
, foobj
->fontoptions
);
2014 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2018 /* }}} setFontOptions */
2022 /* {{{ proto void setFontSize(float size)
2024 PHP_METHOD(CairoContext
, setFontSize
)
2026 zend_class_entry
* _this_ce
;
2028 zval
* _this_zval
= NULL
;
2033 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &size
) == FAILURE
) {
2037 _this_ce
= Z_OBJCE_P(_this_zval
);
2038 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2039 cairo_set_font_size(curr
->context
, size
);
2040 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2043 /* }}} setFontSize */
2047 /* {{{ proto void setLineCap(int line_cap)
2049 PHP_METHOD(CairoContext
, setLineCap
)
2051 zend_class_entry
* _this_ce
;
2053 zval
* _this_zval
= NULL
;
2058 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &line_cap
) == FAILURE
) {
2062 _this_ce
= Z_OBJCE_P(_this_zval
);
2063 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2064 cairo_set_line_cap(curr
->context
, line_cap
);
2065 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2070 /* }}} setLineCap */
2074 /* {{{ proto void setLineJoin(int line_join)
2076 PHP_METHOD(CairoContext
, setLineJoin
)
2078 zend_class_entry
* _this_ce
;
2080 zval
* _this_zval
= NULL
;
2085 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &line_join
) == FAILURE
) {
2089 _this_ce
= Z_OBJCE_P(_this_zval
);
2090 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2092 cairo_set_line_join(curr
->context
, line_join
);
2093 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2096 /* }}} setLineJoin */
2100 /* {{{ proto void setLineWidth(float width)
2102 PHP_METHOD(CairoContext
, setLineWidth
)
2104 zend_class_entry
* _this_ce
;
2106 zval
* _this_zval
= NULL
;
2111 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &width
) == FAILURE
) {
2115 _this_ce
= Z_OBJCE_P(_this_zval
);
2116 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2117 cairo_set_line_width(curr
->context
, width
);
2119 /* }}} set_line_width */
2123 /* {{{ proto void setMatrix(object matix)
2125 PHP_METHOD(CairoContext
, setMatrix
)
2127 zend_class_entry
* _this_ce
;
2129 zval
* _this_zval
= NULL
;
2130 zval
* matix
= NULL
;
2134 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matix
) == FAILURE
) {
2138 _this_ce
= Z_OBJCE_P(_this_zval
);
2139 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2140 matrix_object
*mobj
=(matrix_object
*)zend_objects_get_address(matix TSRMLS_CC
);
2141 cairo_set_matrix(curr
->context
, &mobj
->matrix
);
2142 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2149 /* {{{ proto void setMiterLimit(float limit)
2151 PHP_METHOD(CairoContext
, setMiterLimit
)
2153 zend_class_entry
* _this_ce
;
2155 zval
* _this_zval
= NULL
;
2160 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &limit
) == FAILURE
) {
2164 _this_ce
= Z_OBJCE_P(_this_zval
);
2165 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2166 cairo_set_miter_limit(curr
->context
, limit
);
2167 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2170 /* }}} setMiterLimit */
2174 /* {{{ proto void setOperator(int op)
2176 PHP_METHOD(CairoContext
, setOperator
)
2178 zend_class_entry
* _this_ce
;
2180 zval
* _this_zval
= NULL
;
2185 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Ol", &_this_zval
, CairoContext_ce_ptr
, &op
) == FAILURE
) {
2189 _this_ce
= Z_OBJCE_P(_this_zval
);
2190 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2191 cairo_set_operator(curr
->context
, op
);
2192 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2195 /* }}} setOperator */
2199 /* {{{ proto void setSource(object p)
2201 PHP_METHOD(CairoContext
, setSource
)
2203 zend_class_entry
* _this_ce
;
2205 zval
* _this_zval
= NULL
;
2210 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &p
) == FAILURE
) {
2214 _this_ce
= Z_OBJCE_P(_this_zval
);
2215 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2216 pattern_object
*ptobj
=(pattern_object
*)zend_objects_get_address(p TSRMLS_CC
);
2217 cairo_set_source(curr
->context
, ptobj
->pattern
);
2218 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2225 /* {{{ proto void setSourceRgb(float red, float green, float blue)
2227 PHP_METHOD(CairoContext
, setSourceRgb
)
2229 zend_class_entry
* _this_ce
;
2231 zval
* _this_zval
= NULL
;
2238 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddd", &_this_zval
, CairoContext_ce_ptr
, &red
, &green
, &blue
) == FAILURE
) {
2242 _this_ce
= Z_OBJCE_P(_this_zval
);
2243 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2244 cairo_set_source_rgb(curr
->context
, red
, green
, blue
);
2245 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2248 /* }}} setSourceRgb */
2252 /* {{{ proto void setSourceRgba(float red, float green, float blue [,float alpha])
2254 PHP_METHOD(CairoContext
, setSourceRgba
)
2256 zend_class_entry
* _this_ce
;
2258 zval
* _this_zval
= NULL
;
2266 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oddd|d", &_this_zval
, CairoContext_ce_ptr
, &red
, &green
, &blue
, &alpha
) == FAILURE
) {
2270 _this_ce
= Z_OBJCE_P(_this_zval
);
2271 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2272 cairo_set_source_rgba(curr
->context
, red
, green
, blue
, alpha
);
2273 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2276 /* }}} setSourceRgba */
2280 /* {{{ proto void setSourceSurface(object surface [,float x, float y])
2282 PHP_METHOD(CairoContext
, setSourceSurface
)
2284 zend_class_entry
* _this_ce
;
2286 zval
* _this_zval
= NULL
;
2287 zval
* surface
= NULL
;
2293 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo|dd", &_this_zval
, CairoContext_ce_ptr
, &surface
, &x
, &y
) == FAILURE
) {
2297 _this_ce
= Z_OBJCE_P(_this_zval
);
2298 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2299 surface_object
*sobj
=(surface_object
*)zend_objects_get_address(surface TSRMLS_CC
);
2300 cairo_set_source_surface(curr
->context
, sobj
->surface
, x
, y
);
2301 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2304 /* }}} setSourceSurface */
2308 /* {{{ proto void setTolerance(float tolerance)
2310 PHP_METHOD(CairoContext
, setTolerance
)
2312 zend_class_entry
* _this_ce
;
2314 zval
* _this_zval
= NULL
;
2315 double tolerance
= 0.0;
2319 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Od", &_this_zval
, CairoContext_ce_ptr
, &tolerance
) == FAILURE
) {
2323 _this_ce
= Z_OBJCE_P(_this_zval
);
2324 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2325 cairo_set_tolerance(curr
->context
, tolerance
);
2326 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2329 /* }}} setTolerance */
2333 /* {{{ proto void showGlyphs(array obj ,int num_glyphs)
2335 PHP_METHOD(CairoContext
, showGlyphs
)
2337 zend_class_entry
* _this_ce
;
2339 zval
* _this_zval
= NULL
, **ppzval
;
2341 long num_glyphs
= 0;
2342 HashTable
*obj_hash
= NULL
;
2343 cairo_glyph_t
*glyphs
=NULL
, *glyph
;
2347 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oa/l", &_this_zval
, CairoContext_ce_ptr
, &obj
, &num_glyphs
) == FAILURE
) {
2351 _this_ce
= Z_OBJCE_P(_this_zval
);
2352 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2353 obj_hash
= HASH_OF(obj
);
2355 glyphs
= emalloc(num_glyphs
*sizeof(cairo_glyph_t
));
2357 for(zend_hash_internal_pointer_reset(obj_hash
); zend_hash_has_more_elements(obj_hash
) == SUCCESS
; zend_hash_move_forward(obj_hash
)) {
2358 if (zend_hash_get_current_data(obj_hash
, (void **)&ppzval
) == FAILURE
) {
2361 // glyphs[i++] = Z_RESVAL_PP(ppzval);
2365 /* for(i=0 , glyph=glyphs; i<num_glyphs; i++, glyph++) {
2366 zend_hash_get_current_data(obj_hash, (void **)&glyph);
2367 zend_hash_move_forward(obj_hash);
2370 cairo_show_glyphs(curr
->context
, glyphs
, num_glyphs
);
2371 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2374 /* }}} showGlyphs */
2378 /* {{{ proto void showPage()
2380 PHP_METHOD(CairoContext
, showPage
)
2382 zend_class_entry
* _this_ce
;
2384 zval
* _this_zval
= NULL
;
2388 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2392 _this_ce
= Z_OBJCE_P(_this_zval
);
2393 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2394 cairo_show_page(curr
->context
);
2395 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2402 /* {{{ proto void showText(string obj)
2404 PHP_METHOD(CairoContext
, showText
)
2406 zend_class_entry
* _this_ce
;
2408 zval
* _this_zval
= NULL
;
2409 const char * obj
= NULL
;
2414 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &obj
, &obj_len
) == FAILURE
) {
2418 _this_ce
= Z_OBJCE_P(_this_zval
);
2419 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2420 cairo_show_text(curr
->context
, obj
);
2421 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2428 /* {{{ proto void stroke()
2430 PHP_METHOD(CairoContext
, stroke
)
2432 zend_class_entry
* _this_ce
;
2434 zval
* _this_zval
= NULL
;
2438 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2442 _this_ce
= Z_OBJCE_P(_this_zval
);
2443 context_object
*curr
= (context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2444 cairo_stroke(curr
->context
);
2445 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2453 /* {{{ proto array strokeExtents()
2455 PHP_METHOD(CairoContext
, strokeExtents
)
2457 zend_class_entry
* _this_ce
;
2459 zval
* _this_zval
= NULL
;
2460 double x1
=0, x2
=0, y1
=0, y2
=0;
2464 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2468 _this_ce
= Z_OBJCE_P(_this_zval
);
2469 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2470 cairo_stroke_extents(curr
->context
, &x1
, &y1
, &x2
, &y2
);
2472 array_init(return_value
);
2473 add_assoc_double(return_value
, "x1", x1
);
2474 add_assoc_double(return_value
, "y1", y1
);
2475 add_assoc_double(return_value
, "x2", x2
);
2476 add_assoc_double(return_value
, "y2", y2
);
2479 /* }}} strokeExtents */
2483 /* {{{ proto void strokePreserve()
2485 PHP_METHOD(CairoContext
, strokePreserve
)
2487 zend_class_entry
* _this_ce
;
2489 zval
* _this_zval
= NULL
;
2493 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "O", &_this_zval
, CairoContext_ce_ptr
) == FAILURE
) {
2497 _this_ce
= Z_OBJCE_P(_this_zval
);
2498 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2499 cairo_stroke_preserve(curr
->context
);
2500 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2503 /* }}} strokePreserve */
2507 /* {{{ proto array textExtents(string str)
2509 PHP_METHOD(CairoContext
, textExtents
)
2511 zend_class_entry
* _this_ce
;
2513 zval
* _this_zval
= NULL
;
2514 const char * str
= NULL
;
2516 cairo_text_extents_t extents
;
2519 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &str
, &str_len
) == FAILURE
) {
2523 _this_ce
= Z_OBJCE_P(_this_zval
);
2524 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2526 cairo_text_extents(curr
->context
, str
, &extents
);
2528 array_init(return_value
);
2529 add_assoc_double(return_value
, "x_bearing", extents
.x_bearing
);
2530 add_assoc_double(return_value
, "y_bearing", extents
.y_bearing
);
2531 add_assoc_double(return_value
, "width", extents
.width
);
2532 add_assoc_double(return_value
, "height", extents
.height
);
2533 add_assoc_double(return_value
, "x_advance", extents
.x_advance
);
2534 add_assoc_double(return_value
, "y_advance", extents
.y_advance
);
2537 /* }}} textExtents */
2541 /* {{{ proto void textPath(string obj)
2543 PHP_METHOD(CairoContext
, textPath
)
2545 zend_class_entry
* _this_ce
;
2547 zval
* _this_zval
= NULL
;
2548 const char * obj
= NULL
;
2553 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Os", &_this_zval
, CairoContext_ce_ptr
, &obj
, &obj_len
) == FAILURE
) {
2557 _this_ce
= Z_OBJCE_P(_this_zval
);
2558 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2559 cairo_text_path(curr
->context
, obj
);
2560 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2567 /* {{{ proto void transform(object matrix)
2569 PHP_METHOD(CairoContext
, transform
)
2571 zend_class_entry
* _this_ce
;
2573 zval
* _this_zval
= NULL
;
2574 zval
* matrix
= NULL
;
2578 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Oo", &_this_zval
, CairoContext_ce_ptr
, &matrix
) == FAILURE
) {
2582 _this_ce
= Z_OBJCE_P(_this_zval
);
2583 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2584 matrix_object
*mobj
= (matrix_object
*)zend_objects_get_address(matrix TSRMLS_CC
);
2585 cairo_transform(curr
->context
, &mobj
->matrix
);
2586 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2593 /* {{{ proto void translate(float tx, float ty)
2595 PHP_METHOD(CairoContext
, translate
)
2597 zend_class_entry
* _this_ce
;
2599 zval
* _this_zval
= NULL
;
2605 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &tx
, &ty
) == FAILURE
) {
2609 _this_ce
= Z_OBJCE_P(_this_zval
);
2610 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2612 cairo_translate(curr
->context
, tx
, ty
);
2613 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2620 /* {{{ proto array userToDevice(float x, float y)
2622 PHP_METHOD(CairoContext
, userToDevice
)
2624 zend_class_entry
* _this_ce
;
2626 zval
* _this_zval
= NULL
;
2632 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &x
, &y
) == FAILURE
) {
2636 _this_ce
= Z_OBJCE_P(_this_zval
);
2637 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2639 cairo_user_to_device(curr
->context
, &x
, &y
);
2640 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2642 array_init(return_value
);
2643 add_assoc_double(return_value
, "x", x
);
2644 add_assoc_double(return_value
, "y", y
);
2647 /* }}} userToDevice */
2651 /* {{{ proto array userToDeviceDistance(float dx, float dy)
2653 PHP_METHOD(CairoContext
, userToDeviceDistance
)
2655 zend_class_entry
* _this_ce
;
2657 zval
* _this_zval
= NULL
;
2663 if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC
, getThis(), "Odd", &_this_zval
, CairoContext_ce_ptr
, &dx
, &dy
) == FAILURE
) {
2667 _this_ce
= Z_OBJCE_P(_this_zval
);
2668 context_object
*curr
=(context_object
*)zend_objects_get_address(_this_zval TSRMLS_CC
);
2669 cairo_user_to_device_distance(curr
->context
, &dx
, &dy
);
2670 phpCAIRO_CONTEXT_ERROR(curr
->context
);
2672 array_init(return_value
);
2673 add_assoc_double(return_value
, "x", dx
);
2674 add_assoc_double(return_value
, "y", dy
);
2677 /* }}} userToDeviceDistance */
2680 static zend_function_entry CairoContext_methods
[] = {
2681 PHP_ME(CairoContext
, __construct
, NULL
, /**/ZEND_ACC_PUBLIC
| ZEND_ACC_CTOR
)
2682 PHP_ME(CairoContext
, appendPath
, CairoContext__append_path_args
, /**/ZEND_ACC_PUBLIC
)
2683 PHP_ME(CairoContext
, arc
, CairoContext__arc_args
, /**/ZEND_ACC_PUBLIC
)
2684 PHP_ME(CairoContext
, arcNegative
, CairoContext__arc_negative_args
, /**/ZEND_ACC_PUBLIC
)
2685 PHP_ME(CairoContext
, clip
, NULL
, /**/ZEND_ACC_PUBLIC
)
2686 PHP_ME(CairoContext
, clipExtents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2687 PHP_ME(CairoContext
, clipPreserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2688 PHP_ME(CairoContext
, closePath
, NULL
, /**/ZEND_ACC_PUBLIC
)
2689 PHP_ME(CairoContext
, copyClipRectangleList
, NULL
, /**/ZEND_ACC_PUBLIC
)
2690 PHP_ME(CairoContext
, copyPage
, NULL
, /**/ZEND_ACC_PUBLIC
)
2691 PHP_ME(CairoContext
, copyPath
, NULL
, /**/ZEND_ACC_PUBLIC
)
2692 PHP_ME(CairoContext
, copyPathFlat
, NULL
, /**/ZEND_ACC_PUBLIC
)
2693 PHP_ME(CairoContext
, curveTo
, CairoContext__curve_to_args
, /**/ZEND_ACC_PUBLIC
)
2694 PHP_ME(CairoContext
, deviceToUser
, CairoContext__device_to_user_args
, /**/ZEND_ACC_PUBLIC
)
2695 PHP_ME(CairoContext
, deviceToUserDistance
, CairoContext__device_to_user_distance_args
, /**/ZEND_ACC_PUBLIC
)
2696 PHP_ME(CairoContext
, fill
, NULL
, /**/ZEND_ACC_PUBLIC
)
2697 PHP_ME(CairoContext
, fillExtents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2698 PHP_ME(CairoContext
, fillPreserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2699 PHP_ME(CairoContext
, fontExtents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2700 PHP_ME(CairoContext
, getAntialias
, NULL
, /**/ZEND_ACC_PUBLIC
)
2701 PHP_ME(CairoContext
, getCurrentPoint
, NULL
, /**/ZEND_ACC_PUBLIC
)
2702 PHP_ME(CairoContext
, getDash
, NULL
, /**/ZEND_ACC_PUBLIC
)
2703 PHP_ME(CairoContext
, getDashCount
, NULL
, /**/ZEND_ACC_PUBLIC
)
2704 PHP_ME(CairoContext
, getFillRule
, NULL
, /**/ZEND_ACC_PUBLIC
)
2705 PHP_ME(CairoContext
, getFontFace
, NULL
, /**/ZEND_ACC_PUBLIC
)
2706 PHP_ME(CairoContext
, getFontMatrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2707 PHP_ME(CairoContext
, getFontOptions
, NULL
, /**/ZEND_ACC_PUBLIC
)
2708 PHP_ME(CairoContext
, getGroupTarget
, NULL
, /**/ZEND_ACC_PUBLIC
)
2709 PHP_ME(CairoContext
, getLineCap
, NULL
, /**/ZEND_ACC_PUBLIC
)
2710 PHP_ME(CairoContext
, getLineJoin
, NULL
, /**/ZEND_ACC_PUBLIC
)
2711 PHP_ME(CairoContext
, getLineWidth
, NULL
, /**/ZEND_ACC_PUBLIC
)
2712 PHP_ME(CairoContext
, getMatrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2713 PHP_ME(CairoContext
, getMiterLimit
, NULL
, /**/ZEND_ACC_PUBLIC
)
2714 PHP_ME(CairoContext
, getOperator
, NULL
, /**/ZEND_ACC_PUBLIC
)
2715 PHP_ME(CairoContext
, getScaledFont
, NULL
, /**/ZEND_ACC_PUBLIC
)
2716 PHP_ME(CairoContext
, getSource
, NULL
, /**/ZEND_ACC_PUBLIC
)
2717 PHP_ME(CairoContext
, getTarget
, NULL
, /**/ZEND_ACC_PUBLIC
)
2718 PHP_ME(CairoContext
, getTolerance
, NULL
, /**/ZEND_ACC_PUBLIC
)
2719 PHP_ME(CairoContext
, glyphExtents
, CairoContext__glyph_extents_args
, /**/ZEND_ACC_PUBLIC
)
2720 PHP_ME(CairoContext
, glyphPath
, CairoContext__glyph_path_args
, /**/ZEND_ACC_PUBLIC
)
2721 PHP_ME(CairoContext
, hasCurrentPoint
, NULL
, /**/ZEND_ACC_PUBLIC
)
2722 PHP_ME(CairoContext
, identityMatrix
, NULL
, /**/ZEND_ACC_PUBLIC
)
2723 PHP_ME(CairoContext
, inFill
, CairoContext__in_fill_args
, /**/ZEND_ACC_PUBLIC
)
2724 PHP_ME(CairoContext
, inStroke
, CairoContext__in_stroke_args
, /**/ZEND_ACC_PUBLIC
)
2725 PHP_ME(CairoContext
, lineTo
, CairoContext__line_to_args
, /**/ZEND_ACC_PUBLIC
)
2726 PHP_ME(CairoContext
, mask
, CairoContext__mask_args
, /**/ZEND_ACC_PUBLIC
)
2727 PHP_ME(CairoContext
, maskSurface
, CairoContext__mask_surface_args
, /**/ZEND_ACC_PUBLIC
)
2728 PHP_ME(CairoContext
, moveTo
, CairoContext__move_to_args
, /**/ZEND_ACC_PUBLIC
)
2729 PHP_ME(CairoContext
, newPath
, NULL
, /**/ZEND_ACC_PUBLIC
)
2730 PHP_ME(CairoContext
, newSubPath
, NULL
, /**/ZEND_ACC_PUBLIC
)
2731 PHP_ME(CairoContext
, paint
, NULL
, /**/ZEND_ACC_PUBLIC
)
2732 PHP_ME(CairoContext
, paintWithAlpha
, CairoContext__paint_with_alpha_args
, /**/ZEND_ACC_PUBLIC
)
2733 PHP_ME(CairoContext
, pathExtents
, CairoContext__path_extents_args
, /**/ZEND_ACC_PUBLIC
)
2734 PHP_ME(CairoContext
, popGroup
, NULL
, /**/ZEND_ACC_PUBLIC
)
2735 PHP_ME(CairoContext
, popGroupToSource
, NULL
, /**/ZEND_ACC_PUBLIC
)
2736 PHP_ME(CairoContext
, pushGroup
, NULL
, /**/ZEND_ACC_PUBLIC
)
2737 PHP_ME(CairoContext
, pushGroupWithContent
, CairoContext__push_group_with_content_args
, /**/ZEND_ACC_PUBLIC
)
2738 PHP_ME(CairoContext
, rectangle
, CairoContext__rectangle_args
, /**/ZEND_ACC_PUBLIC
)
2739 PHP_ME(CairoContext
, relCurveTo
, CairoContext__rel_curve_to_args
, /**/ZEND_ACC_PUBLIC
)
2740 PHP_ME(CairoContext
, relLineTo
, CairoContext__rel_line_to_args
, /**/ZEND_ACC_PUBLIC
)
2741 PHP_ME(CairoContext
, relMoveTo
, CairoContext__rel_move_to_args
, /**/ZEND_ACC_PUBLIC
)
2742 PHP_ME(CairoContext
, resetClip
, NULL
, /**/ZEND_ACC_PUBLIC
)
2743 PHP_ME(CairoContext
, restore
, NULL
, /**/ZEND_ACC_PUBLIC
)
2744 PHP_ME(CairoContext
, rotate
, CairoContext__rotate_args
, /**/ZEND_ACC_PUBLIC
)
2745 PHP_ME(CairoContext
, save
, NULL
, /**/ZEND_ACC_PUBLIC
)
2746 PHP_ME(CairoContext
, scale
, CairoContext__scale_args
, /**/ZEND_ACC_PUBLIC
)
2747 PHP_ME(CairoContext
, selectFontFace
, CairoContext__select_font_face_args
, /**/ZEND_ACC_PUBLIC
)
2748 PHP_ME(CairoContext
, setAntialias
, CairoContext__set_antialias_args
, /**/ZEND_ACC_PUBLIC
)
2749 PHP_ME(CairoContext
, setDash
, CairoContext__set_dash_args
, /**/ZEND_ACC_PUBLIC
)
2750 PHP_ME(CairoContext
, setFillRule
, CairoContext__set_fill_rule_args
, /**/ZEND_ACC_PUBLIC
)
2751 PHP_ME(CairoContext
, setFontFace
, CairoContext__set_font_face_args
, /**/ZEND_ACC_PUBLIC
)
2752 PHP_ME(CairoContext
, setFontMatrix
, CairoContext__set_font_matrix_args
, /**/ZEND_ACC_PUBLIC
)
2753 PHP_ME(CairoContext
, setFontOptions
, CairoContext__set_font_options_args
, /**/ZEND_ACC_PUBLIC
)
2754 PHP_ME(CairoContext
, setFontSize
, CairoContext__set_font_size_args
, /**/ZEND_ACC_PUBLIC
)
2755 PHP_ME(CairoContext
, setLineCap
, CairoContext__set_line_cap_args
, /**/ZEND_ACC_PUBLIC
)
2756 PHP_ME(CairoContext
, setLineJoin
, CairoContext__set_line_join_args
, /**/ZEND_ACC_PUBLIC
)
2757 PHP_ME(CairoContext
, setLineWidth
, CairoContext__set_line_width_args
, /**/ZEND_ACC_PUBLIC
)
2758 PHP_ME(CairoContext
, setMatrix
, CairoContext__set_matrix_args
, /**/ZEND_ACC_PUBLIC
)
2759 PHP_ME(CairoContext
, setMiterLimit
, CairoContext__set_miter_limit_args
, /**/ZEND_ACC_PUBLIC
)
2760 PHP_ME(CairoContext
, setOperator
, CairoContext__set_operator_args
, /**/ZEND_ACC_PUBLIC
)
2761 PHP_ME(CairoContext
, setSource
, CairoContext__set_source_args
, /**/ZEND_ACC_PUBLIC
)
2762 PHP_ME(CairoContext
, setSourceRgb
, CairoContext__set_source_rgb_args
, /**/ZEND_ACC_PUBLIC
)
2763 PHP_ME(CairoContext
, setSourceRgba
, CairoContext__set_source_rgba_args
, /**/ZEND_ACC_PUBLIC
)
2764 PHP_ME(CairoContext
, setSourceSurface
, CairoContext__set_source_surface_args
, /**/ZEND_ACC_PUBLIC
)
2765 PHP_ME(CairoContext
, setTolerance
, CairoContext__set_tolerance_args
, /**/ZEND_ACC_PUBLIC
)
2766 PHP_ME(CairoContext
, showGlyphs
, CairoContext__show_glyphs_args
, /**/ZEND_ACC_PUBLIC
)
2767 PHP_ME(CairoContext
, showPage
, NULL
, /**/ZEND_ACC_PUBLIC
)
2768 PHP_ME(CairoContext
, showText
, CairoContext__show_text_args
, /**/ZEND_ACC_PUBLIC
)
2769 PHP_ME(CairoContext
, stroke
, NULL
, /**/ZEND_ACC_PUBLIC
)
2770 PHP_ME(CairoContext
, strokeExtents
, NULL
, /**/ZEND_ACC_PUBLIC
)
2771 PHP_ME(CairoContext
, strokePreserve
, NULL
, /**/ZEND_ACC_PUBLIC
)
2772 PHP_ME(CairoContext
, textExtents
, CairoContext__text_extents_args
, /**/ZEND_ACC_PUBLIC
)
2773 PHP_ME(CairoContext
, textPath
, CairoContext__text_path_args
, /**/ZEND_ACC_PUBLIC
)
2774 PHP_ME(CairoContext
, transform
, CairoContext__transform_args
, /**/ZEND_ACC_PUBLIC
)
2775 PHP_ME(CairoContext
, translate
, CairoContext__translate_args
, /**/ZEND_ACC_PUBLIC
)
2776 PHP_ME(CairoContext
, userToDevice
, CairoContext__user_to_device_args
, /**/ZEND_ACC_PUBLIC
)
2777 PHP_ME(CairoContext
, userToDeviceDistance
, CairoContext__user_to_device_distance_args
, /**/ZEND_ACC_PUBLIC
)
2778 { NULL
, NULL
, NULL
}
2783 static zend_object_handlers CairoContext_handlers
;
2786 typedef struct _context_object {
2792 static void CairoContext_object_dtor(void *object
)
2794 context_object
*context
= (context_object
*)object
;
2795 zend_hash_destroy(context
->std
.properties
);
2796 FREE_HASHTABLE(context
->std
.properties
);
2798 if(context
->context
){
2799 cairo_destroy(context
->context
);
2804 static zend_object_value
CairoContext_object_new(zend_class_entry
*ce
)
2806 zend_object_value retval
;
2807 context_object
*context
;
2810 context
=emalloc(sizeof(context_object
));
2811 memset(context
,0,sizeof(context_object
));
2812 context
->std
.ce
= ce
;
2813 ALLOC_HASHTABLE(context
->std
.properties
);
2814 zend_hash_init(context
->std
.properties
, 0, NULL
, ZVAL_PTR_DTOR
,0);
2815 zend_hash_copy(context
->std
.properties
, &ce
->default_properties
, (copy_ctor_func_t
) zval_add_ref
, (void *) &temp
, sizeof(zval
*));
2816 retval
.handle
= zend_objects_store_put(context
, NULL
, (zend_objects_free_object_storage_t
)CairoContext_object_dtor
, NULL TSRMLS_CC
);
2817 retval
.handlers
= &CairoContext_handlers
;
2823 static void class_init_CairoContext(void)
2825 zend_class_entry ce
;
2826 INIT_CLASS_ENTRY(ce
, "CairoContext", CairoContext_methods
);
2827 CairoContext_ce_ptr
= zend_register_internal_class(&ce
);
2828 CairoContext_ce_ptr
->create_object
= CairoContext_object_new
;
2829 memcpy(&CairoContext_handlers
, zend_get_std_object_handlers(), sizeof(zend_object_handlers
));
2830 CairoContext_handlers
.clone_obj
=NULL
;
2833 /* }}} Class CairoContext */