@revizly/sharp-libvips-dev 1.0.7 → 1.0.9

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.
Files changed (147) hide show
  1. package/cplusplus/VImage.cpp +18 -2
  2. package/cplusplus/vips-operators.cpp +79 -3
  3. package/include/aom/aom.h +1 -1
  4. package/include/aom/aom_codec.h +22 -5
  5. package/include/aom/aom_decoder.h +1 -1
  6. package/include/aom/aom_encoder.h +5 -1
  7. package/include/aom/aom_external_partition.h +1 -1
  8. package/include/aom/aom_frame_buffer.h +1 -1
  9. package/include/aom/aom_image.h +4 -2
  10. package/include/aom/aom_integer.h +1 -9
  11. package/include/aom/aomcx.h +64 -9
  12. package/include/aom/aomdx.h +1 -1
  13. package/include/archive.h +2 -2
  14. package/include/archive_entry.h +7 -1
  15. package/include/cairo/cairo-version.h +1 -1
  16. package/include/expat.h +4 -2
  17. package/include/expat_config.h +3 -6
  18. package/include/freetype2/freetype/config/ftconfig.h +1 -1
  19. package/include/freetype2/freetype/config/ftheader.h +1 -1
  20. package/include/freetype2/freetype/config/ftoption.h +17 -1
  21. package/include/freetype2/freetype/config/ftstdlib.h +1 -1
  22. package/include/freetype2/freetype/config/integer-types.h +1 -1
  23. package/include/freetype2/freetype/config/mac-support.h +1 -1
  24. package/include/freetype2/freetype/config/public-macros.h +1 -1
  25. package/include/freetype2/freetype/freetype.h +35 -83
  26. package/include/freetype2/freetype/ftadvanc.h +1 -1
  27. package/include/freetype2/freetype/ftbbox.h +1 -1
  28. package/include/freetype2/freetype/ftbdf.h +1 -1
  29. package/include/freetype2/freetype/ftbitmap.h +1 -1
  30. package/include/freetype2/freetype/ftbzip2.h +1 -1
  31. package/include/freetype2/freetype/ftcache.h +1 -1
  32. package/include/freetype2/freetype/ftcid.h +1 -1
  33. package/include/freetype2/freetype/ftcolor.h +1 -1
  34. package/include/freetype2/freetype/ftdriver.h +75 -1
  35. package/include/freetype2/freetype/fterrdef.h +1 -1
  36. package/include/freetype2/freetype/fterrors.h +1 -1
  37. package/include/freetype2/freetype/ftfntfmt.h +1 -1
  38. package/include/freetype2/freetype/ftgasp.h +1 -1
  39. package/include/freetype2/freetype/ftglyph.h +1 -1
  40. package/include/freetype2/freetype/ftgxval.h +1 -1
  41. package/include/freetype2/freetype/ftgzip.h +1 -1
  42. package/include/freetype2/freetype/ftimage.h +17 -12
  43. package/include/freetype2/freetype/ftincrem.h +1 -1
  44. package/include/freetype2/freetype/ftlcdfil.h +1 -1
  45. package/include/freetype2/freetype/ftlist.h +1 -1
  46. package/include/freetype2/freetype/ftlzw.h +1 -1
  47. package/include/freetype2/freetype/ftmac.h +1 -1
  48. package/include/freetype2/freetype/ftmm.h +31 -2
  49. package/include/freetype2/freetype/ftmodapi.h +1 -1
  50. package/include/freetype2/freetype/ftmoderr.h +1 -1
  51. package/include/freetype2/freetype/ftotval.h +1 -1
  52. package/include/freetype2/freetype/ftoutln.h +2 -2
  53. package/include/freetype2/freetype/ftparams.h +1 -1
  54. package/include/freetype2/freetype/ftpfr.h +1 -1
  55. package/include/freetype2/freetype/ftrender.h +1 -1
  56. package/include/freetype2/freetype/ftsizes.h +1 -1
  57. package/include/freetype2/freetype/ftsnames.h +1 -1
  58. package/include/freetype2/freetype/ftstroke.h +1 -1
  59. package/include/freetype2/freetype/ftsynth.h +1 -1
  60. package/include/freetype2/freetype/ftsystem.h +1 -1
  61. package/include/freetype2/freetype/fttrigon.h +1 -1
  62. package/include/freetype2/freetype/fttypes.h +1 -1
  63. package/include/freetype2/freetype/ftwinfnt.h +1 -1
  64. package/include/freetype2/freetype/otsvg.h +1 -1
  65. package/include/freetype2/freetype/t1tables.h +1 -59
  66. package/include/freetype2/freetype/ttnameid.h +1 -1
  67. package/include/freetype2/freetype/tttables.h +4 -3
  68. package/include/freetype2/freetype/tttags.h +1 -1
  69. package/include/freetype2/ft2build.h +1 -1
  70. package/include/fribidi/fribidi-config.h +2 -2
  71. package/include/fribidi/fribidi-unicode-version.h +3 -3
  72. package/include/gio-unix-2.0/gio/gunixmounts.h +97 -23
  73. package/include/glib-2.0/gio/gappinfo.h +40 -25
  74. package/include/glib-2.0/gio/gasyncresult.h +1 -1
  75. package/include/glib-2.0/gio/gfile.h +4 -0
  76. package/include/glib-2.0/gio/gio-visibility.h +34 -0
  77. package/include/glib-2.0/gio/gioenums.h +2 -2
  78. package/include/glib-2.0/gio/gresource.h +6 -0
  79. package/include/glib-2.0/girepository/gi-visibility.h +34 -0
  80. package/include/glib-2.0/girepository/gicallableinfo.h +12 -0
  81. package/include/glib-2.0/girepository/gitypes.h +1 -0
  82. package/include/glib-2.0/glib/garray.h +1 -1
  83. package/include/glib-2.0/glib/glib-visibility.h +34 -0
  84. package/include/glib-2.0/glib/gmacros.h +8 -2
  85. package/include/glib-2.0/glib/gmain.h +223 -54
  86. package/include/glib-2.0/glib/gmem.h +3 -0
  87. package/include/glib-2.0/glib/gqsort.h +8 -1
  88. package/include/glib-2.0/glib/grefstring.h +4 -0
  89. package/include/glib-2.0/glib/gstdio.h +65 -0
  90. package/include/glib-2.0/glib/gstrfuncs.h +4 -0
  91. package/include/glib-2.0/glib/gstring.h +4 -0
  92. package/include/glib-2.0/glib/gunicode.h +17 -1
  93. package/include/glib-2.0/glib/gvariant.h +50 -13
  94. package/include/glib-2.0/glib/gvarianttype.h +62 -46
  95. package/include/glib-2.0/glib/gversionmacros.h +9 -0
  96. package/include/glib-2.0/glib-unix.h +21 -0
  97. package/include/glib-2.0/gmodule/gmodule-visibility.h +34 -0
  98. package/include/glib-2.0/gobject/gobject-visibility.h +34 -0
  99. package/include/glib-2.0/gobject/gobjectnotifyqueue.c +3 -3
  100. package/include/glib-2.0/gobject/gtype.h +5 -5
  101. package/include/harfbuzz/hb-buffer.h +7 -0
  102. package/include/harfbuzz/hb-common.h +18 -0
  103. package/include/harfbuzz/hb-draw.h +1 -1
  104. package/include/harfbuzz/hb-face.h +36 -0
  105. package/include/harfbuzz/hb-ft.h +3 -0
  106. package/include/harfbuzz/hb-version.h +3 -3
  107. package/include/libheif/heif.h +485 -34
  108. package/include/libheif/heif_items.h +237 -0
  109. package/include/libheif/heif_properties.h +58 -2
  110. package/include/libheif/heif_regions.h +1 -1
  111. package/include/libheif/heif_version.h +2 -2
  112. package/include/libpng16/png.h +13 -13
  113. package/include/libpng16/pngconf.h +4 -4
  114. package/include/libpng16/pnglibconf.h +1 -1
  115. package/include/librsvg-2.0/librsvg/rsvg-version.h +3 -3
  116. package/include/librsvg-2.0/librsvg/rsvg.h +32 -1
  117. package/include/libxml2/libxml/parser.h +1 -1
  118. package/include/libxml2/libxml/xmlexports.h +2 -2
  119. package/include/libxml2/libxml/xmlversion.h +13 -13
  120. package/include/pixman-1/pixman-version.h +3 -3
  121. package/include/png.h +13 -13
  122. package/include/pngconf.h +4 -4
  123. package/include/pnglibconf.h +1 -1
  124. package/include/tiffio.h +11 -11
  125. package/include/tiffvers.h +4 -4
  126. package/include/vips/VImage8.h +170 -60
  127. package/include/vips/arithmetic.h +9 -0
  128. package/include/vips/basic.h +8 -4
  129. package/include/vips/buf.h +0 -2
  130. package/include/vips/connection.h +0 -2
  131. package/include/vips/conversion.h +0 -3
  132. package/include/vips/create.h +11 -0
  133. package/include/vips/enumtypes.h +3 -3
  134. package/include/vips/foreign.h +4 -18
  135. package/include/vips/header.h +7 -0
  136. package/include/vips/image.h +7 -2
  137. package/include/vips/interpolate.h +2 -3
  138. package/include/vips/memory.h +19 -1
  139. package/include/vips/operation.h +2 -7
  140. package/include/vips/private.h +7 -0
  141. package/include/vips/util.h +7 -17
  142. package/include/vips/version.h +8 -8
  143. package/include/vips/vips.h +11 -5
  144. package/include/vips/vips8 +19 -12
  145. package/include/zlib.h +3 -3
  146. package/package.json +1 -1
  147. package/versions.json +16 -16
