@img/sharp-libvips-dev-wasm32 0.0.3

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 (475) hide show
  1. package/README.md +35 -0
  2. package/include/aom/aom.h +127 -0
  3. package/include/aom/aom_codec.h +577 -0
  4. package/include/aom/aom_decoder.h +257 -0
  5. package/include/aom/aom_encoder.h +1144 -0
  6. package/include/aom/aom_external_partition.h +452 -0
  7. package/include/aom/aom_frame_buffer.h +84 -0
  8. package/include/aom/aom_image.h +448 -0
  9. package/include/aom/aom_integer.h +68 -0
  10. package/include/aom/aomcx.h +2181 -0
  11. package/include/aom/aomdx.h +604 -0
  12. package/include/cgif.h +80 -0
  13. package/include/expat.h +1064 -0
  14. package/include/expat_config.h +140 -0
  15. package/include/expat_external.h +165 -0
  16. package/include/ffi.h +531 -0
  17. package/include/ffitarget.h +62 -0
  18. package/include/glib-2.0/gio/gaction.h +100 -0
  19. package/include/glib-2.0/gio/gactiongroup.h +163 -0
  20. package/include/glib-2.0/gio/gactiongroupexporter.h +47 -0
  21. package/include/glib-2.0/gio/gactionmap.h +101 -0
  22. package/include/glib-2.0/gio/gappinfo.h +369 -0
  23. package/include/glib-2.0/gio/gapplication.h +257 -0
  24. package/include/glib-2.0/gio/gapplicationcommandline.h +124 -0
  25. package/include/glib-2.0/gio/gasyncinitable.h +132 -0
  26. package/include/glib-2.0/gio/gasyncresult.h +87 -0
  27. package/include/glib-2.0/gio/gbufferedinputstream.h +135 -0
  28. package/include/glib-2.0/gio/gbufferedoutputstream.h +88 -0
  29. package/include/glib-2.0/gio/gbytesicon.h +54 -0
  30. package/include/glib-2.0/gio/gcancellable.h +120 -0
  31. package/include/glib-2.0/gio/gcharsetconverter.h +65 -0
  32. package/include/glib-2.0/gio/gcontenttype.h +84 -0
  33. package/include/glib-2.0/gio/gconverter.h +98 -0
  34. package/include/glib-2.0/gio/gconverterinputstream.h +82 -0
  35. package/include/glib-2.0/gio/gconverteroutputstream.h +82 -0
  36. package/include/glib-2.0/gio/gcredentials.h +87 -0
  37. package/include/glib-2.0/gio/gdatagrambased.h +146 -0
  38. package/include/glib-2.0/gio/gdatainputstream.h +182 -0
  39. package/include/glib-2.0/gio/gdataoutputstream.h +127 -0
  40. package/include/glib-2.0/gio/gdbusactiongroup.h +56 -0
  41. package/include/glib-2.0/gio/gdbusaddress.h +67 -0
  42. package/include/glib-2.0/gio/gdbusauthobserver.h +53 -0
  43. package/include/glib-2.0/gio/gdbusconnection.h +691 -0
  44. package/include/glib-2.0/gio/gdbuserror.h +111 -0
  45. package/include/glib-2.0/gio/gdbusinterface.h +83 -0
  46. package/include/glib-2.0/gio/gdbusinterfaceskeleton.h +129 -0
  47. package/include/glib-2.0/gio/gdbusintrospection.h +327 -0
  48. package/include/glib-2.0/gio/gdbusmenumodel.h +47 -0
  49. package/include/glib-2.0/gio/gdbusmessage.h +204 -0
  50. package/include/glib-2.0/gio/gdbusmethodinvocation.h +136 -0
  51. package/include/glib-2.0/gio/gdbusnameowning.h +117 -0
  52. package/include/glib-2.0/gio/gdbusnamewatching.h +104 -0
  53. package/include/glib-2.0/gio/gdbusobject.h +80 -0
  54. package/include/glib-2.0/gio/gdbusobjectmanager.h +96 -0
  55. package/include/glib-2.0/gio/gdbusobjectmanagerclient.h +148 -0
  56. package/include/glib-2.0/gio/gdbusobjectmanagerserver.h +95 -0
  57. package/include/glib-2.0/gio/gdbusobjectproxy.h +81 -0
  58. package/include/glib-2.0/gio/gdbusobjectskeleton.h +98 -0
  59. package/include/glib-2.0/gio/gdbusproxy.h +220 -0
  60. package/include/glib-2.0/gio/gdbusserver.h +62 -0
  61. package/include/glib-2.0/gio/gdbusutils.h +65 -0
  62. package/include/glib-2.0/gio/gdebugcontroller.h +81 -0
  63. package/include/glib-2.0/gio/gdebugcontrollerdbus.h +71 -0
  64. package/include/glib-2.0/gio/gdrive.h +274 -0
  65. package/include/glib-2.0/gio/gdtlsclientconnection.h +77 -0
  66. package/include/glib-2.0/gio/gdtlsconnection.h +230 -0
  67. package/include/glib-2.0/gio/gdtlsserverconnection.h +71 -0
  68. package/include/glib-2.0/gio/gemblem.h +63 -0
  69. package/include/glib-2.0/gio/gemblemedicon.h +83 -0
  70. package/include/glib-2.0/gio/gfile.h +1359 -0
  71. package/include/glib-2.0/gio/gfileattribute.h +86 -0
  72. package/include/glib-2.0/gio/gfileenumerator.h +154 -0
  73. package/include/glib-2.0/gio/gfileicon.h +59 -0
  74. package/include/glib-2.0/gio/gfileinfo.h +1546 -0
  75. package/include/glib-2.0/gio/gfileinputstream.h +116 -0
  76. package/include/glib-2.0/gio/gfileiostream.h +123 -0
  77. package/include/glib-2.0/gio/gfilemonitor.h +100 -0
  78. package/include/glib-2.0/gio/gfilenamecompleter.h +81 -0
  79. package/include/glib-2.0/gio/gfileoutputstream.h +124 -0
  80. package/include/glib-2.0/gio/gfilterinputstream.h +80 -0
  81. package/include/glib-2.0/gio/gfilteroutputstream.h +80 -0
  82. package/include/glib-2.0/gio/gicon.h +133 -0
  83. package/include/glib-2.0/gio/ginetaddress.h +125 -0
  84. package/include/glib-2.0/gio/ginetaddressmask.h +86 -0
  85. package/include/glib-2.0/gio/ginetsocketaddress.h +80 -0
  86. package/include/glib-2.0/gio/ginitable.h +107 -0
  87. package/include/glib-2.0/gio/ginputstream.h +218 -0
  88. package/include/glib-2.0/gio/gio-autocleanups.h +155 -0
  89. package/include/glib-2.0/gio/gio-visibility.h +952 -0
  90. package/include/glib-2.0/gio/gio.h +186 -0
  91. package/include/glib-2.0/gio/gioenums.h +2149 -0
  92. package/include/glib-2.0/gio/gioenumtypes.h +207 -0
  93. package/include/glib-2.0/gio/gioerror.h +58 -0
  94. package/include/glib-2.0/gio/giomodule.h +199 -0
  95. package/include/glib-2.0/gio/gioscheduler.h +56 -0
  96. package/include/glib-2.0/gio/giostream.h +137 -0
  97. package/include/glib-2.0/gio/giotypes.h +660 -0
  98. package/include/glib-2.0/gio/glistmodel.h +74 -0
  99. package/include/glib-2.0/gio/gliststore.h +97 -0
  100. package/include/glib-2.0/gio/gloadableicon.h +101 -0
  101. package/include/glib-2.0/gio/gmemoryinputstream.h +92 -0
  102. package/include/glib-2.0/gio/gmemorymonitor.h +64 -0
  103. package/include/glib-2.0/gio/gmemoryoutputstream.h +109 -0
  104. package/include/glib-2.0/gio/gmenu.h +184 -0
  105. package/include/glib-2.0/gio/gmenuexporter.h +55 -0
  106. package/include/glib-2.0/gio/gmenumodel.h +307 -0
  107. package/include/glib-2.0/gio/gmount.h +278 -0
  108. package/include/glib-2.0/gio/gmountoperation.h +179 -0
  109. package/include/glib-2.0/gio/gnativesocketaddress.h +67 -0
  110. package/include/glib-2.0/gio/gnativevolumemonitor.h +63 -0
  111. package/include/glib-2.0/gio/gnetworkaddress.h +82 -0
  112. package/include/glib-2.0/gio/gnetworking.h +81 -0
  113. package/include/glib-2.0/gio/gnetworkmonitor.h +101 -0
  114. package/include/glib-2.0/gio/gnetworkservice.h +77 -0
  115. package/include/glib-2.0/gio/gnotification.h +103 -0
  116. package/include/glib-2.0/gio/goutputstream.h +334 -0
  117. package/include/glib-2.0/gio/gpermission.h +129 -0
  118. package/include/glib-2.0/gio/gpollableinputstream.h +106 -0
  119. package/include/glib-2.0/gio/gpollableoutputstream.h +127 -0
  120. package/include/glib-2.0/gio/gpollableutils.h +66 -0
  121. package/include/glib-2.0/gio/gpowerprofilemonitor.h +65 -0
  122. package/include/glib-2.0/gio/gpropertyaction.h +49 -0
  123. package/include/glib-2.0/gio/gproxy.h +130 -0
  124. package/include/glib-2.0/gio/gproxyaddress.h +88 -0
  125. package/include/glib-2.0/gio/gproxyaddressenumerator.h +83 -0
  126. package/include/glib-2.0/gio/gproxyresolver.h +97 -0
  127. package/include/glib-2.0/gio/gremoteactiongroup.h +77 -0
  128. package/include/glib-2.0/gio/gresolver.h +299 -0
  129. package/include/glib-2.0/gio/gresource.h +132 -0
  130. package/include/glib-2.0/gio/gseekable.h +105 -0
  131. package/include/glib-2.0/gio/gsettings.h +347 -0
  132. package/include/glib-2.0/gio/gsettingsbackend.h +176 -0
  133. package/include/glib-2.0/gio/gsettingsschema.h +115 -0
  134. package/include/glib-2.0/gio/gsimpleaction.h +65 -0
  135. package/include/glib-2.0/gio/gsimpleactiongroup.h +99 -0
  136. package/include/glib-2.0/gio/gsimpleasyncresult.h +164 -0
  137. package/include/glib-2.0/gio/gsimpleiostream.h +47 -0
  138. package/include/glib-2.0/gio/gsimplepermission.h +47 -0
  139. package/include/glib-2.0/gio/gsimpleproxyresolver.h +91 -0
  140. package/include/glib-2.0/gio/gsocket.h +330 -0
  141. package/include/glib-2.0/gio/gsocketaddress.h +84 -0
  142. package/include/glib-2.0/gio/gsocketaddressenumerator.h +103 -0
  143. package/include/glib-2.0/gio/gsocketclient.h +199 -0
  144. package/include/glib-2.0/gio/gsocketconnectable.h +83 -0
  145. package/include/glib-2.0/gio/gsocketconnection.h +117 -0
  146. package/include/glib-2.0/gio/gsocketcontrolmessage.h +113 -0
  147. package/include/glib-2.0/gio/gsocketlistener.h +157 -0
  148. package/include/glib-2.0/gio/gsocketservice.h +95 -0
  149. package/include/glib-2.0/gio/gsrvtarget.h +60 -0
  150. package/include/glib-2.0/gio/gsubprocess.h +169 -0
  151. package/include/glib-2.0/gio/gsubprocesslauncher.h +121 -0
  152. package/include/glib-2.0/gio/gtask.h +207 -0
  153. package/include/glib-2.0/gio/gtcpconnection.h +71 -0
  154. package/include/glib-2.0/gio/gtcpwrapperconnection.h +71 -0
  155. package/include/glib-2.0/gio/gtestdbus.h +74 -0
  156. package/include/glib-2.0/gio/gthemedicon.h +70 -0
  157. package/include/glib-2.0/gio/gthreadedsocketservice.h +83 -0
  158. package/include/glib-2.0/gio/gtlsbackend.h +115 -0
  159. package/include/glib-2.0/gio/gtlscertificate.h +125 -0
  160. package/include/glib-2.0/gio/gtlsclientconnection.h +88 -0
  161. package/include/glib-2.0/gio/gtlsconnection.h +214 -0
  162. package/include/glib-2.0/gio/gtlsdatabase.h +249 -0
  163. package/include/glib-2.0/gio/gtlsfiledatabase.h +60 -0
  164. package/include/glib-2.0/gio/gtlsinteraction.h +150 -0
  165. package/include/glib-2.0/gio/gtlspassword.h +121 -0
  166. package/include/glib-2.0/gio/gtlsserverconnection.h +71 -0
  167. package/include/glib-2.0/gio/gunixconnection.h +102 -0
  168. package/include/glib-2.0/gio/gunixcredentialsmessage.h +89 -0
  169. package/include/glib-2.0/gio/gunixfdlist.h +97 -0
  170. package/include/glib-2.0/gio/gunixsocketaddress.h +83 -0
  171. package/include/glib-2.0/gio/gvfs.h +170 -0
  172. package/include/glib-2.0/gio/gvolume.h +255 -0
  173. package/include/glib-2.0/gio/gvolumemonitor.h +156 -0
  174. package/include/glib-2.0/gio/gzlibcompressor.h +64 -0
  175. package/include/glib-2.0/gio/gzlibdecompressor.h +60 -0
  176. package/include/glib-2.0/glib/deprecated/gallocator.h +88 -0
  177. package/include/glib-2.0/glib/deprecated/gcache.h +77 -0
  178. package/include/glib-2.0/glib/deprecated/gcompletion.h +85 -0
  179. package/include/glib-2.0/glib/deprecated/gmain.h +137 -0
  180. package/include/glib-2.0/glib/deprecated/grel.h +107 -0
  181. package/include/glib-2.0/glib/deprecated/gthread.h +295 -0
  182. package/include/glib-2.0/glib/galloca.h +147 -0
  183. package/include/glib-2.0/glib/garray.h +323 -0
  184. package/include/glib-2.0/glib/gasyncqueue.h +126 -0
  185. package/include/glib-2.0/glib/gatomic.h +587 -0
  186. package/include/glib-2.0/glib/gbacktrace.h +74 -0
  187. package/include/glib-2.0/glib/gbase64.h +63 -0
  188. package/include/glib-2.0/glib/gbitlock.h +78 -0
  189. package/include/glib-2.0/glib/gbookmarkfile.h +300 -0
  190. package/include/glib-2.0/glib/gbytes.h +99 -0
  191. package/include/glib-2.0/glib/gcharset.h +49 -0
  192. package/include/glib-2.0/glib/gchecksum.h +106 -0
  193. package/include/glib-2.0/glib/gconvert.h +179 -0
  194. package/include/glib-2.0/glib/gdataset.h +156 -0
  195. package/include/glib-2.0/glib/gdate.h +309 -0
  196. package/include/glib-2.0/glib/gdatetime.h +275 -0
  197. package/include/glib-2.0/glib/gdir.h +54 -0
  198. package/include/glib-2.0/glib/genviron.h +65 -0
  199. package/include/glib-2.0/glib/gerror.h +263 -0
  200. package/include/glib-2.0/glib/gfileutils.h +223 -0
  201. package/include/glib-2.0/glib/ggettext.h +65 -0
  202. package/include/glib-2.0/glib/ghash.h +206 -0
  203. package/include/glib-2.0/glib/ghmac.h +85 -0
  204. package/include/glib-2.0/glib/ghook.h +204 -0
  205. package/include/glib-2.0/glib/ghostutils.h +45 -0
  206. package/include/glib-2.0/glib/gi18n-lib.h +29 -0
  207. package/include/glib-2.0/glib/gi18n.h +34 -0
  208. package/include/glib-2.0/glib/giochannel.h +407 -0
  209. package/include/glib-2.0/glib/gkeyfile.h +332 -0
  210. package/include/glib-2.0/glib/glib-autocleanups.h +105 -0
  211. package/include/glib-2.0/glib/glib-typeof.h +47 -0
  212. package/include/glib-2.0/glib/glib-visibility.h +952 -0
  213. package/include/glib-2.0/glib/glist.h +179 -0
  214. package/include/glib-2.0/glib/gmacros.h +1425 -0
  215. package/include/glib-2.0/glib/gmain.h +862 -0
  216. package/include/glib-2.0/glib/gmappedfile.h +60 -0
  217. package/include/glib-2.0/glib/gmarkup.h +265 -0
  218. package/include/glib-2.0/glib/gmem.h +425 -0
  219. package/include/glib-2.0/glib/gmessages.h +690 -0
  220. package/include/glib-2.0/glib/gnode.h +309 -0
  221. package/include/glib-2.0/glib/goption.h +409 -0
  222. package/include/glib-2.0/glib/gpathbuf.h +90 -0
  223. package/include/glib-2.0/glib/gpattern.h +65 -0
  224. package/include/glib-2.0/glib/gpoll.h +122 -0
  225. package/include/glib-2.0/glib/gprimes.h +52 -0
  226. package/include/glib-2.0/glib/gprintf.h +59 -0
  227. package/include/glib-2.0/glib/gqsort.h +47 -0
  228. package/include/glib-2.0/glib/gquark.h +70 -0
  229. package/include/glib-2.0/glib/gqueue.h +205 -0
  230. package/include/glib-2.0/glib/grand.h +101 -0
  231. package/include/glib-2.0/glib/grcbox.h +91 -0
  232. package/include/glib-2.0/glib/grefcount.h +179 -0
  233. package/include/glib-2.0/glib/grefstring.h +59 -0
  234. package/include/glib-2.0/glib/gscanner.h +301 -0
  235. package/include/glib-2.0/glib/gsequence.h +175 -0
  236. package/include/glib-2.0/glib/gshell.h +59 -0
  237. package/include/glib-2.0/glib/gslice.h +117 -0
  238. package/include/glib-2.0/glib/gslist.h +166 -0
  239. package/include/glib-2.0/glib/gspawn.h +323 -0
  240. package/include/glib-2.0/glib/gstdio.h +231 -0
  241. package/include/glib-2.0/glib/gstrfuncs.h +504 -0
  242. package/include/glib-2.0/glib/gstring.h +296 -0
  243. package/include/glib-2.0/glib/gstringchunk.h +59 -0
  244. package/include/glib-2.0/glib/gstrvbuilder.h +69 -0
  245. package/include/glib-2.0/glib/gtestutils.h +763 -0
  246. package/include/glib-2.0/glib/gthread.h +603 -0
  247. package/include/glib-2.0/glib/gthreadpool.h +105 -0
  248. package/include/glib-2.0/glib/gtimer.h +80 -0
  249. package/include/glib-2.0/glib/gtimezone.h +98 -0
  250. package/include/glib-2.0/glib/gtrashstack.h +60 -0
  251. package/include/glib-2.0/glib/gtree.h +181 -0
  252. package/include/glib-2.0/glib/gtypes.h +591 -0
  253. package/include/glib-2.0/glib/gunicode.h +974 -0
  254. package/include/glib-2.0/glib/guri.h +420 -0
  255. package/include/glib-2.0/glib/gutils.h +479 -0
  256. package/include/glib-2.0/glib/guuid.h +42 -0
  257. package/include/glib-2.0/glib/gvariant.h +541 -0
  258. package/include/glib-2.0/glib/gvarianttype.h +384 -0
  259. package/include/glib-2.0/glib/gversion.h +57 -0
  260. package/include/glib-2.0/glib/gversionmacros.h +490 -0
  261. package/include/glib-2.0/glib/gwin32.h +142 -0
  262. package/include/glib-2.0/glib-object.h +46 -0
  263. package/include/glib-2.0/glib-unix.h +125 -0
  264. package/include/glib-2.0/glib.h +121 -0
  265. package/include/glib-2.0/gmodule/gmodule-visibility.h +952 -0
  266. package/include/glib-2.0/gmodule.h +147 -0
  267. package/include/glib-2.0/gobject/gbinding.h +156 -0
  268. package/include/glib-2.0/gobject/gbindinggroup.h +85 -0
  269. package/include/glib-2.0/gobject/gboxed.h +124 -0
  270. package/include/glib-2.0/gobject/gclosure.h +323 -0
  271. package/include/glib-2.0/gobject/genums.h +381 -0
  272. package/include/glib-2.0/gobject/glib-enumtypes.h +25 -0
  273. package/include/glib-2.0/gobject/glib-types.h +400 -0
  274. package/include/glib-2.0/gobject/gmarshal.h +434 -0
  275. package/include/glib-2.0/gobject/gobject-autocleanups.h +33 -0
  276. package/include/glib-2.0/gobject/gobject-visibility.h +952 -0
  277. package/include/glib-2.0/gobject/gobject.h +953 -0
  278. package/include/glib-2.0/gobject/gobjectnotifyqueue.c +199 -0
  279. package/include/glib-2.0/gobject/gparam.h +477 -0
  280. package/include/glib-2.0/gobject/gparamspecs.h +1151 -0
  281. package/include/glib-2.0/gobject/gsignal.h +647 -0
  282. package/include/glib-2.0/gobject/gsignalgroup.h +98 -0
  283. package/include/glib-2.0/gobject/gsourceclosure.h +40 -0
  284. package/include/glib-2.0/gobject/gtype.h +2715 -0
  285. package/include/glib-2.0/gobject/gtypemodule.h +302 -0
  286. package/include/glib-2.0/gobject/gtypeplugin.h +136 -0
  287. package/include/glib-2.0/gobject/gvalue.h +212 -0
  288. package/include/glib-2.0/gobject/gvaluearray.h +106 -0
  289. package/include/glib-2.0/gobject/gvaluecollector.h +290 -0
  290. package/include/glib-2.0/gobject/gvaluetypes.h +318 -0
  291. package/include/hwy/aligned_allocator.h +211 -0
  292. package/include/hwy/base.h +1517 -0
  293. package/include/hwy/cache_control.h +108 -0
  294. package/include/hwy/detect_compiler_arch.h +281 -0
  295. package/include/hwy/detect_targets.h +644 -0
  296. package/include/hwy/foreach_target.h +340 -0
  297. package/include/hwy/highway.h +435 -0
  298. package/include/hwy/highway_export.h +74 -0
  299. package/include/hwy/nanobenchmark.h +171 -0
  300. package/include/hwy/ops/arm_neon-inl.h +8913 -0
  301. package/include/hwy/ops/arm_sve-inl.h +5105 -0
  302. package/include/hwy/ops/emu128-inl.h +2811 -0
  303. package/include/hwy/ops/generic_ops-inl.h +4745 -0
  304. package/include/hwy/ops/ppc_vsx-inl.h +5716 -0
  305. package/include/hwy/ops/rvv-inl.h +5070 -0
  306. package/include/hwy/ops/scalar-inl.h +1995 -0
  307. package/include/hwy/ops/set_macros-inl.h +578 -0
  308. package/include/hwy/ops/shared-inl.h +539 -0
  309. package/include/hwy/ops/tuple-inl.h +125 -0
  310. package/include/hwy/ops/wasm_128-inl.h +5917 -0
  311. package/include/hwy/ops/x86_128-inl.h +11173 -0
  312. package/include/hwy/ops/x86_256-inl.h +7529 -0
  313. package/include/hwy/ops/x86_512-inl.h +6849 -0
  314. package/include/hwy/per_target.h +44 -0
  315. package/include/hwy/print-inl.h +62 -0
  316. package/include/hwy/print.h +75 -0
  317. package/include/hwy/robust_statistics.h +148 -0
  318. package/include/hwy/targets.h +338 -0
  319. package/include/hwy/timer-inl.h +200 -0
  320. package/include/hwy/timer.h +55 -0
  321. package/include/index.js +1 -0
  322. package/include/jconfig.h +37 -0
  323. package/include/jerror.h +335 -0
  324. package/include/jmorecfg.h +382 -0
  325. package/include/jpeglib.h +1211 -0
  326. package/include/lcms2.h +1958 -0
  327. package/include/lcms2_plugin.h +700 -0
  328. package/include/libexif/_stdint.h +2 -0
  329. package/include/libexif/exif-byte-order.h +48 -0
  330. package/include/libexif/exif-content.h +181 -0
  331. package/include/libexif/exif-data-type.h +46 -0
  332. package/include/libexif/exif-data.h +267 -0
  333. package/include/libexif/exif-entry.h +186 -0
  334. package/include/libexif/exif-format.h +65 -0
  335. package/include/libexif/exif-ifd.h +51 -0
  336. package/include/libexif/exif-loader.h +128 -0
  337. package/include/libexif/exif-log.h +116 -0
  338. package/include/libexif/exif-mem.h +91 -0
  339. package/include/libexif/exif-mnote-data.h +122 -0
  340. package/include/libexif/exif-tag.h +307 -0
  341. package/include/libexif/exif-utils.h +194 -0
  342. package/include/libheif/heif.h +2169 -0
  343. package/include/libheif/heif_cxx.h +1362 -0
  344. package/include/libheif/heif_plugin.h +306 -0
  345. package/include/libheif/heif_properties.h +138 -0
  346. package/include/libheif/heif_regions.h +866 -0
  347. package/include/libheif/heif_version.h +38 -0
  348. package/include/libimagequant.h +111 -0
  349. package/include/resvg.h +491 -0
  350. package/include/spng.h +537 -0
  351. package/include/tiff.h +899 -0
  352. package/include/tiffconf.h +145 -0
  353. package/include/tiffio.h +653 -0
  354. package/include/tiffvers.h +36 -0
  355. package/include/vips/VConnection8.h +144 -0
  356. package/include/vips/VError8.h +79 -0
  357. package/include/vips/VImage8.h +6329 -0
  358. package/include/vips/VInterpolate8.h +74 -0
  359. package/include/vips/VRegion8.h +154 -0
  360. package/include/vips/arithmetic.h +571 -0
  361. package/include/vips/basic.h +113 -0
  362. package/include/vips/buf.h +120 -0
  363. package/include/vips/colour.h +306 -0
  364. package/include/vips/connection.h +567 -0
  365. package/include/vips/conversion.h +357 -0
  366. package/include/vips/convolution.h +101 -0
  367. package/include/vips/create.h +161 -0
  368. package/include/vips/dbuf.h +101 -0
  369. package/include/vips/debug.h +106 -0
  370. package/include/vips/draw.h +113 -0
  371. package/include/vips/enumtypes.h +184 -0
  372. package/include/vips/error.h +142 -0
  373. package/include/vips/foreign.h +1033 -0
  374. package/include/vips/format.h +135 -0
  375. package/include/vips/freqfilt.h +64 -0
  376. package/include/vips/gate.h +90 -0
  377. package/include/vips/generate.h +92 -0
  378. package/include/vips/header.h +322 -0
  379. package/include/vips/histogram.h +85 -0
  380. package/include/vips/image.h +605 -0
  381. package/include/vips/interpolate.h +140 -0
  382. package/include/vips/memory.h +105 -0
  383. package/include/vips/morphology.h +73 -0
  384. package/include/vips/mosaicing.h +79 -0
  385. package/include/vips/object.h +720 -0
  386. package/include/vips/operation.h +183 -0
  387. package/include/vips/private.h +225 -0
  388. package/include/vips/rect.h +80 -0
  389. package/include/vips/region.h +238 -0
  390. package/include/vips/resample.h +123 -0
  391. package/include/vips/sbuf.h +143 -0
  392. package/include/vips/semaphore.h +77 -0
  393. package/include/vips/thread.h +75 -0
  394. package/include/vips/threadpool.h +159 -0
  395. package/include/vips/transform.h +89 -0
  396. package/include/vips/type.h +310 -0
  397. package/include/vips/util.h +451 -0
  398. package/include/vips/vector.h +63 -0
  399. package/include/vips/version.h +26 -0
  400. package/include/vips/vips.h +195 -0
  401. package/include/vips/vips8 +60 -0
  402. package/include/webp/decode.h +504 -0
  403. package/include/webp/demux.h +363 -0
  404. package/include/webp/encode.h +552 -0
  405. package/include/webp/mux.h +530 -0
  406. package/include/webp/mux_types.h +98 -0
  407. package/include/webp/sharpyuv/sharpyuv.h +103 -0
  408. package/include/webp/sharpyuv/sharpyuv_csp.h +60 -0
  409. package/include/webp/types.h +72 -0
  410. package/include/zconf.h +203 -0
  411. package/include/zlib.h +1859 -0
  412. package/include/zlib_name_mangling.h +8 -0
  413. package/lib/glib-2.0/include/glibconfig.h +220 -0
  414. package/lib/index.js +1 -0
  415. package/lib/libaom.a +0 -0
  416. package/lib/libcgif.a +0 -0
  417. package/lib/libexif.a +0 -0
  418. package/lib/libexif.la +41 -0
  419. package/lib/libexpat.a +0 -0
  420. package/lib/libexpat.la +41 -0
  421. package/lib/libffi.a +0 -0
  422. package/lib/libffi.la +41 -0
  423. package/lib/libgio-2.0.a +0 -0
  424. package/lib/libglib-2.0.a +0 -0
  425. package/lib/libgmodule-2.0.a +0 -0
  426. package/lib/libgobject-2.0.a +0 -0
  427. package/lib/libgthread-2.0.a +0 -0
  428. package/lib/libheif.a +0 -0
  429. package/lib/libhwy.a +0 -0
  430. package/lib/libimagequant.a +0 -0
  431. package/lib/libjpeg.a +0 -0
  432. package/lib/liblcms2.a +0 -0
  433. package/lib/libresvg.a +0 -0
  434. package/lib/libsharpyuv.a +0 -0
  435. package/lib/libsharpyuv.la +41 -0
  436. package/lib/libspng.a +0 -0
  437. package/lib/libtiff.a +0 -0
  438. package/lib/libtiff.la +41 -0
  439. package/lib/libvips-cpp.a +0 -0
  440. package/lib/libvips.a +0 -0
  441. package/lib/libwebp.a +0 -0
  442. package/lib/libwebp.la +41 -0
  443. package/lib/libwebpdemux.a +0 -0
  444. package/lib/libwebpdemux.la +41 -0
  445. package/lib/libwebpmux.a +0 -0
  446. package/lib/libwebpmux.la +41 -0
  447. package/lib/libz.a +0 -0
  448. package/lib/pkgconfig/aom.pc +14 -0
  449. package/lib/pkgconfig/cgif.pc +9 -0
  450. package/lib/pkgconfig/expat.pc +12 -0
  451. package/lib/pkgconfig/gio-2.0.pc +24 -0
  452. package/lib/pkgconfig/glib-2.0.pc +16 -0
  453. package/lib/pkgconfig/gmodule-2.0.pc +12 -0
  454. package/lib/pkgconfig/gmodule-export-2.0.pc +12 -0
  455. package/lib/pkgconfig/gmodule-no-export-2.0.pc +12 -0
  456. package/lib/pkgconfig/gobject-2.0.pc +10 -0
  457. package/lib/pkgconfig/gthread-2.0.pc +10 -0
  458. package/lib/pkgconfig/imagequant.pc +9 -0
  459. package/lib/pkgconfig/lcms2.pc +9 -0
  460. package/lib/pkgconfig/libexif.pc +12 -0
  461. package/lib/pkgconfig/libffi.pc +11 -0
  462. package/lib/pkgconfig/libheif.pc +23 -0
  463. package/lib/pkgconfig/libhwy.pc +10 -0
  464. package/lib/pkgconfig/libjpeg.pc +10 -0
  465. package/lib/pkgconfig/libsharpyuv.pc +11 -0
  466. package/lib/pkgconfig/libtiff-4.pc +12 -0
  467. package/lib/pkgconfig/libwebp.pc +12 -0
  468. package/lib/pkgconfig/libwebpdemux.pc +11 -0
  469. package/lib/pkgconfig/libwebpmux.pc +12 -0
  470. package/lib/pkgconfig/spng.pc +10 -0
  471. package/lib/pkgconfig/vips-cpp.pc +10 -0
  472. package/lib/pkgconfig/vips.pc +10 -0
  473. package/lib/pkgconfig/zlib.pc +14 -0
  474. package/package.json +31 -0
  475. package/versions.json +19 -0
@@ -0,0 +1,1362 @@
1
+ /*
2
+ * C++ interface to libheif
3
+ * Copyright (c) 2018 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_CXX_H
22
+ #define LIBHEIF_HEIF_CXX_H
23
+
24
+ #include <memory>
25
+ #include <string>
26
+ #include <vector>
27
+ #include <cassert>
28
+
29
+ extern "C" {
30
+ #include <libheif/heif.h>
31
+ }
32
+
33
+
34
+ namespace heif {
35
+
36
+ class Error
37
+ {
38
+ public:
39
+ Error()
40
+ {
41
+ m_code = heif_error_Ok;
42
+ m_subcode = heif_suberror_Unspecified;
43
+ m_message = "Ok";
44
+ }
45
+
46
+ Error(const heif_error& err)
47
+ {
48
+ assert(err.message);
49
+
50
+ m_code = err.code;
51
+ m_subcode = err.subcode;
52
+ m_message = err.message;
53
+ }
54
+
55
+ Error(heif_error_code code, heif_suberror_code subcode, const std::string& msg)
56
+ {
57
+ m_code = code;
58
+ m_subcode = subcode;
59
+ m_message = msg;
60
+ }
61
+
62
+ const std::string& get_message() const
63
+ { return m_message; }
64
+
65
+ heif_error_code get_code() const
66
+ { return m_code; }
67
+
68
+ heif_suberror_code get_subcode() const
69
+ { return m_subcode; }
70
+
71
+ operator bool() const
72
+ { return m_code != heif_error_Ok; }
73
+
74
+ private:
75
+ heif_error_code m_code;
76
+ heif_suberror_code m_subcode;
77
+ std::string m_message;
78
+ };
79
+
80
+
81
+ class ImageHandle;
82
+
83
+ class Image;
84
+
85
+ class Encoder;
86
+
87
+ class EncoderParameter;
88
+
89
+ class EncoderDescriptor;
90
+
91
+
92
+ class Context
93
+ {
94
+ public:
95
+ Context();
96
+
97
+ class ReadingOptions
98
+ {
99
+ };
100
+
101
+ // throws Error
102
+ void read_from_file(const std::string& filename, const ReadingOptions& opts = ReadingOptions());
103
+
104
+ // DEPRECATED. Use read_from_memory_without_copy() instead.
105
+ // throws Error
106
+ void read_from_memory(const void* mem, size_t size, const ReadingOptions& opts = ReadingOptions());
107
+
108
+ // throws Error
109
+ void read_from_memory_without_copy(const void* mem, size_t size, const ReadingOptions& opts = ReadingOptions());
110
+
111
+ class Reader
112
+ {
113
+ public:
114
+ virtual ~Reader() = default;
115
+
116
+ virtual int64_t get_position() const = 0;
117
+
118
+ virtual int read(void* data, size_t size) = 0;
119
+
120
+ virtual int seek(int64_t position) = 0;
121
+
122
+ virtual heif_reader_grow_status wait_for_file_size(int64_t target_size) = 0;
123
+ };
124
+
125
+ // throws Error
126
+ void read_from_reader(Reader&, const ReadingOptions& opts = ReadingOptions());
127
+
128
+ int get_number_of_top_level_images() const noexcept;
129
+
130
+ bool is_top_level_image_ID(heif_item_id id) const noexcept;
131
+
132
+ std::vector<heif_item_id> get_list_of_top_level_image_IDs() const noexcept;
133
+
134
+ // throws Error
135
+ heif_item_id get_primary_image_ID() const;
136
+
137
+ // throws Error
138
+ ImageHandle get_primary_image_handle() const;
139
+
140
+ ImageHandle get_image_handle(heif_item_id id) const;
141
+
142
+
143
+ class EncodingOptions : public heif_encoding_options
144
+ {
145
+ public:
146
+ EncodingOptions();
147
+ };
148
+
149
+ // throws Error
150
+ ImageHandle encode_image(const Image& img, Encoder& encoder,
151
+ const EncodingOptions& options = EncodingOptions());
152
+
153
+ // throws Error
154
+ void set_primary_image(ImageHandle& new_primary_image_handle);
155
+
156
+ // throws Error
157
+ ImageHandle encode_thumbnail(const Image& image,
158
+ const ImageHandle& master_image,
159
+ Encoder& encoder,
160
+ const EncodingOptions&,
161
+ int bbox_size);
162
+
163
+ // throws Error
164
+ void assign_thumbnail(const ImageHandle& thumbnail_image,
165
+ const ImageHandle& master_image);
166
+
167
+ // throws Error
168
+ void add_exif_metadata(const ImageHandle& master_image,
169
+ const void* data, int size);
170
+
171
+ // throws Error
172
+ void add_XMP_metadata(const ImageHandle& master_image,
173
+ const void* data, int size);
174
+
175
+ class Writer
176
+ {
177
+ public:
178
+ virtual ~Writer() = default;
179
+
180
+ virtual heif_error write(const void* data, size_t size) = 0;
181
+ };
182
+
183
+ // throws Error
184
+ void write(Writer&);
185
+
186
+ // throws Error
187
+ void write_to_file(const std::string& filename) const;
188
+
189
+ private:
190
+ std::shared_ptr<heif_context> m_context;
191
+
192
+ friend struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
193
+ const void* data,
194
+ size_t size,
195
+ void* userdata);
196
+
197
+ //static Context wrap_without_releasing(heif_context*); // internal use in friend function only
198
+ };
199
+
200
+
201
+ class ImageHandle
202
+ {
203
+ public:
204
+ ImageHandle() = default;
205
+
206
+ ImageHandle(heif_image_handle* handle);
207
+
208
+ bool empty() const noexcept
209
+ { return !m_image_handle; }
210
+
211
+ bool is_primary_image() const noexcept;
212
+
213
+ int get_width() const noexcept;
214
+
215
+ int get_height() const noexcept;
216
+
217
+ bool has_alpha_channel() const noexcept;
218
+
219
+ bool is_premultiplied_alpha() const noexcept;
220
+
221
+ int get_luma_bits_per_pixel() const noexcept;
222
+
223
+ int get_chroma_bits_per_pixel() const noexcept;
224
+
225
+ int get_ispe_width() const noexcept;
226
+
227
+ int get_ispe_height() const noexcept;
228
+
229
+ // ------------------------- depth images -------------------------
230
+
231
+ // TODO
232
+
233
+ // ------------------------- thumbnails -------------------------
234
+
235
+ int get_number_of_thumbnails() const noexcept;
236
+
237
+ std::vector<heif_item_id> get_list_of_thumbnail_IDs() const noexcept;
238
+
239
+ // throws Error
240
+ ImageHandle get_thumbnail(heif_item_id id);
241
+
242
+ // ------------------------- metadata (Exif / XMP) -------------------------
243
+
244
+ // Can optionally be filtered by type ("Exif" / "XMP")
245
+ std::vector<heif_item_id> get_list_of_metadata_block_IDs(const char* type_filter = nullptr) const noexcept;
246
+
247
+ std::string get_metadata_type(heif_item_id metadata_id) const noexcept;
248
+
249
+ std::string get_metadata_content_type(heif_item_id metadata_id) const noexcept;
250
+
251
+ // throws error
252
+ std::vector<uint8_t> get_metadata(heif_item_id) const;
253
+
254
+
255
+ class DecodingOptions
256
+ {
257
+ };
258
+
259
+ // throws Error
260
+ Image decode_image(heif_colorspace colorspace, heif_chroma chroma,
261
+ const DecodingOptions& options = DecodingOptions());
262
+
263
+
264
+ heif_image_handle* get_raw_image_handle() noexcept
265
+ { return m_image_handle.get(); }
266
+
267
+ const heif_image_handle* get_raw_image_handle() const noexcept
268
+ { return m_image_handle.get(); }
269
+
270
+ private:
271
+ std::shared_ptr<heif_image_handle> m_image_handle;
272
+ };
273
+
274
+
275
+ class ColorProfile_nclx
276
+ {
277
+ public:
278
+ ColorProfile_nclx();
279
+
280
+ ~ColorProfile_nclx();
281
+
282
+ heif_color_primaries get_color_primaries() const;
283
+
284
+ heif_transfer_characteristics get_transfer_characteristics() const;
285
+
286
+ heif_matrix_coefficients get_matrix_coefficients() const;
287
+
288
+ bool is_full_range() const;
289
+
290
+ void set_color_primaries(heif_color_primaries cp);
291
+
292
+ // DEPRECATED: typo in function name. Use set_color_primaries() instead.
293
+ void set_color_primaties(heif_color_primaries cp);
294
+
295
+ void set_transfer_characteristics(heif_transfer_characteristics tc);
296
+
297
+ void set_matrix_coefficients(heif_matrix_coefficients mc);
298
+
299
+ void set_full_range_flag(bool is_full_range);
300
+
301
+ private:
302
+ ColorProfile_nclx(heif_color_profile_nclx* nclx)
303
+ { mProfile = nclx; }
304
+
305
+ heif_color_profile_nclx* mProfile;
306
+
307
+ friend class Image;
308
+ };
309
+
310
+
311
+ class Image
312
+ {
313
+ public:
314
+ Image() = default;
315
+
316
+ Image(heif_image* image);
317
+
318
+
319
+ // throws Error
320
+ void create(int width, int height,
321
+ enum heif_colorspace colorspace,
322
+ enum heif_chroma chroma);
323
+
324
+ // throws Error
325
+ void add_plane(enum heif_channel channel,
326
+ int width, int height, int bit_depth);
327
+
328
+ heif_colorspace get_colorspace() const noexcept;
329
+
330
+ heif_chroma get_chroma_format() const noexcept;
331
+
332
+ int get_width(enum heif_channel channel) const noexcept;
333
+
334
+ int get_height(enum heif_channel channel) const noexcept;
335
+
336
+ int get_bits_per_pixel(enum heif_channel channel) const noexcept;
337
+
338
+ int get_bits_per_pixel_range(enum heif_channel channel) const noexcept;
339
+
340
+ bool has_channel(enum heif_channel channel) const noexcept;
341
+
342
+ const uint8_t* get_plane(enum heif_channel channel, int* out_stride) const noexcept;
343
+
344
+ uint8_t* get_plane(enum heif_channel channel, int* out_stride) noexcept;
345
+
346
+ // throws Error
347
+ void set_nclx_color_profile(const ColorProfile_nclx&);
348
+
349
+ // throws Error
350
+ ColorProfile_nclx get_nclx_color_profile() const;
351
+
352
+ heif_color_profile_type get_color_profile_type() const;
353
+
354
+ // throws Error
355
+ std::vector<uint8_t> get_raw_color_profile() const;
356
+
357
+ void set_raw_color_profile(heif_color_profile_type type,
358
+ const std::vector<uint8_t>& data);
359
+
360
+ bool is_premultiplied_alpha() const noexcept;
361
+
362
+ void set_premultiplied_alpha(bool is_premultiplied_alpha) noexcept;
363
+
364
+ class ScalingOptions
365
+ {
366
+ };
367
+
368
+ // throws Error
369
+ Image scale_image(int width, int height,
370
+ const ScalingOptions& options = ScalingOptions()) const;
371
+
372
+ private:
373
+ std::shared_ptr<heif_image> m_image;
374
+
375
+ friend class Context;
376
+ };
377
+
378
+
379
+ class EncoderDescriptor
380
+ {
381
+ public:
382
+ static std::vector<EncoderDescriptor>
383
+ get_encoder_descriptors(enum heif_compression_format format_filter,
384
+ const char* name_filter) noexcept;
385
+
386
+ std::string get_name() const noexcept;
387
+
388
+ std::string get_id_name() const noexcept;
389
+
390
+ enum heif_compression_format get_compression_format() const noexcept;
391
+
392
+ // DEPRECATED: typo in function name
393
+ bool supportes_lossy_compression() const noexcept;
394
+
395
+ // DEPRECATED: typo in function name
396
+ bool supportes_lossless_compression() const noexcept;
397
+
398
+
399
+ // throws Error
400
+ Encoder get_encoder() const;
401
+
402
+ bool supports_lossy_compression() const noexcept;
403
+
404
+ bool supports_lossless_compression() const noexcept;
405
+
406
+ private:
407
+ EncoderDescriptor(const struct heif_encoder_descriptor* descr) : m_descriptor(descr)
408
+ {}
409
+
410
+ const struct heif_encoder_descriptor* m_descriptor = nullptr;
411
+ };
412
+
413
+
414
+ class EncoderParameter
415
+ {
416
+ public:
417
+ std::string get_name() const noexcept;
418
+
419
+ enum heif_encoder_parameter_type get_type() const noexcept;
420
+
421
+ bool is_integer() const noexcept;
422
+
423
+ // Returns 'true' if the integer range is limited.
424
+ bool get_valid_integer_range(int& out_minimum, int& out_maximum);
425
+
426
+ bool is_boolean() const noexcept;
427
+
428
+ bool is_string() const noexcept;
429
+
430
+ std::vector<std::string> get_valid_string_values() const;
431
+
432
+ private:
433
+ EncoderParameter(const heif_encoder_parameter*);
434
+
435
+ const struct heif_encoder_parameter* m_parameter;
436
+
437
+ friend class Encoder;
438
+ };
439
+
440
+
441
+ class Encoder
442
+ {
443
+ public:
444
+ // throws Error
445
+ Encoder(enum heif_compression_format format);
446
+
447
+ // throws Error
448
+ void set_lossy_quality(int quality);
449
+
450
+ // throws Error
451
+ void set_lossless(bool enable_lossless);
452
+
453
+ std::vector<EncoderParameter> list_parameters() const noexcept;
454
+
455
+ void set_integer_parameter(const std::string& parameter_name, int value);
456
+
457
+ int get_integer_parameter(const std::string& parameter_name) const;
458
+
459
+ void set_boolean_parameter(const std::string& parameter_name, bool value);
460
+
461
+ bool get_boolean_parameter(const std::string& parameter_name) const;
462
+
463
+ void set_string_parameter(const std::string& parameter_name, const std::string& value);
464
+
465
+ std::string get_string_parameter(const std::string& parameter_name) const;
466
+
467
+ void set_parameter(const std::string& parameter_name, const std::string& parameter_value);
468
+
469
+ std::string get_parameter(const std::string& parameter_name) const;
470
+
471
+ private:
472
+ Encoder(struct heif_encoder*) noexcept;
473
+
474
+ std::shared_ptr<heif_encoder> m_encoder;
475
+
476
+ friend class EncoderDescriptor;
477
+
478
+ friend class Context;
479
+ };
480
+
481
+
482
+ // ==========================================================================================
483
+ // IMPLEMENTATION
484
+ // ==========================================================================================
485
+
486
+ inline Context::Context()
487
+ {
488
+ heif_context* ctx = heif_context_alloc();
489
+ m_context = std::shared_ptr<heif_context>(ctx,
490
+ [](heif_context* c) { heif_context_free(c); });
491
+ }
492
+
493
+ inline void Context::read_from_file(const std::string& filename, const ReadingOptions& /*opts*/)
494
+ {
495
+ Error err = Error(heif_context_read_from_file(m_context.get(), filename.c_str(), NULL));
496
+ if (err) {
497
+ throw err;
498
+ }
499
+ }
500
+
501
+ inline void Context::read_from_memory(const void* mem, size_t size, const ReadingOptions& /*opts*/)
502
+ {
503
+ Error err = Error(heif_context_read_from_memory(m_context.get(), mem, size, NULL));
504
+ if (err) {
505
+ throw err;
506
+ }
507
+ }
508
+
509
+ inline void Context::read_from_memory_without_copy(const void* mem, size_t size, const ReadingOptions& /*opts*/)
510
+ {
511
+ Error err = Error(heif_context_read_from_memory_without_copy(m_context.get(), mem, size, NULL));
512
+ if (err) {
513
+ throw err;
514
+ }
515
+ }
516
+
517
+
518
+ inline int64_t heif_reader_trampoline_get_position(void* userdata)
519
+ {
520
+ Context::Reader* reader = (Context::Reader*) userdata;
521
+ return reader->get_position();
522
+ }
523
+
524
+ inline int heif_reader_trampoline_read(void* data, size_t size, void* userdata)
525
+ {
526
+ Context::Reader* reader = (Context::Reader*) userdata;
527
+ return reader->read(data, size);
528
+ }
529
+
530
+ inline int heif_reader_trampoline_seek(int64_t position, void* userdata)
531
+ {
532
+ Context::Reader* reader = (Context::Reader*) userdata;
533
+ return reader->seek(position);
534
+ }
535
+
536
+ inline heif_reader_grow_status heif_reader_trampoline_wait_for_file_size(int64_t target_size, void* userdata)
537
+ {
538
+ Context::Reader* reader = (Context::Reader*) userdata;
539
+ return reader->wait_for_file_size(target_size);
540
+ }
541
+
542
+
543
+ static struct heif_reader heif_reader_trampoline =
544
+ {
545
+ 1,
546
+ heif_reader_trampoline_get_position,
547
+ heif_reader_trampoline_read,
548
+ heif_reader_trampoline_seek,
549
+ heif_reader_trampoline_wait_for_file_size
550
+ };
551
+
552
+ inline void Context::read_from_reader(Reader& reader, const ReadingOptions& /*opts*/)
553
+ {
554
+ Error err = Error(heif_context_read_from_reader(m_context.get(), &heif_reader_trampoline,
555
+ &reader, NULL));
556
+ if (err) {
557
+ throw err;
558
+ }
559
+ }
560
+
561
+
562
+ inline int Context::get_number_of_top_level_images() const noexcept
563
+ {
564
+ return heif_context_get_number_of_top_level_images(m_context.get());
565
+ }
566
+
567
+ inline bool Context::is_top_level_image_ID(heif_item_id id) const noexcept
568
+ {
569
+ return heif_context_is_top_level_image_ID(m_context.get(), id);
570
+ }
571
+
572
+ inline std::vector<heif_item_id> Context::get_list_of_top_level_image_IDs() const noexcept
573
+ {
574
+ int num = get_number_of_top_level_images();
575
+ std::vector<heif_item_id> IDs(num);
576
+ heif_context_get_list_of_top_level_image_IDs(m_context.get(), IDs.data(), num);
577
+ return IDs;
578
+ }
579
+
580
+ inline heif_item_id Context::get_primary_image_ID() const
581
+ {
582
+ heif_item_id id;
583
+ Error err = Error(heif_context_get_primary_image_ID(m_context.get(), &id));
584
+ if (err) {
585
+ throw err;
586
+ }
587
+ return id;
588
+ }
589
+
590
+ inline ImageHandle Context::get_primary_image_handle() const
591
+ {
592
+ heif_image_handle* handle;
593
+ Error err = Error(heif_context_get_primary_image_handle(m_context.get(), &handle));
594
+ if (err) {
595
+ throw err;
596
+ }
597
+
598
+ return ImageHandle(handle);
599
+ }
600
+
601
+ inline ImageHandle Context::get_image_handle(heif_item_id id) const
602
+ {
603
+ struct heif_image_handle* handle;
604
+ Error err = Error(heif_context_get_image_handle(m_context.get(), id, &handle));
605
+ if (err) {
606
+ throw err;
607
+ }
608
+ return ImageHandle(handle);
609
+ }
610
+
611
+ #if 0
612
+ inline Context Context::wrap_without_releasing(heif_context* ctx) {
613
+ Context context;
614
+ context.m_context = std::shared_ptr<heif_context>(ctx,
615
+ [] (heif_context*) { /* NOP */ });
616
+ return context;
617
+ }
618
+ #endif
619
+
620
+ inline struct ::heif_error heif_writer_trampoline_write(struct heif_context* ctx,
621
+ const void* data,
622
+ size_t size,
623
+ void* userdata)
624
+ {
625
+ Context::Writer* writer = (Context::Writer*) userdata;
626
+
627
+ (void) ctx;
628
+
629
+ //Context context = Context::wrap_without_releasing(ctx);
630
+ //return writer->write(context, data, size);
631
+ return writer->write(data, size);
632
+ }
633
+
634
+ static struct heif_writer heif_writer_trampoline =
635
+ {
636
+ 1,
637
+ &heif_writer_trampoline_write
638
+ };
639
+
640
+ inline void Context::write(Writer& writer)
641
+ {
642
+ Error err = Error(heif_context_write(m_context.get(), &heif_writer_trampoline, &writer));
643
+ if (err) {
644
+ throw err;
645
+ }
646
+ }
647
+
648
+ inline void Context::write_to_file(const std::string& filename) const
649
+ {
650
+ Error err = Error(heif_context_write_to_file(m_context.get(), filename.c_str()));
651
+ if (err) {
652
+ throw err;
653
+ }
654
+ }
655
+
656
+
657
+ inline ImageHandle::ImageHandle(heif_image_handle* handle)
658
+ {
659
+ if (handle != nullptr) {
660
+ m_image_handle = std::shared_ptr<heif_image_handle>(handle,
661
+ [](heif_image_handle* h) { heif_image_handle_release(h); });
662
+ }
663
+ }
664
+
665
+ inline bool ImageHandle::is_primary_image() const noexcept
666
+ {
667
+ return heif_image_handle_is_primary_image(m_image_handle.get()) != 0;
668
+ }
669
+
670
+ inline int ImageHandle::get_width() const noexcept
671
+ {
672
+ return heif_image_handle_get_width(m_image_handle.get());
673
+ }
674
+
675
+ inline int ImageHandle::get_height() const noexcept
676
+ {
677
+ return heif_image_handle_get_height(m_image_handle.get());
678
+ }
679
+
680
+ inline bool ImageHandle::has_alpha_channel() const noexcept
681
+ {
682
+ return heif_image_handle_has_alpha_channel(m_image_handle.get()) != 0;
683
+ }
684
+
685
+ inline bool ImageHandle::is_premultiplied_alpha() const noexcept
686
+ {
687
+ return heif_image_handle_is_premultiplied_alpha(m_image_handle.get()) != 0;
688
+ }
689
+
690
+ inline int ImageHandle::get_luma_bits_per_pixel() const noexcept
691
+ {
692
+ return heif_image_handle_get_luma_bits_per_pixel(m_image_handle.get());
693
+ }
694
+
695
+ inline int ImageHandle::get_chroma_bits_per_pixel() const noexcept
696
+ {
697
+ return heif_image_handle_get_chroma_bits_per_pixel(m_image_handle.get());
698
+ }
699
+
700
+ inline int ImageHandle::get_ispe_width() const noexcept
701
+ {
702
+ return heif_image_handle_get_ispe_width(m_image_handle.get());
703
+ }
704
+
705
+ inline int ImageHandle::get_ispe_height() const noexcept
706
+ {
707
+ return heif_image_handle_get_ispe_height(m_image_handle.get());
708
+ }
709
+
710
+ // ------------------------- depth images -------------------------
711
+
712
+ // TODO
713
+
714
+ // ------------------------- thumbnails -------------------------
715
+
716
+ inline int ImageHandle::get_number_of_thumbnails() const noexcept
717
+ {
718
+ return heif_image_handle_get_number_of_thumbnails(m_image_handle.get());
719
+ }
720
+
721
+ inline std::vector<heif_item_id> ImageHandle::get_list_of_thumbnail_IDs() const noexcept
722
+ {
723
+ int num = get_number_of_thumbnails();
724
+ std::vector<heif_item_id> IDs(num);
725
+ heif_image_handle_get_list_of_thumbnail_IDs(m_image_handle.get(), IDs.data(), num);
726
+ return IDs;
727
+ }
728
+
729
+ inline ImageHandle ImageHandle::get_thumbnail(heif_item_id id)
730
+ {
731
+ heif_image_handle* handle;
732
+ Error err = Error(heif_image_handle_get_thumbnail(m_image_handle.get(), id, &handle));
733
+ if (err) {
734
+ throw err;
735
+ }
736
+
737
+ return ImageHandle(handle);
738
+ }
739
+
740
+ inline Image ImageHandle::decode_image(heif_colorspace colorspace, heif_chroma chroma,
741
+ const DecodingOptions& /*options*/)
742
+ {
743
+ heif_image* out_img;
744
+ Error err = Error(heif_decode_image(m_image_handle.get(),
745
+ &out_img,
746
+ colorspace,
747
+ chroma,
748
+ nullptr)); //const struct heif_decoding_options* options);
749
+ if (err) {
750
+ throw err;
751
+ }
752
+
753
+ return Image(out_img);
754
+ }
755
+
756
+
757
+ inline std::vector<heif_item_id> ImageHandle::get_list_of_metadata_block_IDs(const char* type_filter) const noexcept
758
+ {
759
+ int nBlocks = heif_image_handle_get_number_of_metadata_blocks(m_image_handle.get(),
760
+ type_filter);
761
+ std::vector<heif_item_id> ids(nBlocks);
762
+ int n = heif_image_handle_get_list_of_metadata_block_IDs(m_image_handle.get(),
763
+ type_filter,
764
+ ids.data(), nBlocks);
765
+ (void) n;
766
+ //assert(n==nBlocks);
767
+ return ids;
768
+ }
769
+
770
+ inline std::string ImageHandle::get_metadata_type(heif_item_id metadata_id) const noexcept
771
+ {
772
+ return heif_image_handle_get_metadata_type(m_image_handle.get(), metadata_id);
773
+ }
774
+
775
+ inline std::string ImageHandle::get_metadata_content_type(heif_item_id metadata_id) const noexcept
776
+ {
777
+ return heif_image_handle_get_metadata_content_type(m_image_handle.get(), metadata_id);
778
+ }
779
+
780
+ inline std::vector<uint8_t> ImageHandle::get_metadata(heif_item_id metadata_id) const
781
+ {
782
+ size_t data_size = heif_image_handle_get_metadata_size(m_image_handle.get(),
783
+ metadata_id);
784
+
785
+ std::vector<uint8_t> data(data_size);
786
+
787
+ Error err = Error(heif_image_handle_get_metadata(m_image_handle.get(),
788
+ metadata_id,
789
+ data.data()));
790
+ if (err) {
791
+ throw err;
792
+ }
793
+
794
+ return data;
795
+ }
796
+
797
+
798
+ inline ColorProfile_nclx::ColorProfile_nclx()
799
+ {
800
+ mProfile = heif_nclx_color_profile_alloc();
801
+ }
802
+
803
+ inline ColorProfile_nclx::~ColorProfile_nclx()
804
+ {
805
+ heif_nclx_color_profile_free(mProfile);
806
+ }
807
+
808
+ inline heif_color_primaries ColorProfile_nclx::get_color_primaries() const
809
+ { return mProfile->color_primaries; }
810
+
811
+ inline heif_transfer_characteristics ColorProfile_nclx::get_transfer_characteristics() const
812
+ { return mProfile->transfer_characteristics; }
813
+
814
+ inline heif_matrix_coefficients ColorProfile_nclx::get_matrix_coefficients() const
815
+ { return mProfile->matrix_coefficients; }
816
+
817
+ inline bool ColorProfile_nclx::is_full_range() const
818
+ { return mProfile->full_range_flag; }
819
+
820
+ inline void ColorProfile_nclx::set_color_primaries(heif_color_primaries cp)
821
+ { mProfile->color_primaries = cp; }
822
+
823
+ inline void ColorProfile_nclx::set_color_primaties(heif_color_primaries cp)
824
+ { set_color_primaries(cp); }
825
+
826
+ inline void ColorProfile_nclx::set_transfer_characteristics(heif_transfer_characteristics tc)
827
+ { mProfile->transfer_characteristics = tc; }
828
+
829
+ inline void ColorProfile_nclx::set_matrix_coefficients(heif_matrix_coefficients mc)
830
+ { mProfile->matrix_coefficients = mc; }
831
+
832
+ inline void ColorProfile_nclx::set_full_range_flag(bool is_full_range)
833
+ { mProfile->full_range_flag = is_full_range; }
834
+
835
+
836
+ inline Image::Image(heif_image* image)
837
+ {
838
+ m_image = std::shared_ptr<heif_image>(image,
839
+ [](heif_image* h) { heif_image_release(h); });
840
+ }
841
+
842
+
843
+ inline void Image::create(int width, int height,
844
+ enum heif_colorspace colorspace,
845
+ enum heif_chroma chroma)
846
+ {
847
+ heif_image* image;
848
+ Error err = Error(heif_image_create(width, height, colorspace, chroma, &image));
849
+ if (err) {
850
+ m_image.reset();
851
+ throw err;
852
+ }
853
+ else {
854
+ m_image = std::shared_ptr<heif_image>(image,
855
+ [](heif_image* h) { heif_image_release(h); });
856
+ }
857
+ }
858
+
859
+ inline void Image::add_plane(enum heif_channel channel,
860
+ int width, int height, int bit_depth)
861
+ {
862
+ Error err = Error(heif_image_add_plane(m_image.get(), channel, width, height, bit_depth));
863
+ if (err) {
864
+ throw err;
865
+ }
866
+ }
867
+
868
+ inline heif_colorspace Image::get_colorspace() const noexcept
869
+ {
870
+ return heif_image_get_colorspace(m_image.get());
871
+ }
872
+
873
+ inline heif_chroma Image::get_chroma_format() const noexcept
874
+ {
875
+ return heif_image_get_chroma_format(m_image.get());
876
+ }
877
+
878
+ inline int Image::get_width(enum heif_channel channel) const noexcept
879
+ {
880
+ return heif_image_get_width(m_image.get(), channel);
881
+ }
882
+
883
+ inline int Image::get_height(enum heif_channel channel) const noexcept
884
+ {
885
+ return heif_image_get_height(m_image.get(), channel);
886
+ }
887
+
888
+ inline int Image::get_bits_per_pixel(enum heif_channel channel) const noexcept
889
+ {
890
+ return heif_image_get_bits_per_pixel(m_image.get(), channel);
891
+ }
892
+
893
+ inline int Image::get_bits_per_pixel_range(enum heif_channel channel) const noexcept
894
+ {
895
+ return heif_image_get_bits_per_pixel_range(m_image.get(), channel);
896
+ }
897
+
898
+ inline bool Image::has_channel(enum heif_channel channel) const noexcept
899
+ {
900
+ return heif_image_has_channel(m_image.get(), channel);
901
+ }
902
+
903
+ inline const uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) const noexcept
904
+ {
905
+ return heif_image_get_plane_readonly(m_image.get(), channel, out_stride);
906
+ }
907
+
908
+ inline uint8_t* Image::get_plane(enum heif_channel channel, int* out_stride) noexcept
909
+ {
910
+ return heif_image_get_plane(m_image.get(), channel, out_stride);
911
+ }
912
+
913
+ inline void Image::set_nclx_color_profile(const ColorProfile_nclx& nclx)
914
+ {
915
+ Error err = Error(heif_image_set_nclx_color_profile(m_image.get(), nclx.mProfile));
916
+ if (err) {
917
+ throw err;
918
+ }
919
+ }
920
+
921
+ // throws Error
922
+ inline ColorProfile_nclx Image::get_nclx_color_profile() const
923
+ {
924
+ heif_color_profile_nclx* nclx = nullptr;
925
+ Error err = Error(heif_image_get_nclx_color_profile(m_image.get(), &nclx));
926
+ if (err) {
927
+ throw err;
928
+ }
929
+
930
+ return ColorProfile_nclx(nclx);
931
+ }
932
+
933
+
934
+ inline heif_color_profile_type Image::get_color_profile_type() const
935
+ {
936
+ return heif_image_get_color_profile_type(m_image.get());
937
+ }
938
+
939
+ // throws Error
940
+ inline std::vector<uint8_t> Image::get_raw_color_profile() const
941
+ {
942
+ auto size = heif_image_get_raw_color_profile_size(m_image.get());
943
+ std::vector<uint8_t> profile(size);
944
+ heif_image_get_raw_color_profile(m_image.get(), profile.data());
945
+ return profile;
946
+ }
947
+
948
+ inline void Image::set_raw_color_profile(heif_color_profile_type type,
949
+ const std::vector<uint8_t>& data)
950
+ {
951
+ const char* profile_type = nullptr;
952
+ switch (type) {
953
+ case heif_color_profile_type_prof:
954
+ profile_type = "prof";
955
+ break;
956
+ case heif_color_profile_type_rICC:
957
+ profile_type = "rICC";
958
+ break;
959
+ default:
960
+ throw Error(heif_error_code::heif_error_Usage_error,
961
+ heif_suberror_Unspecified,
962
+ "invalid raw color profile type");
963
+ break;
964
+ }
965
+
966
+ Error err = Error(heif_image_set_raw_color_profile(m_image.get(), profile_type,
967
+ data.data(), data.size()));
968
+ if (err) {
969
+ throw err;
970
+ }
971
+ }
972
+
973
+ inline bool Image::is_premultiplied_alpha() const noexcept
974
+ {
975
+ return heif_image_is_premultiplied_alpha(m_image.get()) != 0;
976
+ }
977
+
978
+ inline void Image::set_premultiplied_alpha(bool is_premultiplied_alpha) noexcept
979
+ {
980
+ heif_image_set_premultiplied_alpha(m_image.get(), is_premultiplied_alpha);
981
+ }
982
+
983
+ inline Image Image::scale_image(int width, int height,
984
+ const ScalingOptions&) const
985
+ {
986
+ heif_image* img;
987
+ Error err = Error(heif_image_scale_image(m_image.get(), &img, width, height,
988
+ nullptr)); // TODO: scaling options not defined yet
989
+ if (err) {
990
+ throw err;
991
+ }
992
+
993
+ return Image(img);
994
+ }
995
+
996
+
997
+ inline std::vector<EncoderDescriptor>
998
+ EncoderDescriptor::get_encoder_descriptors(enum heif_compression_format format_filter,
999
+ const char* name_filter) noexcept
1000
+ {
1001
+ int maxDescriptors = 10;
1002
+ int nDescriptors;
1003
+ for (;;) {
1004
+ const struct heif_encoder_descriptor** descriptors;
1005
+ descriptors = new const heif_encoder_descriptor* [maxDescriptors];
1006
+
1007
+ nDescriptors = heif_context_get_encoder_descriptors(nullptr,
1008
+ format_filter,
1009
+ name_filter,
1010
+ descriptors,
1011
+ maxDescriptors);
1012
+ if (nDescriptors < maxDescriptors) {
1013
+ std::vector<EncoderDescriptor> outDescriptors;
1014
+ outDescriptors.reserve(nDescriptors);
1015
+ for (int i = 0; i < nDescriptors; i++) {
1016
+ outDescriptors.push_back(EncoderDescriptor(descriptors[i]));
1017
+ }
1018
+
1019
+ delete[] descriptors;
1020
+
1021
+ return outDescriptors;
1022
+ }
1023
+ else {
1024
+ delete[] descriptors;
1025
+ maxDescriptors *= 2;
1026
+ }
1027
+ }
1028
+ }
1029
+
1030
+
1031
+ inline std::string EncoderDescriptor::get_name() const noexcept
1032
+ {
1033
+ return heif_encoder_descriptor_get_name(m_descriptor);
1034
+ }
1035
+
1036
+ inline std::string EncoderDescriptor::get_id_name() const noexcept
1037
+ {
1038
+ return heif_encoder_descriptor_get_id_name(m_descriptor);
1039
+ }
1040
+
1041
+ inline enum heif_compression_format EncoderDescriptor::get_compression_format() const noexcept
1042
+ {
1043
+ return heif_encoder_descriptor_get_compression_format(m_descriptor);
1044
+ }
1045
+
1046
+ inline bool EncoderDescriptor::supportes_lossy_compression() const noexcept
1047
+ {
1048
+ return heif_encoder_descriptor_supports_lossy_compression(m_descriptor);
1049
+ }
1050
+
1051
+ inline bool EncoderDescriptor::supports_lossy_compression() const noexcept
1052
+ {
1053
+ return heif_encoder_descriptor_supports_lossy_compression(m_descriptor);
1054
+ }
1055
+
1056
+ inline bool EncoderDescriptor::supportes_lossless_compression() const noexcept
1057
+ {
1058
+ return heif_encoder_descriptor_supports_lossless_compression(m_descriptor);
1059
+ }
1060
+
1061
+ inline bool EncoderDescriptor::supports_lossless_compression() const noexcept
1062
+ {
1063
+ return heif_encoder_descriptor_supports_lossless_compression(m_descriptor);
1064
+ }
1065
+
1066
+ inline Encoder EncoderDescriptor::get_encoder() const
1067
+ {
1068
+ heif_encoder* encoder;
1069
+ Error err = Error(heif_context_get_encoder(nullptr, m_descriptor, &encoder));
1070
+ if (err) {
1071
+ throw err;
1072
+ }
1073
+
1074
+ return Encoder(encoder);
1075
+ }
1076
+
1077
+
1078
+ inline Encoder::Encoder(enum heif_compression_format format)
1079
+ {
1080
+ heif_encoder* encoder;
1081
+ Error err = Error(heif_context_get_encoder_for_format(nullptr, format, &encoder));
1082
+ if (err) {
1083
+ throw err;
1084
+ }
1085
+
1086
+ m_encoder = std::shared_ptr<heif_encoder>(encoder,
1087
+ [](heif_encoder* e) { heif_encoder_release(e); });
1088
+ }
1089
+
1090
+ inline Encoder::Encoder(struct heif_encoder* encoder) noexcept
1091
+ {
1092
+ m_encoder = std::shared_ptr<heif_encoder>(encoder,
1093
+ [](heif_encoder* e) { heif_encoder_release(e); });
1094
+ }
1095
+
1096
+
1097
+ inline EncoderParameter::EncoderParameter(const heif_encoder_parameter* param)
1098
+ : m_parameter(param)
1099
+ {
1100
+ }
1101
+
1102
+ inline std::string EncoderParameter::get_name() const noexcept
1103
+ {
1104
+ return heif_encoder_parameter_get_name(m_parameter);
1105
+ }
1106
+
1107
+ inline enum heif_encoder_parameter_type EncoderParameter::get_type() const noexcept
1108
+ {
1109
+ return heif_encoder_parameter_get_type(m_parameter);
1110
+ }
1111
+
1112
+ inline bool EncoderParameter::is_integer() const noexcept
1113
+ {
1114
+ return get_type() == heif_encoder_parameter_type_integer;
1115
+ }
1116
+
1117
+ inline bool EncoderParameter::get_valid_integer_range(int& out_minimum, int& out_maximum)
1118
+ {
1119
+ int have_minimum_maximum;
1120
+ Error err = Error(heif_encoder_parameter_get_valid_integer_range(m_parameter,
1121
+ &have_minimum_maximum,
1122
+ &out_minimum, &out_maximum));
1123
+ if (err) {
1124
+ throw err;
1125
+ }
1126
+
1127
+ return have_minimum_maximum;
1128
+ }
1129
+
1130
+ inline bool EncoderParameter::is_boolean() const noexcept
1131
+ {
1132
+ return get_type() == heif_encoder_parameter_type_boolean;
1133
+ }
1134
+
1135
+ inline bool EncoderParameter::is_string() const noexcept
1136
+ {
1137
+ return get_type() == heif_encoder_parameter_type_string;
1138
+ }
1139
+
1140
+ inline std::vector<std::string> EncoderParameter::get_valid_string_values() const
1141
+ {
1142
+ const char* const* stringarray;
1143
+ Error err = Error(heif_encoder_parameter_get_valid_string_values(m_parameter,
1144
+ &stringarray));
1145
+ if (err) {
1146
+ throw err;
1147
+ }
1148
+
1149
+ std::vector<std::string> values;
1150
+ for (int i = 0; stringarray[i]; i++) {
1151
+ values.push_back(stringarray[i]);
1152
+ }
1153
+
1154
+ return values;
1155
+ }
1156
+
1157
+ inline std::vector<EncoderParameter> Encoder::list_parameters() const noexcept
1158
+ {
1159
+ std::vector<EncoderParameter> parameters;
1160
+
1161
+ for (const struct heif_encoder_parameter* const* params = heif_encoder_list_parameters(m_encoder.get());
1162
+ *params;
1163
+ params++) {
1164
+ parameters.push_back(EncoderParameter(*params));
1165
+ }
1166
+
1167
+ return parameters;
1168
+ }
1169
+
1170
+
1171
+ inline void Encoder::set_lossy_quality(int quality)
1172
+ {
1173
+ Error err = Error(heif_encoder_set_lossy_quality(m_encoder.get(), quality));
1174
+ if (err) {
1175
+ throw err;
1176
+ }
1177
+ }
1178
+
1179
+ inline void Encoder::set_lossless(bool enable_lossless)
1180
+ {
1181
+ Error err = Error(heif_encoder_set_lossless(m_encoder.get(), enable_lossless));
1182
+ if (err) {
1183
+ throw err;
1184
+ }
1185
+ }
1186
+
1187
+ inline void Encoder::set_integer_parameter(const std::string& parameter_name, int value)
1188
+ {
1189
+ Error err = Error(heif_encoder_set_parameter_integer(m_encoder.get(), parameter_name.c_str(), value));
1190
+ if (err) {
1191
+ throw err;
1192
+ }
1193
+ }
1194
+
1195
+ inline int Encoder::get_integer_parameter(const std::string& parameter_name) const
1196
+ {
1197
+ int value;
1198
+ Error err = Error(heif_encoder_get_parameter_integer(m_encoder.get(), parameter_name.c_str(), &value));
1199
+ if (err) {
1200
+ throw err;
1201
+ }
1202
+ return value;
1203
+ }
1204
+
1205
+ inline void Encoder::set_boolean_parameter(const std::string& parameter_name, bool value)
1206
+ {
1207
+ Error err = Error(heif_encoder_set_parameter_boolean(m_encoder.get(), parameter_name.c_str(), value));
1208
+ if (err) {
1209
+ throw err;
1210
+ }
1211
+ }
1212
+
1213
+ inline bool Encoder::get_boolean_parameter(const std::string& parameter_name) const
1214
+ {
1215
+ int value;
1216
+ Error err = Error(heif_encoder_get_parameter_boolean(m_encoder.get(), parameter_name.c_str(), &value));
1217
+ if (err) {
1218
+ throw err;
1219
+ }
1220
+ return value;
1221
+ }
1222
+
1223
+ inline void Encoder::set_string_parameter(const std::string& parameter_name, const std::string& value)
1224
+ {
1225
+ Error err = Error(heif_encoder_set_parameter_string(m_encoder.get(), parameter_name.c_str(), value.c_str()));
1226
+ if (err) {
1227
+ throw err;
1228
+ }
1229
+ }
1230
+
1231
+ inline std::string Encoder::get_string_parameter(const std::string& parameter_name) const
1232
+ {
1233
+ const int max_size = 250;
1234
+ char value[max_size];
1235
+ Error err = Error(heif_encoder_get_parameter_string(m_encoder.get(), parameter_name.c_str(),
1236
+ value, max_size));
1237
+ if (err) {
1238
+ throw err;
1239
+ }
1240
+ return value;
1241
+ }
1242
+
1243
+ inline void Encoder::set_parameter(const std::string& parameter_name, const std::string& parameter_value)
1244
+ {
1245
+ Error err = Error(heif_encoder_set_parameter(m_encoder.get(), parameter_name.c_str(),
1246
+ parameter_value.c_str()));
1247
+ if (err) {
1248
+ throw err;
1249
+ }
1250
+ }
1251
+
1252
+ inline std::string Encoder::get_parameter(const std::string& parameter_name) const
1253
+ {
1254
+ const int max_size = 250;
1255
+ char value[max_size];
1256
+ Error err = Error(heif_encoder_get_parameter(m_encoder.get(), parameter_name.c_str(),
1257
+ value, max_size));
1258
+ if (err) {
1259
+ throw err;
1260
+ }
1261
+ return value;
1262
+ }
1263
+
1264
+ inline void Context::set_primary_image(ImageHandle& new_primary_image_handle)
1265
+ {
1266
+ Error err = Error(heif_context_set_primary_image(m_context.get(),
1267
+ new_primary_image_handle.get_raw_image_handle()));
1268
+ if (err) {
1269
+ throw err;
1270
+ }
1271
+ }
1272
+
1273
+
1274
+ inline Context::EncodingOptions::EncodingOptions()
1275
+ {
1276
+ // TODO: this is a bit hacky. It would be better to have an API function to set
1277
+ // the options to default values. But I do not see any reason for that apart from
1278
+ // this use-case.
1279
+
1280
+ struct heif_encoding_options* default_options = heif_encoding_options_alloc();
1281
+ *static_cast<heif_encoding_options*>(this) = *default_options; // copy over all options
1282
+ heif_encoding_options_free(default_options);
1283
+ }
1284
+
1285
+
1286
+ inline ImageHandle Context::encode_image(const Image& img, Encoder& encoder,
1287
+ const EncodingOptions& options)
1288
+ {
1289
+ struct heif_image_handle* image_handle;
1290
+
1291
+ Error err = Error(heif_context_encode_image(m_context.get(),
1292
+ img.m_image.get(),
1293
+ encoder.m_encoder.get(),
1294
+ &options,
1295
+ &image_handle));
1296
+ if (err) {
1297
+ throw err;
1298
+ }
1299
+
1300
+ return ImageHandle(image_handle);
1301
+ }
1302
+
1303
+
1304
+ inline ImageHandle Context::encode_thumbnail(const Image& image,
1305
+ const ImageHandle& master_image_handle,
1306
+ Encoder& encoder,
1307
+ const EncodingOptions& options,
1308
+ int bbox_size)
1309
+ {
1310
+ struct heif_image_handle* thumb_image_handle;
1311
+
1312
+ Error err = Error(heif_context_encode_thumbnail(m_context.get(),
1313
+ image.m_image.get(),
1314
+ master_image_handle.get_raw_image_handle(),
1315
+ encoder.m_encoder.get(),
1316
+ &options,
1317
+ bbox_size,
1318
+ &thumb_image_handle));
1319
+ if (err) {
1320
+ throw err;
1321
+ }
1322
+
1323
+ return ImageHandle(thumb_image_handle);
1324
+ }
1325
+
1326
+
1327
+ inline void Context::assign_thumbnail(const ImageHandle& thumbnail_image,
1328
+ const ImageHandle& master_image)
1329
+ {
1330
+ Error err = Error(heif_context_assign_thumbnail(m_context.get(),
1331
+ thumbnail_image.get_raw_image_handle(),
1332
+ master_image.get_raw_image_handle()));
1333
+ if (err) {
1334
+ throw err;
1335
+ }
1336
+ }
1337
+
1338
+ inline void Context::add_exif_metadata(const ImageHandle& master_image,
1339
+ const void* data, int size)
1340
+ {
1341
+ Error err = Error(heif_context_add_exif_metadata(m_context.get(),
1342
+ master_image.get_raw_image_handle(),
1343
+ data, size));
1344
+ if (err) {
1345
+ throw err;
1346
+ }
1347
+ }
1348
+
1349
+ inline void Context::add_XMP_metadata(const ImageHandle& master_image,
1350
+ const void* data, int size)
1351
+ {
1352
+ Error err = Error(heif_context_add_XMP_metadata(m_context.get(),
1353
+ master_image.get_raw_image_handle(),
1354
+ data, size));
1355
+ if (err) {
1356
+ throw err;
1357
+ }
1358
+ }
1359
+ }
1360
+
1361
+
1362
+ #endif