Repository navigation
Expand file tree
/
Copy pathcodecs.stub.php
More file actions
388 lines (328 loc) · 8.47 KB
/
Copy pathcodecs.stub.php
File metadata and controls
388 lines (328 loc) · 8.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
<?php
/**
* SPDX-License-Identifier: Apache-2.0
* Copyright 2026 Fojle Rabbi (Rabib)
*
* @generate-class-entries
*/
namespace Codecs
{
enum Format: string
{
case Avif = 'avif';
case JpegXl = 'jxl';
case Heif = 'heif';
}
enum AlphaMode: string
{
case Straight = 'straight';
case Premultiplied = 'premultiplied';
}
enum ChromaSubsampling: string
{
case Yuv444 = '444';
case Yuv422 = '422';
case Yuv420 = '420';
case Yuv400 = '400';
}
enum MatrixCoefficients: int
{
case Identity = 0;
case Bt709 = 1;
case Bt601 = 5;
case Bt2020Ncl = 9;
case YcgcoRe = 13;
case YcgcoRo = 14;
}
enum Orientation: int
{
case TopLeft = 1;
case TopRight = 2;
case BottomRight = 3;
case BottomLeft = 4;
case LeftTop = 5;
case RightTop = 6;
case RightBottom = 7;
case LeftBottom = 8;
}
enum MetadataPolicy: string
{
case Preserve = 'preserve';
case Strip = 'strip';
}
enum ErrorCode: int
{
case Ok = 0;
case Container = 1;
case Bitstream = 2;
case Metadata = 3;
case Limit = 4;
case Dimension = 5;
case Pixels = 6;
case Unsupported = 7;
case HeifNotCompiled = 8;
case StreamIo = 9;
case OutOfMemory = 10;
case Internal = 11;
}
class Exception extends \RuntimeException
{
public ErrorCode $errorCode;
public function getErrorCode(): ErrorCode
{
}
}
class DecodeException extends Exception
{
}
class EncodeException extends Exception
{
}
class LimitException extends Exception
{
}
class UnsupportedFormatException extends Exception
{
}
class CorruptDataException extends Exception
{
}
class StreamException extends Exception
{
}
interface EncodeOptions
{
}
final readonly class Cicp
{
public int $colourPrimaries;
public int $transferCharacteristics;
public int $matrixCoefficients;
public bool $fullRange;
public function __construct(
int $colourPrimaries,
int $transferCharacteristics,
int $matrixCoefficients,
bool $fullRange
) {
}
}
final readonly class DecodeOptions
{
public int $maxDimension;
public int $maxPixels;
public bool $ignoreIcc;
public bool $ignoreExif;
public bool $ignoreXmp;
public bool $keepOrientation;
public bool $firstFrameOnly;
public ?MatrixCoefficients $matrixOverride;
public ?int $threads;
public function __construct(
int $maxDimension = 0,
int $maxPixels = 0,
bool $ignoreIcc = false,
bool $ignoreExif = false,
bool $ignoreXmp = false,
bool $keepOrientation = false,
bool $firstFrameOnly = false,
?MatrixCoefficients $matrixOverride = null,
?int $threads = null
) {
}
}
final readonly class AvifEncodeOptions implements EncodeOptions
{
public int $quality;
public ?int $qualityAlpha;
public int $speed;
public ChromaSubsampling $subsampling;
public MatrixCoefficients $matrix;
public bool $lossless;
public AlphaMode $alpha;
public MetadataPolicy $metadata;
public ?int $threads;
public function __construct(
int $quality = 60,
?int $qualityAlpha = null,
int $speed = 6,
ChromaSubsampling $subsampling = ChromaSubsampling::Yuv420,
MatrixCoefficients $matrix = MatrixCoefficients::Bt601,
bool $lossless = false,
AlphaMode $alpha = AlphaMode::Straight,
MetadataPolicy $metadata = MetadataPolicy::Preserve,
?int $threads = null
) {
}
}
final readonly class JxlEncodeOptions implements EncodeOptions
{
public int $quality;
public int $effort;
public int $decodingSpeed;
public bool $lossless;
public AlphaMode $alpha;
public MetadataPolicy $metadata;
public ?int $threads;
public function __construct(
int $quality = 90,
int $effort = 7,
int $decodingSpeed = 0,
bool $lossless = false,
AlphaMode $alpha = AlphaMode::Straight,
MetadataPolicy $metadata = MetadataPolicy::Preserve,
?int $threads = null
) {
}
}
final readonly class Info
{
public Format $format;
public int $width;
public int $height;
public int $bitDepth;
public bool $alpha;
public Cicp $cicp;
public ?string $iccProfile;
public Orientation $orientation;
public int $frameCount;
public bool $animated;
public int $byteSize;
public array $metadataBlocks;
/** @param array $metadataBlocks */
public function __construct(
Format $format,
int $width,
int $height,
int $bitDepth,
bool $alpha,
Cicp $cicp,
?string $iccProfile,
Orientation $orientation,
int $frameCount,
bool $animated,
int $byteSize,
array $metadataBlocks
) {
}
}
final class Image
{
public static function fromPixels(int $width, int $height, string $rgba16, AlphaMode $alpha): Image
{
}
public static function fromPng(string $png): Image
{
}
public static function fromGd(object $gd): Image
{
}
public function width(): int
{
}
public function height(): int
{
}
public function bitDepth(): int
{
}
public function alphaMode(): AlphaMode
{
}
public function provenance(): string
{
}
public function cicp(): Cicp
{
}
public function iccProfile(): ?string
{
}
public function exif(): ?string
{
}
public function xmp(): ?string
{
}
public function orientation(): Orientation
{
}
public function memoryUsage(): int
{
}
public function close(): void
{
}
public function toPng(): string
{
}
public function rgba16(): string
{
}
public function rgba8(): string
{
}
private function __clone(): void
{
}
public function __debugInfo(): array
{
}
}
final class Codec
{
public static function decode(string $data, ?DecodeOptions $options = null): Image
{
}
public static function decodeFile(string $path, ?DecodeOptions $options = null): Image
{
}
/** @param resource $stream */
public static function decodeStream($stream, ?DecodeOptions $options = null): Image
{
}
public static function encode(Image $image, Format $format, ?EncodeOptions $options = null): string
{
}
public static function encodeFile(
Image $image,
string $path,
Format $format,
?EncodeOptions $options = null
): void {
}
/** @param resource $stream */
public static function encodeStream(
Image $image,
$stream,
Format $format,
?EncodeOptions $options = null
): void {
}
public static function transcode(string $data, Format $format, ?EncodeOptions $options = null): string
{
}
public static function probe(string $data): Info
{
}
public static function probeFile(string $path): Info
{
}
/** @param resource $stream */
public static function probeStream($stream): Info
{
}
public static function supports(Format $format): bool
{
}
/**
* @return array
*/
public static function versions(): array
{
}
public static function version(): string
{
}
}
}