@@ -52,8 +52,10 @@ extern "C" {
52
52
  // 1.14 3 5 1 1 1 1
53
53
  // 1.15 4 5 1 1 1 1
54
54
  // 1.16 5 6 1 1 1 1
55
+ // 1.18 5 7 1 1 1 1
56
+ // 1.19 6 7 2 1 1 1
55
57
 
56
- #if defined(_MSC_VER) && !defined(LIBHEIF_STATIC_BUILD)
58
+ #if (defined(_WIN32) || defined __CYGWIN__) && !defined(LIBHEIF_STATIC_BUILD)
57
59
  #ifdef LIBHEIF_EXPORTS
58
60
  #define LIBHEIF_API __declspec(dllexport)
59
61
  #else
@@ -133,7 +135,10 @@ enum heif_error_code
133
135
  heif_error_Color_profile_does_not_exist = 10,
134
136
 
135
137
  // Error loading a dynamic plugin
136
- heif_error_Plugin_loading_error = 11
138
+ heif_error_Plugin_loading_error = 11,
139
+
140
+ // Operation has been canceled
141
+ heif_error_Canceled = 12
137
142
  };
138
143
 
139
144
 
@@ -229,6 +234,28 @@ enum heif_suberror_code
229
234
  // Invalid specification of region item
230
235
  heif_suberror_Invalid_region_data = 136,
231
236
 
237
+ // Image has no ispe property
238
+ heif_suberror_No_ispe_property = 137,
239
+
240
+ heif_suberror_Camera_intrinsic_matrix_undefined = 138,
241
+
242
+ heif_suberror_Camera_extrinsic_matrix_undefined = 139,
243
+
244
+ // Invalid JPEG 2000 codestream - usually a missing marker
245
+ heif_suberror_Invalid_J2K_codestream = 140,
246
+
247
+ heif_suberror_No_vvcC_box = 141,
248
+
249
+ // icbr is only needed in some situations, this error is for those cases
250
+ heif_suberror_No_icbr_box = 142,
251
+
252
+ heif_suberror_No_avcC_box = 143,
253
+
254
+ // we got a mini box, but could not read it properly
255
+ heif_suberror_Invalid_mini_box = 149,
256
+
257
+ // Decompressing generic compression or header compression data failed (e.g. bitstream corruption)
258
+ heif_suberror_Decompression_invalid_data = 150,
232
259
 
233
260
  // --- Memory_allocation_error ---
234
261
 
@@ -237,6 +264,9 @@ enum heif_suberror_code
237
264
  // security limits further.
238
265
  heif_suberror_Security_limit_exceeded = 1000,
239
266
 
267
+ // There was an error from the underlying compression / decompression library.
268
+ // One possibility is lack of resources (e.g. memory).
269
+ heif_suberror_Compression_initialisation_error = 1001,
240
270
 
241
271
  // --- Usage_error ---
242
272
 
@@ -285,6 +315,10 @@ enum heif_suberror_code
285
315
 
286
316
  heif_suberror_Unsupported_header_compression_method = 3005,
287
317
 
318
+ // Generically compressed data used an unsupported compression method
319
+ heif_suberror_Unsupported_generic_compression_method = 3006,
320
+
321
+ heif_suberror_Unsupported_essential_property = 3007,
288
322
 
289
323
  // --- Encoder_plugin_error ---
290
324
 
@@ -304,9 +338,10 @@ enum heif_suberror_code
304
338
 
305
339
  // --- Plugin loading error ---
306
340
 
307
- heif_suberror_Plugin_loading_error = 6000, // a specific plugin file cannot be loaded
308
- heif_suberror_Plugin_is_not_loaded = 6001, // trying to remove a plugin that is not loaded
309
- heif_suberror_Cannot_read_plugin_directory = 6002 // error while scanning the directory for plugins
341
+ heif_suberror_Plugin_loading_error = 6000, // a specific plugin file cannot be loaded
342
+ heif_suberror_Plugin_is_not_loaded = 6001, // trying to remove a plugin that is not loaded
343
+ heif_suberror_Cannot_read_plugin_directory = 6002, // error while scanning the directory for plugins
344
+ heif_suberror_No_matching_decoder_installed = 6003 // no decoder found for that compression format
310
345
  };
311
346
 
312
347
 
@@ -375,7 +410,7 @@ enum heif_compression_format
375
410
  */
376
411
  heif_compression_AV1 = 4,
377
412
  /**
378
- * VVC compression. (Currently unused in libheif.)
413
+ * VVC compression.
379
414
  *
380
415
  * The compression format is defined in ISO/IEC 23090-3. This is equivalent to H.266.
381
416
  *
@@ -385,7 +420,7 @@ enum heif_compression_format
385
420
  /**
386
421
  * EVC compression. (Currently unused in libheif.)
387
422
  *
388
- * The compression format is defined in ISO/IEC 23094-1. This is equivalent to H.266.
423
+ * The compression format is defined in ISO/IEC 23094-1.
389
424
  *
390
425
  * The encapsulation is defined in ISO/IEC 23008-12:2022 Annex M.
391
426
  */
@@ -400,7 +435,7 @@ enum heif_compression_format
400
435
  /**
401
436
  * Uncompressed encoding.
402
437
  *
403
- * This is defined in ISO/IEC 23001-17:2023 (Final Draft International Standard).
438
+ * This is defined in ISO/IEC 23001-17:2024.
404
439
  */
405
440
  heif_compression_uncompressed = 8,
406
441
  /**
@@ -408,7 +443,14 @@ enum heif_compression_format
408
443
  *
409
444
  * See ISO/IEC 23008-12:2022 Section 6.10.2
410
445
  */
411
- heif_compression_mask = 9
446
+ heif_compression_mask = 9,
447
+ /**
448
+ * High Throughput JPEG 2000 (HT-J2K) compression.
449
+ *
450
+ * The encapsulation of HT-J2K is specified in ISO/IEC 15444-16:2021.
451
+ * The core encoding is defined in ISO/IEC 15444-15, or ITU-T T.814.
452
+ */
453
+ heif_compression_HTJ2K = 10
412
454
  };
413
455
 
414
456
  enum heif_chroma
@@ -452,7 +494,10 @@ enum heif_colorspace
452
494
  heif_colorspace_RGB = 1,
453
495
 
454
496
  // heif_colorspace_monochrome should only be used with heif_chroma = heif_chroma_monochrome
455
- heif_colorspace_monochrome = 2
497
+ heif_colorspace_monochrome = 2,
498
+
499
+ // Indicates that this image has no visual channels.
500
+ heif_colorspace_nonvisual = 3
456
501
  };
457
502
 
458
503
  enum heif_channel
@@ -464,9 +509,21 @@ enum heif_channel
464
509
  heif_channel_G = 4,
465
510
  heif_channel_B = 5,
466
511
  heif_channel_Alpha = 6,
467
- heif_channel_interleaved = 10
512
+ heif_channel_interleaved = 10,
513
+ heif_channel_filter_array = 11,
514
+ heif_channel_depth = 12,
515
+ heif_channel_disparity = 13
468
516
  };
469
517
 
518
+ enum heif_metadata_compression
519
+ {
520
+ heif_metadata_compression_off = 0,
521
+ heif_metadata_compression_auto = 1,
522
+ heif_metadata_compression_unknown = 2, // only used when reading unknown method from input file
523
+ heif_metadata_compression_deflate = 3,
524
+ heif_metadata_compression_zlib = 4, // do not use for header data
525
+ heif_metadata_compression_brotli = 5
526
+ };
470
527
 
471
528
  // ========================= library initialization ======================
472
529
 
@@ -506,6 +563,10 @@ struct heif_error heif_init(struct heif_init_params*);
506
563
  * You should call heif_init() when you start using libheif and heif_deinit() when you are finished.
507
564
  * These calls are reference counted. Each call to heif_init() should be matched by one call to heif_deinit().
508
565
  *
566
+ * Note: heif_deinit() must not be called after exit(), for example in a global C++ object's destructor.
567
+ * If you do, global variables in libheif might have already been released when heif_deinit() is running,
568
+ * leading to a crash.
569
+ *
509
570
  * \sa heif_init()
510
571
  */
511
572
  LIBHEIF_API
@@ -564,6 +625,18 @@ enum heif_filetype_result
564
625
  LIBHEIF_API
565
626
  enum heif_filetype_result heif_check_filetype(const uint8_t* data, int len);
566
627
 
628
+ /**
629
+ * Check the filetype box content for a supported file type.
630
+ *
631
+ * <p>The data is assumed to start from the start of the `ftyp` box.
632
+ *
633
+ * <p>This function checks the compatible brands.
634
+ *
635
+ * @returns heif_error_ok if a supported brand is found, or other error if not.
636
+ */
637
+ LIBHEIF_API
638
+ struct heif_error heif_has_compatible_filetype(const uint8_t* data, int len);
639
+
567
640
  LIBHEIF_API
568
641
  int heif_check_jpeg_filetype(const uint8_t* data, int len);
569
642
 
@@ -707,6 +780,13 @@ typedef uint32_t heif_brand2;
707
780
  */
708
781
  #define heif_brand2_mif2 heif_fourcc('m','i','f','2')
709
782
 
