xref: /PHP-8.1/ext/gd/gd.stub.php (revision 220f0f55)
1<?php
2
3/** @generate-class-entries */
4
5/**
6 * @strict-properties
7 * @not-serializable
8 */
9final class GdImage {}
10
11/**
12 * @strict-properties
13 * @not-serializable
14 */
15final class GdFont {}
16
17/**
18 * @return array<string, string|bool>
19 * @refcount 1
20 */
21function gd_info(): array {}
22
23function imageloadfont(string $filename): GdFont|false {}
24
25function imagesetstyle(GdImage $image, array $style): bool {}
26
27/** @refcount 1 */
28function imagecreatetruecolor(int $width, int $height): GdImage|false {}
29
30function imageistruecolor(GdImage $image): bool {}
31
32function imagetruecolortopalette(GdImage $image, bool $dither, int $num_colors): bool {}
33
34function imagepalettetotruecolor(GdImage $image): bool {}
35
36function imagecolormatch(GdImage $image1, GdImage $image2): bool {}
37
38function imagesetthickness(GdImage $image, int $thickness): bool {}
39
40function imagefilledellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): bool {}
41
42function imagefilledarc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color, int $style): bool {}
43
44function imagealphablending(GdImage $image, bool $enable): bool {}
45
46function imagesavealpha(GdImage $image, bool $enable): bool {}
47
48function imagelayereffect(GdImage $image, int $effect): bool {}
49
50function imagecolorallocatealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int|false {}
51
52function imagecolorresolvealpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}
53
54function imagecolorclosestalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}
55
56function imagecolorexactalpha(GdImage $image, int $red, int $green, int $blue, int $alpha): int {}
57
58function imagecopyresampled(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): bool {}
59
60#ifdef PHP_WIN32
61
62/** @refcount 1 */
63function imagegrabwindow(int $handle, bool $client_area = false): GdImage|false {}
64
65/** @refcount 1 */
66function imagegrabscreen(): GdImage|false {}
67
68#endif
69
70// TODO: $ignore_transparent is ignored???
71/** @refcount 1 */
72function imagerotate(GdImage $image, float $angle, int $background_color, bool $ignore_transparent = false): GdImage|false {}
73
74function imagesettile(GdImage $image, GdImage $tile): bool {}
75
76function imagesetbrush(GdImage $image, GdImage $brush): bool {}
77
78/** @refcount 1 */
79function imagecreate(int $width, int $height): GdImage|false {}
80
81function imagetypes(): int {}
82
83/** @refcount 1 */
84function imagecreatefromstring(string $data): GdImage|false {}
85
86#ifdef HAVE_GD_AVIF
87/** @refcount 1 */
88function imagecreatefromavif(string $filename): GdImage|false {}
89#endif
90
91/** @refcount 1 */
92function imagecreatefromgif(string $filename): GdImage|false {}
93
94#ifdef HAVE_GD_JPG
95/** @refcount 1 */
96function imagecreatefromjpeg(string $filename): GdImage|false {}
97#endif
98
99#ifdef HAVE_GD_PNG
100/** @refcount 1 */
101function imagecreatefrompng(string $filename): GdImage|false {}
102#endif
103
104#ifdef HAVE_GD_WEBP
105/** @refcount 1 */
106function imagecreatefromwebp(string $filename): GdImage|false {}
107#endif
108
109/** @refcount 1 */
110function imagecreatefromxbm(string $filename): GdImage|false {}
111
112#ifdef HAVE_GD_XPM
113/** @refcount 1 */
114function imagecreatefromxpm(string $filename): GdImage|false {}
115#endif
116
117/** @refcount 1 */
118function imagecreatefromwbmp(string $filename): GdImage|false {}
119
120/** @refcount 1 */
121function imagecreatefromgd(string $filename): GdImage|false {}
122
123/** @refcount 1 */
124function imagecreatefromgd2(string $filename): GdImage|false {}
125
126/** @refcount 1 */
127function imagecreatefromgd2part(string $filename, int $x, int $y, int $width, int $height): GdImage|false {}
128
129#ifdef HAVE_GD_BMP
130/** @refcount 1 */
131function imagecreatefrombmp(string $filename): GdImage|false {}
132#endif
133
134#ifdef HAVE_GD_TGA
135function imagecreatefromtga(string $filename): GdImage|false {}
136#endif
137
138function imagexbm(GdImage $image, ?string $filename, ?int $foreground_color = null): bool {}
139
140#ifdef HAVE_GD_AVIF
141/** @param resource|string|null $file */
142function imageavif(GdImage $image, $file = null, int $quality = -1, int $speed = -1): bool {}
143#endif
144
145/** @param resource|string|null $file */
146function imagegif(GdImage $image, $file = null): bool {}
147
148#ifdef HAVE_GD_PNG
149/** @param resource|string|null $file */
150function imagepng(GdImage $image, $file = null, int $quality = -1, int $filters = -1): bool {}
151#endif
152
153#ifdef HAVE_GD_WEBP
154/** @param resource|string|null $file */
155function imagewebp(GdImage $image, $file = null, int $quality = -1): bool {}
156#endif
157
158#ifdef HAVE_GD_JPG
159/** @param resource|string|null $file */
160function imagejpeg(GdImage $image, $file = null, int $quality = -1): bool {}
161#endif
162
163/** @param resource|string|null $file */
164function imagewbmp(GdImage $image, $file = null, ?int $foreground_color = null): bool {}
165
166function imagegd(GdImage $image, ?string $file = null): bool {}
167
168function imagegd2(GdImage $image, ?string $file = null, int $chunk_size = UNKNOWN, int $mode = UNKNOWN): bool {}
169
170#ifdef HAVE_GD_BMP
171/** @param resource|string|null $file */
172function imagebmp(GdImage $image, $file = null, bool $compressed = true): bool {}
173#endif
174
175function imagedestroy(GdImage $image): bool {}
176
177function imagecolorallocate(GdImage $image, int $red, int $green, int $blue): int|false {}
178
179function imagepalettecopy(GdImage $dst, GdImage $src): void {}
180
181function imagecolorat(GdImage $image, int $x, int $y): int|false {}
182
183function imagecolorclosest(GdImage $image, int $red, int $green, int $blue): int {}
184
185function imagecolorclosesthwb(GdImage $image, int $red, int $green, int $blue): int {}
186
187function imagecolordeallocate(GdImage $image, int $color): bool {}
188
189function imagecolorresolve(GdImage $image, int $red, int $green, int $blue): int {}
190
191function imagecolorexact(GdImage $image, int $red, int $green, int $blue): int {}
192
193/** @return false|null */
194function imagecolorset(GdImage $image, int $color, int $red, int $green, int $blue, int $alpha = 0): ?bool {}
195
196/**
197 * @return array<string, int>
198 * @refcount 1
199 */
200function imagecolorsforindex(GdImage $image, int $color): array {}
201
202function imagegammacorrect(GdImage $image, float $input_gamma, float $output_gamma): bool {}
203
204function imagesetpixel(GdImage $image, int $x, int $y, int $color): bool {}
205
206function imageline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool {}
207
208function imagedashedline(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool {}
209
210function imagerectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool {}
211
212function imagefilledrectangle(GdImage $image, int $x1, int $y1, int $x2, int $y2, int $color): bool {}
213
214function imagearc(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $start_angle, int $end_angle, int $color): bool {}
215
216function imageellipse(GdImage $image, int $center_x, int $center_y, int $width, int $height, int $color): bool {}
217
218function imagefilltoborder(GdImage $image, int $x, int $y, int $border_color, int $color): bool {}
219
220function imagefill(GdImage $image, int $x, int $y, int $color): bool {}
221
222function imagecolorstotal(GdImage $image): int {}
223
224function imagecolortransparent(GdImage $image, ?int $color = null): int {}
225
226function imageinterlace(GdImage $image, ?bool $enable = null): bool {}
227
228function imagepolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
229
230function imageopenpolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
231
232function imagefilledpolygon(GdImage $image, array $points, int $num_points_or_color, ?int $color = null): bool {}
233
234function imagefontwidth(GdFont|int $font): int {}
235
236function imagefontheight(GdFont|int $font): int {}
237
238function imagechar(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): bool {}
239
240function imagecharup(GdImage $image, GdFont|int $font, int $x, int $y, string $char, int $color): bool {}
241
242function imagestring(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): bool {}
243
244function imagestringup(GdImage $image, GdFont|int $font, int $x, int $y, string $string, int $color): bool {}
245
246function imagecopy(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height): bool {}
247
248function imagecopymerge(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): bool {}
249
250function imagecopymergegray(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $src_width, int $src_height, int $pct): bool {}
251
252function imagecopyresized(GdImage $dst_image, GdImage $src_image, int $dst_x, int $dst_y, int $src_x, int $src_y, int $dst_width, int $dst_height, int $src_width, int $src_height): bool {}
253
254function imagesx(GdImage $image): int {}
255
256function imagesy(GdImage $image): int {}
257
258function imagesetclip(GdImage $image, int $x1, int $y1, int $x2, int $y2): bool {}
259
260/**
261 * @return array<int, int>
262 * @refcount 1
263 */
264function imagegetclip(GdImage $image): array {}
265
266#ifdef HAVE_GD_FREETYPE
267/**
268 * @return array<int, int>|false
269 * @refcount 1
270 */
271function imageftbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array|false {}
272
273/**
274 * @return array<int, int>|false
275 * @refcount 1
276 */
277function imagefttext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {}
278
279/**
280 * @return array<int, int>|false
281 * @alias imageftbbox
282 */
283function imagettfbbox(float $size, float $angle, string $font_filename, string $string, array $options = []): array|false {}
284
285/**
286 * @return array<int, int>|false
287 * @alias imagefttext
288 */
289function imagettftext(GdImage $image, float $size, float $angle, int $x, int $y, int $color, string $font_filename, string $text, array $options = []): array|false {}
290#endif
291
292/** @param array|int|float|bool $args */
293function imagefilter(GdImage $image, int $filter, ...$args): bool {}
294
295function imageconvolution(GdImage $image, array $matrix, float $divisor, float $offset): bool {}
296
297function imageflip(GdImage $image, int $mode): bool {}
298
299function imageantialias(GdImage $image, bool $enable): bool {}
300
301/** @refcount 1 */
302function imagecrop(GdImage $image, array $rectangle): GdImage|false {}
303
304/** @refcount 1 */
305function imagecropauto(GdImage $image, int $mode = IMG_CROP_DEFAULT, float $threshold = 0.5, int $color = -1): GdImage|false {}
306
307/** @refcount 1 */
308function imagescale(GdImage $image, int $width, int $height = -1, int $mode = IMG_BILINEAR_FIXED): GdImage|false {}
309
310/** @refcount 1 */
311function imageaffine(GdImage $image, array $affine, ?array $clip = null): GdImage|false {}
312
313/**
314 * @param array|float $options
315 * @refcount 1
316 * @return array<int, float>|false
317 */
318function imageaffinematrixget(int $type, $options): array|false {}
319
320/**
321 * @return array<int, float>|false
322 * @refcount 1
323 */
324function imageaffinematrixconcat(array $matrix1, array $matrix2): array|false {}
325
326function imagegetinterpolation(GdImage $image): int {}
327
328function imagesetinterpolation(GdImage $image, int $method = IMG_BILINEAR_FIXED): bool {}
329
330/**
331 * @return array<int, int>|true
332 * @refcount 1
333 */
334function imageresolution(GdImage $image, ?int $resolution_x = null, ?int $resolution_y = null): array|bool {}
335