1 /* 2 +----------------------------------------------------------------------+ 3 | PHP Version 5 | 4 +----------------------------------------------------------------------+ 5 | Copyright (c) 1997-2013 The PHP Group | 6 +----------------------------------------------------------------------+ 7 | This source file is subject to version 3.01 of the PHP license, | 8 | that is bundled with this package in the file LICENSE, and is | 9 | available through the world-wide-web at the following url: | 10 | http://www.php.net/license/3_01.txt | 11 | If you did not receive a copy of the PHP license and are unable to | 12 | obtain it through the world-wide-web, please send a note to | 13 | license@php.net so we can mail you a copy immediately. | 14 +----------------------------------------------------------------------+ 15 | Authors: Rasmus Lerdorf <rasmus@php.net> | 16 | Stig Bakken <ssb@php.net> | 17 +----------------------------------------------------------------------+ 18 */ 19 20 /* $Id$ */ 21 22 #ifndef PHP_GD_H 23 #define PHP_GD_H 24 25 #define HAVE_GDIMAGECREATEFROMPNG 1 26 27 #if HAVE_LIBFREETYPE 28 # ifndef ENABLE_GD_TTF 29 # define ENABLE_GD_TTF 30 # endif 31 #endif 32 33 #if HAVE_LIBGD 34 35 /* open_basedir and safe_mode checks */ 36 #define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg) \ 37 if (!filename || php_check_open_basedir(filename TSRMLS_CC) || \ 38 (PG(safe_mode) && !php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR)) \ 39 ) { \ 40 php_error_docref(NULL TSRMLS_CC, E_WARNING, errormsg); \ 41 RETURN_FALSE; \ 42 } 43 44 #define PHP_GDIMG_TYPE_GIF 1 45 #define PHP_GDIMG_TYPE_PNG 2 46 #define PHP_GDIMG_TYPE_JPG 3 47 #define PHP_GDIMG_TYPE_WBM 4 48 #define PHP_GDIMG_TYPE_XBM 5 49 #define PHP_GDIMG_TYPE_XPM 6 50 #define PHP_GDIMG_CONVERT_WBM 7 51 #define PHP_GDIMG_TYPE_GD 8 52 #define PHP_GDIMG_TYPE_GD2 9 53 #define PHP_GDIMG_TYPE_GD2PART 10 54 55 #ifdef PHP_WIN32 56 # define PHP_GD_API __declspec(dllexport) 57 #elif defined(__GNUC__) && __GNUC__ >= 4 58 # define PHP_GD_API __attribute__ ((visibility("default"))) 59 #else 60 # define PHP_GD_API 61 #endif 62 63 PHPAPI extern const char php_sig_gif[3]; 64 PHPAPI extern const char php_sig_jpg[3]; 65 PHPAPI extern const char php_sig_png[3]; 66 67 extern zend_module_entry gd_module_entry; 68 #define phpext_gd_ptr &gd_module_entry 69 70 /* gd.c functions */ 71 PHP_MINFO_FUNCTION(gd); 72 PHP_MINIT_FUNCTION(gd); 73 #if HAVE_LIBT1 || HAVE_GD_FONTMUTEX 74 PHP_MSHUTDOWN_FUNCTION(gd); 75 #endif 76 #if HAVE_GD_STRINGFT 77 PHP_RSHUTDOWN_FUNCTION(gd); 78 #endif 79 80 PHP_FUNCTION(gd_info); 81 PHP_FUNCTION(imagearc); 82 PHP_FUNCTION(imageellipse); 83 PHP_FUNCTION(imagechar); 84 PHP_FUNCTION(imagecharup); 85 PHP_FUNCTION(imageistruecolor); 86 PHP_FUNCTION(imagecolorallocate); 87 PHP_FUNCTION(imagepalettecopy); 88 PHP_FUNCTION(imagecolorat); 89 PHP_FUNCTION(imagecolorclosest); 90 PHP_FUNCTION(imagecolorclosesthwb); 91 PHP_FUNCTION(imagecolordeallocate); 92 PHP_FUNCTION(imagecolorresolve); 93 PHP_FUNCTION(imagecolorexact); 94 PHP_FUNCTION(imagecolorset); 95 PHP_FUNCTION(imagecolorstotal); 96 PHP_FUNCTION(imagecolorsforindex); 97 PHP_FUNCTION(imagecolortransparent); 98 PHP_FUNCTION(imagecopy); 99 PHP_FUNCTION(imagecopymerge); 100 PHP_FUNCTION(imagecopyresized); 101 PHP_FUNCTION(imagetypes); 102 PHP_FUNCTION(imagecreate); 103 PHP_FUNCTION(imageftbbox); 104 PHP_FUNCTION(imagefttext); 105 106 PHP_FUNCTION(imagecreatetruecolor); 107 PHP_FUNCTION(imagetruecolortopalette); 108 PHP_FUNCTION(imagesetthickness); 109 PHP_FUNCTION(imagefilledellipse); 110 PHP_FUNCTION(imagefilledarc); 111 PHP_FUNCTION(imagealphablending); 112 PHP_FUNCTION(imagesavealpha); 113 PHP_FUNCTION(imagecolorallocatealpha); 114 PHP_FUNCTION(imagecolorresolvealpha); 115 PHP_FUNCTION(imagecolorclosestalpha); 116 PHP_FUNCTION(imagecolorexactalpha); 117 PHP_FUNCTION(imagecopyresampled); 118 119 #ifdef PHP_WIN32 120 PHP_FUNCTION(imagegrabwindow); 121 PHP_FUNCTION(imagegrabscreen); 122 #endif 123 124 PHP_FUNCTION(imagerotate); 125 126 #ifdef HAVE_GD_BUNDLED 127 PHP_FUNCTION(imageantialias); 128 #endif 129 130 PHP_FUNCTION(imagesetthickness); 131 PHP_FUNCTION(imagecopymergegray); 132 PHP_FUNCTION(imagesetbrush); 133 PHP_FUNCTION(imagesettile); 134 PHP_FUNCTION(imagesetstyle); 135 136 PHP_FUNCTION(imagecreatefromstring); 137 PHP_FUNCTION(imagecreatefromgif); 138 PHP_FUNCTION(imagecreatefromjpeg); 139 PHP_FUNCTION(imagecreatefromxbm); 140 PHP_FUNCTION(imagecreatefrompng); 141 PHP_FUNCTION(imagecreatefromwbmp); 142 PHP_FUNCTION(imagecreatefromgd); 143 PHP_FUNCTION(imagecreatefromgd2); 144 PHP_FUNCTION(imagecreatefromgd2part); 145 #if defined(HAVE_GD_XPM) && defined(HAVE_GD_BUNDLED) 146 PHP_FUNCTION(imagecreatefromxpm); 147 #endif 148 149 PHP_FUNCTION(imagegammacorrect); 150 PHP_FUNCTION(imagedestroy); 151 PHP_FUNCTION(imagefill); 152 PHP_FUNCTION(imagefilledpolygon); 153 PHP_FUNCTION(imagefilledrectangle); 154 PHP_FUNCTION(imagefilltoborder); 155 PHP_FUNCTION(imagefontwidth); 156 PHP_FUNCTION(imagefontheight); 157 158 PHP_FUNCTION(imagegif ); 159 PHP_FUNCTION(imagejpeg ); 160 PHP_FUNCTION(imagepng); 161 PHP_FUNCTION(imagewbmp); 162 PHP_FUNCTION(imagegd); 163 PHP_FUNCTION(imagegd2); 164 165 PHP_FUNCTION(imageinterlace); 166 PHP_FUNCTION(imageline); 167 PHP_FUNCTION(imageloadfont); 168 PHP_FUNCTION(imagepolygon); 169 PHP_FUNCTION(imagerectangle); 170 PHP_FUNCTION(imagesetpixel); 171 PHP_FUNCTION(imagestring); 172 PHP_FUNCTION(imagestringup); 173 PHP_FUNCTION(imagesx); 174 PHP_FUNCTION(imagesy); 175 PHP_FUNCTION(imagedashedline); 176 PHP_FUNCTION(imagettfbbox); 177 PHP_FUNCTION(imagettftext); 178 PHP_FUNCTION(imagepsloadfont); 179 /* 180 PHP_FUNCTION(imagepscopyfont); 181 */ 182 PHP_FUNCTION(imagepsfreefont); 183 PHP_FUNCTION(imagepsencodefont); 184 PHP_FUNCTION(imagepsextendfont); 185 PHP_FUNCTION(imagepsslantfont); 186 PHP_FUNCTION(imagepstext); 187 PHP_FUNCTION(imagepsbbox); 188 189 PHP_FUNCTION(jpeg2wbmp); 190 PHP_FUNCTION(png2wbmp); 191 PHP_FUNCTION(image2wbmp); 192 193 PHP_FUNCTION(imagecolormatch); 194 195 #if HAVE_GD_BUNDLED 196 PHP_FUNCTION(imagelayereffect); 197 PHP_FUNCTION(imagexbm); 198 #endif 199 200 PHP_FUNCTION(imagefilter); 201 PHP_FUNCTION(imageconvolution); 202 203 PHP_GD_API int phpi_get_le_gd(void); 204 205 #else 206 207 #define phpext_gd_ptr NULL 208 209 #endif 210 211 #endif /* PHP_GD_H */ 212