783
+ /**
784
+ * HEIF image structural brand (`mif3`).
785
+ *
786
+ * This indicates the low-overhead (ftyp+mini) structure.
787
+ */
788
+ #define heif_brand2_mif3 heif_fourcc('m','i','f','3')
789
+
710
790
  /**
711
791
  * HEIF image sequence structural brand (`msf1`).
712
792
  *
@@ -808,6 +888,10 @@ typedef uint32_t heif_brand2;
808
888
  LIBHEIF_API
809
889
  heif_brand2 heif_read_main_brand(const uint8_t* data, int len);
810
890
 
891
+ // input data should be at least 16 bytes
892
+ LIBHEIF_API
893
+ heif_brand2 heif_read_minor_version_brand(const uint8_t* data, int len);
894
+
811
895
  // 'brand_fourcc' must be 4 character long, but need not be 0-terminated
812
896
  LIBHEIF_API
813
897
  heif_brand2 heif_fourcc_to_brand(const char* brand_fourcc);
@@ -870,15 +954,33 @@ LIBHEIF_API
870
954
  void heif_context_free(struct heif_context*);
871
955
 
872
956
 
957
+
873
958
  struct heif_reading_options;
874
959
 
875
960
  enum heif_reader_grow_status
876
961
  {
877
- heif_reader_grow_status_size_reached, // requested size has been reached, we can read until this point
878
- heif_reader_grow_status_timeout, // size has not been reached yet, but it may still grow further
879
- heif_reader_grow_status_size_beyond_eof // size has not been reached and never will. The file has grown to its full size
962
+ heif_reader_grow_status_size_reached, // requested size has been reached, we can read until this point
963
+ heif_reader_grow_status_timeout, // size has not been reached yet, but it may still grow further (deprecated)
964
+ heif_reader_grow_status_size_beyond_eof, // size has not been reached and never will. The file has grown to its full size
965
+ heif_reader_grow_status_error // an error has occurred
880
966
  };
881
967
 
968
+ struct heif_reader_range_request_result
969
+ {
970
+ enum heif_reader_grow_status status; // should not return 'heif_reader_grow_status_timeout'
971
+
972
+ // Indicates up to what position the file has been read.
973
+ // If we cannot read the whole file range (status == 'heif_reader_grow_status_size_beyond_eof'), this is the actual end position.
974
+ // On the other hand, it may be that the reader was reading more data than requested. In that case, it should indicate the full size here
975
+ // and libheif may decide to make use of the additional data (e.g. for filling 'tili' offset tables).
976
+ uint64_t range_end;
977
+
978
+ // for status == 'heif_reader_grow_status_error'
979
+ int reader_error_code; // a reader specific error code
980
+ const char* reader_error_msg; // libheif will call heif_reader.release_error_msg on this if it is not NULL
981
+ };
982
+
983
+
882
984
  struct heif_reader
883
985
  {
884
986
  // API version supported by this reader
@@ -887,7 +989,7 @@ struct heif_reader
887
989
  // --- version 1 functions ---
888
990
  int64_t (* get_position)(void* userdata);
889
991
 
890
- // The functions read(), and seek() return heif_error_ok on success.
992
+ // The functions read(), and seek() return 0 on success.
891
993
  // Generally, libheif will make sure that we do not read past the file size.
892
994
  int (* read)(void* data,
893
995
  size_t size,
@@ -905,6 +1007,47 @@ struct heif_reader
905
1007
  // detection whether the target_size is above the (fixed) file length
906
1008
  // (in this case, return 'size_beyond_eof').
907
1009
  enum heif_reader_grow_status (* wait_for_file_size)(int64_t target_size, void* userdata);
1010
+
1011
+ // --- version 2 functions ---
1012
+
1013
+ // These two functions are for applications that want to stream HEIF files on demand.
1014
+ // For example, a large HEIF file that is served over HTTPS and we only want to download
1015
+ // it partially to decode individual tiles.
1016
+ // If you do not have this use case, you do not have to implement these functions and
1017
+ // you can set them to NULL. For simple linear loading, you may use the 'wait_for_file_size'
1018
+ // function above instead.
1019
+
1020
+ // If this function is defined, libheif will often request a file range before accessing it.
1021
+ // The purpose of this function is that libheif will usually read very small chunks of data with the
1022
+ // read() callback above. However, it is inefficient to request such a small chunk of data over a network
1023
+ // and the network delay will significantly increase the decoding time.
1024
+ // Thus, libheif will call request_range() with a larger block of data that should be preloaded and the
1025
+ // subsequent read() calls will work within the requested ranges.
1026
+ //
1027
+ // Note: `end_pos` is one byte after the last position to be read.
1028
+ // You should return
1029
+ // - 'heif_reader_grow_status_size_reached' if the requested range is available, or
1030
+ // - 'heif_reader_grow_status_size_beyond_eof' if the requested range exceeds the file size
1031
+ // (the valid part of the range has been read).
1032
+ struct heif_reader_range_request_result (*request_range)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1033
+
1034
+ // libheif might issue hints when it assumes that a file range might be needed in the future.
1035
+ // This may happen, for example, when your are doing selective tile accesses and libheif proposes
1036
+ // to preload offset pointer tables.
1037
+ // Another difference to request_file_range() is that this call should be non-blocking.
1038
+ // If you preload any data, do this in a background thread.
1039
+ void (*preload_range_hint)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1040
+
1041
+ // If libheif does not need access to a file range anymore, it may call this function to
1042
+ // give a hint to the reader that it may release the range from a cache.
1043
+ // If you do not maintain a file cache that wants to reduce its size dynamically, you do not
1044
+ // need to implement this function.
1045
+ void (*release_file_range)(uint64_t start_pos, uint64_t end_pos, void* userdata);
1046
+
1047
+ // Release an error message that was returned by heif_reader in an earlier call.
1048
+ // If this function is NULL, the error message string will not be released.
1049
+ // This is a viable option if you are only returning static strings.
1050
+ void (*release_error_msg)(const char* msg);
908
1051
  };
909
1052
 
910
1053
 
@@ -973,6 +1116,9 @@ LIBHEIF_API
973
1116
  void heif_context_debug_dump_boxes_to_file(struct heif_context* ctx, int fd);
974
1117
 
975
1118
 
1119
+ // Set the maximum image size security limit. This function will set the maximum image area (number of pixels)
1120
+ // to maximum_width ^ 2. Alternatively to using this function, you can also set the maximum image area
1121
+ // in the security limits structure returned by heif_context_get_security_limits().
976
1122
  LIBHEIF_API
977
1123
  void heif_context_set_maximum_image_size_limit(struct heif_context* ctx, int maximum_width);
978
1124
 
@@ -985,6 +1131,53 @@ LIBHEIF_API
985
1131
  void heif_context_set_max_decoding_threads(struct heif_context* ctx, int max_threads);
986
1132
 
987
1133
 
1134
+ // --- security limits
1135
+
1136
+ // If you set a limit to 0, the limit is disabled.
1137
+ struct heif_security_limits {
1138
+ uint8_t version;
1139
+
1140
+ // --- version 1
1141
+
1142
+ // Limit on the maximum image size to avoid allocating too much memory.
1143
+ // For example, setting this to 32768^2 pixels = 1 Gigapixels results
1144
+ // in 1.5 GB memory need for YUV-4:2:0 or 4 GB for RGB32.
1145
+ uint64_t max_image_size_pixels;
1146
+ uint64_t max_number_of_tiles;
1147
+ uint32_t max_bayer_pattern_pixels;
1148
+ uint32_t max_items;
1149
+
1150
+ uint32_t max_color_profile_size;
1151
+ uint64_t max_memory_block_size;
1152
+
1153
+ uint32_t max_components;
1154
+
1155
+ uint32_t max_iloc_extents_per_item;
1156
+ uint32_t max_size_entity_group;
1157
+
1158
+ uint32_t max_children_per_box; // for all boxes that are not covered by other limits
1159
+ };
1160
+
1161
+ // The global security limits are the default for new heif_contexts.
1162
+ // These global limits cannot be changed, but you can override the limits for a specific heif_context.
1163
+ LIBHEIF_API
1164
+ const struct heif_security_limits* heif_get_global_security_limits();
1165
+
1166
+ // Returns a set of fully disabled security limits. Use with care and only after user confirmation.
1167
+ LIBHEIF_API
1168
+ const struct heif_security_limits* heif_get_disabled_security_limits();
1169
+
1170
+ // Returns the security limits for a heif_context.
1171
+ // By default, the limits are set to the global limits, but you can change them in the returned object.
1172
+ LIBHEIF_API
1173
+ struct heif_security_limits* heif_context_get_security_limits(const struct heif_context*);
1174
+
1175
+ // Overwrites the security limits of a heif_context.
1176
+ // This is a convenience function to easily copy limits.
1177
+ LIBHEIF_API
1178
+ struct heif_error heif_context_set_security_limits(struct heif_context*, const struct heif_security_limits*);
1179
+
1180
+
988
1181
  // ========================= heif_image_handle =========================
989
1182
 
990
1183
  // An heif_image_handle is a handle to a logical image in the HEIF file.
@@ -1020,17 +1213,21 @@ LIBHEIF_API
1020
1213
  int heif_image_handle_is_premultiplied_alpha(const struct heif_image_handle*);
1021
1214
 
1022
1215
  // Returns -1 on error, e.g. if this information is not present in the image.
1216
+ // Only defined for images coded in the YCbCr or monochrome colorspace.
1023
1217
  LIBHEIF_API
1024
1218
  int heif_image_handle_get_luma_bits_per_pixel(const struct heif_image_handle*);
1025
1219
 
1026
1220
  // Returns -1 on error, e.g. if this information is not present in the image.
1221
+ // Only defined for images coded in the YCbCr colorspace.
1027
1222
  LIBHEIF_API
1028
1223
  int heif_image_handle_get_chroma_bits_per_pixel(const struct heif_image_handle*);
1029
1224
 
1030
1225
  // Return the colorspace that libheif proposes to use for decoding.
1031
1226
  // Usually, these will be either YCbCr or Monochrome, but it may also propose RGB for images
1032
- // encoded with matrix_coefficients=0.
1227
+ // encoded with matrix_coefficients=0 or for images coded natively in RGB.
1033
1228
  // It may also return *_undefined if the file misses relevant information to determine this without decoding.
1229
+ // These are only proposed values that avoid colorspace conversions as much as possible.
1230
+ // You can still request the output in your preferred colorspace, but this may involve an internal conversion.
1034
1231
  LIBHEIF_API
1035
1232
  struct heif_error heif_image_handle_get_preferred_decoding_colorspace(const struct heif_image_handle* image_handle,
1036
1233
  enum heif_colorspace* out_colorspace,
@@ -1057,6 +1254,86 @@ LIBHEIF_API
1057
1254
  struct heif_context* heif_image_handle_get_context(const struct heif_image_handle* handle);
1058
1255
 
1059
1256
 
1257
+ struct heif_image_tiling
1258
+ {
1259
+ int version;
1260
+
1261
+ // --- version 1
1262
+
1263
+ uint32_t num_columns;
1264
+ uint32_t num_rows;
1265
+ uint32_t tile_width;
1266
+ uint32_t tile_height;
1267
+
1268
+ uint32_t image_width;
1269
+ uint32_t image_height;
1270
+
1271
+ // Position of the top left tile.
1272
+ // Usually, this is (0;0), but if a tiled image is rotated or cropped, it may be that the top left tile should be placed at a negative position.
1273
+ // The offsets define this negative shift.
1274
+ uint32_t top_offset;
1275
+ uint32_t left_offset;
1276
+
1277
+ uint8_t number_of_extra_dimensions; // 0 for normal images, 1 for volumetric (3D), ...
1278
+ uint32_t extra_dimension_size[8]; // size of extra dimensions (first 8 dimensions)
1279
+ };
1280
+
1281
+
1282
+ // If 'process_image_transformations' is true, this returns modified sizes.
1283
+ // If it is false, the top_offset and left_offset will always be (0;0).
1284
+ LIBHEIF_API
1285
+ struct heif_error heif_image_handle_get_image_tiling(const struct heif_image_handle* handle, int process_image_transformations, struct heif_image_tiling* out_tiling);
1286
+
1287
+
1288
+ // For grid images, return the image item ID of a specific grid tile.
1289
+ // If 'process_image_transformations' is true, the tile positions are given in the transformed image coordinate system and
1290
+ // are internally mapped to the original image tile positions.
1291
+ LIBHEIF_API
1292
+ struct heif_error heif_image_handle_get_grid_image_tile_id(const struct heif_image_handle* handle,
1293
+ int process_image_transformations,
1294
+ uint32_t tile_x, uint32_t tile_y,
1295
+ heif_item_id* out_tile_item_id);
1296
+
1297
+
1298
+ struct heif_decoding_options;
1299
+
1300
+ // The tile position is given in tile indices, not in pixel coordinates.
1301
+ // If the image transformations are processed (option->ignore_image_transformations==false), the tile position
1302
+ // is given in the transformed coordinates.
1303
+ LIBHEIF_API
1304
+ struct heif_error heif_image_handle_decode_image_tile(const struct heif_image_handle* in_handle,
1305
+ struct heif_image** out_img,
1306
+ enum heif_colorspace colorspace,
1307
+ enum heif_chroma chroma,
1308
+ const struct heif_decoding_options* options,
1309
+ uint32_t tile_x, uint32_t tile_y);
1310
+
1311
+
1312
+ // ------------------------- entity groups ------------------------
1313
+
1314
+ typedef uint32_t heif_entity_group_id;
1315
+
1316
+ struct heif_entity_group
1317
+ {
1318
+ heif_entity_group_id entity_group_id;
1319
+ uint32_t entity_group_type; // this is a FourCC constant
1320
+ heif_item_id* entities;
1321
+ uint32_t num_entities;
1322
+ };
1323
+
1324
+ // Use 0 for `type_filter` or `item_filter` to disable the filter.
1325
+ // Returns an array of heif_entity_group structs with *out_num_groups entries.
1326
+ LIBHEIF_API
1327
+ struct heif_entity_group* heif_context_get_entity_groups(const struct heif_context*,
1328
+ uint32_t type_filter,
1329
+ heif_item_id item_filter,
1330
+ int* out_num_groups);
1331
+
1332
+ // Release an array of entity groups returned by heif_context_get_entity_groups().
1333
+ LIBHEIF_API
1334
+ void heif_entity_groups_release(struct heif_entity_group*, int num_groups);
1335
+
1336
+
1060
1337
  // ------------------------- depth images -------------------------
1061
1338
 
1062
1339
  LIBHEIF_API
@@ -1352,13 +1629,17 @@ struct heif_color_profile_nclx* heif_nclx_color_profile_alloc(void);
1352
1629
  LIBHEIF_API
1353
1630
  void heif_nclx_color_profile_free(struct heif_color_profile_nclx* nclx_profile);
1354
1631
 
1355
-
1632
+ // Note: in early versions of HEIF, there could only be one color profile per image. However, this has been changed.
1633
+ // This function will now return ICC if one is present and NCLX only if there is no ICC.
1634
+ // You may better avoid this function and simply query for NCLX and ICC directly.
1356
1635
  LIBHEIF_API
1357
1636
  enum heif_color_profile_type heif_image_get_color_profile_type(const struct heif_image* image);
1358
1637
 
1638
+ // Returns the size of the ICC profile if one is assigned to the image. Otherwise, it returns 0.
1359
1639
  LIBHEIF_API
1360
1640
  size_t heif_image_get_raw_color_profile_size(const struct heif_image* image);
1361
1641
 
1642
+ // Returns the ICC profile if one is assigned to the image. Otherwise, it returns an error.
1362
1643
  LIBHEIF_API
1363
1644
  struct heif_error heif_image_get_raw_color_profile(const struct heif_image* image,
1364
1645
  void* out_data);
@@ -1368,6 +1649,44 @@ struct heif_error heif_image_get_nclx_color_profile(const struct heif_image* ima
1368
1649
  struct heif_color_profile_nclx** out_data);
1369
1650
 
1370
1651
 
1652
+ // ------------------------- intrinsic and extrinsic matrices -------------------------
1653
+
1654
+ struct heif_camera_intrinsic_matrix
1655
+ {
1656
+ double focal_length_x;
1657
+ double focal_length_y;
1658
+ double principal_point_x;
1659
+ double principal_point_y;
1660
+ double skew;
1661
+ };
1662
+
1663
+
1664
+ LIBHEIF_API
1665
+ int heif_image_handle_has_camera_intrinsic_matrix(const struct heif_image_handle* handle);
1666
+
1667
+ LIBHEIF_API
1668
+ struct heif_error heif_image_handle_get_camera_intrinsic_matrix(const struct heif_image_handle* handle,
1669
+ struct heif_camera_intrinsic_matrix* out_matrix);
1670
+
1671
+
1672
+ struct heif_camera_extrinsic_matrix;
1673
+
1674
+ LIBHEIF_API
1675
+ int heif_image_handle_has_camera_extrinsic_matrix(const struct heif_image_handle* handle);
1676
+
1677
+ LIBHEIF_API
1678
+ struct heif_error heif_image_handle_get_camera_extrinsic_matrix(const struct heif_image_handle* handle,
1679
+ struct heif_camera_extrinsic_matrix** out_matrix);
1680
+
1681
+ LIBHEIF_API
1682
+ void heif_camera_extrinsic_matrix_release(struct heif_camera_extrinsic_matrix*);
1683
+
1684
+ LIBHEIF_API
1685
+ struct heif_error heif_camera_extrinsic_matrix_get_rotation_matrix(const struct heif_camera_extrinsic_matrix*,
1686
+ double* out_matrix_row_major);
1687
+
1688
+
1689
+
1371
1690
  // ========================= heif_image =========================
1372
1691
 
1373
1692
  // An heif_image contains a decoded pixel image in various colorspaces, chroma formats,
@@ -1402,8 +1721,10 @@ enum heif_chroma_upsampling_algorithm
1402
1721
  heif_chroma_upsampling_bilinear = 2
1403
1722
  };
1404
1723
 
1724
+
1405
1725
  struct heif_color_conversion_options
1406
1726
  {
1727
+ // 'version' must be 1.
1407
1728
  uint8_t version;
1408
1729
 
1409
1730
  // --- version 1 options
@@ -1418,8 +1739,15 @@ struct heif_color_conversion_options
1418
1739
  // Set this field to 'true' if you want to make sure that the specified algorithm is used even
1419
1740
  // at the cost of slightly higher computation times.
1420
1741
  uint8_t only_use_preferred_chroma_algorithm;
1742
+
1743
+ // --- Note that we cannot extend this struct because it is embedded in
1744
+ // other structs (heif_decoding_options and heif_encoding_options).
1421
1745
  };
1422
1746
 
1747
+ // Assumes that it is a version=1 struct.
1748
+ LIBHEIF_API
1749
+ void heif_color_conversion_options_set_defaults(struct heif_color_conversion_options*);
1750
+
1423
1751
 
1424
1752
  struct heif_decoding_options
1425
1753
  {
@@ -1431,6 +1759,7 @@ struct heif_decoding_options
1431
1759
  // Default: false (do not ignore).
1432
1760
  uint8_t ignore_transformations;
1433
1761
 
1762
+ // Any of the progress functions may be called from background threads.
1434
1763
  void (* start_progress)(enum heif_progress_step step, int max_progress, void* progress_user_data);
1435
1764
 
1436
1765
  void (* on_progress)(enum heif_progress_step step, int progress, void* progress_user_data);
@@ -1456,10 +1785,13 @@ struct heif_decoding_options
1456
1785
  // The priority is defined in the plugin.
1457
1786
  const char* decoder_id;
1458
1787
 
1459
-
1460
1788
  // version 5 options
1461
1789
 
1462
1790
  struct heif_color_conversion_options color_conversion_options;
1791
+
1792
+ // version 6 options
1793
+
1794
+ int (* cancel_decoding)(void* progress_user_data);
1463
1795
  };
1464
1796
 
1465
1797
 
@@ -1549,7 +1881,6 @@ struct heif_error heif_image_crop(struct heif_image* img,
1549
1881
  LIBHEIF_API
1550
1882
  int heif_image_get_bits_per_pixel(const struct heif_image*, enum heif_channel channel);
1551
1883
 
1552
-
1553
1884
  // Get the number of bits per pixel in the given image channel. This function returns
1554
1885
  // the number of bits used for representing the pixel value, which might be smaller
1555
1886
  // than the number of bits used in memory.
@@ -1577,6 +1908,7 @@ uint8_t* heif_image_get_plane(struct heif_image*,
1577
1908
  int* out_stride);
1578
1909
 
1579
1910
 
1911
+
1580
1912
  struct heif_scaling_options;
1581
1913
 
1582
1914
  // Currently, heif_scaling_options is not defined yet. Pass a NULL pointer.
@@ -1586,6 +1918,12 @@ struct heif_error heif_image_scale_image(const struct heif_image* input,
1586
1918
  int width, int height,
1587
1919
  const struct heif_scaling_options* options);
1588
1920
 
1921
+ // Extends the image size to match the given size by extending the right and bottom borders.
1922
+ // The border areas are filled with zero.
1923
+ LIBHEIF_API
1924
+ struct heif_error heif_image_extend_to_size_fill_with_zero(struct heif_image* image,
1925
+ uint32_t width, uint32_t height);
1926
+
1589
1927
  // The color profile is not attached to the image handle because we might need it
1590
1928
  // for color space transform and encoding.
1591
1929
  LIBHEIF_API
@@ -1639,6 +1977,10 @@ int heif_image_has_content_light_level(const struct heif_image*);
1639
1977
  LIBHEIF_API
1640
1978
  void heif_image_get_content_light_level(const struct heif_image*, struct heif_content_light_level* out);
1641
1979
 
1980
+ // Returns whether the image has 'content light level' information. If 0 is returned, the output is not filled.
1981
+ LIBHEIF_API
1982
+ int heif_image_handle_get_content_light_level(const struct heif_image_handle*, struct heif_content_light_level* out);
1983
+
1642
1984
  LIBHEIF_API
1643
1985
  void heif_image_set_content_light_level(const struct heif_image*, const struct heif_content_light_level* in);
1644
1986
 
@@ -1665,15 +2007,27 @@ struct heif_decoded_mastering_display_colour_volume
1665
2007
  double min_display_mastering_luminance;
1666
2008
  };
1667
2009
 
2010
+ struct heif_ambient_viewing_environment
2011
+ {
2012
+ uint32_t ambient_illumination;
2013
+ uint16_t ambient_light_x;
2014
+ uint16_t ambient_light_y;
2015
+ };
2016
+
1668
2017
  LIBHEIF_API
1669
2018
  int heif_image_has_mastering_display_colour_volume(const struct heif_image*);
1670
2019
 
1671
2020
  LIBHEIF_API
1672
2021
  void heif_image_get_mastering_display_colour_volume(const struct heif_image*, struct heif_mastering_display_colour_volume* out);
1673
2022
 
2023
+ // Returns whether the image has 'mastering display colour volume' information. If 0 is returned, the output is not filled.
2024
+ LIBHEIF_API
2025
+ int heif_image_handle_get_mastering_display_colour_volume(const struct heif_image_handle*, struct heif_mastering_display_colour_volume* out);
2026
+
1674
2027
  LIBHEIF_API
1675
2028
  void heif_image_set_mastering_display_colour_volume(const struct heif_image*, const struct heif_mastering_display_colour_volume* in);
1676
2029
 
2030
+
1677
2031
  // Converts the internal numeric representation of heif_mastering_display_colour_volume to the
1678
2032
  // normalized values, collected in heif_decoded_mastering_display_colour_volume.
1679
2033
  // Values that are out-of-range are decoded to 0, indicating an undefined value (as specified in ISO/IEC 23008-2).
@@ -1684,6 +2038,10 @@ struct heif_error heif_mastering_display_colour_volume_decode(const struct heif_
1684
2038
  LIBHEIF_API
1685
2039
  void heif_image_get_pixel_aspect_ratio(const struct heif_image*, uint32_t* aspect_h, uint32_t* aspect_v);
1686
2040
 
2041
+ // Returns whether the image has 'pixel aspect ratio information' information. If 0 is returned, the output is filled with the 1:1 default.
2042
+ LIBHEIF_API
2043
+ int heif_image_handle_get_pixel_aspect_ratio(const struct heif_image_handle*, uint32_t* aspect_h, uint32_t* aspect_v);
2044
+
1687
2045
  LIBHEIF_API
1688
2046
  void heif_image_set_pixel_aspect_ratio(struct heif_image*, uint32_t aspect_h, uint32_t aspect_v);
1689
2047
 
@@ -1711,6 +2069,10 @@ struct heif_error heif_context_write(struct heif_context*,
1711
2069
  struct heif_writer* writer,
1712
2070
  void* userdata);
1713
2071
 
2072
+ // Add a compatible brand that is now added automatically by libheif when encoding images (e.g. some application brands like 'geo1').
2073
+ LIBHEIF_API
2074
+ void heif_context_add_compatible_brand(struct heif_context* ctx,
2075
+ heif_brand2 compatible_brand);
1714
2076
 
1715
2077
  // ----- encoder -----
1716
2078
 
@@ -2016,6 +2378,11 @@ struct heif_encoding_options
2016
2378
  // version 6 options
2017
2379
 
2018
2380
  struct heif_color_conversion_options color_conversion_options;
2381
+
2382
+ // version 7 options
2383
+
2384
+ // Set this to true to use compressed form of uncC where possible.
2385
+ uint8_t prefer_uncC_short_form;
2019
2386
  };
2020
2387
 
2021
2388
  LIBHEIF_API
@@ -2037,6 +2404,55 @@ struct heif_error heif_context_encode_image(struct heif_context*,
2037
2404
  const struct heif_encoding_options* options,
2038
2405
  struct heif_image_handle** out_image_handle);
2039
2406
 
2407
+ /**
2408
+ * @brief Encodes an array of images into a grid.
2409
+ *
2410
+ * @param ctx The file context
2411
+ * @param tiles User allocated array of images that will form the grid.
2412
+ * @param rows The number of rows in the grid.
2413
+ * @param columns The number of columns in the grid.
2414
+ * @param encoder Defines the encoder to use. See heif_context_get_encoder_for_format()
2415
+ * @param input_options Optional, may be nullptr.
2416
+ * @param out_image_handle Returns a handle to the grid. The caller is responsible for freeing it.
2417
+ * @return Returns an error if ctx, tiles, or encoder is nullptr. If rows or columns is 0.
2418
+ */
2419
+ LIBHEIF_API
2420
+ struct heif_error heif_context_encode_grid(struct heif_context* ctx,
2421
+ struct heif_image** tiles,
2422
+ uint16_t rows,
2423
+ uint16_t columns,
2424
+ struct heif_encoder* encoder,
2425
+ const struct heif_encoding_options* input_options,
2426
+ struct heif_image_handle** out_image_handle);
2427
+
2428
+ LIBHEIF_API
2429
+ struct heif_error heif_context_add_grid_image(struct heif_context* ctx,
2430
+ uint32_t image_width,
2431
+ uint32_t image_height,
2432
+ uint32_t tile_columns,
2433
+ uint32_t tile_rows,
2434
+ const struct heif_encoding_options* encoding_options,
2435
+ struct heif_image_handle** out_grid_image_handle);
2436
+
2437
+ LIBHEIF_API
2438
+ struct heif_error heif_context_add_image_tile(struct heif_context* ctx,
2439
+ struct heif_image_handle* tiled_image,
2440
+ uint32_t tile_x, uint32_t tile_y,
2441
+ const struct heif_image* image,
2442
+ struct heif_encoder* encoder);
2443
+
2444
+ // offsets[] should either be NULL (all offsets==0) or an array of size 2*nImages with x;y offset pairs.
2445
+ // If background_rgba is NULL, the background is transparent.
2446
+ LIBHEIF_API
2447
+ struct heif_error heif_context_add_overlay_image(struct heif_context* ctx,
2448
+ uint32_t image_width,
2449
+ uint32_t image_height,
2450
+ uint16_t nImages,
2451
+ const heif_item_id* image_ids,
2452
+ int32_t* offsets,
2453
+ const uint16_t background_rgba[4],
2454
+ struct heif_image_handle** out_iovl_image_handle);
2455
+
2040
2456
  LIBHEIF_API
