mirror of
https://github.com/php/php-src.git
synced 2025-08-18 15:08:55 +02:00
- revert Harmut commit, Histogram implementation not correct and no idea
where you got the ok to add that
This commit is contained in:
parent
72c9d907d3
commit
f4ea8372a4
3 changed files with 0 additions and 50 deletions
1
NEWS
1
NEWS
|
@ -30,4 +30,3 @@ PHP NEWS
|
||||||
- Added possibility to check in which extension an internal function was
|
- Added possibility to check in which extension an internal function was
|
||||||
defined using reflection API. (Johannes)
|
defined using reflection API. (Johannes)
|
||||||
- Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus)
|
- Fixed bug #34286 (__toString() behavior is inconsistent). (Marcus)
|
||||||
- Added ImageColorHistogram() to gd extension. (Hartmut)
|
|
||||||
|
|
48
ext/gd/gd.c
48
ext/gd/gd.c
|
@ -144,7 +144,6 @@ zend_function_entry gd_functions[] = {
|
||||||
PHP_FE(imagechar, NULL)
|
PHP_FE(imagechar, NULL)
|
||||||
PHP_FE(imagecharup, NULL)
|
PHP_FE(imagecharup, NULL)
|
||||||
PHP_FE(imagecolorat, NULL)
|
PHP_FE(imagecolorat, NULL)
|
||||||
PHP_FE(imagecolorhistogram, NULL)
|
|
||||||
PHP_FE(imagecolorallocate, NULL)
|
PHP_FE(imagecolorallocate, NULL)
|
||||||
PHP_FE(imagepalettecopy, NULL)
|
PHP_FE(imagepalettecopy, NULL)
|
||||||
PHP_FE(imagecreatefromstring, NULL)
|
PHP_FE(imagecreatefromstring, NULL)
|
||||||
|
@ -2348,53 +2347,6 @@ PHP_FUNCTION(imagecolorstotal)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ proto array imagecolorhistogram(resource im)
|
|
||||||
Return color histogram for an image */
|
|
||||||
PHP_FUNCTION(imagecolorhistogram)
|
|
||||||
{
|
|
||||||
zval **IM;
|
|
||||||
gdImagePtr im;
|
|
||||||
int num_colors, x, y, n;
|
|
||||||
long *color_count;
|
|
||||||
|
|
||||||
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &IM) == FAILURE) {
|
|
||||||
ZEND_WRONG_PARAM_COUNT();
|
|
||||||
}
|
|
||||||
|
|
||||||
ZEND_FETCH_RESOURCE(im, gdImagePtr, IM, -1, "Image", le_gd);
|
|
||||||
|
|
||||||
if (!im->pixels) {
|
|
||||||
RETURN_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
num_colors = gdImageColorsTotal(im);
|
|
||||||
|
|
||||||
if (num_colors <= 0) {
|
|
||||||
RETURN_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
color_count = (long *)calloc(num_colors, sizeof(long));
|
|
||||||
|
|
||||||
for (x = 0; x < gdImageSX(im); x++) {
|
|
||||||
for (y = 0; y < gdImageSY(im); y++) {
|
|
||||||
#if HAVE_LIBGD13
|
|
||||||
color_count[im->pixels[y][x]]++;
|
|
||||||
#else
|
|
||||||
color_count[im->pixels[x][y]]++;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
array_init(return_value);
|
|
||||||
|
|
||||||
for (n = 0; n < num_colors; n++) {
|
|
||||||
add_index_long(return_value, n, color_count[n]);
|
|
||||||
}
|
|
||||||
|
|
||||||
efree(color_count);
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* {{{ proto int imagecolortransparent(resource im [, int col])
|
/* {{{ proto int imagecolortransparent(resource im [, int col])
|
||||||
Define a color as transparent */
|
Define a color as transparent */
|
||||||
PHP_FUNCTION(imagecolortransparent)
|
PHP_FUNCTION(imagecolortransparent)
|
||||||
|
|
|
@ -86,7 +86,6 @@ PHP_FUNCTION(imagecolorexact);
|
||||||
PHP_FUNCTION(imagecolorset);
|
PHP_FUNCTION(imagecolorset);
|
||||||
PHP_FUNCTION(imagecolorstotal);
|
PHP_FUNCTION(imagecolorstotal);
|
||||||
PHP_FUNCTION(imagecolorsforindex);
|
PHP_FUNCTION(imagecolorsforindex);
|
||||||
PHP_FUNCTION(imagecolorhistogram);
|
|
||||||
PHP_FUNCTION(imagecolortransparent);
|
PHP_FUNCTION(imagecolortransparent);
|
||||||
PHP_FUNCTION(imagecopy);
|
PHP_FUNCTION(imagecopy);
|
||||||
PHP_FUNCTION(imagecopymerge);
|
PHP_FUNCTION(imagecopymerge);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue