|
|
@@ -193,6 +193,8 @@ PHP_MINIT_FUNCTION(pipi) { |
|
|
|
ZEND_FETCH_RESOURCE(img1, pipi_image_t*, &_zval1, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); \ |
|
|
|
ZEND_FETCH_RESOURCE(img2, pipi_image_t*, &_zval2, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
#define RETURN_SUCCESS(i) \ |
|
|
|
RETURN_BOOL((i) == 0); |
|
|
|
|
|
|
|
|
|
|
|
//--------PIPI'S FUNCTIONS---------// |
|
|
@@ -201,6 +203,9 @@ PHP_FUNCTION(pipi_get_color_from_string) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_get_version) { |
|
|
|
if (ZEND_NUM_ARGS() != 0) { |
|
|
|
WRONG_PARAM_COUNT; |
|
|
|
} |
|
|
|
RETURN_STRING(estrdup(pipi_get_version()), 0); |
|
|
|
} |
|
|
|
|
|
|
@@ -231,9 +236,9 @@ PHP_FUNCTION(pipi_command) { |
|
|
|
ZEND_FETCH_RESOURCE(ctxt, pipi_context_t*, &res, -1, PHP_PIPI_CONTEXT_RES_NAME, le_pipi_context); |
|
|
|
|
|
|
|
if (arg2_len != 0) { |
|
|
|
RETURN_BOOL(pipi_command(ctxt, arg1, arg2) == 0); |
|
|
|
RETURN_SUCCESS(pipi_command(ctxt, arg1, arg2)); |
|
|
|
} |
|
|
|
RETURN_BOOL(pipi_command(ctxt, arg1) == 0); |
|
|
|
RETURN_SUCCESS(pipi_command(ctxt, arg1)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_load) { |
|
|
@@ -280,7 +285,7 @@ PHP_FUNCTION(pipi_save) { |
|
|
|
pipi_image_t *img; |
|
|
|
ZEND_FETCH_RESOURCE(img, pipi_image_t*, &res, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
RETURN_BOOL(pipi_save(img, str) == 0); |
|
|
|
RETURN_SUCCESS(pipi_save(img, str)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_set_gamma) { |
|
|
@@ -690,6 +695,14 @@ PHP_FUNCTION(pipi_flood_fill) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_draw_line) { |
|
|
|
zval *_zval; |
|
|
|
long x1, y1, x2, y2, color, style = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rlllll|l", &_zval, &x1, &y1, &x2, &y2, &color, &style) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *img; |
|
|
|
ZEND_FETCH_RESOURCE(img, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
RETURN_SUCCESS(pipi_draw_line(img, x1, y1, x2, y2, color, style)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_draw_rectangle) { |
|
|
@@ -766,6 +779,9 @@ PHP_FUNCTION(pipi_dither_24to16) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_new_histogram) { |
|
|
|
if (ZEND_NUM_ARGS() != 0) { |
|
|
|
WRONG_PARAM_COUNT; |
|
|
|
} |
|
|
|
pipi_histogram_t *histogram; |
|
|
|
histogram = pipi_new_histogram(); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, histogram, le_pipi_histogram); |
|
|
@@ -782,7 +798,7 @@ PHP_FUNCTION(pipi_get_image_histogram) { |
|
|
|
ZEND_FETCH_RESOURCE(image, pipi_image_t*, &_zval_img, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
ZEND_FETCH_RESOURCE(histogram, pipi_histogram_t*, &_zval_hst, -1, PHP_PIPI_HISTOGRAM_RES_NAME, le_pipi_histogram); |
|
|
|
|
|
|
|
RETURN_BOOL(pipi_get_image_histogram(image, histogram, flags) == 0); |
|
|
|
RETURN_SUCCESS(pipi_get_image_histogram(image, histogram, flags)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_render_histogram) { |
|
|
@@ -796,7 +812,7 @@ PHP_FUNCTION(pipi_render_histogram) { |
|
|
|
ZEND_FETCH_RESOURCE(image, pipi_image_t*, &_zval_img, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
ZEND_FETCH_RESOURCE(histogram, pipi_histogram_t*, &_zval_hst, -1, PHP_PIPI_HISTOGRAM_RES_NAME, le_pipi_histogram); |
|
|
|
|
|
|
|
RETURN_BOOL(pipi_render_histogram(image, histogram, flags) == 0); |
|
|
|
RETURN_SUCCESS(pipi_render_histogram(image, histogram, flags)); |
|
|
|
} |
|
|
|
|
|
|
|
|