Back to index

php5  5.3.10
Defines | Functions
gd.c File Reference
#include "php.h"
#include "php_ini.h"
#include "ext/standard/head.h"
#include <math.h>
#include "SAPI.h"
#include "php_gd.h"
#include "ext/standard/info.h"
#include "php_open_temporary_file.h"

Go to the source code of this file.

Defines

#define PHP_GD_SINGLE_RES

Functions

static void php_image_filter_negate (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_grayscale (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_brightness (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_contrast (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_colorize (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_edgedetect (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_emboss (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_gaussian_blur (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_selective_blur (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_mean_removal (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_smooth (INTERNAL_FUNCTION_PARAMETERS)
static void php_image_filter_pixelate (INTERNAL_FUNCTION_PARAMETERS)
 PHP_FUNCTION (imagefilter)
 PHP_FUNCTION (imageconvolution)

Define Documentation

Value:
zval *SIM;    \
	gdImagePtr im_src;  \
       if (zend_parse_parameters(1 TSRMLS_CC, "r", &SIM) == FAILURE) {       \
              RETURN_FALSE; \
       }      \
       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);    \
       if (im_src == NULL) {       \
              RETURN_FALSE; \
       }

Definition at line 4729 of file gd.c.


Function Documentation

PHP_FUNCTION ( imagefilter  )

Definition at line 4937 of file gd.c.

{
       zval *tmp;

       typedef void (*image_filter)(INTERNAL_FUNCTION_PARAMETERS);
       long filtertype;
       image_filter filters[] =
       {
              php_image_filter_negate ,
              php_image_filter_grayscale,
              php_image_filter_brightness,
              php_image_filter_contrast,
              php_image_filter_colorize,
              php_image_filter_edgedetect,
              php_image_filter_emboss,
              php_image_filter_gaussian_blur,
              php_image_filter_selective_blur,
              php_image_filter_mean_removal,
              php_image_filter_smooth,
              php_image_filter_pixelate
       };

       if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > IMAGE_FILTER_MAX_ARGS) {
              WRONG_PARAM_COUNT;
       } else if (zend_parse_parameters(2 TSRMLS_CC, "rl", &tmp, &filtertype) == FAILURE) {
              return;
       }

       if (filtertype >= 0 && filtertype <= IMAGE_FILTER_MAX) {
              filters[filtertype](INTERNAL_FUNCTION_PARAM_PASSTHRU);
       }
}

Here is the call graph for this function:

PHP_FUNCTION ( imageconvolution  )

Definition at line 4973 of file gd.c.

{
       zval *SIM, *hash_matrix;
       zval **var = NULL, **var2 = NULL;
       gdImagePtr im_src = NULL;
       double div, offset;
       int nelem, i, j, res;
       float matrix[3][3] = {{0,0,0}, {0,0,0}, {0,0,0}};

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "radd", &SIM, &hash_matrix, &div, &offset) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);

       nelem = zend_hash_num_elements(Z_ARRVAL_P(hash_matrix));
       if (nelem != 3) {
              php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have 3x3 array");
              RETURN_FALSE;
       }

       for (i=0; i<3; i++) {
              if (zend_hash_index_find(Z_ARRVAL_P(hash_matrix), (i), (void **) &var) == SUCCESS && Z_TYPE_PP(var) == IS_ARRAY) {
                     if (Z_TYPE_PP(var) != IS_ARRAY || zend_hash_num_elements(Z_ARRVAL_PP(var)) != 3 ) {
                            php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have 3x3 array");
                            RETURN_FALSE;
                     }

                     for (j=0; j<3; j++) {
                            if (zend_hash_index_find(Z_ARRVAL_PP(var), (j), (void **) &var2) == SUCCESS) {
                                   SEPARATE_ZVAL(var2);
                                   convert_to_double(*var2);
                                   matrix[i][j] = Z_DVAL_PP(var2);
                            } else {
                                   php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have a 3x3 matrix");
                                   RETURN_FALSE;
                            }
                     }
              }
       }
       res = gdImageConvolution(im_src, matrix, div, offset);

       if (res) {
              RETURN_TRUE;
       } else {
              RETURN_FALSE;
       }
}

Here is the call graph for this function:

Definition at line 4762 of file gd.c.

{
       zval *SIM;
       gdImagePtr im_src;
       long brightness, tmp;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zll", &SIM, &tmp, &brightness) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);

       if (im_src == NULL) {
              RETURN_FALSE;
       }

       if (gdImageBrightness(im_src, (int)brightness) == 1) {
              RETURN_TRUE;
       }

       RETURN_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4808 of file gd.c.

{
       zval *SIM;
       gdImagePtr im_src;
       long r,g,b,tmp;
       long a = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllll|l", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);

       if (im_src == NULL) {
              RETURN_FALSE;
       }

       if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) {
              RETURN_TRUE;
       }

       RETURN_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4785 of file gd.c.

{
       zval *SIM;
       gdImagePtr im_src;
       long contrast, tmp;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &SIM, &tmp, &contrast) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);

       if (im_src == NULL) {
              RETURN_FALSE;
       }

       if (gdImageContrast(im_src, (int)contrast) == 1) {
              RETURN_TRUE;
       }

       RETURN_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4832 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4843 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4854 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4751 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4876 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4740 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4911 of file gd.c.

{
       zval *IM;
       gdImagePtr im;
       long tmp, blocksize;
       zend_bool mode = 0;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll|b", &IM, &tmp, &blocksize, &mode) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd);

       if (im == NULL) {
              RETURN_FALSE;
       }

       if (gdImagePixelate(im, (int) blocksize, (const unsigned int) mode)) {
              RETURN_TRUE;
       }

       RETURN_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4865 of file gd.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 4887 of file gd.c.

{
       zval *SIM;
       long tmp;
       gdImagePtr im_src;
       double weight;

       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rld", &SIM, &tmp, &weight) == FAILURE) {
              RETURN_FALSE;
       }

       ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, "Image", le_gd);

       if (im_src == NULL) {
              RETURN_FALSE;
       }

       if (gdImageSmooth(im_src, (float)weight)==1) {
              RETURN_TRUE;
       }

       RETURN_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function: