@img/sharp-libvips-dev 1.2.0-rc.3 → 1.2.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/include/fontconfig/fontconfig.h +12 -2
- package/include/glib-2.0/girepository/girepository.h +3 -0
- package/include/glib-2.0/glib/gmarkup.h +4 -0
- package/include/libheif/heif.h +16 -2603
- package/include/libheif/heif_aux_images.h +182 -0
- package/include/libheif/heif_brands.h +373 -0
- package/include/libheif/heif_color.h +357 -0
- package/include/libheif/heif_context.h +329 -0
- package/include/libheif/heif_cxx.h +6 -6
- package/include/libheif/heif_decoding.h +162 -0
- package/include/libheif/heif_encoding.h +391 -0
- package/include/libheif/heif_entity_groups.h +60 -0
- package/include/libheif/heif_error.h +302 -0
- package/include/libheif/heif_image.h +352 -0
- package/include/libheif/heif_image_handle.h +120 -0
- package/include/libheif/heif_items.h +45 -45
- package/include/libheif/heif_library.h +216 -0
- package/include/libheif/heif_metadata.h +133 -0
- package/include/libheif/heif_plugin.h +53 -41
- package/include/libheif/heif_properties.h +73 -36
- package/include/libheif/heif_regions.h +95 -95
- package/include/libheif/heif_security.h +102 -0
- package/include/libheif/heif_sequences.h +577 -0
- package/include/libheif/heif_tai_timestamps.h +202 -0
- package/include/libheif/heif_tiling.h +137 -0
- package/include/libheif/heif_uncompressed.h +109 -0
- package/include/libheif/heif_version.h +2 -2
- package/include/libpng16/png.h +7 -7
- package/include/libpng16/pngconf.h +1 -1
- package/include/libpng16/pnglibconf.h +1 -1
- package/include/pango-1.0/pango/pango-attributes.h +1 -1
- package/include/pango-1.0/pango/pango-features.h +2 -2
- package/include/png.h +7 -7
- package/include/pngconf.h +1 -1
- package/include/pnglibconf.h +1 -1
- package/include/vips/version.h +4 -4
- package/package.json +1 -1
- package/versions.json +5 -5
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2023 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_ERROR_H
|
|
22
|
+
#define LIBHEIF_HEIF_ERROR_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <stddef.h>
|
|
29
|
+
#include <stdint.h>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
enum heif_error_code
|
|
33
|
+
{
|
|
34
|
+
// Everything ok, no error occurred.
|
|
35
|
+
heif_error_Ok = 0,
|
|
36
|
+
|
|
37
|
+
// Input file does not exist.
|
|
38
|
+
heif_error_Input_does_not_exist = 1,
|
|
39
|
+
|
|
40
|
+
// Error in input file. Corrupted or invalid content.
|
|
41
|
+
heif_error_Invalid_input = 2,
|
|
42
|
+
|
|
43
|
+
// Input file type is not supported.
|
|
44
|
+
heif_error_Unsupported_filetype = 3,
|
|
45
|
+
|
|
46
|
+
// Image requires an unsupported decoder feature.
|
|
47
|
+
heif_error_Unsupported_feature = 4,
|
|
48
|
+
|
|
49
|
+
// Library API has been used in an invalid way.
|
|
50
|
+
heif_error_Usage_error = 5,
|
|
51
|
+
|
|
52
|
+
// Could not allocate enough memory.
|
|
53
|
+
heif_error_Memory_allocation_error = 6,
|
|
54
|
+
|
|
55
|
+
// The decoder plugin generated an error
|
|
56
|
+
heif_error_Decoder_plugin_error = 7,
|
|
57
|
+
|
|
58
|
+
// The encoder plugin generated an error
|
|
59
|
+
heif_error_Encoder_plugin_error = 8,
|
|
60
|
+
|
|
61
|
+
// Error during encoding or when writing to the output
|
|
62
|
+
heif_error_Encoding_error = 9,
|
|
63
|
+
|
|
64
|
+
// Application has asked for a color profile type that does not exist
|
|
65
|
+
heif_error_Color_profile_does_not_exist = 10,
|
|
66
|
+
|
|
67
|
+
// Error loading a dynamic plugin
|
|
68
|
+
heif_error_Plugin_loading_error = 11,
|
|
69
|
+
|
|
70
|
+
// Operation has been canceled
|
|
71
|
+
heif_error_Canceled = 12,
|
|
72
|
+
|
|
73
|
+
heif_error_End_of_sequence = 13
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
enum heif_suberror_code
|
|
78
|
+
{
|
|
79
|
+
// no further information available
|
|
80
|
+
heif_suberror_Unspecified = 0,
|
|
81
|
+
|
|
82
|
+
// --- Invalid_input ---
|
|
83
|
+
|
|
84
|
+
// End of data reached unexpectedly.
|
|
85
|
+
heif_suberror_End_of_data = 100,
|
|
86
|
+
|
|
87
|
+
// Size of box (defined in header) is wrong
|
|
88
|
+
heif_suberror_Invalid_box_size = 101,
|
|
89
|
+
|
|
90
|
+
// Mandatory 'ftyp' box is missing
|
|
91
|
+
heif_suberror_No_ftyp_box = 102,
|
|
92
|
+
|
|
93
|
+
heif_suberror_No_idat_box = 103,
|
|
94
|
+
|
|
95
|
+
heif_suberror_No_meta_box = 104,
|
|
96
|
+
|
|
97
|
+
heif_suberror_No_hdlr_box = 105,
|
|
98
|
+
|
|
99
|
+
heif_suberror_No_hvcC_box = 106,
|
|
100
|
+
|
|
101
|
+
heif_suberror_No_pitm_box = 107,
|
|
102
|
+
|
|
103
|
+
heif_suberror_No_ipco_box = 108,
|
|
104
|
+
|
|
105
|
+
heif_suberror_No_ipma_box = 109,
|
|
106
|
+
|
|
107
|
+
heif_suberror_No_iloc_box = 110,
|
|
108
|
+
|
|
109
|
+
heif_suberror_No_iinf_box = 111,
|
|
110
|
+
|
|
111
|
+
heif_suberror_No_iprp_box = 112,
|
|
112
|
+
|
|
113
|
+
heif_suberror_No_iref_box = 113,
|
|
114
|
+
|
|
115
|
+
heif_suberror_No_pict_handler = 114,
|
|
116
|
+
|
|
117
|
+
// An item property referenced in the 'ipma' box is not existing in the 'ipco' container.
|
|
118
|
+
heif_suberror_Ipma_box_references_nonexisting_property = 115,
|
|
119
|
+
|
|
120
|
+
// No properties have been assigned to an item.
|
|
121
|
+
heif_suberror_No_properties_assigned_to_item = 116,
|
|
122
|
+
|
|
123
|
+
// Image has no (compressed) data
|
|
124
|
+
heif_suberror_No_item_data = 117,
|
|
125
|
+
|
|
126
|
+
// Invalid specification of image grid (tiled image)
|
|
127
|
+
heif_suberror_Invalid_grid_data = 118,
|
|
128
|
+
|
|
129
|
+
// Tile-images in a grid image are missing
|
|
130
|
+
heif_suberror_Missing_grid_images = 119,
|
|
131
|
+
|
|
132
|
+
heif_suberror_Invalid_clean_aperture = 120,
|
|
133
|
+
|
|
134
|
+
// Invalid specification of overlay image
|
|
135
|
+
heif_suberror_Invalid_overlay_data = 121,
|
|
136
|
+
|
|
137
|
+
// Overlay image completely outside of visible canvas area
|
|
138
|
+
heif_suberror_Overlay_image_outside_of_canvas = 122,
|
|
139
|
+
|
|
140
|
+
heif_suberror_Auxiliary_image_type_unspecified = 123,
|
|
141
|
+
|
|
142
|
+
heif_suberror_No_or_invalid_primary_item = 124,
|
|
143
|
+
|
|
144
|
+
heif_suberror_No_infe_box = 125,
|
|
145
|
+
|
|
146
|
+
heif_suberror_Unknown_color_profile_type = 126,
|
|
147
|
+
|
|
148
|
+
heif_suberror_Wrong_tile_image_chroma_format = 127,
|
|
149
|
+
|
|
150
|
+
heif_suberror_Invalid_fractional_number = 128,
|
|
151
|
+
|
|
152
|
+
heif_suberror_Invalid_image_size = 129,
|
|
153
|
+
|
|
154
|
+
heif_suberror_Invalid_pixi_box = 130,
|
|
155
|
+
|
|
156
|
+
heif_suberror_No_av1C_box = 131,
|
|
157
|
+
|
|
158
|
+
heif_suberror_Wrong_tile_image_pixel_depth = 132,
|
|
159
|
+
|
|
160
|
+
heif_suberror_Unknown_NCLX_color_primaries = 133,
|
|
161
|
+
|
|
162
|
+
heif_suberror_Unknown_NCLX_transfer_characteristics = 134,
|
|
163
|
+
|
|
164
|
+
heif_suberror_Unknown_NCLX_matrix_coefficients = 135,
|
|
165
|
+
|
|
166
|
+
// Invalid specification of region item
|
|
167
|
+
heif_suberror_Invalid_region_data = 136,
|
|
168
|
+
|
|
169
|
+
// Image has no ispe property
|
|
170
|
+
heif_suberror_No_ispe_property = 137,
|
|
171
|
+
|
|
172
|
+
heif_suberror_Camera_intrinsic_matrix_undefined = 138,
|
|
173
|
+
|
|
174
|
+
heif_suberror_Camera_extrinsic_matrix_undefined = 139,
|
|
175
|
+
|
|
176
|
+
// Invalid JPEG 2000 codestream - usually a missing marker
|
|
177
|
+
heif_suberror_Invalid_J2K_codestream = 140,
|
|
178
|
+
|
|
179
|
+
heif_suberror_No_vvcC_box = 141,
|
|
180
|
+
|
|
181
|
+
// icbr is only needed in some situations, this error is for those cases
|
|
182
|
+
heif_suberror_No_icbr_box = 142,
|
|
183
|
+
|
|
184
|
+
heif_suberror_No_avcC_box = 143,
|
|
185
|
+
|
|
186
|
+
// we got a mini box, but could not read it properly
|
|
187
|
+
heif_suberror_Invalid_mini_box = 149,
|
|
188
|
+
|
|
189
|
+
// Decompressing generic compression or header compression data failed (e.g. bitstream corruption)
|
|
190
|
+
heif_suberror_Decompression_invalid_data = 150,
|
|
191
|
+
|
|
192
|
+
heif_suberror_No_moov_box = 151,
|
|
193
|
+
|
|
194
|
+
// --- Memory_allocation_error ---
|
|
195
|
+
|
|
196
|
+
// A security limit preventing unreasonable memory allocations was exceeded by the input file.
|
|
197
|
+
// Please check whether the file is valid. If it is, contact us so that we could increase the
|
|
198
|
+
// security limits further.
|
|
199
|
+
heif_suberror_Security_limit_exceeded = 1000,
|
|
200
|
+
|
|
201
|
+
// There was an error from the underlying compression / decompression library.
|
|
202
|
+
// One possibility is lack of resources (e.g. memory).
|
|
203
|
+
heif_suberror_Compression_initialisation_error = 1001,
|
|
204
|
+
|
|
205
|
+
// --- Usage_error ---
|
|
206
|
+
|
|
207
|
+
// An item ID was used that is not present in the file.
|
|
208
|
+
heif_suberror_Nonexisting_item_referenced = 2000, // also used for Invalid_input
|
|
209
|
+
|
|
210
|
+
// An API argument was given a NULL pointer, which is not allowed for that function.
|
|
211
|
+
heif_suberror_Null_pointer_argument = 2001,
|
|
212
|
+
|
|
213
|
+
// Image channel referenced that does not exist in the image
|
|
214
|
+
heif_suberror_Nonexisting_image_channel_referenced = 2002,
|
|
215
|
+
|
|
216
|
+
// The version of the passed plugin is not supported.
|
|
217
|
+
heif_suberror_Unsupported_plugin_version = 2003,
|
|
218
|
+
|
|
219
|
+
// The version of the passed writer is not supported.
|
|
220
|
+
heif_suberror_Unsupported_writer_version = 2004,
|
|
221
|
+
|
|
222
|
+
// The given (encoder) parameter name does not exist.
|
|
223
|
+
heif_suberror_Unsupported_parameter = 2005,
|
|
224
|
+
|
|
225
|
+
// The value for the given parameter is not in the valid range.
|
|
226
|
+
heif_suberror_Invalid_parameter_value = 2006,
|
|
227
|
+
|
|
228
|
+
// Error in property specification
|
|
229
|
+
heif_suberror_Invalid_property = 2007,
|
|
230
|
+
|
|
231
|
+
// Image reference cycle found in iref
|
|
232
|
+
heif_suberror_Item_reference_cycle = 2008,
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
// --- Unsupported_feature ---
|
|
236
|
+
|
|
237
|
+
// Image was coded with an unsupported compression method.
|
|
238
|
+
heif_suberror_Unsupported_codec = 3000,
|
|
239
|
+
|
|
240
|
+
// Image is specified in an unknown way, e.g. as tiled grid image (which is supported)
|
|
241
|
+
heif_suberror_Unsupported_image_type = 3001,
|
|
242
|
+
|
|
243
|
+
heif_suberror_Unsupported_data_version = 3002,
|
|
244
|
+
|
|
245
|
+
// The conversion of the source image to the requested chroma / colorspace is not supported.
|
|
246
|
+
heif_suberror_Unsupported_color_conversion = 3003,
|
|
247
|
+
|
|
248
|
+
heif_suberror_Unsupported_item_construction_method = 3004,
|
|
249
|
+
|
|
250
|
+
heif_suberror_Unsupported_header_compression_method = 3005,
|
|
251
|
+
|
|
252
|
+
// Generically compressed data used an unsupported compression method
|
|
253
|
+
heif_suberror_Unsupported_generic_compression_method = 3006,
|
|
254
|
+
|
|
255
|
+
heif_suberror_Unsupported_essential_property = 3007,
|
|
256
|
+
|
|
257
|
+
// --- Encoder_plugin_error ---
|
|
258
|
+
|
|
259
|
+
heif_suberror_Unsupported_bit_depth = 4000,
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
// --- Encoding_error ---
|
|
263
|
+
|
|
264
|
+
heif_suberror_Cannot_write_output_data = 5000,
|
|
265
|
+
|
|
266
|
+
heif_suberror_Encoder_initialization = 5001,
|
|
267
|
+
heif_suberror_Encoder_encoding = 5002,
|
|
268
|
+
heif_suberror_Encoder_cleanup = 5003,
|
|
269
|
+
|
|
270
|
+
heif_suberror_Too_many_regions = 5004,
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
// --- Plugin loading error ---
|
|
274
|
+
|
|
275
|
+
heif_suberror_Plugin_loading_error = 6000, // a specific plugin file cannot be loaded
|
|
276
|
+
heif_suberror_Plugin_is_not_loaded = 6001, // trying to remove a plugin that is not loaded
|
|
277
|
+
heif_suberror_Cannot_read_plugin_directory = 6002, // error while scanning the directory for plugins
|
|
278
|
+
heif_suberror_No_matching_decoder_installed = 6003 // no decoder found for that compression format
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
typedef struct heif_error
|
|
283
|
+
{
|
|
284
|
+
// main error category
|
|
285
|
+
enum heif_error_code code;
|
|
286
|
+
|
|
287
|
+
// more detailed error code
|
|
288
|
+
enum heif_suberror_code subcode;
|
|
289
|
+
|
|
290
|
+
// textual error message (is always defined, you do not have to check for NULL)
|
|
291
|
+
const char* message;
|
|
292
|
+
} heif_error;
|
|
293
|
+
|
|
294
|
+
// Default success return value. Intended for use in user-supplied callback functions.
|
|
295
|
+
LIBHEIF_API extern const heif_error heif_error_success;
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
#ifdef __cplusplus
|
|
299
|
+
}
|
|
300
|
+
#endif
|
|
301
|
+
|
|
302
|
+
#endif
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* HEIF codec.
|
|
3
|
+
* Copyright (c) 2017-2025 Dirk Farin <dirk.farin@gmail.com>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of libheif.
|
|
6
|
+
*
|
|
7
|
+
* libheif is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as
|
|
9
|
+
* published by the Free Software Foundation, either version 3 of
|
|
10
|
+
* the License, or (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* libheif is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with libheif. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef LIBHEIF_HEIF_IMAGE_H
|
|
22
|
+
#define LIBHEIF_HEIF_IMAGE_H
|
|
23
|
+
|
|
24
|
+
#ifdef __cplusplus
|
|
25
|
+
extern "C" {
|
|
26
|
+
#endif
|
|
27
|
+
|
|
28
|
+
#include <libheif/heif_library.h>
|
|
29
|
+
#include <libheif/heif_error.h>
|
|
30
|
+
#include <stddef.h>
|
|
31
|
+
#include <stdint.h>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
enum heif_chroma
|
|
35
|
+
{
|
|
36
|
+
heif_chroma_undefined = 99,
|
|
37
|
+
heif_chroma_monochrome = 0,
|
|
38
|
+
heif_chroma_420 = 1,
|
|
39
|
+
heif_chroma_422 = 2,
|
|
40
|
+
heif_chroma_444 = 3,
|
|
41
|
+
heif_chroma_interleaved_RGB = 10,
|
|
42
|
+
heif_chroma_interleaved_RGBA = 11,
|
|
43
|
+
heif_chroma_interleaved_RRGGBB_BE = 12, // HDR, big endian.
|
|
44
|
+
heif_chroma_interleaved_RRGGBBAA_BE = 13, // HDR, big endian.
|
|
45
|
+
heif_chroma_interleaved_RRGGBB_LE = 14, // HDR, little endian.
|
|
46
|
+
heif_chroma_interleaved_RRGGBBAA_LE = 15 // HDR, little endian.
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// DEPRECATED ENUM NAMES
|
|
50
|
+
#define heif_chroma_interleaved_24bit heif_chroma_interleaved_RGB
|
|
51
|
+
#define heif_chroma_interleaved_32bit heif_chroma_interleaved_RGBA
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
enum heif_colorspace
|
|
55
|
+
{
|
|
56
|
+
heif_colorspace_undefined = 99,
|
|
57
|
+
|
|
58
|
+
// heif_colorspace_YCbCr should be used with one of these heif_chroma values:
|
|
59
|
+
// * heif_chroma_444
|
|
60
|
+
// * heif_chroma_422
|
|
61
|
+
// * heif_chroma_420
|
|
62
|
+
heif_colorspace_YCbCr = 0,
|
|
63
|
+
|
|
64
|
+
// heif_colorspace_RGB should be used with one of these heif_chroma values:
|
|
65
|
+
// * heif_chroma_444 (for planar RGB)
|
|
66
|
+
// * heif_chroma_interleaved_RGB
|
|
67
|
+
// * heif_chroma_interleaved_RGBA
|
|
68
|
+
// * heif_chroma_interleaved_RRGGBB_BE
|
|
69
|
+
// * heif_chroma_interleaved_RRGGBBAA_BE
|
|
70
|
+
// * heif_chroma_interleaved_RRGGBB_LE
|
|
71
|
+
// * heif_chroma_interleaved_RRGGBBAA_LE
|
|
72
|
+
heif_colorspace_RGB = 1,
|
|
73
|
+
|
|
74
|
+
// heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_monochrome
|
|
75
|
+
heif_colorspace_monochrome = 2,
|
|
76
|
+
|
|
77
|
+
// Indicates that this image has no visual channels.
|
|
78
|
+
heif_colorspace_nonvisual = 3
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
enum heif_channel
|
|
82
|
+
{
|
|
83
|
+
heif_channel_Y = 0,
|
|
84
|
+
heif_channel_Cb = 1,
|
|
85
|
+
heif_channel_Cr = 2,
|
|
86
|
+
heif_channel_R = 3,
|
|
87
|
+
heif_channel_G = 4,
|
|
88
|
+
heif_channel_B = 5,
|
|
89
|
+
heif_channel_Alpha = 6,
|
|
90
|
+
heif_channel_interleaved = 10,
|
|
91
|
+
heif_channel_filter_array = 11,
|
|
92
|
+
heif_channel_depth = 12,
|
|
93
|
+
heif_channel_disparity = 13
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
// An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
|
|
98
|
+
// and bit depths.
|
|
99
|
+
|
|
100
|
+
// Note: when converting images to an interleaved chroma format, the resulting
|
|
101
|
+
// image contains only a single channel of type channel_interleaved with, e.g., 3 bytes per pixel,
|
|
102
|
+
// containing the interleaved R,G,B values.
|
|
103
|
+
|
|
104
|
+
// Planar RGB images are specified as heif_colorspace_RGB / heif_chroma_444.
|
|
105
|
+
|
|
106
|
+
typedef struct heif_image heif_image;
|
|
107
|
+
typedef struct heif_image_handle heif_image_handle;
|
|
108
|
+
typedef struct heif_security_limits heif_security_limits;
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// Get the colorspace format of the image.
|
|
112
|
+
LIBHEIF_API
|
|
113
|
+
enum heif_colorspace heif_image_get_colorspace(const heif_image*);
|
|
114
|
+
|
|
115
|
+
// Get the chroma format of the image.
|
|
116
|
+
LIBHEIF_API
|
|
117
|
+
enum heif_chroma heif_image_get_chroma_format(const heif_image*);
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Get the width of a specified image channel.
|
|
121
|
+
*
|
|
122
|
+
* @param img the image to get the width for
|
|
123
|
+
* @param channel the channel to select
|
|
124
|
+
* @return the width of the channel in pixels, or -1 the channel does not exist in the image
|
|
125
|
+
*/
|
|
126
|
+
LIBHEIF_API
|
|
127
|
+
int heif_image_get_width(const heif_image* img, enum heif_channel channel);
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Get the height of a specified image channel.
|
|
131
|
+
*
|
|
132
|
+
* @param img the image to get the height for
|
|
133
|
+
* @param channel the channel to select
|
|
134
|
+
* @return the height of the channel in pixels, or -1 the channel does not exist in the image
|
|
135
|
+
*/
|
|
136
|
+
LIBHEIF_API
|
|
137
|
+
int heif_image_get_height(const heif_image* img, enum heif_channel channel);
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Get the width of the main channel.
|
|
141
|
+
*
|
|
142
|
+
* This is the Y channel in YCbCr or mono, or any in RGB.
|
|
143
|
+
*
|
|
144
|
+
* @param img the image to get the primary width for
|
|
145
|
+
* @return the width in pixels
|
|
146
|
+
*/
|
|
147
|
+
LIBHEIF_API
|
|
148
|
+
int heif_image_get_primary_width(const heif_image* img);
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Get the height of the main channel.
|
|
152
|
+
*
|
|
153
|
+
* This is the Y channel in YCbCr or mono, or any in RGB.
|
|
154
|
+
*
|
|
155
|
+
* @param img the image to get the primary height for
|
|
156
|
+
* @return the height in pixels
|
|
157
|
+
*/
|
|
158
|
+
LIBHEIF_API
|
|
159
|
+
int heif_image_get_primary_height(const heif_image* img);
|
|
160
|
+
|
|
161
|
+
LIBHEIF_API
|
|
162
|
+
heif_error heif_image_crop(heif_image* img,
|
|
163
|
+
int left, int right, int top, int bottom);
|
|
164
|
+
|
|
165
|
+
LIBHEIF_API
|
|
166
|
+
heif_error heif_image_extract_area(const heif_image*,
|
|
167
|
+
uint32_t x0, uint32_t y0, uint32_t w, uint32_t h,
|
|
168
|
+
const heif_security_limits* limits,
|
|
169
|
+
heif_image** out_image);
|
|
170
|
+
|
|
171
|
+
// Get the number of bits per pixel in the given image channel. Returns -1 if
|
|
172
|
+
// a non-existing channel was given.
|
|
173
|
+
// Note that the number of bits per pixel may be different for each color channel.
|
|
174
|
+
// This function returns the number of bits used for storage of each pixel.
|
|
175
|
+
// Especially for HDR images, this is probably not what you want. Have a look at
|
|
176
|
+
// heif_image_get_bits_per_pixel_range() instead.
|
|
177
|
+
LIBHEIF_API
|
|
178
|
+
int heif_image_get_bits_per_pixel(const heif_image*, enum heif_channel channel);
|
|
179
|
+
|
|
180
|
+
// Get the number of bits per pixel in the given image channel. This function returns
|
|
181
|
+
// the number of bits used for representing the pixel value, which might be smaller
|
|
182
|
+
// than the number of bits used in memory.
|
|
183
|
+
// For example, in 12bit HDR images, this function returns '12', while still 16 bits
|
|
184
|
+
// are reserved for storage. For interleaved RGBA with 12 bit, this function also returns
|
|
185
|
+
// '12', not '48' or '64' (heif_image_get_bits_per_pixel returns 64 in this case).
|
|
186
|
+
LIBHEIF_API
|
|
187
|
+
int heif_image_get_bits_per_pixel_range(const heif_image*, enum heif_channel channel);
|
|
188
|
+
|
|
189
|
+
LIBHEIF_API
|
|
190
|
+
int heif_image_has_channel(const heif_image*, enum heif_channel channel);
|
|
191
|
+
|
|
192
|
+
// Get a pointer to the actual pixel data.
|
|
193
|
+
// The 'out_stride' is returned as "bytes per line".
|
|
194
|
+
// When out_stride is NULL, no value will be written.
|
|
195
|
+
// Returns NULL if a non-existing channel was given.
|
|
196
|
+
// Deprecated, use the safer version heif_image_get_plane_readonly2() instead.
|
|
197
|
+
LIBHEIF_API
|
|
198
|
+
const uint8_t* heif_image_get_plane_readonly(const heif_image*,
|
|
199
|
+
enum heif_channel channel,
|
|
200
|
+
int* out_stride);
|
|
201
|
+
|
|
202
|
+
// Deprecated, use the safer version heif_image_get_plane2() instead.
|
|
203
|
+
LIBHEIF_API
|
|
204
|
+
uint8_t* heif_image_get_plane(heif_image*,
|
|
205
|
+
enum heif_channel channel,
|
|
206
|
+
int* out_stride);
|
|
207
|
+
|
|
208
|
+
// These are safer variants of the two functions above.
|
|
209
|
+
// The 'stride' parameter is often multiplied by the image height in the client application.
|
|
210
|
+
// For very large images, this can lead to integer overflows and, consequently, illegal memory accesses.
|
|
211
|
+
// The changed 'stride' parameter types eliminates this common error.
|
|
212
|
+
LIBHEIF_API
|
|
213
|
+
const uint8_t* heif_image_get_plane_readonly2(const heif_image*,
|
|
214
|
+
enum heif_channel channel,
|
|
215
|
+
size_t* out_stride);
|
|
216
|
+
|
|
217
|
+
LIBHEIF_API
|
|
218
|
+
uint8_t* heif_image_get_plane2(heif_image*,
|
|
219
|
+
enum heif_channel channel,
|
|
220
|
+
size_t* out_stride);
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
typedef struct heif_scaling_options heif_scaling_options;
|
|
224
|
+
|
|
225
|
+
// Currently, heif_scaling_options is not defined yet. Pass a NULL pointer.
|
|
226
|
+
LIBHEIF_API
|
|
227
|
+
heif_error heif_image_scale_image(const heif_image* input,
|
|
228
|
+
heif_image** output,
|
|
229
|
+
int width, int height,
|
|
230
|
+
const heif_scaling_options* options);
|
|
231
|
+
|
|
232
|
+
// Extends the image size to match the given size by extending the right and bottom borders.
|
|
233
|
+
// The border areas are filled with zero.
|
|
234
|
+
LIBHEIF_API
|
|
235
|
+
heif_error heif_image_extend_to_size_fill_with_zero(heif_image* image,
|
|
236
|
+
uint32_t width, uint32_t height);
|
|
237
|
+
|
|
238
|
+
// Fills the image decoding warnings into the provided 'out_warnings' array.
|
|
239
|
+
// The size of the array has to be provided in max_output_buffer_entries.
|
|
240
|
+
// If max_output_buffer_entries==0, the number of decoder warnings is returned.
|
|
241
|
+
// The function fills the warnings into the provided buffer, starting with 'first_warning_idx'.
|
|
242
|
+
// It returns the number of warnings filled into the buffer.
|
|
243
|
+
// Note: you can iterate through all warnings by using 'max_output_buffer_entries=1' and iterate 'first_warning_idx'.
|
|
244
|
+
LIBHEIF_API
|
|
245
|
+
int heif_image_get_decoding_warnings(heif_image* image,
|
|
246
|
+
int first_warning_idx,
|
|
247
|
+
heif_error* out_warnings,
|
|
248
|
+
int max_output_buffer_entries);
|
|
249
|
+
|
|
250
|
+
// This function is only for decoder plugin implementors.
|
|
251
|
+
LIBHEIF_API
|
|
252
|
+
void heif_image_add_decoding_warning(heif_image* image,
|
|
253
|
+
heif_error err);
|
|
254
|
+
|
|
255
|
+
// Release heif_image.
|
|
256
|
+
LIBHEIF_API
|
|
257
|
+
void heif_image_release(const heif_image*);
|
|
258
|
+
|
|
259
|
+
LIBHEIF_API
|
|
260
|
+
void heif_image_get_pixel_aspect_ratio(const heif_image*, uint32_t* aspect_h, uint32_t* aspect_v);
|
|
261
|
+
|
|
262
|
+
LIBHEIF_API
|
|
263
|
+
void heif_image_set_pixel_aspect_ratio(heif_image*, uint32_t aspect_h, uint32_t aspect_v);
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
// --- heif_image allocation
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Create a new image of the specified resolution and colorspace.
|
|
270
|
+
*
|
|
271
|
+
* <p>This does not allocate memory for the image data. Use {@link heif_image_add_plane} to
|
|
272
|
+
* add the corresponding planes to match the specified {@code colorspace} and {@code chroma}.
|
|
273
|
+
*
|
|
274
|
+
* @param width the width of the image in pixels
|
|
275
|
+
* @param height the height of the image in pixels
|
|
276
|
+
* @param colorspace the colorspace of the image
|
|
277
|
+
* @param chroma the chroma of the image
|
|
278
|
+
* @param out_image pointer to pointer of the resulting image
|
|
279
|
+
* @return whether the creation succeeded or there was an error
|
|
280
|
+
*/
|
|
281
|
+
LIBHEIF_API
|
|
282
|
+
heif_error heif_image_create(int width, int height,
|
|
283
|
+
enum heif_colorspace colorspace,
|
|
284
|
+
enum heif_chroma chroma,
|
|
285
|
+
heif_image** out_image);
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Add an image plane to the image.
|
|
289
|
+
*
|
|
290
|
+
* <p>The image plane needs to match the colorspace and chroma of the image. Note
|
|
291
|
+
* that this does not need to be a single "planar" format - interleaved pixel channels
|
|
292
|
+
* can also be used if the chroma is interleaved.
|
|
293
|
+
*
|
|
294
|
+
* <p>The indicated bit_depth corresponds to the bit depth per channel. For example,
|
|
295
|
+
* with an interleaved format like RRGGBB where each color is represented by 10 bits,
|
|
296
|
+
* the {@code bit_depth} would be {@code 10} rather than {@code 30}.
|
|
297
|
+
*
|
|
298
|
+
* <p>For backward compatibility, one can also specify 24bits for RGB and 32bits for RGBA,
|
|
299
|
+
* instead of the preferred 8 bits. However, this use is deprecated.
|
|
300
|
+
*
|
|
301
|
+
* @param image the parent image to add the channel plane to
|
|
302
|
+
* @param channel the channel of the plane to add
|
|
303
|
+
* @param width the width of the plane
|
|
304
|
+
* @param height the height of the plane
|
|
305
|
+
* @param bit_depth the bit depth per color channel
|
|
306
|
+
* @return whether the addition succeeded or there was an error
|
|
307
|
+
*
|
|
308
|
+
* @note The width and height are usually the same as the parent image, but can be
|
|
309
|
+
* less for subsampling.
|
|
310
|
+
*
|
|
311
|
+
* @note The specified width can differ from the row stride of the resulting image plane.
|
|
312
|
+
* Always use the result of {@link heif_image_get_plane} or {@link heif_image_get_plane_readonly}
|
|
313
|
+
* to determine row stride.
|
|
314
|
+
*/
|
|
315
|
+
LIBHEIF_API
|
|
316
|
+
heif_error heif_image_add_plane(heif_image* image,
|
|
317
|
+
enum heif_channel channel,
|
|
318
|
+
int width, int height, int bit_depth);
|
|
319
|
+
|
|
320
|
+
/*
|
|
321
|
+
* The security limits should preferably be the limits from a heif_context.
|
|
322
|
+
* The memory allocated will then be registered in the memory budget of that context.
|
|
323
|
+
*/
|
|
324
|
+
LIBHEIF_API
|
|
325
|
+
heif_error heif_image_add_plane_safe(heif_image* image,
|
|
326
|
+
enum heif_channel channel,
|
|
327
|
+
int width, int height, int bit_depth,
|
|
328
|
+
const heif_security_limits* limits);
|
|
329
|
+
|
|
330
|
+
// Signal that the image is premultiplied by the alpha pixel values.
|
|
331
|
+
LIBHEIF_API
|
|
332
|
+
void heif_image_set_premultiplied_alpha(heif_image* image,
|
|
333
|
+
int is_premultiplied_alpha);
|
|
334
|
+
|
|
335
|
+
LIBHEIF_API
|
|
336
|
+
int heif_image_is_premultiplied_alpha(heif_image* image);
|
|
337
|
+
|
|
338
|
+
// This function extends the padding of the image so that it has at least the given physical size.
|
|
339
|
+
// The padding border is filled with the pixels along the right/bottom border.
|
|
340
|
+
// This function may be useful if you want to process the image, but have some external padding requirements.
|
|
341
|
+
// The image size will not be modified if it is already larger/equal than the given physical size.
|
|
342
|
+
// I.e. you cannot assume that after calling this function, the stride will be equal to min_physical_width.
|
|
343
|
+
LIBHEIF_API
|
|
344
|
+
heif_error heif_image_extend_padding_to_size(heif_image* image,
|
|
345
|
+
int min_physical_width, int min_physical_height);
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
#ifdef __cplusplus
|
|
349
|
+
}
|
|
350
|
+
#endif
|
|
351
|
+
|
|
352
|
+
#endif
|