From 6aeecd94a4d353cbfc5e84715c5c87e59d03b49d Mon Sep 17 00:00:00 2001 From: aki Date: Sat, 19 Jul 2008 23:34:33 +0530 Subject: [PATCH] Changed the entire file structure to remove the .c includes from cairo.c --- src/cairo/CairoContext.c | 417 +++++------ src/cairo/CairoContext.h | 698 ++++++++++++++++++ src/cairo/CairoException.c | 8 +- src/cairo/CairoExceptionMacro.h | 31 + src/cairo/CairoFont.c | 182 +++-- src/cairo/CairoFont.h | 92 +++ src/cairo/CairoMatrix.c | 65 +- src/cairo/CairoMatrix.h | 69 ++ src/cairo/CairoPath.c | 54 +- src/cairo/CairoPath.h | 11 + src/cairo/CairoPattern.c | 208 +++--- src/cairo/CairoPattern.h | 132 ++++ src/cairo/CairoSurface.c | 270 ++++--- src/cairo/CairoSurface.h | 269 +++++++ src/cairo/cairo.c | 249 ++++--- src/cairo/config.m4 | 6 +- src/cairo/php_cairo.h | 1502 +++------------------------------------ src/cairo/php_cairo_api.h | 6 +- src/cairo/php_cairo_ce_ptr.h | 42 ++ 19 files changed, 2179 insertions(+), 2132 deletions(-) create mode 100644 src/cairo/CairoContext.h create mode 100644 src/cairo/CairoExceptionMacro.h create mode 100644 src/cairo/CairoFont.h create mode 100644 src/cairo/CairoMatrix.h create mode 100644 src/cairo/CairoPath.h create mode 100644 src/cairo/CairoPattern.h create mode 100644 src/cairo/CairoSurface.h rewrite src/cairo/php_cairo.h (94%) create mode 100644 src/cairo/php_cairo_ce_ptr.h diff --git a/src/cairo/CairoContext.c b/src/cairo/CairoContext.c index 015042c..9bc7ddc 100644 --- a/src/cairo/CairoContext.c +++ b/src/cairo/CairoContext.c @@ -1,6 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoContext.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + /* {{{ Class CairoContext */ -PHP_CAIRO_API static zend_class_entry * CairoContext_ce_ptr = NULL; +//PHP_CAIRO_API static zend_class_entry * CairoContext_ce_ptr = NULL; /* {{{ Methods */ @@ -18,13 +23,13 @@ PHP_METHOD(CairoContext, __construct) } _this_zval = getThis(); - cairo_surface_t *surface; + cairo_surface_t *surface; surface_object *sobj = (surface_object *)zend_object_store_get_object(obj TSRMLS_CC); surface = sobj->surface; - context_object *context=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - context->context=cairo_create(surface); + context_object *context = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context->context = cairo_create(surface); } /* }}} __construct */ @@ -44,7 +49,7 @@ PHP_METHOD(CairoContext, appendPath) } context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - path_object *pobj=(path_object *)zend_objects_get_address(p TSRMLS_CC); + path_object *pobj = (path_object *)zend_objects_get_address(p TSRMLS_CC); cairo_append_path(curr->context,pobj->path); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -71,9 +76,9 @@ PHP_METHOD(CairoContext, arc) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_arc(curr->context,xc,yc,radius,angle1,angle2); - PHP_CAIRO_CONTEXT_ERROR(curr->context) + PHP_CAIRO_CONTEXT_ERROR(curr->context) } /* }}} arc */ @@ -124,7 +129,7 @@ PHP_METHOD(CairoContext, clip) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_clip(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context) } @@ -145,10 +150,10 @@ PHP_METHOD(CairoContext, clipExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_clip_extents(curr->context, &x1, &y1, &x2, &y2); - PHP_CAIRO_CONTEXT_ERROR(curr->context) + PHP_CAIRO_CONTEXT_ERROR(curr->context) array_init(return_value); add_next_index_double(return_value, x1); add_next_index_double(return_value, y1); @@ -174,10 +179,10 @@ PHP_METHOD(CairoContext, clipPreserve) } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_clip_preserve(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context) + PHP_CAIRO_CONTEXT_ERROR(curr->context) } /* }}} clipPreserve */ @@ -196,10 +201,10 @@ PHP_METHOD(CairoContext, closePath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_close_path(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context) + PHP_CAIRO_CONTEXT_ERROR(curr->context) } /* }}} closePath */ @@ -221,7 +226,7 @@ PHP_METHOD(CairoContext, copyClipRectangleList) if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); rlist = cairo_copy_clip_rectangle_list(curr->context); PHP_CAIRO_ERROR(rlist->status) @@ -230,14 +235,11 @@ PHP_METHOD(CairoContext, copyClipRectangleList) array_init(temp_arr); for(i = 0, r = rlist->rectangles; i < rlist->num_rectangles; i++, r++) { - //ALLOC_INIT_ZVAL(temp_arr); - //array_init(temp_arr); add_assoc_double(temp_arr,"x",r->x); add_assoc_double(temp_arr,"y",r->y); add_assoc_double(temp_arr,"width",r->width); add_assoc_double(temp_arr,"height",r->height); add_next_index_zval(return_value,temp_arr); - // zval_ptr_dtor(temp_arr); } @@ -262,9 +264,9 @@ PHP_METHOD(CairoContext, copyPage) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_copy_page(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context) + PHP_CAIRO_CONTEXT_ERROR(curr->context) } /* }}} copyPage */ @@ -284,7 +286,7 @@ PHP_METHOD(CairoContext, copyPath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); object_init_ex(return_value, CairoPath_ce_ptr); path_object *pobj = (path_object *)zend_objects_get_address(return_value TSRMLS_CC); @@ -307,7 +309,7 @@ PHP_METHOD(CairoContext, copyPathFlat) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); object_init_ex(return_value, CairoPath_ce_ptr); path_object *pobj = (path_object *)zend_objects_get_address(return_value TSRMLS_CC); @@ -337,7 +339,7 @@ PHP_METHOD(CairoContext, curveTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_curve_to(curr->context, x1, y1, x2, y2, x3, y3); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -362,7 +364,7 @@ PHP_METHOD(CairoContext, deviceToUser) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_device_to_user(curr->context, &x, &y); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -391,7 +393,7 @@ PHP_METHOD(CairoContext, deviceToUserDistance) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_device_to_user_distance(curr->context, &x, &y); PHP_CAIRO_CONTEXT_ERROR(curr->context) array_init(return_value); @@ -416,7 +418,7 @@ PHP_METHOD(CairoContext, fill) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_fill(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -439,7 +441,7 @@ PHP_METHOD(CairoContext, fillExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_font_extents(curr->context, &e); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -467,7 +469,7 @@ PHP_METHOD(CairoContext, fillPreserve) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_fill_preserve(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -488,7 +490,7 @@ PHP_METHOD(CairoContext, fontExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_font_extents(curr->context, &e); PHP_CAIRO_CONTEXT_ERROR(curr->context) @@ -509,16 +511,14 @@ PHP_METHOD(CairoContext, fontExtents) PHP_METHOD(CairoContext, getAntialias) { zval * _this_zval = NULL; - long temp; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - temp = cairo_get_antialias(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_get_antialias(curr->context)); - RETURN_LONG(temp); } /* }}} getAntialias */ @@ -537,7 +537,7 @@ PHP_METHOD(CairoContext, getCurrentPoint) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_get_current_point(curr->context, &x, &y); array_init(return_value); add_assoc_double(return_value, "x", x); @@ -560,7 +560,7 @@ PHP_METHOD(CairoContext, getDash) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); count = cairo_get_dash_count(curr->context); dashes = emalloc(count* sizeof(double)); if(dashes==NULL) @@ -569,7 +569,7 @@ PHP_METHOD(CairoContext, getDash) MAKE_STD_ZVAL(sub_array); array_init(sub_array); - for(i=0; icontext); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_get_dash_count(curr->context)); - RETURN_LONG(count); } /* }}} getDashCount */ @@ -609,17 +607,15 @@ PHP_METHOD(CairoContext, getFillRule) { zval * _this_zval = NULL; - long fill; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - fill = cairo_get_fill_rule(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_get_fill_rule(curr->context)); - RETURN_LONG(fill); } /* }}} getFillRule */ @@ -636,7 +632,7 @@ PHP_METHOD(CairoContext, getFontFace) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); object_init_ex(return_value, CairoFontFace_ce_ptr); fontface_object *ffobj = (fontface_object *)zend_objects_get_address(return_value TSRMLS_CC); @@ -659,7 +655,7 @@ PHP_METHOD(CairoContext, getFontMatrix) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_get_font_matrix(curr->context, &matrix); object_init_ex(return_value, CairoMatrix_ce_ptr); @@ -683,7 +679,7 @@ PHP_METHOD(CairoContext, getFontOptions) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_get_font_options(curr->context, options); object_init_ex(return_value, CairoFontOptions_ce_ptr); @@ -708,8 +704,8 @@ PHP_METHOD(CairoContext, getGroupTarget) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - sur = cairo_get_group_target(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + sur = cairo_get_group_target(curr->context); ce = get_CairoSurface_ce_ptr(sur); @@ -728,18 +724,16 @@ PHP_METHOD(CairoContext, getLineCap) { zval * _this_zval = NULL; - long line_cap; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - line_cap = cairo_get_line_cap(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_get_line_cap(curr->context)); - RETURN_LONG(line_cap); } /* }}} getLineCap */ @@ -751,17 +745,15 @@ PHP_METHOD(CairoContext, getLineJoin) { zval * _this_zval = NULL; - long line_join; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - line_join = cairo_get_line_join(curr->context); - RETURN_LONG(line_join); + RETURN_LONG(cairo_get_line_join(curr->context)); } /* }}} getLineJoin */ @@ -774,7 +766,6 @@ PHP_METHOD(CairoContext, getLineWidth) zval * _this_zval = NULL; - double width; @@ -782,10 +773,9 @@ PHP_METHOD(CairoContext, getLineWidth) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - width = cairo_get_line_width(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_DOUBLE(cairo_get_line_width(curr->context)); - RETURN_DOUBLE(width); } /* }}} getLineWidth */ @@ -804,7 +794,7 @@ PHP_METHOD(CairoContext, getMatrix) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_get_matrix(curr->context, &matrix); object_init_ex(return_value, CairoMatrix_ce_ptr); @@ -821,17 +811,15 @@ PHP_METHOD(CairoContext, getMiterLimit) { zval * _this_zval = NULL; - double miter; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - miter = cairo_get_miter_limit(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_DOUBLE(cairo_get_miter_limit(curr->context)); - RETURN_DOUBLE(miter); } /* }}} getMiterLimit */ @@ -844,16 +832,14 @@ PHP_METHOD(CairoContext, getOperator) zval * _this_zval = NULL; - long operator; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - operator = cairo_get_operator(curr->context); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_get_operator(curr->context)); - RETURN_LONG(operator); } /* }}} getOperator */ @@ -872,7 +858,7 @@ PHP_METHOD(CairoContext, getScaledFont) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); object_init_ex(return_value, CairoScaledFont_ce_ptr); scaledfont_object *sfobj = (scaledfont_object *)zend_objects_get_address(return_value TSRMLS_CC); @@ -897,9 +883,9 @@ PHP_METHOD(CairoContext, getSource) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - pat = cairo_pattern_reference(cairo_get_source(curr->context)); + pat = cairo_pattern_reference(cairo_get_source(curr->context)); ce = get_CairoPattern_ce_ptr(pat); object_init_ex(return_value, ce); @@ -915,7 +901,7 @@ PHP_METHOD(CairoContext, getSource) */ PHP_METHOD(CairoContext, getTarget) { - zend_class_entry *ce; + zend_class_entry *ce; zval * _this_zval = NULL; cairo_surface_t *sur; @@ -924,9 +910,9 @@ PHP_METHOD(CairoContext, getTarget) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - sur = cairo_surface_reference(cairo_get_target(curr->context)); + sur = cairo_surface_reference(cairo_get_target(curr->context)); ce = get_CairoSurface_ce_ptr(sur); object_init_ex(return_value, ce); @@ -945,17 +931,15 @@ PHP_METHOD(CairoContext, getTolerance) { zval * _this_zval = NULL; - double tolerance; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoContext_ce_ptr) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - tolerance = cairo_get_tolerance(curr->context); - RETURN_DOUBLE(tolerance); + RETURN_DOUBLE(cairo_get_tolerance(curr->context)); } /* }}} getTolerance */ @@ -969,7 +953,7 @@ PHP_METHOD(CairoContext, glyphExtents) zval * _this_zval = NULL, **ppzval; zval * obj = NULL; long num = -1; - cairo_glyph_t **glyphs=NULL , **glyph; + cairo_glyph_t **glyphs = NULL , **glyph; HashTable *obj_hash = NULL; cairo_text_extents_t extents; @@ -979,11 +963,11 @@ PHP_METHOD(CairoContext, glyphExtents) obj_hash = HASH_OF(obj); glyphs = emalloc(num*sizeof(cairo_glyph_t)); - for(i=0 , glyph=glyphs; icontext, glyphs, num, &extents); @@ -1009,7 +993,7 @@ PHP_METHOD(CairoContext, glyphPath) zval * _this_zval = NULL; zval * obh = NULL; long num = 0; - cairo_glyph_t *glyphs=NULL , *glyph; + cairo_glyph_t *glyphs = NULL , *glyph; HashTable *obj_hash = NULL; cairo_text_extents_t extents; @@ -1017,14 +1001,14 @@ PHP_METHOD(CairoContext, glyphPath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); obj_hash = HASH_OF(obh); - glyphs = emalloc(num*sizeof(cairo_glyph_t)); - for(i=0 , glyph=glyphs; icontext, glyphs, num); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1046,7 +1030,7 @@ PHP_METHOD(CairoContext, hasCurrentPoint) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); do { @@ -1070,7 +1054,7 @@ PHP_METHOD(CairoContext, identityMatrix) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_identity_matrix(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1088,22 +1072,22 @@ PHP_METHOD(CairoContext, inFill) zval * _this_zval = NULL; double x = 0.0; double y = 0.0; - int result; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoContext_ce_ptr, &x, &y) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - result = cairo_in_fill(curr->context, x, y); + RETURN_BOOL(cairo_in_fill(curr->context, x, y)); + /* if(result) - zval_bool(return_value,1); + RETURN_TRUE; else - zval_bool(return_value,0); - + RETURN_FALSE; +*/ } /* }}} inFill */ @@ -1118,22 +1102,21 @@ PHP_METHOD(CairoContext, inStroke) zval * _this_zval = NULL; double x = 0.0; double y = 0.0; - int result; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Odd", &_this_zval, CairoContext_ce_ptr, &x, &y) == FAILURE) { return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - result = cairo_in_stroke(curr->context, x, y); - + RETURN_BOOL(cairo_in_stroke(curr->context, x, y)); + /* if(result) zval_bool(return_value,1); else zval_bool(return_value,0); - +*/ } /* }}} inStroke */ @@ -1154,7 +1137,7 @@ PHP_METHOD(CairoContext, lineTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_line_to(curr->context, x, y); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1178,7 +1161,7 @@ PHP_METHOD(CairoContext, mask) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); pattern_object *ptobj = (pattern_object *)zend_objects_get_address(p TSRMLS_CC); cairo_mask(curr->context, ptobj->pattern); @@ -1205,8 +1188,8 @@ PHP_METHOD(CairoContext, maskSurface) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - surface_object *sobj=(surface_object *)zend_objects_get_address(s TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *sobj = (surface_object *)zend_objects_get_address(s TSRMLS_CC); cairo_mask_surface(curr->context, sobj->surface, surface_x, surface_y); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1231,7 +1214,7 @@ PHP_METHOD(CairoContext, moveTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_move_to(curr->context, x, y); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1254,7 +1237,7 @@ PHP_METHOD(CairoContext, newPath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_new_path(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1276,7 +1259,7 @@ PHP_METHOD(CairoContext, newSubPath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_new_sub_path(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1298,7 +1281,7 @@ PHP_METHOD(CairoContext, paint) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_paint(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1322,7 +1305,7 @@ PHP_METHOD(CairoContext, paintWithAlpha) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_paint_with_alpha(curr->context, alpha); @@ -1345,7 +1328,7 @@ PHP_METHOD(CairoContext, pathExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); array_init(return_value); @@ -1362,7 +1345,7 @@ PHP_METHOD(CairoContext, pathExtents) */ PHP_METHOD(CairoContext, popGroup) { - zend_class_entry *ce; + zend_class_entry *ce; zval * _this_zval = NULL; cairo_pattern_t *pat; @@ -1371,12 +1354,12 @@ PHP_METHOD(CairoContext, popGroup) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - pat = cairo_pop_group(curr->context); + pat = cairo_pop_group(curr->context); ce = get_CairoPattern_ce_ptr(pat); object_init_ex(return_value, ce); - pattern_object *ptobj=(pattern_object *)zend_objects_get_address(return_value TSRMLS_CC); + pattern_object *ptobj = (pattern_object *)zend_objects_get_address(return_value TSRMLS_CC); ptobj->pattern = pat; } @@ -1397,7 +1380,7 @@ PHP_METHOD(CairoContext, popGroupToSource) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pop_group_to_source(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1420,7 +1403,7 @@ PHP_METHOD(CairoContext, pushGroup) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_push_group(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1444,7 +1427,7 @@ PHP_METHOD(CairoContext, pushGroupWithContent) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_push_group_with_content(curr->context, content); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1470,7 +1453,7 @@ PHP_METHOD(CairoContext, rectangle) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_rectangle(curr->context, x, y, width, height); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1499,7 +1482,7 @@ PHP_METHOD(CairoContext, relCurveTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_rel_curve_to(curr->context, x1, y1, x2, y2, x3, y3); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1523,9 +1506,9 @@ PHP_METHOD(CairoContext, relLineTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_rel_line_to(curr->context, x, y); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} relLineTo */ @@ -1547,7 +1530,7 @@ PHP_METHOD(CairoContext, relMoveTo) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_rel_move_to(curr->context, x, y); PHP_CAIRO_CONTEXT_ERROR(curr->context); } @@ -1568,7 +1551,7 @@ PHP_METHOD(CairoContext, resetClip) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_reset_clip(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1591,10 +1574,10 @@ PHP_METHOD(CairoContext, restore) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_restore(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } @@ -1616,9 +1599,9 @@ PHP_METHOD(CairoContext, rotate) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_rotate(curr->context, angle); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} rotate */ @@ -1638,10 +1621,10 @@ PHP_METHOD(CairoContext, save) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_save(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} save */ @@ -1663,9 +1646,9 @@ PHP_METHOD(CairoContext, scale) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - cairo_scale(curr->context, x, y); + cairo_scale(curr->context, x, y); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1691,9 +1674,9 @@ PHP_METHOD(CairoContext, selectFontFace) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_select_font_face(curr->context, family, slant, weight); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} selectFontFace */ @@ -1714,9 +1697,9 @@ PHP_METHOD(CairoContext, setAntialias) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_antialias(curr->context, antialias); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setAntialias */ @@ -1741,15 +1724,15 @@ PHP_METHOD(CairoContext, setDash) } dashes_hash = Z_ARRVAL_P(dashes); das = emalloc(num_dashes * sizeof(double)); - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); i = zend_hash_num_elements(dashes_hash); if(i!=num_dashes) printf("Problem !!!"); i=0; for(zend_hash_internal_pointer_reset(dashes_hash); zend_hash_has_more_elements(dashes_hash) == SUCCESS; zend_hash_move_forward(dashes_hash)) { if (zend_hash_get_current_data(dashes_hash, (void **)&ppzval) == FAILURE) { - continue; - } + continue; + } das[i++] = Z_DVAL_PP(ppzval); @@ -1778,7 +1761,7 @@ PHP_METHOD(CairoContext, setFillRule) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_fill_rule(curr->context, fill_rule); PHP_CAIRO_CONTEXT_ERROR(curr->context); } @@ -1800,7 +1783,7 @@ PHP_METHOD(CairoContext, setFontFace) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); if (obj != NULL) { fontface_object *ffobj = (fontface_object *)zend_objects_get_address(obj TSRMLS_CC); cairo_set_font_face(curr->context, ffobj->fontface); @@ -1829,8 +1812,8 @@ PHP_METHOD(CairoContext, setFontMatrix) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - matrix_object *mobj=(matrix_object *)zend_objects_get_address(matrix TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *mobj = (matrix_object *)zend_objects_get_address(matrix TSRMLS_CC); cairo_set_font_matrix(curr->context, &mobj->matrix); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1853,10 +1836,10 @@ PHP_METHOD(CairoContext, setFontOptions) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - fontoptions_object *foobj=(fontoptions_object *)zend_objects_get_address(options TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *foobj = (fontoptions_object *)zend_objects_get_address(options TSRMLS_CC); cairo_set_font_options(curr->context, foobj->fontoptions); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } @@ -1878,9 +1861,9 @@ PHP_METHOD(CairoContext, setFontSize) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_font_size(curr->context, size); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setFontSize */ @@ -1901,9 +1884,9 @@ PHP_METHOD(CairoContext, setLineCap) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_line_cap(curr->context, line_cap); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -1926,10 +1909,10 @@ PHP_METHOD(CairoContext, setLineJoin) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_line_join(curr->context, line_join); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setLineJoin */ @@ -1971,10 +1954,10 @@ PHP_METHOD(CairoContext, setMatrix) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - matrix_object *mobj=(matrix_object *)zend_objects_get_address(matix TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *mobj = (matrix_object *)zend_objects_get_address(matix TSRMLS_CC); cairo_set_matrix(curr->context, &mobj->matrix); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setMatrix */ @@ -1995,9 +1978,9 @@ PHP_METHOD(CairoContext, setMiterLimit) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_miter_limit(curr->context, limit); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setMiterLimit */ @@ -2018,9 +2001,9 @@ PHP_METHOD(CairoContext, setOperator) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_operator(curr->context, op); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setOperator */ @@ -2041,10 +2024,10 @@ PHP_METHOD(CairoContext, setSource) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - pattern_object *ptobj=(pattern_object *)zend_objects_get_address(p TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *ptobj = (pattern_object *)zend_objects_get_address(p TSRMLS_CC); cairo_set_source(curr->context, ptobj->pattern); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setSource */ @@ -2067,9 +2050,9 @@ PHP_METHOD(CairoContext, setSourceRgb) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_source_rgb(curr->context, red, green, blue); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setSourceRgb */ @@ -2093,9 +2076,9 @@ PHP_METHOD(CairoContext, setSourceRgba) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_source_rgba(curr->context, red, green, blue, alpha); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setSourceRgba */ @@ -2118,10 +2101,10 @@ PHP_METHOD(CairoContext, setSourceSurface) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - surface_object *sobj=(surface_object *)zend_objects_get_address(surface TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *sobj = (surface_object *)zend_objects_get_address(surface TSRMLS_CC); cairo_set_source_surface(curr->context, sobj->surface, x, y); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setSourceSurface */ @@ -2142,9 +2125,9 @@ PHP_METHOD(CairoContext, setTolerance) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_set_tolerance(curr->context, tolerance); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} setTolerance */ @@ -2168,24 +2151,18 @@ PHP_METHOD(CairoContext, showGlyphs) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - obj_hash = HASH_OF(obj); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + obj_hash = HASH_OF(obj); glyphs = emalloc(num_glyphs*sizeof(cairo_glyph_t)); i=0; - for(zend_hash_internal_pointer_reset(obj_hash); zend_hash_has_more_elements(obj_hash) == SUCCESS; zend_hash_move_forward(obj_hash)) { - if (zend_hash_get_current_data(obj_hash, (void **)&ppzval) == FAILURE) { - continue; - } -// glyphs[i++] = Z_RESVAL_PP(ppzval); - } + for(zend_hash_internal_pointer_reset(obj_hash); zend_hash_has_more_elements(obj_hash) == SUCCESS; zend_hash_move_forward(obj_hash)) { + if (zend_hash_get_current_data(obj_hash, (void **)&ppzval) == FAILURE) { + continue; + } + } -/* for(i=0 , glyph=glyphs; icontext, glyphs, num_glyphs); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -2207,9 +2184,9 @@ PHP_METHOD(CairoContext, showPage) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_show_page(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} showPage */ @@ -2231,9 +2208,9 @@ PHP_METHOD(CairoContext, showText) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_show_text(curr->context, obj); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} showText */ @@ -2255,7 +2232,7 @@ PHP_METHOD(CairoContext, stroke) context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_stroke(curr->context); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } @@ -2269,7 +2246,7 @@ PHP_METHOD(CairoContext, strokeExtents) { zval * _this_zval = NULL; - double x1=0, x2=0, y1=0, y2=0; + double x1 = 0, x2 = 0, y1 = 0, y2 = 0; @@ -2277,7 +2254,7 @@ PHP_METHOD(CairoContext, strokeExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_stroke_extents(curr->context, &x1, &y1, &x2, &y2); array_init(return_value); @@ -2304,7 +2281,7 @@ PHP_METHOD(CairoContext, strokePreserve) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_stroke_preserve(curr->context); PHP_CAIRO_CONTEXT_ERROR(curr->context); @@ -2320,7 +2297,7 @@ PHP_METHOD(CairoContext, textExtents) zval * _this_zval = NULL; const char * str = NULL; - long str_len=0; + long str_len = 0; cairo_text_extents_t extents; @@ -2328,7 +2305,7 @@ PHP_METHOD(CairoContext, textExtents) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_text_extents(curr->context, str, &extents); @@ -2360,9 +2337,9 @@ PHP_METHOD(CairoContext, textPath) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_text_path(curr->context, obj); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} textPath */ @@ -2383,10 +2360,10 @@ PHP_METHOD(CairoContext, transform) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); matrix_object *mobj = (matrix_object *)zend_objects_get_address(matrix TSRMLS_CC); cairo_transform(curr->context, &mobj->matrix); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} transform */ @@ -2408,10 +2385,10 @@ PHP_METHOD(CairoContext, translate) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_translate(curr->context, tx, ty); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); } /* }}} translate */ @@ -2433,10 +2410,10 @@ PHP_METHOD(CairoContext, userToDevice) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_user_to_device(curr->context, &x, &y); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); array_init(return_value); add_assoc_double(return_value, "x", x); @@ -2462,9 +2439,9 @@ PHP_METHOD(CairoContext, userToDeviceDistance) return; } - context_object *curr=(context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + context_object *curr = (context_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_user_to_device_distance(curr->context, &dx, &dy); - PHP_CAIRO_CONTEXT_ERROR(curr->context); + PHP_CAIRO_CONTEXT_ERROR(curr->context); array_init(return_value); add_assoc_double(return_value, "x", dx); @@ -2588,7 +2565,7 @@ typedef struct _context_object { static void CairoContext_object_dtor(void *object) { - context_object *context = (context_object *)object; + context_object *context = (context_object *)object; zend_hash_destroy(context->std.properties); FREE_HASHTABLE(context->std.properties); @@ -2604,27 +2581,27 @@ static zend_object_value CairoContext_object_new(zend_class_entry *ce) context_object *context; zval *temp; - context=emalloc(sizeof(context_object)); + context = emalloc(sizeof(context_object)); memset(context,0,sizeof(context_object)); context->std.ce = ce; - ALLOC_HASHTABLE(context->std.properties); - zend_hash_init(context->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(context->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(context, NULL, (zend_objects_free_object_storage_t)CairoContext_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoContext_handlers; - return retval; + ALLOC_HASHTABLE(context->std.properties); + zend_hash_init(context->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(context->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(context, NULL, (zend_objects_free_object_storage_t)CairoContext_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoContext_handlers; + return retval; } -static void class_init_CairoContext(void) +void class_init_CairoContext(void) { zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "CairoContext", CairoContext_methods); - CairoContext_ce_ptr = zend_register_internal_class(&ce); - CairoContext_ce_ptr->create_object = CairoContext_object_new; - memcpy(&CairoContext_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - CairoContext_handlers.clone_obj=NULL; + INIT_CLASS_ENTRY(ce, "CairoContext", CairoContext_methods); + CairoContext_ce_ptr = zend_register_internal_class(&ce); + CairoContext_ce_ptr->create_object = CairoContext_object_new; + memcpy(&CairoContext_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + CairoContext_handlers.clone_obj = NULL; } /* }}} Class CairoContext */ diff --git a/src/cairo/CairoContext.h b/src/cairo/CairoContext.h new file mode 100644 index 0000000..48f1391 --- /dev/null +++ b/src/cairo/CairoContext.h @@ -0,0 +1,698 @@ + +PHP_METHOD(CairoContext, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_OBJ_INFO(0, obj, CairoSurface, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, appendPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__append_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, p, CairoPath, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, arc); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__arc_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) + ZEND_ARG_INFO(0, xc) + ZEND_ARG_INFO(0, yc) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, angle1) + ZEND_ARG_INFO(0, angle2) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, arcNegative); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__arc_negative_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) + ZEND_ARG_INFO(0, xc) + ZEND_ARG_INFO(0, yc) + ZEND_ARG_INFO(0, radius) + ZEND_ARG_INFO(0, angle1) + ZEND_ARG_INFO(0, angle2) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, clip); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, clipExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, clipPreserve); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, closePath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__close_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, copyClipRectangleList); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_clip_rectangle_list_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, copyPage); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_page_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, copyPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, copyPathFlat); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_path_flat_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, curveTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__curve_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_ARG_INFO(0, x3) + ZEND_ARG_INFO(0, y3) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, deviceToUser); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__device_to_user_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, deviceToUserDistance); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__device_to_user_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, fill); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, fillExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, fillPreserve); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, fontExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__font_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getAntialias); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getCurrentPoint); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_current_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getDash); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_dash_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getDashCount); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_dash_count_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getFillRule); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_fill_rule_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getFontFace); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getFontMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getFontOptions); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getGroupTarget); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_group_target_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getLineCap); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_cap_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getLineJoin); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_join_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getLineWidth); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getMiterLimit); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_miter_limit_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getOperator); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_operator_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getScaledFont); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_scaled_font_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getSource); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getTarget); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_target_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, getTolerance); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_tolerance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, glyphExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__glyph_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +#if (PHP_MINOR_VERSION > 0) + ZEND_ARG_ARRAY_INFO(0, obj, 1) +#else + ZEND_ARG_INFO(0, obj) +#endif + ZEND_ARG_INFO(0, num) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, glyphPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__glyph_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +#if (PHP_MINOR_VERSION > 0) + ZEND_ARG_ARRAY_INFO(0, obh, 1) +#else + ZEND_ARG_INFO(0, obh); +#endif + ZEND_ARG_INFO(0, num) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, hasCurrentPoint); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__has_current_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, identityMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__identity_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, inFill); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__in_fill_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, inStroke); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__in_stroke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, lineTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__line_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, mask); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__mask_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, p, CairoPattern, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, maskSurface); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__mask_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, s, CairoSurface, 1) + ZEND_ARG_INFO(0, surface_x) + ZEND_ARG_INFO(0, surface_y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, moveTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__move_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, newPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__new_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, newSubPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__new_sub_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, paint); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__paint_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, paintWithAlpha); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__paint_with_alpha_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, alpha) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, pathExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__path_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_OBJ_INFO(0, path, CairoPath, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, popGroup); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__pop_group_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, popGroupToSource); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__pop_group_to_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, pushGroup); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__push_group_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, pushGroupWithContent); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__push_group_with_content_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, content) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, rectangle); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__rectangle_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, relCurveTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_curve_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) + ZEND_ARG_INFO(0, x2) + ZEND_ARG_INFO(0, y2) + ZEND_ARG_INFO(0, x3) + ZEND_ARG_INFO(0, y3) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, relLineTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_line_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, relMoveTo); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_move_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, resetClip); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__reset_clip_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, restore); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__restore_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, rotate); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, angle) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, save); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__save_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, scale); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__scale_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, selectFontFace); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__select_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, family) + ZEND_ARG_INFO(0, slant) + ZEND_ARG_INFO(0, weight) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setAntialias); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, antialias) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setDash); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_dash_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +#if (PHP_MINOR_VERSION > 0) + ZEND_ARG_ARRAY_INFO(0, dashes, 1) +#else + ZEND_ARG_INFO(0, dashes) +#endif + ZEND_ARG_INFO(0, num_dashes) + ZEND_ARG_INFO(0, offset) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setFillRule); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_fill_rule_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, fill_rule) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setFontFace); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_OBJ_INFO(0, obj, CairoFontFace, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setFontMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, matrix, CairoMatrix, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setFontOptions); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, options, CairoFontOptions, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setFontSize); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, size) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setLineCap); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_cap_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, line_cap) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setLineJoin); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_join_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, line_join) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setLineWidth); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, width) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, matix, CairoMatrix, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setMiterLimit); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_miter_limit_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, limit) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setOperator); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_operator_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, op) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setSource); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_OBJ_INFO(0, p, CairoPattern, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setSourceRgb); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_rgb_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, red) + ZEND_ARG_INFO(0, green) + ZEND_ARG_INFO(0, blue) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setSourceRgba); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, red) + ZEND_ARG_INFO(0, green) + ZEND_ARG_INFO(0, blue) + ZEND_ARG_INFO(0, alpha) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setSourceSurface); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, surface, CairoSurface, 1) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, setTolerance); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_tolerance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, tolerance) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, showGlyphs); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_glyphs_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) +#if (PHP_MINOR_VERSION > 0) + ZEND_ARG_ARRAY_INFO(0, obj, 1) +#else + ZEND_ARG_INFO(0, obj) +#endif + ZEND_ARG_INFO(0, num_glyphs) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, showPage); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_page_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, showText); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_text_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, obj) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, stroke); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, strokeExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, strokePreserve); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, textExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__text_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, textPath); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__text_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, obj) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, transform); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__transform_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, matrix, CairoMatrix, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, translate); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__translate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, tx) + ZEND_ARG_INFO(0, ty) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, userToDevice); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__user_to_device_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoContext, userToDeviceDistance); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoContext__user_to_device_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, dx) + ZEND_ARG_INFO(0, dy) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/CairoException.c b/src/cairo/CairoException.c index 1b74ad4..9f873c0 100644 --- a/src/cairo/CairoException.c +++ b/src/cairo/CairoException.c @@ -1,6 +1,10 @@ +#include "php_cairo_api.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + /* {{{ Class CairoException */ -static zend_class_entry * CairoException_ce_ptr = NULL; +//static zend_class_entry * CairoException_ce_ptr = NULL; /* {{{ Methods */ @@ -10,7 +14,7 @@ static zend_function_entry CairoException_methods[] = { /* }}} Methods */ -static void class_init_CairoException(void) +void class_init_CairoException(void) { zend_class_entry ce; diff --git a/src/cairo/CairoExceptionMacro.h b/src/cairo/CairoExceptionMacro.h new file mode 100644 index 0000000..9a80689 --- /dev/null +++ b/src/cairo/CairoExceptionMacro.h @@ -0,0 +1,31 @@ +#define PHP_CAIRO_ERROR(status) \ + if (status != CAIRO_STATUS_SUCCESS) { \ + phpCairoCheckStatus(status); \ + return; \ + } + +#define PHP_CAIRO_CONTEXT_ERROR(context) \ + cairo_status_t status = cairo_status (context); \ + PHP_CAIRO_ERROR(status) + +#define PHP_CAIRO_PATTERN_ERROR(pattern) \ + cairo_status_t status = cairo_pattern_status(pattern); \ + PHP_CAIRO_ERROR(status) + +#define PHP_CAIRO_SURFACE_ERROR(surface) \ + cairo_status_t status = cairo_surface_status(surface); \ + PHP_CAIRO_ERROR(status) + +#define PHP_CAIRO_SCALEDFONT_ERROR(sc_font) \ + cairo_status_t status = cairo_scaled_font_status(sc_font); \ + PHP_CAIRO_ERROR(status) + +#define PHP_CAIRO_FONTOPTIONS_ERROR(font_opt) \ + cairo_status_t status = cairo_font_options_status(font_opt); \ + PHP_CAIRO_ERROR(status) + + + + + + diff --git a/src/cairo/CairoFont.c b/src/cairo/CairoFont.c index 9e61b3f..6b6b202 100644 --- a/src/cairo/CairoFont.c +++ b/src/cairo/CairoFont.c @@ -1,7 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoFont.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" /* {{{ Class CairoFontFace */ -static zend_class_entry * CairoFontFace_ce_ptr = NULL; +//static zend_class_entry * CairoFontFace_ce_ptr = NULL; /* {{{ Methods */ @@ -14,7 +18,7 @@ PHP_METHOD(CairoFontFace, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } @@ -39,34 +43,34 @@ static zend_object_handlers CairoFontFace_handlers; static void CairoFontFace_object_dtor(void *object) { - fontface_object *fontface = (fontface_object *)object; - zend_hash_destroy(fontface->std.properties); - FREE_HASHTABLE(fontface->std.properties); - - if(fontface->fontface){ - cairo_font_face_destroy(fontface->fontface); - } - efree(object); -} + fontface_object *fontface = (fontface_object *)object; + zend_hash_destroy(fontface->std.properties); + FREE_HASHTABLE(fontface->std.properties); + + if(fontface->fontface){ + cairo_font_face_destroy(fontface->fontface); + } + efree(object); +} static zend_object_value CairoFontFace_object_new(zend_class_entry *ce) { - zend_object_value retval; - fontface_object *fontface; - zval *temp; - fontface = emalloc(sizeof(fontface_object)); - memset(fontface,0,sizeof(fontface_object)); - fontface->std.ce = ce; - ALLOC_HASHTABLE(fontface->std.properties); - zend_hash_init(fontface->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(fontface->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(fontface, NULL, (zend_objects_free_object_storage_t)CairoFontFace_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoFontFace_handlers; - return retval; + zend_object_value retval; + fontface_object *fontface; + zval *temp; + fontface = emalloc(sizeof(fontface_object)); + memset(fontface,0,sizeof(fontface_object)); + fontface->std.ce = ce; + ALLOC_HASHTABLE(fontface->std.properties); + zend_hash_init(fontface->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(fontface->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(fontface, NULL, (zend_objects_free_object_storage_t)CairoFontFace_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoFontFace_handlers; + return retval; } -static void class_init_CairoFontFace(void) +void class_init_CairoFontFace(void) { zend_class_entry ce; @@ -82,7 +86,7 @@ static void class_init_CairoFontFace(void) /* {{{ Class CairoFontOptions */ -static zend_class_entry * CairoFontOptions_ce_ptr = NULL; +//istatic zend_class_entry * CairoFontOptions_ce_ptr = NULL; /* {{{ Methods */ @@ -95,7 +99,7 @@ PHP_METHOD(CairoFontOptions, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } _this_zval = getThis(); @@ -113,17 +117,15 @@ PHP_METHOD(CairoFontOptions, getAntialias) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoFontOptions_ce_ptr) == FAILURE) { return; } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_font_options_get_antialias(curr->fontoptions); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_font_options_get_antialias(curr->fontoptions)); - RETURN_LONG(x); } /* }}} getAntialias */ @@ -135,7 +137,6 @@ PHP_METHOD(CairoFontOptions, getHintMetrics) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoFontOptions_ce_ptr) == FAILURE) { @@ -143,10 +144,9 @@ PHP_METHOD(CairoFontOptions, getHintMetrics) } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_font_options_get_hint_metrics(curr->fontoptions); - RETURN_LONG(x); + RETURN_LONG(cairo_font_options_get_hint_metrics(curr->fontoptions)); } /* }}} getHintMetrics */ @@ -158,17 +158,15 @@ PHP_METHOD(CairoFontOptions, getHintStyle) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoFontOptions_ce_ptr) == FAILURE) { return; } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_font_options_get_hint_style(curr->fontoptions); - RETURN_LONG(x); + RETURN_LONG(cairo_font_options_get_hint_style(curr->fontoptions)); } /* }}} getHintStyle */ @@ -180,17 +178,15 @@ PHP_METHOD(CairoFontOptions, getSubpixelOrder) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoFontOptions_ce_ptr) == FAILURE) { return; } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_font_options_get_subpixel_order(curr->fontoptions); - RETURN_LONG(x); + RETURN_LONG(cairo_font_options_get_subpixel_order(curr->fontoptions)); } /* }}} getSubpixelOrder */ @@ -210,7 +206,7 @@ PHP_METHOD(CairoFontOptions, setAntialias) return; } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_font_options_set_antialias(curr->fontoptions, aa); PHP_CAIRO_FONTOPTIONS_ERROR(curr->fontoptions); @@ -234,7 +230,7 @@ PHP_METHOD(CairoFontOptions, setHintMetrics) } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_font_options_set_hint_metrics(curr->fontoptions, hm); PHP_CAIRO_FONTOPTIONS_ERROR(curr->fontoptions); @@ -280,7 +276,7 @@ PHP_METHOD(CairoFontOptions, setSubpixelOrder) return; } - fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + fontoptions_object *curr = (fontoptions_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_font_options_set_subpixel_order(curr->fontoptions, so); PHP_CAIRO_FONTOPTIONS_ERROR(curr->fontoptions); @@ -308,34 +304,34 @@ static zend_object_handlers CairoFontOptions_handlers; static void CairoFontOptions_object_dtor(void *object) { - fontoptions_object *fontoptions = (fontoptions_object *)object; - zend_hash_destroy(fontoptions->std.properties); - FREE_HASHTABLE(fontoptions->std.properties); - - if(fontoptions->fontoptions){ - cairo_font_options_destroy(fontoptions->fontoptions); - } - efree(object); -} + fontoptions_object *fontoptions = (fontoptions_object *)object; + zend_hash_destroy(fontoptions->std.properties); + FREE_HASHTABLE(fontoptions->std.properties); + + if(fontoptions->fontoptions){ + cairo_font_options_destroy(fontoptions->fontoptions); + } + efree(object); +} static zend_object_value CairoFontOptions_object_new(zend_class_entry *ce) { - zend_object_value retval; - fontoptions_object *fontoptions; - zval *temp; - fontoptions=emalloc(sizeof(fontoptions_object)); - memset(fontoptions,0,sizeof(fontoptions_object)); - fontoptions->std.ce = ce; - ALLOC_HASHTABLE(fontoptions->std.properties); - zend_hash_init(fontoptions->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(fontoptions->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(fontoptions, NULL, (zend_objects_free_object_storage_t)CairoFontOptions_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoFontOptions_handlers; - return retval; + zend_object_value retval; + fontoptions_object *fontoptions; + zval *temp; + fontoptions = emalloc(sizeof(fontoptions_object)); + memset(fontoptions,0,sizeof(fontoptions_object)); + fontoptions->std.ce = ce; + ALLOC_HASHTABLE(fontoptions->std.properties); + zend_hash_init(fontoptions->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(fontoptions->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(fontoptions, NULL, (zend_objects_free_object_storage_t)CairoFontOptions_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoFontOptions_handlers; + return retval; } -static void class_init_CairoFontOptions(void) +void class_init_CairoFontOptions(void) { zend_class_entry ce; @@ -351,7 +347,7 @@ static void class_init_CairoFontOptions(void) /* {{{ Class CairoScaledFont */ -static zend_class_entry * CairoScaledFont_ce_ptr = NULL; +//static zend_class_entry * CairoScaledFont_ce_ptr = NULL; /* {{{ Methods */ @@ -399,7 +395,7 @@ PHP_METHOD(CairoScaledFont, extents) return; } - scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_scaled_font_extents(curr->scaledfont, &e); PHP_CAIRO_SCALEDFONT_ERROR(curr->scaledfont); @@ -428,7 +424,7 @@ PHP_METHOD(CairoScaledFont, getFontFace) return; } - scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); object_init_ex(return_value, CairoFontFace_ce_ptr); fontface_object *ffobj = (fontface_object *)zend_objects_get_address(return_value); @@ -455,7 +451,7 @@ PHP_METHOD(CairoScaledFont, textExtents) return; } - scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + scaledfont_object *curr = (scaledfont_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_scaled_font_text_extents(curr->scaledfont, str, &extents); PHP_CAIRO_SCALEDFONT_ERROR(curr->scaledfont); @@ -487,34 +483,34 @@ static zend_object_handlers CairoScaledFont_handlers; static void CairoScaledFont_object_dtor(void *object) { - scaledfont_object *scaledfont = (scaledfont_object *)object; - zend_hash_destroy(scaledfont->std.properties); - FREE_HASHTABLE(scaledfont->std.properties); - - if(scaledfont->scaledfont){ - cairo_scaled_font_destroy(scaledfont->scaledfont); - } - efree(object); -} + scaledfont_object *scaledfont = (scaledfont_object *)object; + zend_hash_destroy(scaledfont->std.properties); + FREE_HASHTABLE(scaledfont->std.properties); + + if(scaledfont->scaledfont){ + cairo_scaled_font_destroy(scaledfont->scaledfont); + } + efree(object); +} static zend_object_value CairoScaledFont_object_new(zend_class_entry *ce) { - zend_object_value retval; - scaledfont_object *scaledfont; - zval *temp; - scaledfont=emalloc(sizeof(scaledfont_object)); - memset(scaledfont,0,sizeof(scaledfont_object)); - scaledfont->std.ce = ce; - ALLOC_HASHTABLE(scaledfont->std.properties); - zend_hash_init(scaledfont->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(scaledfont->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(scaledfont, NULL, (zend_objects_free_object_storage_t)CairoScaledFont_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoScaledFont_handlers; - return retval; + zend_object_value retval; + scaledfont_object *scaledfont; + zval *temp; + scaledfont = emalloc(sizeof(scaledfont_object)); + memset(scaledfont,0,sizeof(scaledfont_object)); + scaledfont->std.ce = ce; + ALLOC_HASHTABLE(scaledfont->std.properties); + zend_hash_init(scaledfont->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(scaledfont->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(scaledfont, NULL, (zend_objects_free_object_storage_t)CairoScaledFont_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoScaledFont_handlers; + return retval; } -static void class_init_CairoScaledFont(void) +void class_init_CairoScaledFont(void) { zend_class_entry ce; diff --git a/src/cairo/CairoFont.h b/src/cairo/CairoFont.h new file mode 100644 index 0000000..cb6113e --- /dev/null +++ b/src/cairo/CairoFont.h @@ -0,0 +1,92 @@ + +PHP_METHOD(CairoFontFace, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontFace____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, getAntialias); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, getHintMetrics); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_hint_metrics_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, getHintStyle); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_hint_style_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, getSubpixelOrder); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_subpixel_order_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, setAntialias); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, aa) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, setHintMetrics); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_hint_metrics_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, hm) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, setHintStyle); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_hint_style_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, hs) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoFontOptions, setSubpixelOrder); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_subpixel_order_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, so) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoScaledFont, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_OBJ_INFO(0, mx1, CairoMatrix, 1) + ZEND_ARG_OBJ_INFO(0, mx2, CairoMatrix, 1) + ZEND_ARG_OBJ_INFO(0, fo, CairoFontOptions, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoScaledFont, extents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoScaledFont, getFontFace); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__get_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoScaledFont, textExtents); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__text_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, str) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/CairoMatrix.c b/src/cairo/CairoMatrix.c index f2f0bbf..0024af3 100644 --- a/src/cairo/CairoMatrix.c +++ b/src/cairo/CairoMatrix.c @@ -1,6 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoMatrix.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + /* {{{ Class CairoMatrix */ -static zend_class_entry * CairoMatrix_ce_ptr = NULL; +//static zend_class_entry * CairoMatrix_ce_ptr = NULL; /* {{{ Methods */ @@ -48,10 +53,10 @@ PHP_METHOD(CairoMatrix, initRotate) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_init_rotate(&matrix, radians); object_init_ex(return_value, CairoMatrix_ce_ptr); - matrix_object *mobj = (matrix_object *)zend_objects_get_address(return_value TSRMLS_CC); + matrix_object *mobj = (matrix_object *)zend_objects_get_address(return_value TSRMLS_CC); mobj->matrix = matrix; } /* }}} initRotate */ @@ -94,11 +99,11 @@ PHP_METHOD(CairoMatrix, multiply) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - matrix_object *mobj = (matrix_object *)zend_objects_get_address(o2 TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *mobj = (matrix_object *)zend_objects_get_address(o2 TSRMLS_CC); cairo_matrix_multiply(&result, &curr->matrix, &mobj->matrix); object_init_ex(return_value, CairoMatrix_ce_ptr); - matrix_object *mret = (matrix_object *)zend_objects_get_address(return_value TSRMLS_CC); + matrix_object *mret = (matrix_object *)zend_objects_get_address(return_value TSRMLS_CC); mret->matrix = result; } /* }}} multiply */ @@ -119,7 +124,7 @@ PHP_METHOD(CairoMatrix, rotate) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_rotate(&curr->matrix, radians); } @@ -142,7 +147,7 @@ PHP_METHOD(CairoMatrix, scale) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_scale(&curr->matrix, sx, xy); } @@ -165,7 +170,7 @@ PHP_METHOD(CairoMatrix, transformDistance) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_transform_distance(&curr->matrix, &dx, &dy); array_init(return_value); @@ -193,7 +198,7 @@ PHP_METHOD(CairoMatrix, transformPoint) } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_transform_point(&curr->matrix, &x, &y); array_init(return_value); add_assoc_double(return_value, "x", x); @@ -219,7 +224,7 @@ PHP_METHOD(CairoMatrix, translate) return; } - matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + matrix_object *curr = (matrix_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_matrix_translate(&curr->matrix, tx, ty); } @@ -245,39 +250,39 @@ static zend_object_handlers CairoMatrix_handlers; static void CairoMatrix_object_dtor(void *object) { - matrix_object *matrix = (matrix_object *)object; - zend_hash_destroy(matrix->std.properties); - FREE_HASHTABLE(matrix->std.properties); - efree(object); + matrix_object *matrix = (matrix_object *)object; + zend_hash_destroy(matrix->std.properties); + FREE_HASHTABLE(matrix->std.properties); + efree(object); } static zend_object_value CairoMatrix_object_new(zend_class_entry *ce) { - zend_object_value retval; - matrix_object *matrix; - zval *temp; - matrix = emalloc(sizeof(matrix_object)); - memset(matrix,0,sizeof(matrix_object)); - matrix->std.ce = ce; - ALLOC_HASHTABLE(matrix->std.properties); - zend_hash_init(matrix->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(matrix->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(matrix, NULL, (zend_objects_free_object_storage_t)CairoMatrix_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoMatrix_handlers; - return retval; + zend_object_value retval; + matrix_object *matrix; + zval *temp; + matrix = emalloc(sizeof(matrix_object)); + memset(matrix,0,sizeof(matrix_object)); + matrix->std.ce = ce; + ALLOC_HASHTABLE(matrix->std.properties); + zend_hash_init(matrix->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(matrix->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(matrix, NULL, (zend_objects_free_object_storage_t)CairoMatrix_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoMatrix_handlers; + return retval; } -static void class_init_CairoMatrix(void) +void class_init_CairoMatrix(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "CairoMatrix", CairoMatrix_methods); CairoMatrix_ce_ptr = zend_register_internal_class(&ce); - CairoMatrix_ce_ptr->create_object = CairoMatrix_object_new; + CairoMatrix_ce_ptr->create_object = CairoMatrix_object_new; memcpy(&CairoMatrix_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - CairoMatrix_handlers.clone_obj=NULL; + CairoMatrix_handlers.clone_obj = NULL; } diff --git a/src/cairo/CairoMatrix.h b/src/cairo/CairoMatrix.h new file mode 100644 index 0000000..83727ca --- /dev/null +++ b/src/cairo/CairoMatrix.h @@ -0,0 +1,69 @@ +PHP_METHOD(CairoMatrix, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) + ZEND_ARG_INFO(0, yx) + ZEND_ARG_INFO(0, xy) + ZEND_ARG_INFO(0, yy) + ZEND_ARG_INFO(0, x0) + ZEND_ARG_INFO(0, y0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, initRotate); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__init_rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, radians) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, invert); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__invert_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, multiply); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__multiply_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, o2, CairoMatrix, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, rotate); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, radians) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, scale); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__scale_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, sx) + ZEND_ARG_INFO(0, xy) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, transformDistance); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__transform_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, dx) + ZEND_ARG_INFO(0, dy) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, transformPoint); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__transform_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoMatrix, translate); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__translate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, tx) + ZEND_ARG_INFO(0, ty) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/CairoPath.c b/src/cairo/CairoPath.c index 9fdeac0..62398b1 100644 --- a/src/cairo/CairoPath.c +++ b/src/cairo/CairoPath.c @@ -1,6 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoPath.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + /* {{{ Class CairoPath */ -static zend_class_entry * CairoPath_ce_ptr = NULL; +//static zend_class_entry * CairoPath_ce_ptr = NULL; /* {{{ Methods */ @@ -13,7 +18,7 @@ PHP_METHOD(CairoPath, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } @@ -35,17 +40,17 @@ PHP_METHOD(CairoPath, toStr) _this_zval = getThis(); path_object *curr = (path_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - cairo_path_t *path = curr->path; - array_init(return_value); + cairo_path_t *path = curr->path; + array_init(return_value); cairo_path_data_t *data; - int i, ret; - char buf[80]; + int i, ret; + char buf[200]; /* I think this is more than enough ... */ - for (i=0; i < path->num_data; i += path->data[i].header.length) { - data = &path->data[i]; - switch (data->header.type) { - case CAIRO_PATH_MOVE_TO: + for (i = 0; i < path->num_data; i += path->data[i].header.length) { + data = &path->data[i]; + switch (data->header.type) { + case CAIRO_PATH_MOVE_TO: sprintf(buf, "move_to %f %f", data[1].point.x, data[1].point.y); add_next_index_string(return_value, buf, 1); break; @@ -53,10 +58,10 @@ PHP_METHOD(CairoPath, toStr) sprintf(buf, "line_to %f %f", data[1].point.x, data[1].point.y); add_next_index_string(return_value, buf, 1); break; - case CAIRO_PATH_CURVE_TO: - sprintf(buf, "curve_to %f %f %f %f %f %f", data[1].point.x, data[1].point.y, data[2].point.x, data[2].point.y, data[3].point.x, data[3].point.y); + case CAIRO_PATH_CURVE_TO: + sprintf(buf, "curve_to %f %f %f %f %f %f", data[1].point.x, data[1].point.y, data[2].point.x, data[2].point.y, data[3].point.x, data[3].point.y); add_next_index_string(return_value, buf, 1); - break; + break; case CAIRO_PATH_CLOSE_PATH: sprintf(buf, "close_path"); add_next_index_string(return_value, buf, 1); @@ -64,7 +69,6 @@ PHP_METHOD(CairoPath, toStr) } } - //free(buf); } /* }}} str */ @@ -82,7 +86,7 @@ static zend_object_handlers CairoPath_handlers; static void CairoPath_object_dtor(void *object) { - path_object *path = (path_object *)object; + path_object *path = (path_object *)object; zend_hash_destroy(path->std.properties); FREE_HASHTABLE(path->std.properties); @@ -98,26 +102,26 @@ static zend_object_value CairoPath_object_new(zend_class_entry *ce) path_object *path; zval *temp; - path=emalloc(sizeof(path_object)); + path = emalloc(sizeof(path_object)); memset(path,0,sizeof(path_object)); path->std.ce = ce; - ALLOC_HASHTABLE(path->std.properties); - zend_hash_init(path->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(path->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(path, NULL, (zend_objects_free_object_storage_t)CairoPath_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoPath_handlers; - return retval; + ALLOC_HASHTABLE(path->std.properties); + zend_hash_init(path->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(path->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(path, NULL, (zend_objects_free_object_storage_t)CairoPath_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoPath_handlers; + return retval; } -static void class_init_CairoPath(void) +void class_init_CairoPath(void) { zend_class_entry ce; INIT_CLASS_ENTRY(ce, "CairoPath", CairoPath_methods); CairoPath_ce_ptr = zend_register_internal_class(&ce); CairoPath_ce_ptr->create_object = CairoPath_object_new; - memcpy(&CairoPath_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); - CairoPath_handlers.clone_obj=NULL; + memcpy(&CairoPath_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + CairoPath_handlers.clone_obj = NULL; } diff --git a/src/cairo/CairoPath.h b/src/cairo/CairoPath.h new file mode 100644 index 0000000..59a896d --- /dev/null +++ b/src/cairo/CairoPath.h @@ -0,0 +1,11 @@ +PHP_METHOD(CairoPath, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPath____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPath, toStr); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPath__to_str_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/CairoPattern.c b/src/cairo/CairoPattern.c index 4443a76..7252204 100644 --- a/src/cairo/CairoPattern.c +++ b/src/cairo/CairoPattern.c @@ -1,7 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoPattern.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" /* {{{ Class CairoPattern */ -static zend_class_entry * CairoPattern_ce_ptr = NULL; +//static zend_class_entry * CairoPattern_ce_ptr = NULL; /* {{{ Methods */ @@ -14,12 +18,12 @@ PHP_METHOD(CairoPattern, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } - php_error(E_ERROR, "Pattern Cannot be initialized"); RETURN_FALSE; + php_error(E_WARNING, "Pattern Cannot be initialized"); RETURN_FALSE; } /* }}} __construct */ @@ -71,18 +75,18 @@ PHP_METHOD(CairoPattern, setMatrix) /* {{{ proto void setExtend(int extend) - */ + */ PHP_METHOD(CairoPattern, setExtend) { - long extend; + long extend; - zval * _this_zval = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &_this_zval, CairoPattern_ce_ptr, &extend) == FAILURE) { - return; - } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - cairo_pattern_set_extend(curr->pattern, extend); - PHP_CAIRO_PATTERN_ERROR(curr->pattern); + zval * _this_zval = NULL; + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &_this_zval, CairoPattern_ce_ptr, &extend) == FAILURE) { + return; + } + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + cairo_pattern_set_extend(curr->pattern, extend); + PHP_CAIRO_PATTERN_ERROR(curr->pattern); } @@ -90,17 +94,17 @@ PHP_METHOD(CairoPattern, setExtend) /* {{{ proto void getExtend() - */ + */ PHP_METHOD(CairoPattern, getExtend) { - long extend; + long extend; - zval * _this_zval = NULL; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPattern_ce_ptr) == FAILURE) { - return; - } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - extend = cairo_pattern_get_extend(curr->pattern); + zval * _this_zval = NULL; + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPattern_ce_ptr) == FAILURE) { + return; + } + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + extend = cairo_pattern_get_extend(curr->pattern); RETURN_LONG(extend); } /* }}} setExtend */ @@ -110,7 +114,7 @@ static zend_function_entry CairoPattern_methods[] = { PHP_ME(CairoPattern, __construct, NULL, /**/ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME(CairoPattern, getMatrix, NULL, /**/ZEND_ACC_PUBLIC) PHP_ME(CairoPattern, setMatrix, CairoPattern__set_matrix_args, /**/ZEND_ACC_PUBLIC) - PHP_ME(CairoPattern, getExtend, NULL, /**/ZEND_ACC_PUBLIC) + PHP_ME(CairoPattern, getExtend, NULL, /**/ZEND_ACC_PUBLIC) PHP_ME(CairoPattern, setExtend, CairoPattern__set_extend_args, /**/ZEND_ACC_PUBLIC) { NULL, NULL, NULL } }; @@ -122,32 +126,32 @@ static zend_object_handlers CairoPattern_handlers; static void CairoPattern_object_dtor(void *object) { pattern_object *pattern = (pattern_object *)object; - zend_hash_destroy(pattern->std.properties); - FREE_HASHTABLE(pattern->std.properties); - if(pattern->pattern){ - cairo_pattern_destroy(pattern->pattern); - } - efree(object); + zend_hash_destroy(pattern->std.properties); + FREE_HASHTABLE(pattern->std.properties); + if(pattern->pattern){ + cairo_pattern_destroy(pattern->pattern); + } + efree(object); } static zend_object_value CairoPattern_object_new(zend_class_entry *ce) { - zend_object_value retval; - pattern_object *pattern; - zval *temp; - pattern=emalloc(sizeof(pattern_object)); - memset(pattern,0,sizeof(pattern_object)); - pattern->std.ce = ce; - ALLOC_HASHTABLE(pattern->std.properties); - zend_hash_init(pattern->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); - zend_hash_copy(pattern->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); - retval.handle = zend_objects_store_put(pattern, NULL, (zend_objects_free_object_storage_t)CairoPattern_object_dtor, NULL TSRMLS_CC); - retval.handlers = &CairoPattern_handlers; - return retval; + zend_object_value retval; + pattern_object *pattern; + zval *temp; + pattern = emalloc(sizeof(pattern_object)); + memset(pattern,0,sizeof(pattern_object)); + pattern->std.ce = ce; + ALLOC_HASHTABLE(pattern->std.properties); + zend_hash_init(pattern->std.properties, 0, NULL, ZVAL_PTR_DTOR,0); + zend_hash_copy(pattern->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref, (void *) &temp, sizeof(zval *)); + retval.handle = zend_objects_store_put(pattern, NULL, (zend_objects_free_object_storage_t)CairoPattern_object_dtor, NULL TSRMLS_CC); + retval.handlers = &CairoPattern_handlers; + return retval; } -static void class_init_CairoPattern(void) +void class_init_CairoPattern(void) { zend_class_entry ce; @@ -162,7 +166,7 @@ static void class_init_CairoPattern(void) /* {{{ Class CairoGradient */ -static zend_class_entry * CairoGradient_ce_ptr = NULL; +//static zend_class_entry * CairoGradient_ce_ptr = NULL; /* {{{ Methods */ @@ -182,7 +186,7 @@ PHP_METHOD(CairoGradient, __construct) - php_error(E_ERROR, "Gradient cannot be initialized"); RETURN_FALSE; + php_error(E_WARNING, "Gradient cannot be initialized"); RETURN_FALSE; } /* }}} __construct */ @@ -206,7 +210,7 @@ PHP_METHOD(CairoGradient, addColorStopRgb) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pattern_add_color_stop_rgb(curr->pattern, offset, red, green, blue); PHP_CAIRO_PATTERN_ERROR(curr->pattern); } @@ -232,7 +236,7 @@ PHP_METHOD(CairoGradient, addColorStopRgba) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pattern_add_color_stop_rgba(curr->pattern, offset, red, green, blue, alpha); PHP_CAIRO_PATTERN_ERROR(curr->pattern); } @@ -253,19 +257,19 @@ static zend_object_handlers CairoGradient_handlers; static zend_object_value CairoGradient_object_new(zend_class_entry *ce TSRMLS_CC) { - zend_object_value retval; - retval = CairoPattern_object_new(ce TSRMLS_CC); - retval.handlers = &CairoGradient_handlers; - return retval; + zend_object_value retval; + retval = CairoPattern_object_new(ce TSRMLS_CC); + retval.handlers = &CairoGradient_handlers; + return retval; } -static void class_init_CairoGradient(void) +void class_init_CairoGradient(void) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "CairoGradient", CairoGradient_methods); - CairoGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoPattern_ce_ptr, "CairoPattern" TSRMLS_CC); - CairoGradient_ce_ptr->create_object = CairoGradient_object_new; - memcpy(&CairoGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "CairoGradient", CairoGradient_methods); + CairoGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoPattern_ce_ptr, "CairoPattern" TSRMLS_CC); + CairoGradient_ce_ptr->create_object = CairoGradient_object_new; + memcpy(&CairoGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); } @@ -273,7 +277,7 @@ static void class_init_CairoGradient(void) /* {{{ Class CairoLinearGradient */ -static zend_class_entry * CairoLinearGradient_ce_ptr = NULL; +//static zend_class_entry * CairoLinearGradient_ce_ptr = NULL; /* {{{ Methods */ @@ -296,7 +300,7 @@ PHP_METHOD(CairoLinearGradient, __construct) } _this_zval = getThis(); - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); curr->pattern = cairo_pattern_create_linear(x0, y0, x1, y1); } @@ -317,7 +321,7 @@ PHP_METHOD(CairoLinearGradient, getLinearPoints) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pattern_get_linear_points(curr->pattern, &x0, &y0, &x1, &y1); array_init(return_value); @@ -342,19 +346,19 @@ static zend_object_handlers CairoLinearGradient_handlers; static zend_object_value CairoLinearGradient_object_new(zend_class_entry *ce TSRMLS_CC) { - zend_object_value retval; - retval = CairoGradient_object_new(ce TSRMLS_CC); - retval.handlers = &CairoLinearGradient_handlers; - return retval; + zend_object_value retval; + retval = CairoGradient_object_new(ce TSRMLS_CC); + retval.handlers = &CairoLinearGradient_handlers; + return retval; } -static void class_init_CairoLinearGradient(void) +void class_init_CairoLinearGradient(void) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "CairoLinearGradient", CairoLinearGradient_methods); - CairoLinearGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoGradient_ce_ptr, "CairoGradient" TSRMLS_CC); - CairoLinearGradient_ce_ptr->create_object = CairoLinearGradient_object_new; - memcpy(&CairoLinearGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "CairoLinearGradient", CairoLinearGradient_methods); + CairoLinearGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoGradient_ce_ptr, "CairoGradient" TSRMLS_CC); + CairoLinearGradient_ce_ptr->create_object = CairoLinearGradient_object_new; + memcpy(&CairoLinearGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); } @@ -362,7 +366,7 @@ static void class_init_CairoLinearGradient(void) /* {{{ Class CairoRadialGradient */ -static zend_class_entry * CairoRadialGradient_ce_ptr = NULL; +//static zend_class_entry * CairoRadialGradient_ce_ptr = NULL; /* {{{ Methods */ @@ -386,7 +390,7 @@ PHP_METHOD(CairoRadialGradient, __construct) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); curr->pattern = cairo_pattern_create_radial(cx0, cy0, radius0, cx1, cy1, radius1); } @@ -407,16 +411,16 @@ PHP_METHOD(CairoRadialGradient, getRadialCircles) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pattern_get_radial_circles(curr->pattern, &x0, &y0, &r0, &x1, &y1, &r1); array_init(return_value); add_assoc_double(return_value, "x0", x0); - add_assoc_double(return_value, "y0", y0); - add_assoc_double(return_value, "r0", r0); - add_assoc_double(return_value, "x1", x1); - add_assoc_double(return_value, "y1", y1); - add_assoc_double(return_value, "r1", r1); + add_assoc_double(return_value, "y0", y0); + add_assoc_double(return_value, "r0", r0); + add_assoc_double(return_value, "x1", x1); + add_assoc_double(return_value, "y1", y1); + add_assoc_double(return_value, "r1", r1); } /* }}} getRadialCircles */ @@ -434,26 +438,26 @@ static zend_object_handlers CairoRadialGradient_handlers; static zend_object_value CairoRadialGradient_object_new(zend_class_entry *ce TSRMLS_CC) { - zend_object_value retval; - retval = CairoGradient_object_new(ce TSRMLS_CC); - retval.handlers = &CairoRadialGradient_handlers; - return retval; + zend_object_value retval; + retval = CairoGradient_object_new(ce TSRMLS_CC); + retval.handlers = &CairoRadialGradient_handlers; + return retval; } -static void class_init_CairoRadialGradient(void) +void class_init_CairoRadialGradient(void) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "CairoRadialGradient", CairoRadialGradient_methods); - CairoRadialGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoGradient_ce_ptr, "CairoGradient" TSRMLS_CC); - CairoRadialGradient_ce_ptr->create_object = CairoRadialGradient_object_new; - memcpy(&CairoRadialGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "CairoRadialGradient", CairoRadialGradient_methods); + CairoRadialGradient_ce_ptr = zend_register_internal_class_ex(&ce, CairoGradient_ce_ptr, "CairoGradient" TSRMLS_CC); + CairoRadialGradient_ce_ptr->create_object = CairoRadialGradient_object_new; + memcpy(&CairoRadialGradient_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); } /* }}} Class CairoRadialGradient */ /* {{{ Class CairoSolidPattern */ -static zend_class_entry * CairoSolidPattern_ce_ptr = NULL; +//static zend_class_entry * CairoSolidPattern_ce_ptr = NULL; /* {{{ Methods */ @@ -529,7 +533,7 @@ static zend_object_value CairoSolidPattern_object_new(zend_class_entry *ce TSRML } -static void class_init_CairoSolidPattern(void) +void class_init_CairoSolidPattern(void) { zend_class_entry ce; @@ -543,7 +547,7 @@ static void class_init_CairoSolidPattern(void) /* {{{ Class CairoSurfacePattern */ -static zend_class_entry * CairoSurfacePattern_ce_ptr = NULL; +//static zend_class_entry * CairoSurfacePattern_ce_ptr = NULL; /* {{{ Methods */ @@ -575,7 +579,6 @@ PHP_METHOD(CairoSurfacePattern, __construct) */ PHP_METHOD(CairoSurfacePattern, getFilter) { - int filter; zval * _this_zval = NULL; @@ -584,9 +587,8 @@ PHP_METHOD(CairoSurfacePattern, getFilter) return; } - pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - filter = cairo_pattern_get_filter(curr->pattern); - RETURN_LONG(filter); + pattern_object *curr = (pattern_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_pattern_get_filter(curr->pattern)); } /* }}} getFilter */ @@ -654,19 +656,19 @@ static zend_object_handlers CairoSurfacePattern_handlers; static zend_object_value CairoSurfacePattern_object_new(zend_class_entry *ce TSRMLS_CC) { - zend_object_value retval; - retval = CairoPattern_object_new(ce TSRMLS_CC); - retval.handlers = &CairoSurfacePattern_handlers; - return retval; + zend_object_value retval; + retval = CairoPattern_object_new(ce TSRMLS_CC); + retval.handlers = &CairoSurfacePattern_handlers; + return retval; } -static void class_init_CairoSurfacePattern(void) +void class_init_CairoSurfacePattern(void) { - zend_class_entry ce; - INIT_CLASS_ENTRY(ce, "CairoSurfacePattern", CairoSurfacePattern_methods); - CairoSurfacePattern_ce_ptr = zend_register_internal_class_ex(&ce, CairoPattern_ce_ptr, "CairoPattern" TSRMLS_CC); - CairoSurfacePattern_ce_ptr->create_object = CairoSurfacePattern_object_new; - memcpy(&CairoSurfacePattern_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); + zend_class_entry ce; + INIT_CLASS_ENTRY(ce, "CairoSurfacePattern", CairoSurfacePattern_methods); + CairoSurfacePattern_ce_ptr = zend_register_internal_class_ex(&ce, CairoPattern_ce_ptr, "CairoPattern" TSRMLS_CC); + CairoSurfacePattern_ce_ptr->create_object = CairoSurfacePattern_object_new; + memcpy(&CairoSurfacePattern_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); } @@ -694,7 +696,7 @@ get_CairoPattern_ce_ptr(cairo_pattern_t *pattern) type = CairoRadialGradient_ce_ptr; break; default: - php_error(E_ERROR,"Unsupported Pattern"); + php_error(E_WARNING,"Unsupported Pattern"); return NULL; } return type; diff --git a/src/cairo/CairoPattern.h b/src/cairo/CairoPattern.h new file mode 100644 index 0000000..5425e6a --- /dev/null +++ b/src/cairo/CairoPattern.h @@ -0,0 +1,132 @@ + +PHP_METHOD(CairoPattern, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPattern, getMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPattern__get_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPattern, setMatrix); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPattern__set_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_OBJ_INFO(0, m, CairoMatrix, 1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoGradient, __contruct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoGradient____contruct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoGradient, addColorStopRgb); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoGradient__add_color_stop_rgb_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, red) + ZEND_ARG_INFO(0, green) + ZEND_ARG_INFO(0, blue) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoGradient, addColorStopRgba); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoGradient__add_color_stop_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) + ZEND_ARG_INFO(0, offset) + ZEND_ARG_INFO(0, red) + ZEND_ARG_INFO(0, green) + ZEND_ARG_INFO(0, blue) + ZEND_ARG_INFO(0, alpha) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoLinearGradient, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoLinearGradient____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, y0) + ZEND_ARG_INFO(0, x1) + ZEND_ARG_INFO(0, y1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoLinearGradient, getLinearPoints); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoLinearGradient__get_linear_points_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoRadialGradient, __constuct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoRadialGradient____constuct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, cx0) + ZEND_ARG_INFO(0, cy0) + ZEND_ARG_INFO(0, radius0) + ZEND_ARG_INFO(0, cx1) + ZEND_ARG_INFO(0, cy1) + ZEND_ARG_INFO(0, radius1) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoRadialGradient, getRadialCircles); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoRadialGradient__get_radial_circles_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSolidPattern, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSolidPattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, g) + ZEND_ARG_INFO(0, b) + ZEND_ARG_INFO(0, a) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSolidPattern, getRgba); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSolidPattern__get_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurfacePattern, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPattern, getExtend); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPattern__get_extend_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurfacePattern, getFilter); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__get_filter_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurfacePattern, getSurface); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__get_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPattern, setExtend); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPattern__set_extend_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, extend) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurfacePattern, setFilter); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__set_filter_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, filter) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/CairoSurface.c b/src/cairo/CairoSurface.c index 8a0133d..b419b91 100644 --- a/src/cairo/CairoSurface.c +++ b/src/cairo/CairoSurface.c @@ -1,6 +1,11 @@ +#include "php_cairo_api.h" +#include "CairoSurface.h" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + /* {{{ Class CairoSurface */ -PHP_CAIRO_API static zend_class_entry * CairoSurface_ce_ptr = NULL; +static zend_class_entry * CairoSurface_ce_ptr = NULL; static zend_object_handlers CairoSurface_handlers; static cairo_status_t @@ -9,12 +14,10 @@ _write_func(void *closure, const unsigned char *data, unsigned int length) int written; php_stream *zs = (php_stream *)closure ; written = php_stream_write(zs, data, length); - //written = php_stream_write_string(zs, data); if(written == length) return CAIRO_STATUS_SUCCESS; else { printf("is it an error ?"); - // CAIRO_STATUS_WRITE_ERROR; } } @@ -23,7 +26,6 @@ _read_func(void *closure, const unsigned char *data, unsigned int length) { int read; php_stream *zs = (php_stream *)closure; - //data = emalloc(length); read = php_stream_read(zs, data, length); if(read == length) return CAIRO_STATUS_SUCCESS; @@ -52,7 +54,7 @@ PHP_METHOD(CairoSurface, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; php_print("wtf"); return; @@ -70,7 +72,7 @@ PHP_METHOD(CairoSurface, __construct) */ PHP_METHOD(CairoSurface, createSimilar) { - zend_class_entry *ce; + zend_class_entry *ce; zval * _this_zval = NULL; cairo_surface_t *sur; int content; @@ -86,7 +88,7 @@ PHP_METHOD(CairoSurface, createSimilar) ce = get_CairoSurface_ce_ptr(sur); object_init_ex(return_value, ce); surface_object *sobj = (surface_object *)zend_objects_get_address(return_value TSRMLS_CC); - sobj->surface=sur; + sobj->surface = sur; } /* }}} createSimilar */ @@ -136,15 +138,13 @@ PHP_METHOD(CairoSurface, getContent) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoSurface_ce_ptr) == FAILURE) { return; } surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x=cairo_surface_get_content(curr->surface); - RETURN_LONG(x); + RETURN_LONG(cairo_surface_get_content(curr->surface)); } /* }}} getContent */ @@ -194,7 +194,7 @@ PHP_METHOD(CairoSurface, getFontOptions) cairo_surface_get_font_options(curr->surface, options); object_init_ex(return_value, CairoFontOptions_ce_ptr); fontoptions_object *fobj = (fontoptions_object *)zend_objects_get_address(return_value TSRMLS_CC); - fobj->fontoptions=options; + fobj->fontoptions = options; } /* }}} getFontOptions */ @@ -289,7 +289,7 @@ PHP_METHOD(CairoSurface, writeToPng) /* {{{ proto void writeToPngStream(stream file) - */ + */ PHP_METHOD(CairoSurface, writeToPngStream) { FILE *file; @@ -353,17 +353,17 @@ static zend_object_value CairoSurface_object_new(zend_class_entry *ce) surface = emalloc(sizeof(surface_object)); memset(surface,0,sizeof(surface_object)); - surface->std.ce=ce; + surface->std.ce = ce; ALLOC_HASHTABLE(surface->std.properties); zend_hash_init(surface->std.properties, 0, NULL, ZVAL_PTR_DTOR, 0); zend_hash_copy(surface->std.properties, &ce->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &temp, sizeof(zval *)); - retval.handle=zend_objects_store_put(surface, NULL, (zend_objects_free_object_storage_t)CairoSurface_object_dtor, NULL TSRMLS_CC); + retval.handle = zend_objects_store_put(surface, NULL, (zend_objects_free_object_storage_t)CairoSurface_object_dtor, NULL TSRMLS_CC); retval.handlers = &CairoSurface_handlers; return retval; } -static void class_init_CairoSurface(void) +void class_init_CairoSurface(void) { zend_class_entry ce; @@ -376,7 +376,7 @@ static void class_init_CairoSurface(void) /* }}} Class CairoSurface */ -/* {{{ Class CairoImageSurface -- done :)*/ +/* {{{ Class CairoImageSurface -- done :)*/ static zend_class_entry * CairoImageSurface_ce_ptr = NULL; static zend_object_handlers CairoImageSurface_handlers; @@ -449,14 +449,14 @@ PHP_METHOD(CairoImageSurface, createFromData) stride = (width + 1) / 8; break; default: - php_error(E_ERROR, "Unknown format"); + php_error(E_WARNING, "Unknown format"); return; } } /* if (height * stride > buffer_len) { - php_error(E_ERROR,"buffer is not long enough"); + php_error(E_WARNING,"buffer is not long enough"); return; } */ @@ -493,22 +493,22 @@ PHP_METHOD(CairoImageSurface, createFromPng) */ PHP_METHOD(CairoImageSurface, createFromPngStream) -{ - FILE *file; - zval *_this_zval = NULL; - cairo_status_t status; - zval *zstream; - php_stream *stream; - int err; - +{ + FILE *file; + zval *_this_zval = NULL; + cairo_status_t status; + zval *zstream; + php_stream *stream; + int err; + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Or", &_this_zval, CairoImageSurface_ce_ptr, &zstream)) { - return; - } - - surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - + return; + } + + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + php_stream_from_zval(stream, &zstream); - curr->surface = cairo_image_surface_create_from_png_stream( _read_func, stream); + curr->surface = cairo_image_surface_create_from_png_stream( _read_func, stream); } @@ -544,7 +544,6 @@ PHP_METHOD(CairoImageSurface, getData) */ PHP_METHOD(CairoImageSurface, getFormat) { - long x; zval * _this_zval = NULL; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) { @@ -552,8 +551,7 @@ PHP_METHOD(CairoImageSurface, getFormat) } surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_image_surface_get_format(curr->surface); - RETURN_LONG(x); + RETURN_LONG(cairo_image_surface_get_format(curr->surface)); } /* }}} getFormat */ @@ -564,16 +562,14 @@ PHP_METHOD(CairoImageSurface, getFormat) PHP_METHOD(CairoImageSurface, getHeight) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) { return; } surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_image_surface_get_height(curr->surface); + RETURN_LONG(cairo_image_surface_get_height(curr->surface)); - RETURN_LONG(x); } /* }}} getHeight */ @@ -584,16 +580,14 @@ PHP_METHOD(CairoImageSurface, getHeight) PHP_METHOD(CairoImageSurface, getStride) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) { return; } surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_image_surface_get_stride(curr->surface); + RETURN_LONG(cairo_image_surface_get_stride(curr->surface)); - RETURN_LONG(x); } /* }}} getStride */ @@ -604,7 +598,6 @@ PHP_METHOD(CairoImageSurface, getStride) PHP_METHOD(CairoImageSurface, getWidth) { zval * _this_zval = NULL; - long x; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoImageSurface_ce_ptr) == FAILURE) { return; @@ -613,8 +606,7 @@ PHP_METHOD(CairoImageSurface, getWidth) surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - x = cairo_image_surface_get_width(curr->surface); - RETURN_LONG(x); + RETURN_LONG(cairo_image_surface_get_width(curr->surface)); } /* }}} getWidth */ @@ -636,14 +628,14 @@ static zend_function_entry CairoImageSurface_methods[] = { static zend_object_value CairoImageSurface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoImageSurface_handlers; return retval; } -static void class_init_CairoImageSurface(void) +void class_init_CairoImageSurface(void) { zend_class_entry ce; @@ -677,8 +669,8 @@ PHP_METHOD(CairoPDFSurface, __construct) zval ***args, *obj; args = (zval ***)safe_emalloc(argc, sizeof(zval *),0); - if(ZEND_NUM_ARGS()== 0 || - zend_get_parameters_array_ex(argc, args)== FAILURE) { + if(ZEND_NUM_ARGS() == 0 || + zend_get_parameters_array_ex(argc, args) == FAILURE) { printf("ERROR"); efree(args); WRONG_PARAM_COUNT; @@ -699,29 +691,29 @@ PHP_METHOD(CairoPDFSurface, __construct) obj = *(args[2]); - switch(Z_TYPE_P(obj)) { - case IS_DOUBLE: - hpts = Z_DVAL_P(obj); - break; - case IS_LONG: - hpts = Z_LVAL_P(obj); - break; - default : - printf("Error!!!"); - return; - } + switch(Z_TYPE_P(obj)) { + case IS_DOUBLE: + hpts = Z_DVAL_P(obj); + break; + case IS_LONG: + hpts = Z_LVAL_P(obj); + break; + default : + printf("Error!!!"); + return; + } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); obj = *(args[0]); - if(Z_TYPE_P(obj)==IS_STRING) { + if(Z_TYPE_P(obj) == IS_STRING) { file = Z_STRVAL_P(obj); curr->surface = cairo_pdf_surface_create(file, wpts, hpts); } - else if(Z_TYPE_P(obj)==IS_RESOURCE) { + else if(Z_TYPE_P(obj) == IS_RESOURCE) { zstream = obj; php_stream_from_zval(stream, &zstream); curr->surface = cairo_pdf_surface_create_for_stream(_write_func, stream, wpts, hpts); @@ -751,7 +743,7 @@ PHP_METHOD(CairoPDFSurface, setSize) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_pdf_surface_set_size(curr->surface, wpts, hpts); } @@ -768,13 +760,13 @@ static zend_function_entry CairoPDFSurface_methods[] = { static zend_object_value CairoPDFSurface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoPDFSurface_handlers; return retval; } -static void class_init_CairoPDFSurface(void) +void class_init_CairoPDFSurface(void) { zend_class_entry ce; @@ -809,8 +801,8 @@ PHP_METHOD(CairoPSSurface, __construct) zval ***args, *obj; args = (zval **)safe_emalloc(argc, sizeof(zval *),0); - if(ZEND_NUM_ARGS()== 0 || - zend_get_parameters_array_ex(argc, args)== FAILURE) { + if(ZEND_NUM_ARGS() == 0 || + zend_get_parameters_array_ex(argc, args) == FAILURE) { printf("ERROR"); efree(args); WRONG_PARAM_COUNT; @@ -831,28 +823,28 @@ PHP_METHOD(CairoPSSurface, __construct) obj = *(args[2]); - switch(Z_TYPE_P(obj)) { - case IS_DOUBLE: - hpts = Z_DVAL_P(obj); - break; - case IS_LONG: - hpts = Z_LVAL_P(obj); - break; - default : - printf("Error!!!"); - return; - } + switch(Z_TYPE_P(obj)) { + case IS_DOUBLE: + hpts = Z_DVAL_P(obj); + break; + case IS_LONG: + hpts = Z_LVAL_P(obj); + break; + default : + printf("Error!!!"); + return; + } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); obj = *(args[0]); - if(Z_TYPE_P(obj)==IS_STRING) { + if(Z_TYPE_P(obj) == IS_STRING) { file = Z_STRVAL_P(obj); curr->surface = cairo_ps_surface_create(file, wpts, hpts); } - else if(Z_TYPE_P(obj)==IS_RESOURCE) { + else if(Z_TYPE_P(obj) == IS_RESOURCE) { zstream = obj; php_stream_from_zval(stream, &zstream); curr->surface = cairo_ps_surface_create_for_stream(_write_func, stream, wpts, hpts); @@ -883,7 +875,7 @@ PHP_METHOD(CairoPSSurface, dscBeginPageSetup) if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoPSSurface_ce_ptr) == FAILURE) { return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_ps_surface_dsc_begin_page_setup(curr->surface); PHP_CAIRO_SURFACE_ERROR(curr->surface); @@ -907,9 +899,9 @@ PHP_METHOD(CairoPSSurface, dscBeginSetup) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_ps_surface_dsc_begin_setup(curr->surface); - PHP_CAIRO_SURFACE_ERROR(curr->surface); + PHP_CAIRO_SURFACE_ERROR(curr->surface); } /* }}} dscBeginSetup */ @@ -929,9 +921,9 @@ PHP_METHOD(CairoPSSurface, dscComment) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_ps_surface_dsc_comment(curr->surface); - PHP_CAIRO_SURFACE_ERROR(curr->surface); + PHP_CAIRO_SURFACE_ERROR(curr->surface); } /* }}} dscComment */ @@ -951,7 +943,7 @@ PHP_METHOD(CairoPSSurface, getLevels) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); array_init(return_value); @@ -977,7 +969,7 @@ PHP_METHOD(CairoPSSurface, getLevelString) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); do { @@ -1002,7 +994,7 @@ PHP_METHOD(CairoPSSurface, restrictToLevel) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); do { @@ -1026,7 +1018,7 @@ PHP_METHOD(CairoPSSurface, setEps) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); do { @@ -1052,7 +1044,7 @@ PHP_METHOD(CairoPSSurface, setSize) return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); cairo_ps_surface_set_size(curr->surface, wpts, hpts); } @@ -1076,13 +1068,13 @@ static zend_function_entry CairoPSSurface_methods[] = { static zend_object_value CairoPSSurface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoPSSurface_handlers; return retval; } -static void class_init_CairoPSSurface(void) +void class_init_CairoPSSurface(void) { zend_class_entry ce; @@ -1118,10 +1110,10 @@ PHP_METHOD(CairoQuartzSurface, __construct) } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - php_error(E_ERROR, "CANNOT BE CALLED"); RETURN_FALSE; + php_error(E_WARNING, "CANNOT BE CALLED"); RETURN_FALSE; } /* }}} __construct */ @@ -1136,13 +1128,13 @@ static zend_function_entry CairoQuartzSurface_methods[] = { static zend_object_value CairoQuartzSurface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoQuartzSurface_handlers; return retval; } -static void class_init_CairoQuartzSurface(void) +void class_init_CairoQuartzSurface(void) { zend_class_entry ce; @@ -1179,8 +1171,8 @@ PHP_METHOD(CairoSVGSurface, __construct) zval ***args, *obj; args = (zval **)safe_emalloc(argc, sizeof(zval *),0); - if(ZEND_NUM_ARGS()== 0 || - zend_get_parameters_array_ex(argc, args)== FAILURE) { + if(ZEND_NUM_ARGS() == 0 || + zend_get_parameters_array_ex(argc, args) == FAILURE) { printf("ERROR"); efree(args); WRONG_PARAM_COUNT; @@ -1201,28 +1193,28 @@ PHP_METHOD(CairoSVGSurface, __construct) obj = *(args[2]); - switch(Z_TYPE_P(obj)) { - case IS_DOUBLE: - hpts = Z_DVAL_P(obj); - break; - case IS_LONG: - hpts = Z_LVAL_P(obj); - break; - default : - printf("Error!!!"); - return; - } + switch(Z_TYPE_P(obj)) { + case IS_DOUBLE: + hpts = Z_DVAL_P(obj); + break; + case IS_LONG: + hpts = Z_LVAL_P(obj); + break; + default : + printf("Error!!!"); + return; + } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); obj = *(args[0]); - if(Z_TYPE_P(obj)==IS_STRING) { + if(Z_TYPE_P(obj) == IS_STRING) { file = Z_STRVAL_P(obj); curr->surface = cairo_svg_surface_create(file, wpts, hpts); } - else if(Z_TYPE_P(obj)==IS_RESOURCE) { + else if(Z_TYPE_P(obj) == IS_RESOURCE) { zstream = obj; php_stream_from_zval(stream, &zstream); curr->surface = cairo_svg_surface_create_for_stream(_write_func, stream, wpts, hpts); @@ -1247,13 +1239,13 @@ static zend_function_entry CairoSVGSurface_methods[] = { static zend_object_value CairoSVGSurface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoSVGSurface_handlers; return retval; } -static void class_init_CairoSVGSurface(void) +void class_init_CairoSVGSurface(void) { zend_class_entry ce; @@ -1266,7 +1258,7 @@ static void class_init_CairoSVGSurface(void) /* }}} Class CairoSVGSurface */ -/* {{{ Class CairoWin32Surface -- Have to work on this aswell */ +/* {{{ Class CairoWin32Surface*/ static zend_class_entry * CairoWin32Surface_ce_ptr = NULL; static zend_object_handlers CairoWin32Surface_handlers; @@ -1289,7 +1281,7 @@ PHP_METHOD(CairoWin32Surface, __construct) } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); curr->surface = cairo_win32_surface_create(hdc, NULL); } /* }}} __construct */ @@ -1304,13 +1296,13 @@ static zend_function_entry CairoWin32Surface_methods[] = { static zend_object_value CairoWin32Surface_object_new(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + zend_object_value retval; + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoWin32Surface_handlers; return retval; } -static void class_init_CairoWin32Surface(void) +void class_init_CairoWin32Surface(void) { zend_class_entry ce; @@ -1338,12 +1330,12 @@ PHP_METHOD(CairoXlibSurface, __construct) - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } _this_zval = getThis(); - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); php_error(E_WARNING, "Cannot Be Initialized"); RETURN_FALSE; @@ -1358,18 +1350,16 @@ PHP_METHOD(CairoXlibSurface, getDepth) { zval * _this_zval = NULL; - long depth; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) { return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - depth = cairo_xlib_surface_get_depth(curr->surface); + RETURN_LONG(cairo_xlib_surface_get_depth(curr->surface)); - RETURN_LONG(depth); } /* }}} getDepth */ @@ -1381,17 +1371,15 @@ PHP_METHOD(CairoXlibSurface, getHeight) { zval * _this_zval = NULL; - long height; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) { return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - height = cairo_xlib_surface_get_height(curr->surface); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_xlib_surface_get_height(curr->surface)); - RETURN_LONG(height); } /* }}} getHeight */ @@ -1403,17 +1391,15 @@ PHP_METHOD(CairoXlibSurface, getWidth) { zval * _this_zval = NULL; - long width; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &_this_zval, CairoXlibSurface_ce_ptr) == FAILURE) { return; } - surface_object *curr =(surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); - width = cairo_xlib_surface_get_width(curr->surface); + surface_object *curr = (surface_object *)zend_objects_get_address(_this_zval TSRMLS_CC); + RETURN_LONG(cairo_xlib_surface_get_width(curr->surface)); - RETURN_LONG(width); } /* }}} getWidth */ @@ -1431,12 +1417,12 @@ static zend_function_entry CairoXlibSurface_methods[] = { static zend_object_value CairoXlibSurface_object_new(zend_class_entry *ce TSRMLS_DC) { zend_object_value retval; - retval=CairoSurface_object_new(ce TSRMLS_CC); + retval = CairoSurface_object_new(ce TSRMLS_CC); retval.handlers = &CairoXlibSurface_handlers; return retval; } -static void class_init_CairoXlibSurface(void) +void class_init_CairoXlibSurface(void) { zend_class_entry ce; @@ -1480,7 +1466,7 @@ get_CairoSurface_ce_ptr(cairo_surface_t *surface) type = CairoQuartzSurface_ce_ptr; break; default: - php_error(E_ERROR,"Unsupported Surface Type"); + php_error(E_WARNING,"Unsupported Surface Type"); return NULL; } return type; diff --git a/src/cairo/CairoSurface.h b/src/cairo/CairoSurface.h new file mode 100644 index 0000000..a39756a --- /dev/null +++ b/src/cairo/CairoSurface.h @@ -0,0 +1,269 @@ +PHP_METHOD(CairoSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, createSimilar); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__create_similar_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) + ZEND_ARG_INFO(0, content) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, finish); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__finish_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, flush); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__flush_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, getContent); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_content_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, getDeviceOffset); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_device_offset_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, getFontOptions); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, markDirtyRectangle); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__mark_dirty_rectangle_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) + ZEND_ARG_INFO(0, x) + ZEND_ARG_INFO(0, y) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, setDeviceOffset); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__set_device_offset_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x_offset) + ZEND_ARG_INFO(0, y_offset) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, setFallbackResolution); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__set_fallback_resolution_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, x_ppi) + ZEND_ARG_INFO(0, y_ppi) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, writeToPng); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__write_to_png_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, file) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSurface, writeToPngStream); +#if (PHP_MAJOR_VERSION >=5) +ZEND_BEGIN_ARG_INFO_EX(CairoSurface__write_to_png_stream_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, zstream) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, widthm) + ZEND_ARG_INFO(0, height) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, createFromData); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_data_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) + ZEND_ARG_INFO(0, obj) + ZEND_ARG_INFO(0, format) + ZEND_ARG_INFO(0, width) + ZEND_ARG_INFO(0, height) + ZEND_ARG_INFO(0, stride) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, createFromPng); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_png_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, file) +ZEND_END_ARG_INFO() +#endif + + +PHP_METHOD(CairoImageSurface, createFromPngStream); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_png_stream_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, zstream) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, getData); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_data_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, getFormat); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_format_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, getHeight); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_height_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, getStride); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_stride_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoImageSurface, getWidth); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPDFSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPDFSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, wpts) + ZEND_ARG_INFO(0, hpts) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPDFSurface, setSize); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPDFSurface__set_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, wpts) + ZEND_ARG_INFO(0, hpts) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, wpts) + ZEND_ARG_INFO(0, hpts) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, dscBeginPageSetup); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_begin_page_setup_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, dscBeginSetup); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_begin_setup_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, dscComment); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_comment_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, getLevels); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__get_levels_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, getLevelString); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__get_level_string_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, restrictToLevel); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__restrict_to_level_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, level) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, setEps); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__set_eps_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoPSSurface, setSize); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__set_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, wpts) + ZEND_ARG_INFO(0, hpts) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoQuartzSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoQuartzSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) + ZEND_ARG_INFO(0, hpixels) + ZEND_ARG_INFO(0, format) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoSVGSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoSVGSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) + ZEND_ARG_INFO(0, wpts) + ZEND_ARG_INFO(0, hpts) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoWin32Surface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoWin32Surface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoXlibSurface, __construct); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoXlibSurface, getDepth); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_depth_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoXlibSurface, getHeight); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_height_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_METHOD(CairoXlibSurface, getWidth); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif diff --git a/src/cairo/cairo.c b/src/cairo/cairo.c index 929351c..700c3bc 100644 --- a/src/cairo/cairo.c +++ b/src/cairo/cairo.c @@ -1,14 +1,14 @@ /* +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt. | | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ - | Authors: Akshat Gupta | + | Authors: Akshat Gupta | +----------------------------------------------------------------------+ */ @@ -16,14 +16,9 @@ #include "php_cairo_api.h" #include "php_cairo.h" -#include "CairoExceptionMacro.c" -#include "CairoException.c" -#include "CairoFont.c" -#include "CairoMatrix.c" -#include "CairoPath.c" -#include "CairoSurface.c" -#include "CairoPattern.c" -#include "CairoContext.c" +#include "CairoExceptionMacro.h" +#include "php_cairo_ce_ptr.h" + #if HAVE_CAIRO /* {{{ Class definitions */ @@ -31,7 +26,7 @@ /* {{{ cairo_functions[] */ function_entry cairo_functions[] = { - PHP_FE(cairo_version , cairo_version_arg_info) + PHP_FE(cairo_version , cairo_version_arg_info) PHP_FE(cairo_version_string, cairo_version_string_arg_info) { NULL, NULL, NULL } }; @@ -44,9 +39,9 @@ zend_module_entry cairo_module_entry = { STANDARD_MODULE_HEADER, "cairo", cairo_functions, - PHP_MINIT(cairo), /* Replace with NULL if there is nothing to do at php startup */ + PHP_MINIT(cairo), /* Replace with NULL if there is nothing to do at php startup */ NULL, /* Replace with NULL if there is nothing to do at php shutdown */ - NULL, /* Replace with NULL if there is nothing to do at request start */ + NULL, /* Replace with NULL if there is nothing to do at request start */ NULL, /* Replace with NULL if there is nothing to do at request end */ PHP_MINFO(cairo), PHP_CAIRO_VERSION, @@ -85,153 +80,153 @@ PHP_MINIT_FUNCTION(cairo) class_init_CairoException(); /* add your stuff here */ - + /* constants */ #if HAS_ATSUI_FONT - REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_ATSUI_FONT", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_FT_FONT - REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_FT_FONT", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_GLITZ_SURFACE - REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_GLITZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_PDF_SURFACE - REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PDF_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_PNG_FUNCTIONS - REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PNG_FUNCTIONS", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_PS_SURFACE - REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_PS_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_SVG_SURFACE - REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_SVG_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_QUARTZ_SURFACE - REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_QUARTZ_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_WIN32_FONT - REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_WIN32_FONT", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_WIN32_SURFACE - REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_WIN32_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_XCB_SURFACE - REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_XCB_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif #if HAS_XLIB_SURFACE - REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 1, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 1, CONST_CS | CONST_PERSISTENT); #else - REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 0, CONST_CS | CONST_PERSISTENT); + REGISTER_LONG_CONSTANT( "HAS_XLIB_SURFACE", 0, CONST_CS | CONST_PERSISTENT); #endif -#define CONSTANT(x) REGISTER_LONG_CONSTANT( #x, CAIRO_##x, CONST_CS | CONST_PERSISTENT) - CONSTANT(ANTIALIAS_DEFAULT); - CONSTANT(ANTIALIAS_NONE); - CONSTANT(ANTIALIAS_GRAY); - CONSTANT(ANTIALIAS_SUBPIXEL); +#define CONSTANT(x) REGISTER_LONG_CONSTANT( #x, CAIRO_##x, CONST_CS | CONST_PERSISTENT) + CONSTANT(ANTIALIAS_DEFAULT); + CONSTANT(ANTIALIAS_NONE); + CONSTANT(ANTIALIAS_GRAY); + CONSTANT(ANTIALIAS_SUBPIXEL); - CONSTANT(CONTENT_COLOR); - CONSTANT(CONTENT_ALPHA); - CONSTANT(CONTENT_COLOR_ALPHA); + CONSTANT(CONTENT_COLOR); + CONSTANT(CONTENT_ALPHA); + CONSTANT(CONTENT_COLOR_ALPHA); - CONSTANT(EXTEND_NONE); - CONSTANT(EXTEND_REPEAT); - CONSTANT(EXTEND_REFLECT); + CONSTANT(EXTEND_NONE); + CONSTANT(EXTEND_REPEAT); + CONSTANT(EXTEND_REFLECT); CONSTANT(EXTEND_PAD); - CONSTANT(FILL_RULE_WINDING); - CONSTANT(FILL_RULE_EVEN_ODD); - - CONSTANT(FILTER_FAST); - CONSTANT(FILTER_GOOD); - CONSTANT(FILTER_BEST); - CONSTANT(FILTER_NEAREST); - CONSTANT(FILTER_BILINEAR); - CONSTANT(FILTER_GAUSSIAN); - - CONSTANT(FONT_WEIGHT_NORMAL); - CONSTANT(FONT_WEIGHT_BOLD); - - CONSTANT(FONT_SLANT_NORMAL); - CONSTANT(FONT_SLANT_ITALIC); - CONSTANT(FONT_SLANT_OBLIQUE); - - CONSTANT(FORMAT_ARGB32); - CONSTANT(FORMAT_RGB24); - CONSTANT(FORMAT_A8); - CONSTANT(FORMAT_A1); - CONSTANT(FORMAT_RGB16_565); - - CONSTANT(HINT_METRICS_DEFAULT); - CONSTANT(HINT_METRICS_OFF); - CONSTANT(HINT_METRICS_ON); - - CONSTANT(HINT_STYLE_DEFAULT); - CONSTANT(HINT_STYLE_NONE); - CONSTANT(HINT_STYLE_SLIGHT); - CONSTANT(HINT_STYLE_MEDIUM); - CONSTANT(HINT_STYLE_FULL); - - CONSTANT(LINE_CAP_BUTT); - CONSTANT(LINE_CAP_ROUND); - CONSTANT(LINE_CAP_SQUARE); - - CONSTANT(LINE_JOIN_MITER); - CONSTANT(LINE_JOIN_ROUND); - CONSTANT(LINE_JOIN_BEVEL); - - CONSTANT(OPERATOR_CLEAR); - - CONSTANT(OPERATOR_SOURCE); - CONSTANT(OPERATOR_OVER); - CONSTANT(OPERATOR_IN); - CONSTANT(OPERATOR_OUT); - CONSTANT(OPERATOR_ATOP); - - CONSTANT(OPERATOR_DEST); - CONSTANT(OPERATOR_DEST_OVER); - CONSTANT(OPERATOR_DEST_IN); - CONSTANT(OPERATOR_DEST_OUT); - CONSTANT(OPERATOR_DEST_ATOP); - - CONSTANT(OPERATOR_XOR); - CONSTANT(OPERATOR_ADD); - CONSTANT(OPERATOR_SATURATE); - - CONSTANT(PATH_MOVE_TO); - CONSTANT(PATH_LINE_TO); - CONSTANT(PATH_CURVE_TO); - CONSTANT(PATH_CLOSE_PATH); - - CONSTANT(SUBPIXEL_ORDER_DEFAULT); - CONSTANT(SUBPIXEL_ORDER_RGB); - CONSTANT(SUBPIXEL_ORDER_BGR); - CONSTANT(SUBPIXEL_ORDER_VRGB); - CONSTANT(SUBPIXEL_ORDER_VBGR); + CONSTANT(FILL_RULE_WINDING); + CONSTANT(FILL_RULE_EVEN_ODD); + + CONSTANT(FILTER_FAST); + CONSTANT(FILTER_GOOD); + CONSTANT(FILTER_BEST); + CONSTANT(FILTER_NEAREST); + CONSTANT(FILTER_BILINEAR); + CONSTANT(FILTER_GAUSSIAN); + + CONSTANT(FONT_WEIGHT_NORMAL); + CONSTANT(FONT_WEIGHT_BOLD); + + CONSTANT(FONT_SLANT_NORMAL); + CONSTANT(FONT_SLANT_ITALIC); + CONSTANT(FONT_SLANT_OBLIQUE); + + CONSTANT(FORMAT_ARGB32); + CONSTANT(FORMAT_RGB24); + CONSTANT(FORMAT_A8); + CONSTANT(FORMAT_A1); + CONSTANT(FORMAT_RGB16_565); + + CONSTANT(HINT_METRICS_DEFAULT); + CONSTANT(HINT_METRICS_OFF); + CONSTANT(HINT_METRICS_ON); + + CONSTANT(HINT_STYLE_DEFAULT); + CONSTANT(HINT_STYLE_NONE); + CONSTANT(HINT_STYLE_SLIGHT); + CONSTANT(HINT_STYLE_MEDIUM); + CONSTANT(HINT_STYLE_FULL); + + CONSTANT(LINE_CAP_BUTT); + CONSTANT(LINE_CAP_ROUND); + CONSTANT(LINE_CAP_SQUARE); + + CONSTANT(LINE_JOIN_MITER); + CONSTANT(LINE_JOIN_ROUND); + CONSTANT(LINE_JOIN_BEVEL); + + CONSTANT(OPERATOR_CLEAR); + + CONSTANT(OPERATOR_SOURCE); + CONSTANT(OPERATOR_OVER); + CONSTANT(OPERATOR_IN); + CONSTANT(OPERATOR_OUT); + CONSTANT(OPERATOR_ATOP); + + CONSTANT(OPERATOR_DEST); + CONSTANT(OPERATOR_DEST_OVER); + CONSTANT(OPERATOR_DEST_IN); + CONSTANT(OPERATOR_DEST_OUT); + CONSTANT(OPERATOR_DEST_ATOP); + + CONSTANT(OPERATOR_XOR); + CONSTANT(OPERATOR_ADD); + CONSTANT(OPERATOR_SATURATE); + + CONSTANT(PATH_MOVE_TO); + CONSTANT(PATH_LINE_TO); + CONSTANT(PATH_CURVE_TO); + CONSTANT(PATH_CLOSE_PATH); + + CONSTANT(SUBPIXEL_ORDER_DEFAULT); + CONSTANT(SUBPIXEL_ORDER_RGB); + CONSTANT(SUBPIXEL_ORDER_BGR); + CONSTANT(SUBPIXEL_ORDER_VRGB); + CONSTANT(SUBPIXEL_ORDER_VBGR); #undef CONSTANT @@ -260,7 +255,7 @@ PHP_MINFO_FUNCTION(cairo) */ PHP_FUNCTION(cairo_version) { - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } @@ -275,7 +270,7 @@ PHP_FUNCTION(cairo_version) PHP_FUNCTION(cairo_version_string) { - if (ZEND_NUM_ARGS()>0) { + if (ZEND_NUM_ARGS()>0) { WRONG_PARAM_COUNT; } @@ -291,6 +286,6 @@ PHP_FUNCTION(cairo_version_string) * tab-width: 4 * c-basic-offset: 4 * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 + * vim600: noet sw = 4 ts = 4 fdm = marker + * vim<600: noet sw = 4 ts = 4 */ diff --git a/src/cairo/config.m4 b/src/cairo/config.m4 index 9c7ce08..b84c2f4 100644 --- a/src/cairo/config.m4 +++ b/src/cairo/config.m4 @@ -1,9 +1,9 @@ dnl -dnl $ Id: cairo 1.0.1$ +dnl $ Id: Cairo 1.0.1$ dnl PHP_ARG_ENABLE(cairo, whether to enable Cairo functions, -[ --with-cairo Enable Cairo support]) +[ --with-cairo Enable php Cairo support]) if test "$PHP_CAIRO" != "no"; then export OLD_CPPFLAGS="$CPPFLAGS" @@ -24,7 +24,7 @@ if test "$PHP_CAIRO" != "no"; then PHP_SUBST(CAIRO_SHARED_LIBADD) AC_DEFINE(HAVE_CAIRO, 1, [ ]) - PHP_NEW_EXTENSION(cairo, cairo.c , $ext_shared) + PHP_NEW_EXTENSION(cairo, cairo.c CairoContext.c CairoException.c CairoFont.c CairoMatrix.c CairoPath.c CairoPattern.c CairoSurface.c, $ext_shared) AC_MSG_CHECKING(for pkg-config) if test ! -f "$PKG_CONFIG"; then diff --git a/src/cairo/php_cairo.h b/src/cairo/php_cairo.h dissimilarity index 94% index 8eb75e9..8051af4 100644 --- a/src/cairo/php_cairo.h +++ b/src/cairo/php_cairo.h @@ -1,1384 +1,118 @@ -/* - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt. | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ - | Authors: Akshat Gupta | - +----------------------------------------------------------------------+ -*/ - -/* $ Id: $ */ - -#define PHP_CAIRO_VERSION "1.01" - -#ifndef PHP_CAIRO_H -#define PHP_CAIRO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -#ifdef HAVE_CAIRO - -#include -#include -#include -#include -#ifdef __cplusplus -} // extern "C" -#endif -#ifdef __cplusplus -extern "C" { -#endif - -extern zend_module_entry phpCairo_module_entry; -#define phpext_phpCairo_ptr &phpCairo_module_entry - -#ifdef PHP_WIN32 -#define PHP_CAIRO_API __declspec(dllexport) -#else -#define PHP_CAIRO_API -#endif - -PHP_MINIT_FUNCTION(cairo); -PHP_MINFO_FUNCTION(cairo); - -#ifdef ZTS -#include "TSRM.h" -#endif - -#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) - -#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) - -#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) - -#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) -#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) -#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) - - -PHP_FUNCTION(cairo_version); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(cairo_version_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_FUNCTION(cairo_version_string); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(cairo_version_string_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_OBJ_INFO(0, obj, CairoSurface, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, appendPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__append_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, p, CairoPath, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, arc); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__arc_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) - ZEND_ARG_INFO(0, xc) - ZEND_ARG_INFO(0, yc) - ZEND_ARG_INFO(0, radius) - ZEND_ARG_INFO(0, angle1) - ZEND_ARG_INFO(0, angle2) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, arcNegative); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__arc_negative_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) - ZEND_ARG_INFO(0, xc) - ZEND_ARG_INFO(0, yc) - ZEND_ARG_INFO(0, radius) - ZEND_ARG_INFO(0, angle1) - ZEND_ARG_INFO(0, angle2) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, clip); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, clipExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, clipPreserve); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__clip_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, closePath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__close_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, copyClipRectangleList); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_clip_rectangle_list_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, copyPage); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_page_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, copyPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, copyPathFlat); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__copy_path_flat_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, curveTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__curve_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) - ZEND_ARG_INFO(0, x1) - ZEND_ARG_INFO(0, y1) - ZEND_ARG_INFO(0, x2) - ZEND_ARG_INFO(0, y2) - ZEND_ARG_INFO(0, x3) - ZEND_ARG_INFO(0, y3) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, deviceToUser); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__device_to_user_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, deviceToUserDistance); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__device_to_user_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, fill); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, fillExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, fillPreserve); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__fill_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, fontExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__font_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getAntialias); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getCurrentPoint); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_current_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getDash); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_dash_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getDashCount); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_dash_count_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getFillRule); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_fill_rule_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getFontFace); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getFontMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getFontOptions); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getGroupTarget); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_group_target_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getLineCap); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_cap_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getLineJoin); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_join_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getLineWidth); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_line_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getMiterLimit); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_miter_limit_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getOperator); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_operator_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getScaledFont); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_scaled_font_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getSource); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getTarget); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_target_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, getTolerance); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__get_tolerance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, glyphExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__glyph_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) -#if (PHP_MINOR_VERSION > 0) - ZEND_ARG_ARRAY_INFO(0, obj, 1) -#else - ZEND_ARG_INFO(0, obj) -#endif - ZEND_ARG_INFO(0, num) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, glyphPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__glyph_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) -#if (PHP_MINOR_VERSION > 0) - ZEND_ARG_ARRAY_INFO(0, obh, 1) -#else - ZEND_ARG_INFO(0, obh); -#endif - ZEND_ARG_INFO(0, num) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, hasCurrentPoint); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__has_current_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, identityMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__identity_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, inFill); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__in_fill_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, inStroke); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__in_stroke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, lineTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__line_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, mask); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__mask_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, p, CairoPattern, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, maskSurface); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__mask_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, s, CairoSurface, 1) - ZEND_ARG_INFO(0, surface_x) - ZEND_ARG_INFO(0, surface_y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, moveTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__move_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, newPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__new_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, newSubPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__new_sub_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, paint); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__paint_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, paintWithAlpha); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__paint_with_alpha_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, alpha) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, pathExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__path_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_OBJ_INFO(0, path, CairoPath, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, popGroup); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__pop_group_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, popGroupToSource); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__pop_group_to_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, pushGroup); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__push_group_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, pushGroupWithContent); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__push_group_with_content_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, content) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, rectangle); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__rectangle_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) - ZEND_ARG_INFO(0, width) - ZEND_ARG_INFO(0, height) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, relCurveTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_curve_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) - ZEND_ARG_INFO(0, x1) - ZEND_ARG_INFO(0, y1) - ZEND_ARG_INFO(0, x2) - ZEND_ARG_INFO(0, y2) - ZEND_ARG_INFO(0, x3) - ZEND_ARG_INFO(0, y3) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, relLineTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_line_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, relMoveTo); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__rel_move_to_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, resetClip); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__reset_clip_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, restore); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__restore_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, rotate); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, angle) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, save); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__save_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, scale); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__scale_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, selectFontFace); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__select_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, family) - ZEND_ARG_INFO(0, slant) - ZEND_ARG_INFO(0, weight) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setAntialias); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, antialias) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setDash); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_dash_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) -#if (PHP_MINOR_VERSION > 0) - ZEND_ARG_ARRAY_INFO(0, dashes, 1) -#else - ZEND_ARG_INFO(0, dashes) -#endif - ZEND_ARG_INFO(0, num_dashes) - ZEND_ARG_INFO(0, offset) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setFillRule); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_fill_rule_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, fill_rule) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setFontFace); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_OBJ_INFO(0, obj, CairoFontFace, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setFontMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, matrix, CairoMatrix, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setFontOptions); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, options, CairoFontOptions, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setFontSize); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_font_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, size) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setLineCap); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_cap_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, line_cap) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setLineJoin); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_join_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, line_join) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setLineWidth); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_line_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, width) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, matix, CairoMatrix, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setMiterLimit); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_miter_limit_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, limit) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setOperator); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_operator_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, op) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setSource); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_OBJ_INFO(0, p, CairoPattern, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setSourceRgb); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_rgb_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) - ZEND_ARG_INFO(0, red) - ZEND_ARG_INFO(0, green) - ZEND_ARG_INFO(0, blue) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setSourceRgba); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) - ZEND_ARG_INFO(0, red) - ZEND_ARG_INFO(0, green) - ZEND_ARG_INFO(0, blue) - ZEND_ARG_INFO(0, alpha) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setSourceSurface); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_source_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, surface, CairoSurface, 1) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, setTolerance); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__set_tolerance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, tolerance) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, showGlyphs); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_glyphs_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) -#if (PHP_MINOR_VERSION > 0) - ZEND_ARG_ARRAY_INFO(0, obj, 1) -#else - ZEND_ARG_INFO(0, obj) -#endif - ZEND_ARG_INFO(0, num_glyphs) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, showPage); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_page_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, showText); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__show_text_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, stroke); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, strokeExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, strokePreserve); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__stroke_preserve_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, textExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__text_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, str) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, textPath); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__text_path_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, obj) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, transform); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__transform_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, matrix, CairoMatrix, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, translate); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__translate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, tx) - ZEND_ARG_INFO(0, ty) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, userToDevice); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__user_to_device_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoContext, userToDeviceDistance); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoContext__user_to_device_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, dx) - ZEND_ARG_INFO(0, dy) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontFace, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontFace____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, getAntialias); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, getHintMetrics); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_hint_metrics_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, getHintStyle); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_hint_style_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, getSubpixelOrder); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__get_subpixel_order_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, setAntialias); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_antialias_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, aa) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, setHintMetrics); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_hint_metrics_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, hm) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, setHintStyle); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_hint_style_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, hs) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoFontOptions, setSubpixelOrder); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoFontOptions__set_subpixel_order_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, so) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) - ZEND_ARG_INFO(0, yx) - ZEND_ARG_INFO(0, xy) - ZEND_ARG_INFO(0, yy) - ZEND_ARG_INFO(0, x0) - ZEND_ARG_INFO(0, y0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, initRotate); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__init_rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, radians) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, invert); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__invert_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, multiply); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__multiply_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, o2, CairoMatrix, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, rotate); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__rotate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, radians) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, scale); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__scale_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, sx) - ZEND_ARG_INFO(0, xy) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, transformDistance); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__transform_distance_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, dx) - ZEND_ARG_INFO(0, dy) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, transformPoint); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__transform_point_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoMatrix, translate); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoMatrix__translate_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, tx) - ZEND_ARG_INFO(0, ty) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPath, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPath____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPath, toStr); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPath__to_str_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPattern, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPattern, getMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPattern__get_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPattern, setMatrix); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPattern__set_matrix_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_OBJ_INFO(0, m, CairoMatrix, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoGradient, __contruct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoGradient____contruct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoGradient, addColorStopRgb); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoGradient__add_color_stop_rgb_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, red) - ZEND_ARG_INFO(0, green) - ZEND_ARG_INFO(0, blue) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoGradient, addColorStopRgba); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoGradient__add_color_stop_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 5) - ZEND_ARG_INFO(0, offset) - ZEND_ARG_INFO(0, red) - ZEND_ARG_INFO(0, green) - ZEND_ARG_INFO(0, blue) - ZEND_ARG_INFO(0, alpha) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoLinearGradient, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoLinearGradient____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) - ZEND_ARG_INFO(0, y0) - ZEND_ARG_INFO(0, x1) - ZEND_ARG_INFO(0, y1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoLinearGradient, getLinearPoints); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoLinearGradient__get_linear_points_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoRadialGradient, __constuct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoRadialGradient____constuct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) - ZEND_ARG_INFO(0, cx0) - ZEND_ARG_INFO(0, cy0) - ZEND_ARG_INFO(0, radius0) - ZEND_ARG_INFO(0, cx1) - ZEND_ARG_INFO(0, cy1) - ZEND_ARG_INFO(0, radius1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoRadialGradient, getRadialCircles); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoRadialGradient__get_radial_circles_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSolidPattern, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSolidPattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, g) - ZEND_ARG_INFO(0, b) - ZEND_ARG_INFO(0, a) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSolidPattern, getRgba); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSolidPattern__get_rgba_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurfacePattern, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPattern, getExtend); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPattern__get_extend_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurfacePattern, getFilter); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__get_filter_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurfacePattern, getSurface); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__get_surface_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPattern, setExtend); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPattern__set_extend_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, extend) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurfacePattern, setFilter); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurfacePattern__set_filter_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, filter) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoScaledFont, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) - ZEND_ARG_OBJ_INFO(0, mx1, CairoMatrix, 1) - ZEND_ARG_OBJ_INFO(0, mx2, CairoMatrix, 1) - ZEND_ARG_OBJ_INFO(0, fo, CairoFontOptions, 1) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoScaledFont, extents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoScaledFont, getFontFace); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__get_font_face_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoScaledFont, textExtents); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoScaledFont__text_extents_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, str) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, createSimilar); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__create_similar_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 3) - ZEND_ARG_INFO(0, content) - ZEND_ARG_INFO(0, width) - ZEND_ARG_INFO(0, height) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, finish); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__finish_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, flush); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__flush_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, getContent); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_content_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, getDeviceOffset); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_device_offset_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, getFontOptions); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__get_font_options_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, markDirtyRectangle); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__mark_dirty_rectangle_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) - ZEND_ARG_INFO(0, x) - ZEND_ARG_INFO(0, y) - ZEND_ARG_INFO(0, width) - ZEND_ARG_INFO(0, height) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, setDeviceOffset); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__set_device_offset_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x_offset) - ZEND_ARG_INFO(0, y_offset) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, setFallbackResolution); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__set_fallback_resolution_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, x_ppi) - ZEND_ARG_INFO(0, y_ppi) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, writeToPng); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__write_to_png_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, file) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSurface, writeToPngStream); -#if (PHP_MAJOR_VERSION >=5) -ZEND_BEGIN_ARG_INFO_EX(CairoSurface__write_to_png_stream_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, zstream) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, widthm) - ZEND_ARG_INFO(0, height) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, createFromData); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_data_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 4) - ZEND_ARG_INFO(0, obj) - ZEND_ARG_INFO(0, format) - ZEND_ARG_INFO(0, width) - ZEND_ARG_INFO(0, height) - ZEND_ARG_INFO(0, stride) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, createFromPng); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_png_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, file) -ZEND_END_ARG_INFO() -#endif - - -PHP_METHOD(CairoImageSurface, createFromPngStream); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__create_from_png_stream_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, zstream) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, getData); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_data_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, getFormat); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_format_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, getHeight); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_height_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, getStride); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_stride_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoImageSurface, getWidth); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoImageSurface__get_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPDFSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPDFSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, wpts) - ZEND_ARG_INFO(0, hpts) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPDFSurface, setSize); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPDFSurface__set_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, wpts) - ZEND_ARG_INFO(0, hpts) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, wpts) - ZEND_ARG_INFO(0, hpts) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, dscBeginPageSetup); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_begin_page_setup_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, dscBeginSetup); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_begin_setup_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, dscComment); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__dsc_comment_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, getLevels); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__get_levels_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, getLevelString); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__get_level_string_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, restrictToLevel); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__restrict_to_level_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, level) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, setEps); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__set_eps_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoPSSurface, setSize); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoPSSurface__set_size_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, wpts) - ZEND_ARG_INFO(0, hpts) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoQuartzSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoQuartzSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 1) - ZEND_ARG_INFO(0, hpixels) - ZEND_ARG_INFO(0, format) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoSVGSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoSVGSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 2) - ZEND_ARG_INFO(0, wpts) - ZEND_ARG_INFO(0, hpts) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoWin32Surface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoWin32Surface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoXlibSurface, __construct); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface____construct_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoXlibSurface, getDepth); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_depth_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoXlibSurface, getHeight); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_height_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -PHP_METHOD(CairoXlibSurface, getWidth); -#if (PHP_MAJOR_VERSION >= 5) -ZEND_BEGIN_ARG_INFO_EX(CairoXlibSurface__get_width_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) -ZEND_END_ARG_INFO() -#endif - -#ifdef __cplusplus -} // extern "C" -#endif - -#endif /* PHP_HAVE_CAIRO */ - -#endif /* PHP_CAIRO_H */ - -/* {{{ Proto's */ - -//zend_class_entry* get_CairoSurface_ce_ptr(cairo_surface_t *); -//zend_class_entry* get_CairoPattern_ce_ptr(cairo_pattern_t *); - -/* }}} */ - - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * End: - * vim600: noet sw=4 ts=4 fdm=marker - * vim<600: noet sw=4 ts=4 - */ +/* + +----------------------------------------------------------------------+ + | This source file is subject to version 3.01 of the PHP license, | + | that is bundled with this package in the file LICENSE, and is | + | available through the world-wide-web at the following url: | + | http://www.php.net/license/3_01.txt. | + | If you did not receive a copy of the PHP license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@php.net so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Akshat Gupta | + +----------------------------------------------------------------------+ +*/ + +/* $ Id: $ */ + +#define PHP_CAIRO_VERSION "1.01" + +#ifndef PHP_CAIRO_H +#define PHP_CAIRO_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#ifdef HAVE_CAIRO + +#include +#include +#include +#include +#ifdef __cplusplus +} /* extern "C" */ + +#endif +#ifdef __cplusplus +extern "C" { +#endif + +extern zend_module_entry phpCairo_module_entry; +#define phpext_phpCairo_ptr &phpCairo_module_entry + +#ifdef PHP_WIN32 +#define PHP_CAIRO_API __declspec(dllexport) +#else +#define PHP_CAIRO_API +#endif + +PHP_MINIT_FUNCTION(cairo); +PHP_MINFO_FUNCTION(cairo); + +#ifdef ZTS +#include "TSRM.h" +#endif + +#define FREE_RESOURCE(resource) zend_list_delete(Z_LVAL_P(resource)) + +#define PROP_GET_LONG(name) Z_LVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_LONG(name, l) zend_update_property_long(_this_ce, _this_zval, #name, strlen(#name), l TSRMLS_CC) + +#define PROP_GET_DOUBLE(name) Z_DVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_DOUBLE(name, d) zend_update_property_double(_this_ce, _this_zval, #name, strlen(#name), d TSRMLS_CC) + +#define PROP_GET_STRING(name) Z_STRVAL_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_GET_STRLEN(name) Z_STRLEN_P(zend_read_property(_this_ce, _this_zval, #name, strlen(#name), 1 TSRMLS_CC)) +#define PROP_SET_STRING(name, s) zend_update_property_string(_this_ce, _this_zval, #name, strlen(#name), s TSRMLS_CC) +#define PROP_SET_STRINGL(name, s, l) zend_update_property_stringl(_this_ce, _this_zval, #name, strlen(#name), s, l TSRMLS_CC) + + +PHP_FUNCTION(cairo_version); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(cairo_version_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + +PHP_FUNCTION(cairo_version_string); +#if (PHP_MAJOR_VERSION >= 5) +ZEND_BEGIN_ARG_INFO_EX(cairo_version_string_arg_info, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 0) +ZEND_END_ARG_INFO() +#endif + + + + + + + + + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* PHP_HAVE_CAIRO */ + +#endif /* PHP_CAIRO_H */ + +/* {{{ Proto's */ + + +/* }}} */ + + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: noet sw = 4 ts = 4 fdm = marker + * vim<600: noet sw = 4 ts = 4 + */ diff --git a/src/cairo/php_cairo_api.h b/src/cairo/php_cairo_api.h index f8096b5..f915c69 100644 --- a/src/cairo/php_cairo_api.h +++ b/src/cairo/php_cairo_api.h @@ -2,12 +2,12 @@ #include typedef struct _context_object { - zend_object std; - cairo_t *context; + zend_object std; + cairo_t *context; } context_object; typedef struct _surface_object { - zend_object std; + zend_object std; cairo_surface_t *surface; } surface_object; diff --git a/src/cairo/php_cairo_ce_ptr.h b/src/cairo/php_cairo_ce_ptr.h new file mode 100644 index 0000000..7426adf --- /dev/null +++ b/src/cairo/php_cairo_ce_ptr.h @@ -0,0 +1,42 @@ +/*This file contains the class entries and also the link for various class declaration + */ + +static zend_class_entry * CairoContext_ce_ptr = NULL; +static zend_class_entry * CairoFontOptions_ce_ptr = NULL; +static zend_class_entry * CairoScaledFont_ce_ptr = NULL; +static zend_class_entry * CairoPath_ce_ptr = NULL; +static zend_class_entry * CairoPattern_ce_ptr = NULL; +static zend_class_entry * CairoGradient_ce_ptr = NULL; +static zend_class_entry * CairoLinearGradient_ce_ptr = NULL; +static zend_class_entry * CairoRadialGradient_ce_ptr = NULL; +static zend_class_entry * CairoSolidPattern_ce_ptr = NULL; +static zend_class_entry * CairoSurfacePattern_ce_ptr = NULL; +/* The classes dervied from CairoSurface have there ce_ptr in the class file itself .... + * They are not called directly and get_CairoSurface_ce_ptr() has to be used. + */ + +static zend_class_entry * CairoFontFace_ce_ptr = NULL; +static zend_class_entry * CairoMatrix_ce_ptr = NULL; +static zend_class_entry * CairoException_ce_ptr = NULL; + +extern void class_init_CairoContext(); +extern void class_init_CairoFontFace(); +extern void class_init_CairoFontOptions(); +extern void class_init_CairoMatrix(); +extern void class_init_CairoPath(); +extern void class_init_CairoPattern(); +extern void class_init_CairoGradient(); +extern void class_init_CairoLinearGradient(); +extern void class_init_CairoRadialGradient(); +extern void class_init_CairoSolidPattern(); +extern void class_init_CairoSurfacePattern(); +extern void class_init_CairoScaledFont(); +extern void class_init_CairoSurface(); +extern void class_init_CairoImageSurface(); +extern void class_init_CairoPDFSurface(); +extern void class_init_CairoPSSurface(); +extern void class_init_CairoQuartzSurface(); +extern void class_init_CairoSVGSurface(); +extern void class_init_CairoWin32Surface(); +extern void class_init_CairoXlibSurface(); +extern void class_init_CairoException(); -- 2.11.4.GIT