xref: /PHP-7.3/ext/gd/php_gd.h (revision 8d3f8ca1)
1 /*
2    +----------------------------------------------------------------------+
3    | PHP Version 7                                                        |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 1997-2018 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 #ifndef PHP_GD_H
21 #define PHP_GD_H
22 
23 #if HAVE_LIBFREETYPE
24 # ifndef ENABLE_GD_TTF
25 #  define ENABLE_GD_TTF
26 # endif
27 #endif
28 
29 #if defined(HAVE_LIBGD) || defined(HAVE_GD_BUNDLED)
30 
31 /* open_basedir and safe_mode checks */
32 #define PHP_GD_CHECK_OPEN_BASEDIR(filename, errormsg)                       \
33 	if (!filename || php_check_open_basedir(filename)) {      \
34 		php_error_docref(NULL, E_WARNING, errormsg);      \
35 		RETURN_FALSE;                                               \
36 	}
37 
38 #define PHP_GDIMG_TYPE_GIF      1
39 #define PHP_GDIMG_TYPE_PNG      2
40 #define PHP_GDIMG_TYPE_JPG      3
41 #define PHP_GDIMG_TYPE_WBM      4
42 #define PHP_GDIMG_TYPE_XBM      5
43 #define PHP_GDIMG_TYPE_XPM      6
44 #define PHP_GDIMG_CONVERT_WBM   7
45 #define PHP_GDIMG_TYPE_GD       8
46 #define PHP_GDIMG_TYPE_GD2      9
47 #define PHP_GDIMG_TYPE_GD2PART  10
48 #define PHP_GDIMG_TYPE_WEBP     11
49 #define PHP_GDIMG_TYPE_BMP      12
50 
51 #define PHP_IMG_GIF    1
52 #define PHP_IMG_JPG    2
53 #define PHP_IMG_JPEG   2
54 #define PHP_IMG_PNG    4
55 #define PHP_IMG_WBMP   8
56 #define PHP_IMG_XPM   16
57 #define PHP_IMG_WEBP  32
58 #define PHP_IMG_BMP   64
59 
60 #ifdef PHP_WIN32
61 #	define PHP_GD_API __declspec(dllexport)
62 #elif defined(__GNUC__) && __GNUC__ >= 4
63 #	define PHP_GD_API __attribute__ ((visibility("default")))
64 #else
65 #	define PHP_GD_API
66 #endif
67 
68 PHPAPI extern const char php_sig_gif[3];
69 PHPAPI extern const char php_sig_jpg[3];
70 PHPAPI extern const char php_sig_png[8];
71 PHPAPI extern const char php_sig_bmp[2];
72 PHPAPI extern const char php_sig_riff[4];
73 PHPAPI extern const char php_sig_webp[4];
74 
75 extern zend_module_entry gd_module_entry;
76 #define phpext_gd_ptr &gd_module_entry
77 
78 #include "php_version.h"
79 #define PHP_GD_VERSION PHP_VERSION
80 
81 /* gd.c functions */
82 PHP_MINFO_FUNCTION(gd);
83 PHP_MINIT_FUNCTION(gd);
84 #if HAVE_GD_FREETYPE && HAVE_LIBFREETYPE
85 PHP_RSHUTDOWN_FUNCTION(gd);
86 #endif
87 
88 PHP_FUNCTION(gd_info);
89 PHP_FUNCTION(imagearc);
90 PHP_FUNCTION(imageellipse);
91 PHP_FUNCTION(imagechar);
92 PHP_FUNCTION(imagecharup);
93 PHP_FUNCTION(imageistruecolor);
94 PHP_FUNCTION(imagecolorallocate);
95 PHP_FUNCTION(imagepalettecopy);
96 PHP_FUNCTION(imagecolorat);
97 PHP_FUNCTION(imagecolorclosest);
98 PHP_FUNCTION(imagecolorclosesthwb);
99 PHP_FUNCTION(imagecolordeallocate);
100 PHP_FUNCTION(imagecolorresolve);
101 PHP_FUNCTION(imagecolorexact);
102 PHP_FUNCTION(imagecolorset);
103 PHP_FUNCTION(imagecolorstotal);
104 PHP_FUNCTION(imagecolorsforindex);
105 PHP_FUNCTION(imagecolortransparent);
106 PHP_FUNCTION(imagecopy);
107 PHP_FUNCTION(imagecopymerge);
108 PHP_FUNCTION(imagecopyresized);
109 PHP_FUNCTION(imagetypes);
110 PHP_FUNCTION(imagecreate);
111 PHP_FUNCTION(imageftbbox);
112 PHP_FUNCTION(imagefttext);
113 
114 PHP_FUNCTION(imagecreatetruecolor);
115 PHP_FUNCTION(imagetruecolortopalette);
116 PHP_FUNCTION(imagepalettetotruecolor);
117 PHP_FUNCTION(imagesetthickness);
118 PHP_FUNCTION(imagefilledellipse);
119 PHP_FUNCTION(imagefilledarc);
120 PHP_FUNCTION(imagealphablending);
121 PHP_FUNCTION(imagesavealpha);
122 PHP_FUNCTION(imagecolorallocatealpha);
123 PHP_FUNCTION(imagecolorresolvealpha);
124 PHP_FUNCTION(imagecolorclosestalpha);
125 PHP_FUNCTION(imagecolorexactalpha);
126 PHP_FUNCTION(imagecopyresampled);
127 
128 #ifdef PHP_WIN32
129 PHP_FUNCTION(imagegrabwindow);
130 PHP_FUNCTION(imagegrabscreen);
131 #endif
132 
133 PHP_FUNCTION(imagerotate);
134 
135 PHP_FUNCTION(imageflip);
136 
137 PHP_FUNCTION(imageantialias);
138 
139 PHP_FUNCTION(imagecrop);
140 PHP_FUNCTION(imagecropauto);
141 PHP_FUNCTION(imagescale);
142 PHP_FUNCTION(imageaffine);
143 PHP_FUNCTION(imageaffinematrixget);
144 PHP_FUNCTION(imageaffinematrixconcat);
145 PHP_FUNCTION(imagesetinterpolation);
146 
147 PHP_FUNCTION(imagesetthickness);
148 PHP_FUNCTION(imagecopymergegray);
149 PHP_FUNCTION(imagesetbrush);
150 PHP_FUNCTION(imagesettile);
151 PHP_FUNCTION(imagesetstyle);
152 
153 PHP_FUNCTION(imagecreatefromstring);
154 PHP_FUNCTION(imagecreatefromgif);
155 PHP_FUNCTION(imagecreatefromjpeg);
156 PHP_FUNCTION(imagecreatefromxbm);
157 PHP_FUNCTION(imagecreatefromwebp);
158 PHP_FUNCTION(imagecreatefrompng);
159 PHP_FUNCTION(imagecreatefromwbmp);
160 PHP_FUNCTION(imagecreatefromgd);
161 PHP_FUNCTION(imagecreatefromgd2);
162 PHP_FUNCTION(imagecreatefromgd2part);
163 #if defined(HAVE_GD_BMP)
164 PHP_FUNCTION(imagecreatefrombmp);
165 #endif
166 #if defined(HAVE_GD_XPM)
167 PHP_FUNCTION(imagecreatefromxpm);
168 #endif
169 
170 PHP_FUNCTION(imagegammacorrect);
171 PHP_FUNCTION(imagedestroy);
172 PHP_FUNCTION(imagefill);
173 PHP_FUNCTION(imagefilledpolygon);
174 PHP_FUNCTION(imagefilledrectangle);
175 PHP_FUNCTION(imagefilltoborder);
176 PHP_FUNCTION(imagefontwidth);
177 PHP_FUNCTION(imagefontheight);
178 
179 PHP_FUNCTION(imagegif );
180 PHP_FUNCTION(imagejpeg );
181 PHP_FUNCTION(imagepng);
182 PHP_FUNCTION(imagewebp);
183 PHP_FUNCTION(imagewbmp);
184 PHP_FUNCTION(imagegd);
185 PHP_FUNCTION(imagegd2);
186 #if defined(HAVE_GD_BMP)
187 PHP_FUNCTION(imagebmp);
188 #endif
189 
190 PHP_FUNCTION(imageinterlace);
191 PHP_FUNCTION(imageline);
192 PHP_FUNCTION(imageloadfont);
193 PHP_FUNCTION(imagepolygon);
194 PHP_FUNCTION(imageopenpolygon);
195 PHP_FUNCTION(imagerectangle);
196 PHP_FUNCTION(imagesetpixel);
197 PHP_FUNCTION(imagestring);
198 PHP_FUNCTION(imagestringup);
199 PHP_FUNCTION(imagesx);
200 PHP_FUNCTION(imagesy);
201 PHP_FUNCTION(imagesetclip);
202 PHP_FUNCTION(imagegetclip);
203 PHP_FUNCTION(imagedashedline);
204 PHP_FUNCTION(imagettfbbox);
205 PHP_FUNCTION(imagettftext);
206 
207 PHP_FUNCTION(jpeg2wbmp);
208 PHP_FUNCTION(png2wbmp);
209 PHP_FUNCTION(image2wbmp);
210 
211 PHP_FUNCTION(imagecolormatch);
212 
213 PHP_FUNCTION(imagelayereffect);
214 PHP_FUNCTION(imagexbm);
215 
216 PHP_FUNCTION(imagefilter);
217 PHP_FUNCTION(imageconvolution);
218 
219 PHP_FUNCTION(imageresolution);
220 
221 PHP_GD_API int phpi_get_le_gd(void);
222 
223 #else
224 
225 #define phpext_gd_ptr NULL
226 
227 #endif
228 
229 #endif /* PHP_GD_H */
230