2041
2457
  struct heif_error heif_context_set_primary_image(struct heif_context*,
2042
2458
  struct heif_image_handle* image_handle);
@@ -2057,13 +2473,6 @@ struct heif_error heif_context_encode_thumbnail(struct heif_context*,
2057
2473
  int bbox_size,
2058
2474
  struct heif_image_handle** out_thumb_image_handle);
2059
2475
 
2060
- enum heif_metadata_compression
2061
- {
2062
- heif_metadata_compression_off,
2063
- heif_metadata_compression_auto,
2064
- heif_metadata_compression_deflate
2065
- };
2066
-
2067
2476
  // Assign 'thumbnail_image' as the thumbnail image of 'master_image'.
2068
2477
  LIBHEIF_API
2069
2478
  struct heif_error heif_context_assign_thumbnail(struct heif_context*,
@@ -2099,22 +2508,64 @@ struct heif_error heif_context_add_generic_metadata(struct heif_context* ctx,
2099
2508
  const void* data, int size,
2100
2509
  const char* item_type, const char* content_type);
2101
2510
 
2511
+ // Add generic metadata with item_type "uri ". Items with this type do not have a content_type, but
2512
+ // an item_uri_type and they have no content_encoding (they are always stored uncompressed).
2513
+ LIBHEIF_API
2514
+ struct heif_error heif_context_add_generic_uri_metadata(struct heif_context* ctx,
2515
+ const struct heif_image_handle* image_handle,
2516
+ const void* data, int size,
2517
+ const char* item_uri_type,
2518
+ heif_item_id* out_item_id);
2519
+
2102
2520
  // --- heif_image allocation
2103
2521
 
2104
- // Create a new image of the specified resolution and colorspace.
2105
- // Note: no memory for the actual image data is reserved yet. You have to use
2106
- // heif_image_add_plane() to add the image planes required by your colorspace/chroma.
2522
+ /**
2523
+ * Create a new image of the specified resolution and colorspace.
2524
+ *
2525
+ * <p>This does not allocate memory for the image data. Use {@link heif_image_add_plane} to
2526
+ * add the corresponding planes to match the specified {@code colorspace} and {@code chroma}.
2527
+ *
2528
+ * @param width the width of the image in pixels
2529
+ * @param height the height of the image in pixels
2530
+ * @param colorspace the colorspace of the image
2531
+ * @param chroma the chroma of the image
2532
+ * @param out_image pointer to pointer of the resulting image
2533
+ * @return whether the creation succeeded or there was an error
2534
+ */
2107
2535
  LIBHEIF_API
2108
2536
  struct heif_error heif_image_create(int width, int height,
2109
2537
  enum heif_colorspace colorspace,
2110
2538
  enum heif_chroma chroma,
2111
2539
  struct heif_image** out_image);
2112
2540
 
2113
- // The indicated bit_depth corresponds to the bit depth per channel.
2114
- // I.e. for interleaved formats like RRGGBB, the bit_depth would be, e.g., 10 bit instead
2115
- // of 30 bits or 3*16=48 bits.
2116
- // For backward compatibility, one can also specify 24bits for RGB and 32bits for RGBA,
2117
- // instead of the preferred 8 bits.
2541
+ /**
2542
+ * Add an image plane to the image.
2543
+ *
2544
+ * <p>The image plane needs to match the colorspace and chroma of the image. Note
2545
+ * that this does not need to be a single "planar" format - interleaved pixel channels
2546
+ * can also be used if the chroma is interleaved.
2547
+ *
2548
+ * <p>The indicated bit_depth corresponds to the bit depth per channel. For example,
2549
+ * with an interleaved format like RRGGBB where each color is represented by 10 bits,
2550
+ * the {@code bit_depth} would be {@code 10} rather than {@code 30}.
2551
+ *
2552
+ * <p>For backward compatibility, one can also specify 24bits for RGB and 32bits for RGBA,
2553
+ * instead of the preferred 8 bits. However, this use is deprecated.
2554
+ *
2555
+ * @param image the parent image to add the channel plane to
2556
+ * @param channel the channel of the plane to add
2557
+ * @param width the width of the plane
2558
+ * @param height the height of the plane
2559
+ * @param bit_depth the bit depth per color channel
2560
+ * @return whether the addition succeeded or there was an error
2561
+ *
2562
+ * @note The width and height are usually the same as the parent image, but can be
2563
+ * less for subsampling.
2564
+ *
2565
+ * @note The specified width can differ from the row stride of the resulting image plane.
2566
+ * Always use the result of {@link heif_image_get_plane} or {@link heif_image_get_plane_readonly}
2567
+ * to determine row stride.
2568
+ */
2118
2569
  LIBHEIF_API
2119
2570
  struct heif_error heif_image_add_plane(struct heif_image* image,
2120
2571
  enum heif_channel channel,