Skip to content

Commit

Permalink
Add beginning of Cairo 1.2 support for RHEL 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
mgdm committed Aug 14, 2011
1 parent e4f5282 commit 9ddd8be
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 31 deletions.
22 changes: 16 additions & 6 deletions cairo.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -820,8 +820,10 @@ static const zend_function_entry cairo_functions[] = {
PHP_FE(cairo_set_antialias, cairo_set_antialias_args) PHP_FE(cairo_set_antialias, cairo_set_antialias_args)
PHP_FE(cairo_get_antialias, cairo_context_args) PHP_FE(cairo_get_antialias, cairo_context_args)
PHP_FE(cairo_set_dash, cairo_set_dash_args) PHP_FE(cairo_set_dash, cairo_set_dash_args)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_FE(cairo_get_dash_count, cairo_context_args) PHP_FE(cairo_get_dash_count, cairo_context_args)
PHP_FE(cairo_get_dash, cairo_context_args) PHP_FE(cairo_get_dash, cairo_context_args)
#endif
PHP_FE(cairo_set_fill_rule, cairo_set_fill_rule_args) PHP_FE(cairo_set_fill_rule, cairo_set_fill_rule_args)
PHP_FE(cairo_get_fill_rule, cairo_context_args) PHP_FE(cairo_get_fill_rule, cairo_context_args)
PHP_FE(cairo_set_line_cap, cairo_set_fill_rule_args) PHP_FE(cairo_set_line_cap, cairo_set_fill_rule_args)
Expand All @@ -838,9 +840,11 @@ static const zend_function_entry cairo_functions[] = {
PHP_FE(cairo_get_tolerance, cairo_context_args) PHP_FE(cairo_get_tolerance, cairo_context_args)
PHP_FE(cairo_clip, cairo_context_args) PHP_FE(cairo_clip, cairo_context_args)
PHP_FE(cairo_clip_preserve, cairo_context_args) PHP_FE(cairo_clip_preserve, cairo_context_args)
PHP_FE(cairo_clip_extents, cairo_context_args)
PHP_FE(cairo_reset_clip, cairo_context_args) PHP_FE(cairo_reset_clip, cairo_context_args)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_FE(cairo_clip_extents, cairo_context_args)
PHP_FE(cairo_clip_rectangle_list, cairo_context_args) PHP_FE(cairo_clip_rectangle_list, cairo_context_args)
#endif
PHP_FE(cairo_fill, cairo_context_args) PHP_FE(cairo_fill, cairo_context_args)
PHP_FE(cairo_fill_preserve, cairo_context_args) PHP_FE(cairo_fill_preserve, cairo_context_args)
PHP_FE(cairo_fill_extents, cairo_context_args) PHP_FE(cairo_fill_extents, cairo_context_args)
Expand Down Expand Up @@ -905,7 +909,9 @@ static const zend_function_entry cairo_functions[] = {
PHP_FE(cairo_set_font_face, cairo_set_font_face_args) PHP_FE(cairo_set_font_face, cairo_set_font_face_args)
PHP_FE(cairo_get_font_face, cairo_context_args) PHP_FE(cairo_get_font_face, cairo_context_args)
PHP_FE(cairo_set_scaled_font, cairo_set_scaled_font_args) PHP_FE(cairo_set_scaled_font, cairo_set_scaled_font_args)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_FE(cairo_get_scaled_font, cairo_context_args) PHP_FE(cairo_get_scaled_font, cairo_context_args)
#endif
PHP_FE(cairo_show_text, cairo_show_text_args) PHP_FE(cairo_show_text, cairo_show_text_args)
PHP_FE(cairo_text_extents, cairo_context_args) PHP_FE(cairo_text_extents, cairo_context_args)
PHP_FE(cairo_font_extents, cairo_context_args) PHP_FE(cairo_font_extents, cairo_context_args)
Expand All @@ -917,21 +923,23 @@ static const zend_function_entry cairo_functions[] = {
PHP_FE(cairo_pattern_set_matrix, cairo_pattern_set_matrix_args) PHP_FE(cairo_pattern_set_matrix, cairo_pattern_set_matrix_args)
PHP_FE(cairo_pattern_create_rgb, cairo_pattern_create_rgb_args) PHP_FE(cairo_pattern_create_rgb, cairo_pattern_create_rgb_args)
PHP_FE(cairo_pattern_create_rgba, cairo_pattern_create_rgba_args) PHP_FE(cairo_pattern_create_rgba, cairo_pattern_create_rgba_args)
PHP_FE(cairo_pattern_get_rgba, cairo_solidpattern_args)
PHP_FE(cairo_pattern_create_for_surface, cairo_create_args) PHP_FE(cairo_pattern_create_for_surface, cairo_create_args)
PHP_FE(cairo_pattern_get_surface, cairo_surfacepattern_args)
PHP_FE(cairo_pattern_set_filter, cairo_pattern_set_filter_args) PHP_FE(cairo_pattern_set_filter, cairo_pattern_set_filter_args)
PHP_FE(cairo_pattern_get_filter, cairo_surfacepattern_args) PHP_FE(cairo_pattern_get_filter, cairo_surfacepattern_args)
PHP_FE(cairo_pattern_set_extend, cairo_pattern_set_extend_args) PHP_FE(cairo_pattern_set_extend, cairo_pattern_set_extend_args)
PHP_FE(cairo_pattern_get_extend, cairo_pattern_get_extend_args) PHP_FE(cairo_pattern_get_extend, cairo_pattern_get_extend_args)
PHP_FE(cairo_pattern_add_color_stop_rgb, cairo_pattern_add_color_stop_rgb_args) PHP_FE(cairo_pattern_add_color_stop_rgb, cairo_pattern_add_color_stop_rgb_args)
PHP_FE(cairo_pattern_add_color_stop_rgba, cairo_pattern_add_color_stop_rgba_args) PHP_FE(cairo_pattern_add_color_stop_rgba, cairo_pattern_add_color_stop_rgba_args)
PHP_FE(cairo_pattern_get_color_stop_rgba, cairo_pattern_get_color_stop_rgba_args)
PHP_FE(cairo_pattern_get_color_stop_count, cairo_gradientpattern_args)
PHP_FE(cairo_pattern_create_linear, cairo_pattern_create_linear_args) PHP_FE(cairo_pattern_create_linear, cairo_pattern_create_linear_args)
PHP_FE(cairo_pattern_get_linear_points, cairo_lineargradient_args)
PHP_FE(cairo_pattern_create_radial, cairo_pattern_create_radial_args) PHP_FE(cairo_pattern_create_radial, cairo_pattern_create_radial_args)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_FE(cairo_pattern_get_color_stop_count, cairo_gradientpattern_args)
PHP_FE(cairo_pattern_get_surface, cairo_surfacepattern_args)
PHP_FE(cairo_pattern_get_rgba, cairo_solidpattern_args)
PHP_FE(cairo_pattern_get_color_stop_rgba, cairo_pattern_get_color_stop_rgba_args)
PHP_FE(cairo_pattern_get_linear_points, cairo_lineargradient_args)
PHP_FE(cairo_pattern_get_radial_circles, cairo_radialgradient_args) PHP_FE(cairo_pattern_get_radial_circles, cairo_radialgradient_args)
#endif


/* Matrix Functions */ /* Matrix Functions */
PHP_FE(cairo_matrix_init, cairo_matrix_init_args) PHP_FE(cairo_matrix_init, cairo_matrix_init_args)
Expand Down Expand Up @@ -984,7 +992,9 @@ static const zend_function_entry cairo_functions[] = {
PHP_FE(cairo_scaled_font_get_font_options, cairo_scaled_font_args) PHP_FE(cairo_scaled_font_get_font_options, cairo_scaled_font_args)
PHP_FE(cairo_scaled_font_get_font_matrix, cairo_scaled_font_args) PHP_FE(cairo_scaled_font_get_font_matrix, cairo_scaled_font_args)
PHP_FE(cairo_scaled_font_get_ctm, cairo_scaled_font_args) PHP_FE(cairo_scaled_font_get_ctm, cairo_scaled_font_args)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
PHP_FE(cairo_scaled_font_get_scale_matrix, cairo_scaled_font_args) PHP_FE(cairo_scaled_font_get_scale_matrix, cairo_scaled_font_args)
#endif
PHP_FE(cairo_scaled_font_get_type, cairo_scaled_font_args) PHP_FE(cairo_scaled_font_get_type, cairo_scaled_font_args)


/* User Font Functions /* User Font Functions
Expand Down
50 changes: 32 additions & 18 deletions cairo_context.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -712,6 +712,7 @@ PHP_FUNCTION(cairo_set_dash)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto int cairo_get_dash_count(CairoContext object) /* {{{ proto int cairo_get_dash_count(CairoContext object)
proto int CairoContext->getDashCount() proto int CairoContext->getDashCount()
This function returns the length of the dash array or 0 */ This function returns the length of the dash array or 0 */
Expand Down Expand Up @@ -772,6 +773,7 @@ PHP_FUNCTION(cairo_get_dash)
add_assoc_double(return_value, "offset", offset); add_assoc_double(return_value, "offset", offset);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto void cairo_set_fill_rule(CairoContext object, int setting) /* {{{ proto void cairo_set_fill_rule(CairoContext object, int setting)
proto void CairoContext->setFillRule(int setting) proto void CairoContext->setFillRule(int setting)
Expand Down Expand Up @@ -1114,14 +1116,13 @@ PHP_FUNCTION(cairo_clip_preserve)
} }
/* }}} */ /* }}} */


/* {{{ proto array cairo_clip_extents(CairoContext object) /* {{{ proto void cairo_reset_clip(CairoContext object)
proto array CairoContext->clipExtents() proto void CairoContext->resetclip()
Computes a bounding box in user coordinates covering the area inside the current clip. */ Reset the current clip region to its original, unrestricted state. */
PHP_FUNCTION(cairo_clip_extents) PHP_FUNCTION(cairo_reset_clip)
{ {
zval *context_zval = NULL; zval *context_zval = NULL;
cairo_context_object *context_object; cairo_context_object *context_object;
double x1, y1, x2, y2;


PHP_CAIRO_ERROR_HANDLING(FALSE) PHP_CAIRO_ERROR_HANDLING(FALSE)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &context_zval, cairo_ce_cairocontext) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &context_zval, cairo_ce_cairocontext) == FAILURE) {
Expand All @@ -1131,24 +1132,20 @@ PHP_FUNCTION(cairo_clip_extents)
PHP_CAIRO_RESTORE_ERRORS(FALSE) PHP_CAIRO_RESTORE_ERRORS(FALSE)


context_object = (cairo_context_object *)cairo_context_object_get(context_zval TSRMLS_CC); context_object = (cairo_context_object *)cairo_context_object_get(context_zval TSRMLS_CC);
cairo_clip_extents(context_object->context, &x1, &y1, &x2, &y2); cairo_reset_clip(context_object->context);
PHP_CAIRO_ERROR(cairo_status(context_object->context)); PHP_CAIRO_ERROR(cairo_status(context_object->context));

array_init(return_value);
add_next_index_double(return_value, x1);
add_next_index_double(return_value, y1);
add_next_index_double(return_value, x2);
add_next_index_double(return_value, y2);
} }
/* }}} */ /* }}} */


/* {{{ proto void cairo_reset_clip(CairoContext object) #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
proto void CairoContext->resetclip() /* {{{ proto array cairo_clip_extents(CairoContext object)
Reset the current clip region to its original, unrestricted state. */ proto array CairoContext->clipExtents()
PHP_FUNCTION(cairo_reset_clip) Computes a bounding box in user coordinates covering the area inside the current clip. */
PHP_FUNCTION(cairo_clip_extents)
{ {
zval *context_zval = NULL; zval *context_zval = NULL;
cairo_context_object *context_object; cairo_context_object *context_object;
double x1, y1, x2, y2;


PHP_CAIRO_ERROR_HANDLING(FALSE) PHP_CAIRO_ERROR_HANDLING(FALSE)
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &context_zval, cairo_ce_cairocontext) == FAILURE) { if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &context_zval, cairo_ce_cairocontext) == FAILURE) {
Expand All @@ -1158,8 +1155,14 @@ PHP_FUNCTION(cairo_reset_clip)
PHP_CAIRO_RESTORE_ERRORS(FALSE) PHP_CAIRO_RESTORE_ERRORS(FALSE)


context_object = (cairo_context_object *)cairo_context_object_get(context_zval TSRMLS_CC); context_object = (cairo_context_object *)cairo_context_object_get(context_zval TSRMLS_CC);
cairo_reset_clip(context_object->context); cairo_clip_extents(context_object->context, &x1, &y1, &x2, &y2);
PHP_CAIRO_ERROR(cairo_status(context_object->context)); PHP_CAIRO_ERROR(cairo_status(context_object->context));

array_init(return_value);
add_next_index_double(return_value, x1);
add_next_index_double(return_value, y1);
add_next_index_double(return_value, x2);
add_next_index_double(return_value, y2);
} }
/* }}} */ /* }}} */


Expand Down Expand Up @@ -1204,6 +1207,7 @@ PHP_FUNCTION(cairo_clip_rectangle_list)
cairo_rectangle_list_destroy(rectangles); cairo_rectangle_list_destroy(rectangles);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto void cairo_fill(CairoContext object) /* {{{ proto void cairo_fill(CairoContext object)
proto void CairoContext->fill() proto void CairoContext->fill()
Expand Down Expand Up @@ -2644,6 +2648,7 @@ PHP_FUNCTION(cairo_set_scaled_font)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto CairoScaledFont object cairo_get_scaled_font(CairoContext object) /* {{{ proto CairoScaledFont object cairo_get_scaled_font(CairoContext object)
proto CairoScaledFont object CairoContext->getScaledFont() proto CairoScaledFont object CairoContext->getScaledFont()
Retrieves the scaled font face selected by the context. If no scaled font has been selected or set then the default face Retrieves the scaled font face selected by the context. If no scaled font has been selected or set then the default face
Expand Down Expand Up @@ -2683,6 +2688,7 @@ PHP_FUNCTION(cairo_get_scaled_font)
cairo_scaled_font_reference(scaled_font_object->scaled_font); cairo_scaled_font_reference(scaled_font_object->scaled_font);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto array cairo_show_text(CairoContext object, string text) /* {{{ proto array cairo_show_text(CairoContext object, string text)
proto array CairoContext->showText(string text) proto array CairoContext->showText(string text)
Expand Down Expand Up @@ -2799,8 +2805,10 @@ const zend_function_entry cairo_context_methods[] = {
PHP_ME_MAPPING(setAntialias, cairo_set_antialias, CairoContext_setAntialias_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setAntialias, cairo_set_antialias, CairoContext_setAntialias_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getAntialias, cairo_get_antialias, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getAntialias, cairo_get_antialias, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(setDash, cairo_set_dash, CairoContext_setDash_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setDash, cairo_set_dash, CairoContext_setDash_args, ZEND_ACC_PUBLIC)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getDashCount, cairo_get_dash_count, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getDashCount, cairo_get_dash_count, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getDash, cairo_get_dash, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getDash, cairo_get_dash, NULL, ZEND_ACC_PUBLIC)
#endif
PHP_ME_MAPPING(setFillRule, cairo_set_fill_rule, CairoContext_setFillRule_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setFillRule, cairo_set_fill_rule, CairoContext_setFillRule_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getFillRule, cairo_get_fill_rule, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getFillRule, cairo_get_fill_rule, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(setLineCap, cairo_set_line_cap, CairoContext_setFillRule_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setLineCap, cairo_set_line_cap, CairoContext_setFillRule_args, ZEND_ACC_PUBLIC)
Expand All @@ -2817,9 +2825,13 @@ const zend_function_entry cairo_context_methods[] = {
PHP_ME_MAPPING(getTolerance, cairo_get_tolerance, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getTolerance, cairo_get_tolerance, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(clip, cairo_clip, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(clip, cairo_clip, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(clipPreserve, cairo_clip_preserve, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(clipPreserve, cairo_clip_preserve, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(clipExtents, cairo_clip_extents, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(resetClip, cairo_reset_clip, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(resetClip, cairo_reset_clip, NULL, ZEND_ACC_PUBLIC)

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(clipExtents, cairo_clip_extents, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(clipRectangleList, cairo_clip_rectangle_list, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(clipRectangleList, cairo_clip_rectangle_list, NULL, ZEND_ACC_PUBLIC)
#endif

PHP_ME_MAPPING(fill, cairo_fill, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(fill, cairo_fill, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(fillPreserve, cairo_fill_preserve, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(fillPreserve, cairo_fill_preserve, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(fillExtents, cairo_fill_extents, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(fillExtents, cairo_fill_extents, NULL, ZEND_ACC_PUBLIC)
Expand Down Expand Up @@ -2881,7 +2893,9 @@ const zend_function_entry cairo_context_methods[] = {
PHP_ME_MAPPING(setFontFace, cairo_set_font_face, CairoContext_setFontFace_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setFontFace, cairo_set_font_face, CairoContext_setFontFace_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getFontFace, cairo_get_font_face, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getFontFace, cairo_get_font_face, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(setScaledFont, cairo_set_scaled_font, CairoContext_setScaledFont_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setScaledFont, cairo_set_scaled_font, CairoContext_setScaledFont_args, ZEND_ACC_PUBLIC)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getScaledFont, cairo_get_scaled_font, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getScaledFont, cairo_get_scaled_font, NULL, ZEND_ACC_PUBLIC)
#endif
PHP_ME_MAPPING(showText, cairo_show_text, CairoContext_text_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(showText, cairo_show_text, CairoContext_text_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(fontExtents, cairo_font_extents, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(fontExtents, cairo_font_extents, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(textExtents, cairo_text_extents, CairoContext_text_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(textExtents, cairo_text_extents, CairoContext_text_args, ZEND_ACC_PUBLIC)
Expand Down
3 changes: 3 additions & 0 deletions cairo_error.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ PHP_MINIT_FUNCTION(cairo_error)
REGISTER_CAIRO_STATUS_LONG_CONST("FILE_NOT_FOUND", CAIRO_STATUS_FILE_NOT_FOUND); REGISTER_CAIRO_STATUS_LONG_CONST("FILE_NOT_FOUND", CAIRO_STATUS_FILE_NOT_FOUND);
REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_DASH", CAIRO_STATUS_INVALID_DASH); REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_DASH", CAIRO_STATUS_INVALID_DASH);
REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_DSC_COMMENT", CAIRO_STATUS_INVALID_DSC_COMMENT); REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_DSC_COMMENT", CAIRO_STATUS_INVALID_DSC_COMMENT);

#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_INDEX", CAIRO_STATUS_INVALID_INDEX); REGISTER_CAIRO_STATUS_LONG_CONST("INVALID_INDEX", CAIRO_STATUS_INVALID_INDEX);
REGISTER_CAIRO_STATUS_LONG_CONST("CLIP_NOT_REPRESENTABLE", CAIRO_STATUS_CLIP_NOT_REPRESENTABLE); REGISTER_CAIRO_STATUS_LONG_CONST("CLIP_NOT_REPRESENTABLE", CAIRO_STATUS_CLIP_NOT_REPRESENTABLE);
#endif


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0) #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 6, 0)
REGISTER_CAIRO_STATUS_LONG_CONST("TEMP_FILE_ERROR", CAIRO_STATUS_TEMP_FILE_ERROR); REGISTER_CAIRO_STATUS_LONG_CONST("TEMP_FILE_ERROR", CAIRO_STATUS_TEMP_FILE_ERROR);
Expand Down
21 changes: 21 additions & 0 deletions cairo_pattern.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ PHP_FUNCTION(cairo_pattern_add_color_stop_rgba)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto array cairo_pattern_get_color_stop_rgba(CairoPattern object) /* {{{ proto array cairo_pattern_get_color_stop_rgba(CairoPattern object)
proto array CairoGradientPattern->getColorStopRgba() proto array CairoGradientPattern->getColorStopRgba()
Gets the color and offset information at the given index for a gradient pattern */ Gets the color and offset information at the given index for a gradient pattern */
Expand Down Expand Up @@ -328,6 +329,7 @@ PHP_FUNCTION(cairo_pattern_get_color_stop_count)
RETURN_LONG(count); RETURN_LONG(count);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto int CairoGradientPattern->getExtend() /* {{{ proto int CairoGradientPattern->getExtend()
Gets the current extend mode for a pattern */ Gets the current extend mode for a pattern */
Expand Down Expand Up @@ -374,8 +376,10 @@ PHP_METHOD(CairoGradientPattern, setExtend)
const zend_function_entry cairo_gradientpattern_methods[] = { const zend_function_entry cairo_gradientpattern_methods[] = {
PHP_ME_MAPPING(addColorStopRgb, cairo_pattern_add_color_stop_rgb, CairoGradient_addColorStopRgb_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(addColorStopRgb, cairo_pattern_add_color_stop_rgb, CairoGradient_addColorStopRgb_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(addColorStopRgba, cairo_pattern_add_color_stop_rgba, CairoGradient_addColorStopRgba_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(addColorStopRgba, cairo_pattern_add_color_stop_rgba, CairoGradient_addColorStopRgba_args, ZEND_ACC_PUBLIC)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getColorStopRgba, cairo_pattern_get_color_stop_rgba, CairoGradient_getColorStopRgba_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getColorStopRgba, cairo_pattern_get_color_stop_rgba, CairoGradient_getColorStopRgba_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getColorStopCount, cairo_pattern_get_color_stop_count, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getColorStopCount, cairo_pattern_get_color_stop_count, NULL, ZEND_ACC_PUBLIC)
#endif
PHP_ME(CairoGradientPattern, getExtend, NULL, ZEND_ACC_PUBLIC) PHP_ME(CairoGradientPattern, getExtend, NULL, ZEND_ACC_PUBLIC)
PHP_ME(CairoGradientPattern, setExtend, CairoSurfacePattern_setExtend_args, ZEND_ACC_PUBLIC) PHP_ME(CairoGradientPattern, setExtend, CairoSurfacePattern_setExtend_args, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL} {NULL, NULL, NULL}
Expand Down Expand Up @@ -445,6 +449,7 @@ PHP_METHOD(CairoSolidPattern, __construct)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto array cairo_pattern_get_rgba(CairoSolidPattern object) /* {{{ proto array cairo_pattern_get_rgba(CairoSolidPattern object)
proto array CairoSolidPattern->getRgba() proto array CairoSolidPattern->getRgba()
This function returns an array with four elements, the float values of red, green, blue, and alpha from the solid pattern */ This function returns an array with four elements, the float values of red, green, blue, and alpha from the solid pattern */
Expand Down Expand Up @@ -472,11 +477,14 @@ PHP_FUNCTION(cairo_pattern_get_rgba)
add_assoc_double(return_value, "alpha", alpha); add_assoc_double(return_value, "alpha", alpha);
} }
/* }}} */ /* }}} */
#endif


/* {{{ cairo_solidpattern_methods[] */ /* {{{ cairo_solidpattern_methods[] */
const zend_function_entry cairo_solidpattern_methods[] = { const zend_function_entry cairo_solidpattern_methods[] = {
PHP_ME(CairoSolidPattern, __construct, CairoSolidPattern___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(CairoSolidPattern, __construct, CairoSolidPattern___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getRgba, cairo_pattern_get_rgba, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getRgba, cairo_pattern_get_rgba, NULL, ZEND_ACC_PUBLIC)
#endif
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
/* }}} */ /* }}} */
Expand Down Expand Up @@ -533,6 +541,7 @@ PHP_METHOD(CairoSurfacePattern, __construct)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto CairoSurface object cairo_pattern_get_surface(CairoSurfacePattern object) /* {{{ proto CairoSurface object cairo_pattern_get_surface(CairoSurfacePattern object)
proto CairoSurface object CairoSurfacePattern->getSurface() proto CairoSurface object CairoSurfacePattern->getSurface()
This function returns the surface object */ This function returns the surface object */
Expand Down Expand Up @@ -570,6 +579,7 @@ PHP_FUNCTION(cairo_pattern_get_surface)
surface_object = (cairo_surface_object *)zend_object_store_get_object(return_value TSRMLS_CC); surface_object = (cairo_surface_object *)zend_object_store_get_object(return_value TSRMLS_CC);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto int cairo_pattern_get_filter(CairoSurfacePattern object) /* {{{ proto int cairo_pattern_get_filter(CairoSurfacePattern object)
proto int CairoPattern->getFilter() proto int CairoPattern->getFilter()
Expand Down Expand Up @@ -699,7 +709,10 @@ PHP_FUNCTION(cairo_pattern_set_extend)
/* {{{ cairo_surfacepattern_methods[] */ /* {{{ cairo_surfacepattern_methods[] */
const zend_function_entry cairo_surfacepattern_methods[] = { const zend_function_entry cairo_surfacepattern_methods[] = {
PHP_ME(CairoSurfacePattern, __construct, CairoSurfacePattern___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(CairoSurfacePattern, __construct, CairoSurfacePattern___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getSurface, cairo_pattern_get_surface, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getSurface, cairo_pattern_get_surface, NULL, ZEND_ACC_PUBLIC)
#endif
PHP_ME_MAPPING(setFilter, cairo_pattern_set_filter, CairoSurfacePattern_setFilter_args, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(setFilter, cairo_pattern_set_filter, CairoSurfacePattern_setFilter_args, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getFilter, cairo_pattern_get_filter, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getFilter, cairo_pattern_get_filter, NULL, ZEND_ACC_PUBLIC)
PHP_ME(CairoSurfacePattern, setExtend, CairoSurfacePattern_setExtend_args, ZEND_ACC_PUBLIC) PHP_ME(CairoSurfacePattern, setExtend, CairoSurfacePattern_setExtend_args, ZEND_ACC_PUBLIC)
Expand Down Expand Up @@ -748,6 +761,7 @@ PHP_METHOD(CairoLinearGradient, __construct)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto void cairo_pattern_get_linear_points(CairoLinearGradient object) /* {{{ proto void cairo_pattern_get_linear_points(CairoLinearGradient object)
proto void CairoLinearGradient->getPoints() proto void CairoLinearGradient->getPoints()
Gets the gradient endpoints for a linear gradient. */ Gets the gradient endpoints for a linear gradient. */
Expand All @@ -774,13 +788,16 @@ PHP_FUNCTION(cairo_pattern_get_linear_points)
add_assoc_double(return_value, "x1", x1); add_assoc_double(return_value, "x1", x1);
add_assoc_double(return_value, "y1", y1); add_assoc_double(return_value, "y1", y1);
} }
#endif


/* }}} */ /* }}} */


/* {{{ cairo_lineargradient_methods[] */ /* {{{ cairo_lineargradient_methods[] */
const zend_function_entry cairo_lineargradient_methods[] = { const zend_function_entry cairo_lineargradient_methods[] = {
PHP_ME(CairoLinearGradient, __construct, CairoLinearGradient___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(CairoLinearGradient, __construct, CairoLinearGradient___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getPoints, cairo_pattern_get_linear_points, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getPoints, cairo_pattern_get_linear_points, NULL, ZEND_ACC_PUBLIC)
#endif
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
/* }}} */ /* }}} */
Expand Down Expand Up @@ -825,6 +842,7 @@ PHP_METHOD(CairoRadialGradient, __construct)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
/* {{{ proto void cairo_pattern_get_radial_circles(CairoRadialGradient object) /* {{{ proto void cairo_pattern_get_radial_circles(CairoRadialGradient object)
proto void CairoRadialGradient->getCircles() proto void CairoRadialGradient->getCircles()
Gets the gradient endpoint circles for a radial gradient, each specified as a center coordinate and a radius. */ Gets the gradient endpoint circles for a radial gradient, each specified as a center coordinate and a radius. */
Expand Down Expand Up @@ -853,13 +871,16 @@ PHP_FUNCTION(cairo_pattern_get_radial_circles)
add_assoc_double(return_value, "y1", y1); add_assoc_double(return_value, "y1", y1);
add_assoc_double(return_value, "r1", r1); add_assoc_double(return_value, "r1", r1);
} }
#endif


/* }}} */ /* }}} */


/* {{{ cairo_radialgradient_methods[] */ /* {{{ cairo_radialgradient_methods[] */
const zend_function_entry cairo_radialgradient_methods[] = { const zend_function_entry cairo_radialgradient_methods[] = {
PHP_ME(CairoRadialGradient, __construct, CairoRadialGradient___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR) PHP_ME(CairoRadialGradient, __construct, CairoRadialGradient___construct_args, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
PHP_ME_MAPPING(getCircles, cairo_pattern_get_radial_circles, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getCircles, cairo_pattern_get_radial_circles, NULL, ZEND_ACC_PUBLIC)
#endif
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
/* }}} */ /* }}} */
Expand Down
2 changes: 2 additions & 0 deletions cairo_ps_surface.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -440,8 +440,10 @@ PHP_MINIT_FUNCTION(cairo_ps_surface)
zend_declare_class_constant_long(cairo_ce_cairopslevel, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \ zend_declare_class_constant_long(cairo_ce_cairopslevel, const_name, sizeof(const_name)-1, (long)value TSRMLS_CC); \
REGISTER_LONG_CONSTANT(#value, value, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(#value, value, CONST_CS | CONST_PERSISTENT);


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 4, 0)
REGISTER_CAIRO_PSLEVEL_LONG_CONST("LEVEL_2", CAIRO_PS_LEVEL_2); REGISTER_CAIRO_PSLEVEL_LONG_CONST("LEVEL_2", CAIRO_PS_LEVEL_2);
REGISTER_CAIRO_PSLEVEL_LONG_CONST("LEVEL_3", CAIRO_PS_LEVEL_3); REGISTER_CAIRO_PSLEVEL_LONG_CONST("LEVEL_3", CAIRO_PS_LEVEL_3);
#endif


return SUCCESS; return SUCCESS;
} }
Expand Down
4 changes: 4 additions & 0 deletions cairo_scaled_font.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ PHP_FUNCTION(cairo_scaled_font_get_ctm)
} }
/* }}} */ /* }}} */


#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
/* {{{ proto CairoMatrix object cairo_scaled_font_get_scale_matrix (CairoScaledFont object) /* {{{ proto CairoMatrix object cairo_scaled_font_get_scale_matrix (CairoScaledFont object)
proto CairoMatrix object CairoScaledFont->getScaleMatrix() proto CairoMatrix object CairoScaledFont->getScaleMatrix()
The scale matrix is product of the font matrix and the ctm associated with the scaled font, and hence is the matrix mapping from font space to device space */ The scale matrix is product of the font matrix and the ctm associated with the scaled font, and hence is the matrix mapping from font space to device space */
Expand All @@ -440,6 +441,7 @@ PHP_FUNCTION(cairo_scaled_font_get_scale_matrix)
cairo_scaled_font_get_scale_matrix(scaled_font_object->scaled_font, matrix_object->matrix); cairo_scaled_font_get_scale_matrix(scaled_font_object->scaled_font, matrix_object->matrix);
} }
/* }}} */ /* }}} */
#endif


/* {{{ proto long cairo_scaled_font_get_type(CairoScaledFont object) /* {{{ proto long cairo_scaled_font_get_type(CairoScaledFont object)
proto long CairoScaledFont->getType() proto long CairoScaledFont->getType()
Expand Down Expand Up @@ -472,7 +474,9 @@ const zend_function_entry cairo_scaled_font_methods[] = {
PHP_ME_MAPPING(getFontOptions, cairo_scaled_font_get_font_options, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getFontOptions, cairo_scaled_font_get_font_options, NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getFontMatrix, cairo_scaled_font_get_font_matrix , NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getFontMatrix, cairo_scaled_font_get_font_matrix , NULL, ZEND_ACC_PUBLIC)
PHP_ME_MAPPING(getCtm, cairo_scaled_font_get_ctm, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getCtm, cairo_scaled_font_get_ctm, NULL, ZEND_ACC_PUBLIC)
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
PHP_ME_MAPPING(getScaleMatrix, cairo_scaled_font_get_scale_matrix, NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getScaleMatrix, cairo_scaled_font_get_scale_matrix, NULL, ZEND_ACC_PUBLIC)
#endif
PHP_ME_MAPPING(getType, cairo_scaled_font_get_type , NULL, ZEND_ACC_PUBLIC) PHP_ME_MAPPING(getType, cairo_scaled_font_get_type , NULL, ZEND_ACC_PUBLIC)
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
Expand Down
Loading

0 comments on commit 9ddd8be

Please sign in to comment.