|
|
@@ -192,6 +192,13 @@ PHP_FUNCTION(pipi_create_context) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_get_command_list) { |
|
|
|
pipi_command_t const *list; |
|
|
|
pipi_command_t const *cmd; |
|
|
|
list = pipi_get_command_list(); |
|
|
|
|
|
|
|
array_init(return_value); |
|
|
|
for (cmd = list; cmd->name; cmd++) |
|
|
|
add_assoc_long(return_value, (char*) cmd->name, cmd->argc); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_command) { |
|
|
@@ -214,8 +221,7 @@ PHP_FUNCTION(pipi_load_stock) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_new) { |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -286,23 +292,20 @@ PHP_FUNCTION(pipi_get_format_name) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_measure_msd) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
RETURN_LONG(pipi_measure_msd(img1, img2)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_measure_rmsd) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
RETURN_LONG(pipi_measure_rmsd(img1, img2)); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_resize) { |
|
|
|
zval *_zval; |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -315,8 +318,7 @@ PHP_FUNCTION(pipi_resize) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_render_random) { |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -326,8 +328,7 @@ PHP_FUNCTION(pipi_render_random) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_render_bayer) { |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -337,8 +338,7 @@ PHP_FUNCTION(pipi_render_bayer) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_render_halftone) { |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -348,17 +348,12 @@ PHP_FUNCTION(pipi_render_halftone) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_rgb) { |
|
|
|
zval *_zval1; |
|
|
|
zval *_zval2; |
|
|
|
zval *_zval3; |
|
|
|
zval *_zval1, *_zval2, *_zval3; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrr", &_zval1, &_zval2, &_zval3) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
|
|
|
|
pipi_image_t *img_r; |
|
|
|
pipi_image_t *img_g; |
|
|
|
pipi_image_t *img_b; |
|
|
|
|
|
|
|
pipi_image_t *img_r, *img_g, *img_b; |
|
|
|
ZEND_FETCH_RESOURCE(img_r, pipi_image_t*, &_zval1, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
ZEND_FETCH_RESOURCE(img_g, pipi_image_t*, &_zval2, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
ZEND_FETCH_RESOURCE(img_b, pipi_image_t*, &_zval3, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
@@ -393,8 +388,7 @@ PHP_FUNCTION(pipi_blue) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_mean) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_mean(img1, img2); |
|
|
@@ -402,8 +396,7 @@ PHP_FUNCTION(pipi_mean) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_min) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_min(img1, img2); |
|
|
@@ -411,8 +404,7 @@ PHP_FUNCTION(pipi_min) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_max) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_max(img1, img2); |
|
|
@@ -420,8 +412,7 @@ PHP_FUNCTION(pipi_max) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_add) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_add(img1, img2); |
|
|
@@ -429,8 +420,7 @@ PHP_FUNCTION(pipi_add) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_sub) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_sub(img1, img2); |
|
|
@@ -438,8 +428,7 @@ PHP_FUNCTION(pipi_sub) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_difference) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_difference(img1, img2); |
|
|
@@ -447,8 +436,7 @@ PHP_FUNCTION(pipi_difference) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_multiply) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_multiply(img1, img2); |
|
|
@@ -456,8 +444,7 @@ PHP_FUNCTION(pipi_multiply) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_divide) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_divide(img1, img2); |
|
|
@@ -465,8 +452,7 @@ PHP_FUNCTION(pipi_divide) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_screen) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_screen(img1, img2); |
|
|
@@ -474,8 +460,7 @@ PHP_FUNCTION(pipi_screen) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_overlay) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_overlay(img1, img2); |
|
|
@@ -486,21 +471,65 @@ PHP_FUNCTION(pipi_convolution) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_gaussian_blur) { |
|
|
|
zval *_zval; |
|
|
|
double value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rd", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_gaussian_blur(src, value); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_gaussian_blur_ext) { |
|
|
|
zval *_zval; |
|
|
|
double v1, v2, v3, v4, v5 = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rddddd", &_zval, &v1, &v2, &v3, &v4, &v5) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_gaussian_blur_ext(src, v1, v2, v3, v4, v5); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_box_blur) { |
|
|
|
zval *_zval; |
|
|
|
long value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_box_blur(src, value); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_box_blur_ext) { |
|
|
|
zval *_zval; |
|
|
|
long m, n = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &m, &n) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_box_blur_ext(src, m, n); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_brightness) { |
|
|
|
zval *_zval; |
|
|
|
long value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) { |
|
|
|
double value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rd", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
@@ -513,8 +542,8 @@ PHP_FUNCTION(pipi_brightness) { |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_contrast) { |
|
|
|
zval *_zval; |
|
|
|
long value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) { |
|
|
|
double value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rd", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
@@ -542,6 +571,17 @@ PHP_FUNCTION(pipi_invert) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_threshold) { |
|
|
|
zval *_zval; |
|
|
|
double value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rd", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_threshold(src, value); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_hflip) { |
|
|
@@ -585,9 +625,31 @@ PHP_FUNCTION(pipi_rotate270) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_median) { |
|
|
|
zval *_zval; |
|
|
|
long value = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &_zval, &value) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_median(src, value); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_median_ext) { |
|
|
|
zval *_zval; |
|
|
|
long rx, ry = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &rx, &ry) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_median_ext(src, rx, ry); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_dilate) { |
|
|
@@ -616,8 +678,7 @@ PHP_FUNCTION(pipi_order) { |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_tile) { |
|
|
|
zval *_zval; |
|
|
|
long width = 0; |
|
|
|
long height = 0; |
|
|
|
long width, height = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &_zval, &width, &height) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
@@ -648,8 +709,7 @@ PHP_FUNCTION(pipi_dither_ediff) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_dither_ordered) { |
|
|
|
pipi_image_t *img1; |
|
|
|
pipi_image_t *img2; |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
FETCH_IMG_IMG(img1, img2); |
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_dither_ordered(img1, img2); |
|
|
@@ -657,9 +717,33 @@ PHP_FUNCTION(pipi_dither_ordered) { |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_dither_ordered_ext) { |
|
|
|
zval *_zval1; |
|
|
|
zval *_zval2; |
|
|
|
double precision, angle = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrdd", &_zval1, &_zval2, &precision, &angle) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *img1, *img2; |
|
|
|
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); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_dither_ordered_ext(img1, img2, precision, angle); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_dither_halftone) { |
|
|
|
zval *_zval; |
|
|
|
double r, angle = 0; |
|
|
|
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rdd", &_zval, &r, &angle) == FAILURE) { |
|
|
|
RETURN_FALSE; |
|
|
|
} |
|
|
|
pipi_image_t *src; |
|
|
|
ZEND_FETCH_RESOURCE(src, pipi_image_t*, &_zval, -1, PHP_PIPI_IMAGE_RES_NAME, le_pipi_image); |
|
|
|
|
|
|
|
pipi_image_t *result; |
|
|
|
result = pipi_dither_halftone(src, r, angle); |
|
|
|
ZEND_REGISTER_RESOURCE(return_value, result, le_pipi_image); |
|
|
|
} |
|
|
|
|
|
|
|
PHP_FUNCTION(pipi_dither_random) { |
|
|
|