@woosh/meep-engine 3.9.0 → 3.11.0

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 (832) hide show
  1. package/README.md +168 -152
  2. package/build/bundle-worker-image-decoder.js +1 -1
  3. package/build/bundle-worker-terrain.js +1 -1
  4. package/package.json +3 -2
  5. package/src/REVIEW_2026_08_06.md +610 -610
  6. package/src/avif/encode_image_source.d.ts +70 -0
  7. package/src/avif/encode_image_source.d.ts.map +1 -0
  8. package/src/avif/encode_image_source.js +117 -0
  9. package/src/avif/encoder_worker.js +15 -126
  10. package/src/avif/index.d.ts +4 -2
  11. package/src/avif/index.js +21 -2
  12. package/src/avif/native/DECISIONS.md +537 -0
  13. package/src/avif/native/NOTICE.md +61 -0
  14. package/src/avif/native/api/AvifDecoder.d.ts +67 -0
  15. package/src/avif/native/api/AvifDecoder.d.ts.map +1 -0
  16. package/src/avif/native/api/AvifDecoder.js +121 -0
  17. package/src/avif/native/api/apply_transformations.d.ts +30 -0
  18. package/src/avif/native/api/apply_transformations.d.ts.map +1 -0
  19. package/src/avif/native/api/apply_transformations.js +120 -0
  20. package/src/avif/native/api/avif_to_sampler2d.d.ts +25 -0
  21. package/src/avif/native/api/avif_to_sampler2d.d.ts.map +1 -0
  22. package/src/avif/native/api/avif_to_sampler2d.js +42 -0
  23. package/src/avif/native/api/convert_to_rgba.d.ts +54 -0
  24. package/src/avif/native/api/convert_to_rgba.d.ts.map +1 -0
  25. package/src/avif/native/api/convert_to_rgba.js +204 -0
  26. package/src/avif/native/api/decode_avif.d.ts +24 -0
  27. package/src/avif/native/api/decode_avif.d.ts.map +1 -0
  28. package/src/avif/native/api/decode_avif.js +111 -0
  29. package/src/avif/native/api/decode_image_item.d.ts +18 -0
  30. package/src/avif/native/api/decode_image_item.d.ts.map +1 -0
  31. package/src/avif/native/api/decode_image_item.js +234 -0
  32. package/src/avif/native/api/encode_avif.d.ts +73 -0
  33. package/src/avif/native/api/encode_avif.d.ts.map +1 -0
  34. package/src/avif/native/api/encode_avif.js +488 -0
  35. package/src/avif/native/api/sampler2d_to_avif.d.ts +22 -0
  36. package/src/avif/native/api/sampler2d_to_avif.d.ts.map +1 -0
  37. package/src/avif/native/api/sampler2d_to_avif.js +108 -0
  38. package/src/avif/native/av1/decode/Av1FrameContext.d.ts +286 -0
  39. package/src/avif/native/av1/decode/Av1FrameContext.d.ts.map +1 -0
  40. package/src/avif/native/av1/decode/Av1FrameContext.js +622 -0
  41. package/src/avif/native/av1/decode/block_decoded.d.ts +27 -0
  42. package/src/avif/native/av1/decode/block_decoded.d.ts.map +1 -0
  43. package/src/avif/native/av1/decode/block_decoded.js +59 -0
  44. package/src/avif/native/av1/decode/decode_av1_still.d.ts +22 -0
  45. package/src/avif/native/av1/decode/decode_av1_still.d.ts.map +1 -0
  46. package/src/avif/native/av1/decode/decode_av1_still.js +309 -0
  47. package/src/avif/native/av1/decode/decode_coefficients.d.ts +20 -0
  48. package/src/avif/native/av1/decode/decode_coefficients.d.ts.map +1 -0
  49. package/src/avif/native/av1/decode/decode_coefficients.js +259 -0
  50. package/src/avif/native/av1/decode/decode_palette.d.ts +28 -0
  51. package/src/avif/native/av1/decode/decode_palette.d.ts.map +1 -0
  52. package/src/avif/native/av1/decode/decode_palette.js +442 -0
  53. package/src/avif/native/av1/decode/decode_tile.d.ts +14 -0
  54. package/src/avif/native/av1/decode/decode_tile.d.ts.map +1 -0
  55. package/src/avif/native/av1/decode/decode_tile.js +1213 -0
  56. package/src/avif/native/av1/decode/get_scan.d.ts +16 -0
  57. package/src/avif/native/av1/decode/get_scan.d.ts.map +1 -0
  58. package/src/avif/native/av1/decode/get_scan.js +138 -0
  59. package/src/avif/native/av1/decode/read_lr.d.ts +35 -0
  60. package/src/avif/native/av1/decode/read_lr.d.ts.map +1 -0
  61. package/src/avif/native/av1/decode/read_lr.js +277 -0
  62. package/src/avif/native/av1/decode/read_transform_type.d.ts +19 -0
  63. package/src/avif/native/av1/decode/read_transform_type.d.ts.map +1 -0
  64. package/src/avif/native/av1/decode/read_transform_type.js +92 -0
  65. package/src/avif/native/av1/decode/reconstruct.d.ts +36 -0
  66. package/src/avif/native/av1/decode/reconstruct.d.ts.map +1 -0
  67. package/src/avif/native/av1/decode/reconstruct.js +241 -0
  68. package/src/avif/native/av1/decode/transform_type.d.ts +49 -0
  69. package/src/avif/native/av1/decode/transform_type.d.ts.map +1 -0
  70. package/src/avif/native/av1/decode/transform_type.js +137 -0
  71. package/src/avif/native/av1/encode/Av1BlockSnapshot.d.ts +81 -0
  72. package/src/avif/native/av1/encode/Av1BlockSnapshot.d.ts.map +1 -0
  73. package/src/avif/native/av1/encode/Av1BlockSnapshot.js +299 -0
  74. package/src/avif/native/av1/encode/Av1EncodeContext.d.ts +384 -0
  75. package/src/avif/native/av1/encode/Av1EncodeContext.d.ts.map +1 -0
  76. package/src/avif/native/av1/encode/Av1EncodeContext.js +590 -0
  77. package/src/avif/native/av1/encode/build_headers.d.ts +50 -0
  78. package/src/avif/native/av1/encode/build_headers.d.ts.map +1 -0
  79. package/src/avif/native/av1/encode/build_headers.js +359 -0
  80. package/src/avif/native/av1/encode/choose_chroma_alpha.d.ts +26 -0
  81. package/src/avif/native/av1/encode/choose_chroma_alpha.d.ts.map +1 -0
  82. package/src/avif/native/av1/encode/choose_chroma_alpha.js +90 -0
  83. package/src/avif/native/av1/encode/choose_filters.d.ts +21 -0
  84. package/src/avif/native/av1/encode/choose_filters.d.ts.map +1 -0
  85. package/src/avif/native/av1/encode/choose_filters.js +318 -0
  86. package/src/avif/native/av1/encode/choose_restoration.d.ts +35 -0
  87. package/src/avif/native/av1/encode/choose_restoration.d.ts.map +1 -0
  88. package/src/avif/native/av1/encode/choose_restoration.js +616 -0
  89. package/src/avif/native/av1/encode/decode_effort.d.ts +57 -0
  90. package/src/avif/native/av1/encode/decode_effort.d.ts.map +1 -0
  91. package/src/avif/native/av1/encode/decode_effort.js +59 -0
  92. package/src/avif/native/av1/encode/encode_av1_still.d.ts +17 -0
  93. package/src/avif/native/av1/encode/encode_av1_still.d.ts.map +1 -0
  94. package/src/avif/native/av1/encode/encode_av1_still.js +194 -0
  95. package/src/avif/native/av1/encode/encode_effort.d.ts +56 -0
  96. package/src/avif/native/av1/encode/encode_effort.d.ts.map +1 -0
  97. package/src/avif/native/av1/encode/encode_effort.js +97 -0
  98. package/src/avif/native/av1/encode/encode_tile.d.ts +26 -0
  99. package/src/avif/native/av1/encode/encode_tile.d.ts.map +1 -0
  100. package/src/avif/native/av1/encode/encode_tile.js +2331 -0
  101. package/src/avif/native/av1/encode/quantise.d.ts +51 -0
  102. package/src/avif/native/av1/encode/quantise.d.ts.map +1 -0
  103. package/src/avif/native/av1/encode/quantise.js +212 -0
  104. package/src/avif/native/av1/encode/write_coefficients.d.ts +42 -0
  105. package/src/avif/native/av1/encode/write_coefficients.d.ts.map +1 -0
  106. package/src/avif/native/av1/encode/write_coefficients.js +367 -0
  107. package/src/avif/native/av1/encode/write_lr.d.ts +33 -0
  108. package/src/avif/native/av1/encode/write_lr.d.ts.map +1 -0
  109. package/src/avif/native/av1/encode/write_lr.js +174 -0
  110. package/src/avif/native/av1/encode/write_transform_type.d.ts +21 -0
  111. package/src/avif/native/av1/encode/write_transform_type.d.ts.map +1 -0
  112. package/src/avif/native/av1/encode/write_transform_type.js +70 -0
  113. package/src/avif/native/av1/entropy/CdfContext.d.ts +167 -0
  114. package/src/avif/native/av1/entropy/CdfContext.d.ts.map +1 -0
  115. package/src/avif/native/av1/entropy/CdfContext.js +433 -0
  116. package/src/avif/native/av1/entropy/SymbolReader.d.ts +103 -0
  117. package/src/avif/native/av1/entropy/SymbolReader.d.ts.map +1 -0
  118. package/src/avif/native/av1/entropy/SymbolReader.js +317 -0
  119. package/src/avif/native/av1/entropy/SymbolWriter.d.ts +107 -0
  120. package/src/avif/native/av1/entropy/SymbolWriter.d.ts.map +1 -0
  121. package/src/avif/native/av1/entropy/SymbolWriter.js +352 -0
  122. package/src/avif/native/av1/entropy/coefficient_context.d.ts +71 -0
  123. package/src/avif/native/av1/entropy/coefficient_context.d.ts.map +1 -0
  124. package/src/avif/native/av1/entropy/coefficient_context.js +325 -0
  125. package/src/avif/native/av1/entropy/partition_cdf.d.ts +54 -0
  126. package/src/avif/native/av1/entropy/partition_cdf.d.ts.map +1 -0
  127. package/src/avif/native/av1/entropy/partition_cdf.js +98 -0
  128. package/src/avif/native/av1/entropy/symbol_cost.d.ts +37 -0
  129. package/src/avif/native/av1/entropy/symbol_cost.d.ts.map +1 -0
  130. package/src/avif/native/av1/entropy/symbol_cost.js +76 -0
  131. package/src/avif/native/av1/filter/cdef.d.ts +15 -0
  132. package/src/avif/native/av1/filter/cdef.d.ts.map +1 -0
  133. package/src/avif/native/av1/filter/cdef.js +313 -0
  134. package/src/avif/native/av1/filter/loop_filter.d.ts +14 -0
  135. package/src/avif/native/av1/filter/loop_filter.d.ts.map +1 -0
  136. package/src/avif/native/av1/filter/loop_filter.js +377 -0
  137. package/src/avif/native/av1/filter/loop_restoration.d.ts +42 -0
  138. package/src/avif/native/av1/filter/loop_restoration.d.ts.map +1 -0
  139. package/src/avif/native/av1/filter/loop_restoration.js +451 -0
  140. package/src/avif/native/av1/filter/superres.d.ts +18 -0
  141. package/src/avif/native/av1/filter/superres.d.ts.map +1 -0
  142. package/src/avif/native/av1/filter/superres.js +86 -0
  143. package/src/avif/native/av1/grain/FilmGrainState.d.ts +62 -0
  144. package/src/avif/native/av1/grain/FilmGrainState.d.ts.map +1 -0
  145. package/src/avif/native/av1/grain/FilmGrainState.js +87 -0
  146. package/src/avif/native/av1/grain/film_grain.d.ts +16 -0
  147. package/src/avif/native/av1/grain/film_grain.d.ts.map +1 -0
  148. package/src/avif/native/av1/grain/film_grain.js +623 -0
  149. package/src/avif/native/av1/obu/FrameHeader.d.ts +248 -0
  150. package/src/avif/native/av1/obu/FrameHeader.d.ts.map +1 -0
  151. package/src/avif/native/av1/obu/FrameHeader.js +381 -0
  152. package/src/avif/native/av1/obu/ObuHeader.d.ts +53 -0
  153. package/src/avif/native/av1/obu/ObuHeader.d.ts.map +1 -0
  154. package/src/avif/native/av1/obu/ObuHeader.js +62 -0
  155. package/src/avif/native/av1/obu/SequenceHeader.d.ts +157 -0
  156. package/src/avif/native/av1/obu/SequenceHeader.d.ts.map +1 -0
  157. package/src/avif/native/av1/obu/SequenceHeader.js +225 -0
  158. package/src/avif/native/av1/obu/for_each_obu.d.ts +24 -0
  159. package/src/avif/native/av1/obu/for_each_obu.d.ts.map +1 -0
  160. package/src/avif/native/av1/obu/for_each_obu.js +50 -0
  161. package/src/avif/native/av1/obu/parse_frame_header.d.ts +18 -0
  162. package/src/avif/native/av1/obu/parse_frame_header.d.ts.map +1 -0
  163. package/src/avif/native/av1/obu/parse_frame_header.js +841 -0
  164. package/src/avif/native/av1/obu/parse_obu_header.d.ts +23 -0
  165. package/src/avif/native/av1/obu/parse_obu_header.d.ts.map +1 -0
  166. package/src/avif/native/av1/obu/parse_obu_header.js +69 -0
  167. package/src/avif/native/av1/obu/parse_sequence_header.d.ts +17 -0
  168. package/src/avif/native/av1/obu/parse_sequence_header.d.ts.map +1 -0
  169. package/src/avif/native/av1/obu/parse_sequence_header.js +263 -0
  170. package/src/avif/native/av1/obu/write_frame_header.d.ts +16 -0
  171. package/src/avif/native/av1/obu/write_frame_header.d.ts.map +1 -0
  172. package/src/avif/native/av1/obu/write_frame_header.js +579 -0
  173. package/src/avif/native/av1/obu/write_sequence_header.d.ts +17 -0
  174. package/src/avif/native/av1/obu/write_sequence_header.d.ts.map +1 -0
  175. package/src/avif/native/av1/obu/write_sequence_header.js +189 -0
  176. package/src/avif/native/av1/predict/IntraPredictionState.d.ts +49 -0
  177. package/src/avif/native/av1/predict/IntraPredictionState.d.ts.map +1 -0
  178. package/src/avif/native/av1/predict/IntraPredictionState.js +58 -0
  179. package/src/avif/native/av1/predict/intra_filter_type.d.ts +17 -0
  180. package/src/avif/native/av1/predict/intra_filter_type.d.ts.map +1 -0
  181. package/src/avif/native/av1/predict/intra_filter_type.js +79 -0
  182. package/src/avif/native/av1/predict/predict_chroma_from_luma.d.ts +50 -0
  183. package/src/avif/native/av1/predict/predict_chroma_from_luma.d.ts.map +1 -0
  184. package/src/avif/native/av1/predict/predict_chroma_from_luma.js +153 -0
  185. package/src/avif/native/av1/predict/predict_intra.d.ts +42 -0
  186. package/src/avif/native/av1/predict/predict_intra.d.ts.map +1 -0
  187. package/src/avif/native/av1/predict/predict_intra.js +803 -0
  188. package/src/avif/native/av1/predict/predict_palette.d.ts +23 -0
  189. package/src/avif/native/av1/predict/predict_palette.d.ts.map +1 -0
  190. package/src/avif/native/av1/predict/predict_palette.js +36 -0
  191. package/src/avif/native/av1/tables/av1_symbols.d.ts +411 -0
  192. package/src/avif/native/av1/tables/av1_symbols.d.ts.map +1 -0
  193. package/src/avif/native/av1/tables/av1_symbols.js +419 -0
  194. package/src/avif/native/av1/tables/block_tables.d.ts +181 -0
  195. package/src/avif/native/av1/tables/block_tables.d.ts.map +1 -0
  196. package/src/avif/native/av1/tables/block_tables.js +270 -0
  197. package/src/avif/native/av1/tables/cdf_tables.d.ts +961 -0
  198. package/src/avif/native/av1/tables/cdf_tables.d.ts.map +1 -0
  199. package/src/avif/native/av1/tables/cdf_tables.js +1893 -0
  200. package/src/avif/native/av1/tables/coefficient_tables.d.ts +41 -0
  201. package/src/avif/native/av1/tables/coefficient_tables.d.ts.map +1 -0
  202. package/src/avif/native/av1/tables/coefficient_tables.js +82 -0
  203. package/src/avif/native/av1/tables/derived_block_tables.d.ts +15 -0
  204. package/src/avif/native/av1/tables/derived_block_tables.d.ts.map +1 -0
  205. package/src/avif/native/av1/tables/derived_block_tables.js +23 -0
  206. package/src/avif/native/av1/tables/filter_tables.d.ts +171 -0
  207. package/src/avif/native/av1/tables/filter_tables.d.ts.map +1 -0
  208. package/src/avif/native/av1/tables/filter_tables.js +313 -0
  209. package/src/avif/native/av1/tables/grain_tables.d.ts +11 -0
  210. package/src/avif/native/av1/tables/grain_tables.d.ts.map +1 -0
  211. package/src/avif/native/av1/tables/grain_tables.js +190 -0
  212. package/src/avif/native/av1/tables/prediction_tables.d.ts +141 -0
  213. package/src/avif/native/av1/tables/prediction_tables.d.ts.map +1 -0
  214. package/src/avif/native/av1/tables/prediction_tables.js +223 -0
  215. package/src/avif/native/av1/tables/quantizer_matrix_tables.d.ts +21 -0
  216. package/src/avif/native/av1/tables/quantizer_matrix_tables.d.ts.map +1 -0
  217. package/src/avif/native/av1/tables/quantizer_matrix_tables.js +38 -0
  218. package/src/avif/native/av1/tables/quantizer_tables.d.ts +21 -0
  219. package/src/avif/native/av1/tables/quantizer_tables.d.ts.map +1 -0
  220. package/src/avif/native/av1/tables/quantizer_tables.js +160 -0
  221. package/src/avif/native/av1/tables/scan_tables.d.ts +321 -0
  222. package/src/avif/native/av1/tables/scan_tables.d.ts.map +1 -0
  223. package/src/avif/native/av1/tables/scan_tables.js +727 -0
  224. package/src/avif/native/av1/tables/segmentation_tables.d.ts +31 -0
  225. package/src/avif/native/av1/tables/segmentation_tables.d.ts.map +1 -0
  226. package/src/avif/native/av1/tables/segmentation_tables.js +48 -0
  227. package/src/avif/native/av1/tables/transform_tables.d.ts +91 -0
  228. package/src/avif/native/av1/tables/transform_tables.d.ts.map +1 -0
  229. package/src/avif/native/av1/tables/transform_tables.js +140 -0
  230. package/src/avif/native/av1/tables/unpack_table.d.ts +33 -0
  231. package/src/avif/native/av1/tables/unpack_table.d.ts.map +1 -0
  232. package/src/avif/native/av1/tables/unpack_table.js +73 -0
  233. package/src/avif/native/av1/transform/forward_transform_2d.d.ts +61 -0
  234. package/src/avif/native/av1/transform/forward_transform_2d.d.ts.map +1 -0
  235. package/src/avif/native/av1/transform/forward_transform_2d.js +574 -0
  236. package/src/avif/native/av1/transform/inverse_transform_1d.d.ts +76 -0
  237. package/src/avif/native/av1/transform/inverse_transform_1d.d.ts.map +1 -0
  238. package/src/avif/native/av1/transform/inverse_transform_1d.js +590 -0
  239. package/src/avif/native/av1/transform/inverse_transform_2d.d.ts +46 -0
  240. package/src/avif/native/av1/transform/inverse_transform_2d.d.ts.map +1 -0
  241. package/src/avif/native/av1/transform/inverse_transform_2d.js +180 -0
  242. package/src/avif/native/av1/util/ceil_log2.d.ts +13 -0
  243. package/src/avif/native/av1/util/ceil_log2.d.ts.map +1 -0
  244. package/src/avif/native/av1/util/ceil_log2.js +18 -0
  245. package/src/avif/native/av1/util/floor_log2.d.ts +20 -0
  246. package/src/avif/native/av1/util/floor_log2.d.ts.map +1 -0
  247. package/src/avif/native/av1/util/floor_log2.js +20 -0
  248. package/src/avif/native/av1/util/round2.d.ts +22 -0
  249. package/src/avif/native/av1/util/round2.d.ts.map +1 -0
  250. package/src/avif/native/av1/util/round2.js +27 -0
  251. package/src/avif/native/av1/util/round2_signed.d.ts +14 -0
  252. package/src/avif/native/av1/util/round2_signed.d.ts.map +1 -0
  253. package/src/avif/native/av1/util/round2_signed.js +17 -0
  254. package/src/avif/native/av1/util/tile_log2.d.ts +16 -0
  255. package/src/avif/native/av1/util/tile_log2.d.ts.map +1 -0
  256. package/src/avif/native/av1/util/tile_log2.js +23 -0
  257. package/src/avif/native/bitstream/BitReader.d.ts +174 -0
  258. package/src/avif/native/bitstream/BitReader.d.ts.map +1 -0
  259. package/src/avif/native/bitstream/BitReader.js +391 -0
  260. package/src/avif/native/bitstream/BitWriter.d.ts +122 -0
  261. package/src/avif/native/bitstream/BitWriter.d.ts.map +1 -0
  262. package/src/avif/native/bitstream/BitWriter.js +351 -0
  263. package/src/avif/native/color/ColourTransform.d.ts +62 -0
  264. package/src/avif/native/color/ColourTransform.d.ts.map +1 -0
  265. package/src/avif/native/color/ColourTransform.js +189 -0
  266. package/src/avif/native/color/YuvImage.d.ts +51 -0
  267. package/src/avif/native/color/YuvImage.d.ts.map +1 -0
  268. package/src/avif/native/color/YuvImage.js +66 -0
  269. package/src/avif/native/color/clamp_sample.d.ts +18 -0
  270. package/src/avif/native/color/clamp_sample.d.ts.map +1 -0
  271. package/src/avif/native/color/clamp_sample.js +25 -0
  272. package/src/avif/native/color/linear_to_transfer.d.ts +24 -0
  273. package/src/avif/native/color/linear_to_transfer.d.ts.map +1 -0
  274. package/src/avif/native/color/linear_to_transfer.js +126 -0
  275. package/src/avif/native/color/primaries.d.ts +20 -0
  276. package/src/avif/native/color/primaries.d.ts.map +1 -0
  277. package/src/avif/native/color/primaries.js +94 -0
  278. package/src/avif/native/color/rgb_row_to_ycbcr.d.ts +20 -0
  279. package/src/avif/native/color/rgb_row_to_ycbcr.d.ts.map +1 -0
  280. package/src/avif/native/color/rgb_row_to_ycbcr.js +78 -0
  281. package/src/avif/native/color/transfer_to_linear.d.ts +49 -0
  282. package/src/avif/native/color/transfer_to_linear.d.ts.map +1 -0
  283. package/src/avif/native/color/transfer_to_linear.js +171 -0
  284. package/src/avif/native/color/upsample_chroma_row.d.ts +35 -0
  285. package/src/avif/native/color/upsample_chroma_row.d.ts.map +1 -0
  286. package/src/avif/native/color/upsample_chroma_row.js +89 -0
  287. package/src/avif/native/color/ycbcr_row_to_rgb.d.ts +23 -0
  288. package/src/avif/native/color/ycbcr_row_to_rgb.d.ts.map +1 -0
  289. package/src/avif/native/color/ycbcr_row_to_rgb.js +78 -0
  290. package/src/avif/native/heif/AvifFile.d.ts +112 -0
  291. package/src/avif/native/heif/AvifFile.d.ts.map +1 -0
  292. package/src/avif/native/heif/AvifFile.js +142 -0
  293. package/src/avif/native/heif/ItemProperty.d.ts +244 -0
  294. package/src/avif/native/heif/ItemProperty.d.ts.map +1 -0
  295. package/src/avif/native/heif/ItemProperty.js +321 -0
  296. package/src/avif/native/heif/find_item_property.d.ts +17 -0
  297. package/src/avif/native/heif/find_item_property.d.ts.map +1 -0
  298. package/src/avif/native/heif/find_item_property.js +28 -0
  299. package/src/avif/native/heif/find_item_references.d.ts +16 -0
  300. package/src/avif/native/heif/find_item_references.d.ts.map +1 -0
  301. package/src/avif/native/heif/find_item_references.js +29 -0
  302. package/src/avif/native/heif/find_items_referencing.d.ts +17 -0
  303. package/src/avif/native/heif/find_items_referencing.d.ts.map +1 -0
  304. package/src/avif/native/heif/find_items_referencing.js +36 -0
  305. package/src/avif/native/heif/parse_avif_file.d.ts +15 -0
  306. package/src/avif/native/heif/parse_avif_file.d.ts.map +1 -0
  307. package/src/avif/native/heif/parse_avif_file.js +383 -0
  308. package/src/avif/native/heif/parse_image_grid.d.ts +18 -0
  309. package/src/avif/native/heif/parse_image_grid.d.ts.map +1 -0
  310. package/src/avif/native/heif/parse_image_grid.js +48 -0
  311. package/src/avif/native/heif/parse_item_property.d.ts +18 -0
  312. package/src/avif/native/heif/parse_item_property.d.ts.map +1 -0
  313. package/src/avif/native/heif/parse_item_property.js +243 -0
  314. package/src/avif/native/heif/read_item_data.d.ts +22 -0
  315. package/src/avif/native/heif/read_item_data.d.ts.map +1 -0
  316. package/src/avif/native/heif/read_item_data.js +97 -0
  317. package/src/avif/native/heif/write_avif_file.d.ts +50 -0
  318. package/src/avif/native/heif/write_avif_file.d.ts.map +1 -0
  319. package/src/avif/native/heif/write_avif_file.js +348 -0
  320. package/src/avif/native/heif/write_item_property.d.ts +16 -0
  321. package/src/avif/native/heif/write_item_property.d.ts.map +1 -0
  322. package/src/avif/native/heif/write_item_property.js +182 -0
  323. package/src/avif/native/index.d.ts +14 -0
  324. package/src/avif/native/index.d.ts.map +1 -0
  325. package/src/avif/native/index.js +56 -0
  326. package/src/avif/native/isobmff/BoxHeader.d.ts +50 -0
  327. package/src/avif/native/isobmff/BoxHeader.d.ts.map +1 -0
  328. package/src/avif/native/isobmff/BoxHeader.js +57 -0
  329. package/src/avif/native/isobmff/BoxWriter.d.ts +118 -0
  330. package/src/avif/native/isobmff/BoxWriter.d.ts.map +1 -0
  331. package/src/avif/native/isobmff/BoxWriter.js +264 -0
  332. package/src/avif/native/isobmff/ByteCursor.d.ts +125 -0
  333. package/src/avif/native/isobmff/ByteCursor.d.ts.map +1 -0
  334. package/src/avif/native/isobmff/ByteCursor.js +298 -0
  335. package/src/avif/native/isobmff/for_each_box.d.ts +23 -0
  336. package/src/avif/native/isobmff/for_each_box.d.ts.map +1 -0
  337. package/src/avif/native/isobmff/for_each_box.js +39 -0
  338. package/src/avif/native/isobmff/read_box_header.d.ts +22 -0
  339. package/src/avif/native/isobmff/read_box_header.d.ts.map +1 -0
  340. package/src/avif/native/isobmff/read_box_header.js +59 -0
  341. package/src/avif/native/isobmff/read_full_box_header.d.ts +26 -0
  342. package/src/avif/native/isobmff/read_full_box_header.d.ts.map +1 -0
  343. package/src/avif/native/isobmff/read_full_box_header.js +33 -0
  344. package/src/avif/threaded_image_encoder.d.ts +7 -2
  345. package/src/avif/threaded_image_encoder.d.ts.map +1 -1
  346. package/src/avif/threaded_image_encoder.js +107 -21
  347. package/src/core/binary/BinaryBuffer.d.ts +40 -0
  348. package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
  349. package/src/core/binary/BinaryBuffer.js +100 -0
  350. package/src/core/binary/hash/crc32.d.ts +16 -0
  351. package/src/core/binary/hash/crc32.d.ts.map +1 -0
  352. package/src/core/binary/hash/crc32.js +96 -0
  353. package/src/core/binary/utf8/utf8_decode.d.ts +21 -0
  354. package/src/core/binary/utf8/utf8_decode.d.ts.map +1 -0
  355. package/src/core/binary/utf8/utf8_decode.js +43 -0
  356. package/src/core/binary/utf8/utf8_encode_into.d.ts +20 -0
  357. package/src/core/binary/utf8/utf8_encode_into.d.ts.map +1 -0
  358. package/src/core/binary/utf8/utf8_encode_into.js +48 -0
  359. package/src/core/binary/utf8/utf8_encoded_length.d.ts +14 -0
  360. package/src/core/binary/utf8/utf8_encoded_length.d.ts.map +1 -0
  361. package/src/core/binary/utf8/utf8_encoded_length.js +36 -0
  362. package/src/core/color/COLOR_FIX_PLAN_2026_08_28.md +417 -0
  363. package/src/core/color/COLOR_REVIEW_2026_08_28.md +779 -0
  364. package/src/core/color/Color.d.ts +128 -20
  365. package/src/core/color/Color.d.ts.map +1 -1
  366. package/src/core/color/Color.js +959 -866
  367. package/src/core/color/PQ/PQ_constants.d.ts +10 -0
  368. package/src/core/color/PQ/PQ_constants.d.ts.map +1 -1
  369. package/src/core/color/PQ/PQ_constants.js +10 -0
  370. package/src/core/color/PQ/linear_to_PQ.d.ts.map +1 -1
  371. package/src/core/color/PQ/linear_to_PQ.js +6 -0
  372. package/src/core/color/REC709_PRIMARIES.d.ts +50 -0
  373. package/src/core/color/REC709_PRIMARIES.d.ts.map +1 -0
  374. package/src/core/color/REC709_PRIMARIES.js +53 -0
  375. package/src/core/color/construct/color_from_hex.d.ts +21 -0
  376. package/src/core/color/construct/color_from_hex.d.ts.map +1 -0
  377. package/src/core/color/construct/color_from_hex.js +33 -0
  378. package/src/core/color/construct/color_from_temperature.d.ts +22 -0
  379. package/src/core/color/construct/color_from_temperature.d.ts.map +1 -0
  380. package/src/core/color/construct/color_from_temperature.js +33 -0
  381. package/src/core/color/construct/color_from_uint24.d.ts +19 -0
  382. package/src/core/color/construct/color_from_uint24.d.ts.map +1 -0
  383. package/src/core/color/construct/color_from_uint24.js +26 -0
  384. package/src/core/color/construct/color_from_uint32.d.ts +20 -0
  385. package/src/core/color/construct/color_from_uint32.d.ts.map +1 -0
  386. package/src/core/color/construct/color_from_uint32.js +39 -0
  387. package/src/core/color/construct/color_gray.d.ts +17 -0
  388. package/src/core/color/construct/color_gray.d.ts.map +1 -0
  389. package/src/core/color/construct/color_gray.js +22 -0
  390. package/src/core/color/hex/hex2rgb.d.ts +1 -11
  391. package/src/core/color/hex/hex2rgb.d.ts.map +1 -1
  392. package/src/core/color/hex/hex2rgb.js +7 -24
  393. package/src/core/color/hex/hex_to_rgb.d.ts +18 -0
  394. package/src/core/color/hex/hex_to_rgb.d.ts.map +1 -0
  395. package/src/core/color/hex/hex_to_rgb.js +62 -0
  396. package/src/core/color/hex/rgb2hex.d.ts +1 -8
  397. package/src/core/color/hex/rgb2hex.d.ts.map +1 -1
  398. package/src/core/color/hex/rgb2hex.js +7 -13
  399. package/src/core/color/hex/rgb_to_hex.d.ts +9 -0
  400. package/src/core/color/hex/rgb_to_hex.d.ts.map +1 -0
  401. package/src/core/color/hex/rgb_to_hex.js +13 -0
  402. package/src/core/color/hex/rgba_to_hex.d.ts +19 -0
  403. package/src/core/color/hex/rgba_to_hex.d.ts.map +1 -0
  404. package/src/core/color/hex/rgba_to_hex.js +23 -0
  405. package/src/core/color/hsv/hsv2rgb.d.ts +1 -12
  406. package/src/core/color/hsv/hsv2rgb.d.ts.map +1 -1
  407. package/src/core/color/hsv/hsv2rgb.js +8 -21
  408. package/src/core/color/hsv/hsv2rgb_float.d.ts +1 -12
  409. package/src/core/color/hsv/hsv2rgb_float.d.ts.map +1 -1
  410. package/src/core/color/hsv/hsv2rgb_float.js +8 -56
  411. package/src/core/color/hsv/hsv_to_rgb.d.ts +13 -0
  412. package/src/core/color/hsv/hsv_to_rgb.d.ts.map +1 -0
  413. package/src/core/color/hsv/hsv_to_rgb.js +39 -0
  414. package/src/core/color/hsv/hsv_to_rgb_uint8.d.ts +13 -0
  415. package/src/core/color/hsv/hsv_to_rgb_uint8.d.ts.map +1 -0
  416. package/src/core/color/hsv/hsv_to_rgb_uint8.js +21 -0
  417. package/src/core/color/hsv/hue_to_rgb_sextant.d.ts +24 -0
  418. package/src/core/color/hsv/hue_to_rgb_sextant.d.ts.map +1 -0
  419. package/src/core/color/hsv/hue_to_rgb_sextant.js +67 -0
  420. package/src/core/color/hsv/rgb2hsv.d.ts +1 -12
  421. package/src/core/color/hsv/rgb2hsv.d.ts.map +1 -1
  422. package/src/core/color/hsv/rgb2hsv.js +7 -42
  423. package/src/core/color/hsv/rgb_to_hsv.d.ts +13 -0
  424. package/src/core/color/hsv/rgb_to_hsv.d.ts.map +1 -0
  425. package/src/core/color/hsv/rgb_to_hsv.js +42 -0
  426. package/src/core/color/hunt/hpe_to_xyz.d.ts +2 -0
  427. package/src/core/color/hunt/hpe_to_xyz.d.ts.map +1 -0
  428. package/src/core/color/hunt/hpe_to_xyz.js +4 -0
  429. package/src/core/color/hunt/xyz_to_hpe.d.ts +1 -6
  430. package/src/core/color/hunt/xyz_to_hpe.d.ts.map +1 -1
  431. package/src/core/color/hunt/xyz_to_hpe.js +12 -15
  432. package/src/core/color/illuminant/D65_spd_tabulated.d.ts.map +1 -1
  433. package/src/core/color/illuminant/D65_spd_tabulated.js +107 -104
  434. package/src/core/color/int2rgb.d.ts +1 -10
  435. package/src/core/color/int2rgb.d.ts.map +1 -1
  436. package/src/core/color/int2rgb.js +7 -12
  437. package/src/core/color/int_to_rgb.d.ts +21 -0
  438. package/src/core/color/int_to_rgb.d.ts.map +1 -0
  439. package/src/core/color/int_to_rgb.js +33 -0
  440. package/src/core/color/kelvin/kelvin_to_rgb.d.ts.map +1 -1
  441. package/src/core/color/kelvin/kelvin_to_rgb.js +22 -2
  442. package/src/core/color/kelvin/rgb_to_kelvin.d.ts +22 -2
  443. package/src/core/color/kelvin/rgb_to_kelvin.d.ts.map +1 -1
  444. package/src/core/color/kelvin/rgb_to_kelvin.js +22 -2
  445. package/src/core/color/lab/lab_to_xyz.d.ts +20 -0
  446. package/src/core/color/lab/lab_to_xyz.d.ts.map +1 -0
  447. package/src/core/color/lab/lab_to_xyz.js +69 -0
  448. package/src/core/color/oklab/gamut_clip_adaptive_l0.d.ts +34 -0
  449. package/src/core/color/oklab/gamut_clip_adaptive_l0.d.ts.map +1 -0
  450. package/src/core/color/oklab/gamut_clip_adaptive_l0.js +46 -0
  451. package/src/core/color/oklab/gamut_clip_at_l0.d.ts +33 -0
  452. package/src/core/color/oklab/gamut_clip_at_l0.d.ts.map +1 -0
  453. package/src/core/color/oklab/gamut_clip_at_l0.js +84 -0
  454. package/src/core/color/oklab/gamut_clip_preserve_chroma.d.ts +24 -0
  455. package/src/core/color/oklab/gamut_clip_preserve_chroma.d.ts.map +1 -0
  456. package/src/core/color/oklab/gamut_clip_preserve_chroma.js +37 -0
  457. package/src/core/color/oklab/gamut_clip_project_to_lcusp.d.ts +23 -0
  458. package/src/core/color/oklab/gamut_clip_project_to_lcusp.d.ts.map +1 -0
  459. package/src/core/color/oklab/gamut_clip_project_to_lcusp.js +46 -0
  460. package/src/core/color/oklab/linear_srgb_to_okhsl.d.ts +19 -0
  461. package/src/core/color/oklab/linear_srgb_to_okhsl.d.ts.map +1 -0
  462. package/src/core/color/oklab/linear_srgb_to_okhsl.js +93 -0
  463. package/src/core/color/oklab/linear_srgb_to_okhsv.d.ts +12 -4
  464. package/src/core/color/oklab/linear_srgb_to_okhsv.d.ts.map +1 -1
  465. package/src/core/color/oklab/linear_srgb_to_okhsv.js +108 -84
  466. package/src/core/color/oklab/linear_srgb_to_oklab.d.ts +13 -4
  467. package/src/core/color/oklab/linear_srgb_to_oklab.d.ts.map +1 -1
  468. package/src/core/color/oklab/linear_srgb_to_oklab.js +28 -19
  469. package/src/core/color/oklab/okhsl_chroma_bounds.d.ts +51 -0
  470. package/src/core/color/oklab/okhsl_chroma_bounds.d.ts.map +1 -0
  471. package/src/core/color/oklab/okhsl_chroma_bounds.js +128 -0
  472. package/src/core/color/oklab/okhsl_to_linear_srgb.d.ts +19 -0
  473. package/src/core/color/oklab/okhsl_to_linear_srgb.d.ts.map +1 -0
  474. package/src/core/color/oklab/okhsl_to_linear_srgb.js +85 -0
  475. package/src/core/color/oklab/oklab_to_oklch.d.ts +24 -0
  476. package/src/core/color/oklab/oklab_to_oklch.d.ts.map +1 -0
  477. package/src/core/color/oklab/oklab_to_oklch.js +35 -0
  478. package/src/core/color/oklab/oklch_to_oklab.d.ts +18 -0
  479. package/src/core/color/oklab/oklch_to_oklab.d.ts.map +1 -0
  480. package/src/core/color/oklab/oklch_to_oklab.js +26 -0
  481. package/src/core/color/oklab/toe.d.ts +12 -0
  482. package/src/core/color/oklab/toe.d.ts.map +1 -1
  483. package/src/core/color/oklab/toe.js +34 -22
  484. package/src/core/color/operations/color_add.d.ts +21 -0
  485. package/src/core/color/operations/color_add.d.ts.map +1 -0
  486. package/src/core/color/operations/color_add.js +23 -0
  487. package/src/core/color/operations/color_add_scaled.d.ts +20 -0
  488. package/src/core/color/operations/color_add_scaled.d.ts.map +1 -0
  489. package/src/core/color/operations/color_add_scaled.js +30 -0
  490. package/src/core/color/operations/color_clamp.d.ts +22 -0
  491. package/src/core/color/operations/color_clamp.d.ts.map +1 -0
  492. package/src/core/color/operations/color_clamp.js +25 -0
  493. package/src/core/color/operations/color_darken.d.ts +2 -1
  494. package/src/core/color/operations/color_darken.d.ts.map +1 -1
  495. package/src/core/color/operations/color_darken.js +25 -24
  496. package/src/core/color/operations/color_desaturate.d.ts +2 -1
  497. package/src/core/color/operations/color_desaturate.d.ts.map +1 -1
  498. package/src/core/color/operations/color_desaturate.js +25 -24
  499. package/src/core/color/operations/color_get_hsl.d.ts +18 -0
  500. package/src/core/color/operations/color_get_hsl.d.ts.map +1 -0
  501. package/src/core/color/operations/color_get_hsl.js +60 -0
  502. package/src/core/color/operations/color_is_in_gamut.d.ts +20 -0
  503. package/src/core/color/operations/color_is_in_gamut.d.ts.map +1 -0
  504. package/src/core/color/operations/color_is_in_gamut.js +30 -0
  505. package/src/core/color/operations/color_lerp.d.ts +12 -3
  506. package/src/core/color/operations/color_lerp.d.ts.map +1 -1
  507. package/src/core/color/operations/color_lerp.js +55 -46
  508. package/src/core/color/operations/color_lighten.d.ts +9 -5
  509. package/src/core/color/operations/color_lighten.d.ts.map +1 -1
  510. package/src/core/color/operations/color_lighten.js +29 -24
  511. package/src/core/color/operations/color_mix_okhsv_channel.d.ts +24 -0
  512. package/src/core/color/operations/color_mix_okhsv_channel.d.ts.map +1 -0
  513. package/src/core/color/operations/color_mix_okhsv_channel.js +48 -0
  514. package/src/core/color/operations/color_multiply_rgb.d.ts +21 -0
  515. package/src/core/color/operations/color_multiply_rgb.d.ts.map +1 -0
  516. package/src/core/color/operations/color_multiply_rgb.js +26 -0
  517. package/src/core/color/operations/color_saturate.d.ts +9 -5
  518. package/src/core/color/operations/color_saturate.d.ts.map +1 -1
  519. package/src/core/color/operations/color_saturate.js +29 -24
  520. package/src/core/color/operations/color_scale_okhsv_channel.d.ts +1 -1
  521. package/src/core/color/operations/color_scale_okhsv_channel.d.ts.map +1 -1
  522. package/src/core/color/operations/color_scale_okhsv_channel.js +58 -45
  523. package/src/core/color/operations/color_srgb_apply.d.ts +28 -0
  524. package/src/core/color/operations/color_srgb_apply.d.ts.map +1 -0
  525. package/src/core/color/operations/color_srgb_apply.js +40 -0
  526. package/src/core/color/operations/color_sub.d.ts +16 -0
  527. package/src/core/color/operations/color_sub.d.ts.map +1 -0
  528. package/src/core/color/operations/color_sub.js +18 -0
  529. package/src/core/color/parse_color.d.ts +10 -1
  530. package/src/core/color/parse_color.d.ts.map +1 -1
  531. package/src/core/color/parse_color.js +100 -84
  532. package/src/core/color/parse_color_normalized.d.ts +24 -0
  533. package/src/core/color/parse_color_normalized.d.ts.map +1 -0
  534. package/src/core/color/parse_color_normalized.js +38 -0
  535. package/src/core/color/rgb2uint24.d.ts +1 -8
  536. package/src/core/color/rgb2uint24.d.ts.map +1 -1
  537. package/src/core/color/rgb2uint24.js +7 -20
  538. package/src/core/color/rgb2uint32.d.ts +1 -9
  539. package/src/core/color/rgb2uint32.d.ts.map +1 -1
  540. package/src/core/color/rgb2uint32.js +7 -18
  541. package/src/core/color/rgb_to_luminance.d.ts +14 -5
  542. package/src/core/color/rgb_to_luminance.d.ts.map +1 -1
  543. package/src/core/color/rgb_to_luminance.js +24 -13
  544. package/src/core/color/rgb_to_uint24.d.ts +9 -0
  545. package/src/core/color/rgb_to_uint24.d.ts.map +1 -0
  546. package/src/core/color/rgb_to_uint24.js +20 -0
  547. package/src/core/color/rgb_to_uint32.d.ts +10 -0
  548. package/src/core/color/rgb_to_uint32.d.ts.map +1 -0
  549. package/src/core/color/rgb_to_uint32.js +21 -0
  550. package/src/core/color/sRGB/linear_to_sRGB.d.ts +7 -0
  551. package/src/core/color/sRGB/linear_to_sRGB.d.ts.map +1 -1
  552. package/src/core/color/sRGB/linear_to_sRGB.js +39 -32
  553. package/src/core/color/xyz/hpe_to_xyz.d.ts +24 -0
  554. package/src/core/color/xyz/hpe_to_xyz.d.ts.map +1 -0
  555. package/src/core/color/xyz/hpe_to_xyz.js +39 -0
  556. package/src/core/color/xyz/rgb_to_xyz.d.ts +17 -2
  557. package/src/core/color/xyz/rgb_to_xyz.d.ts.map +1 -1
  558. package/src/core/color/xyz/rgb_to_xyz.js +44 -18
  559. package/src/core/color/xyz/xyz_cmf_tabulated.d.ts.map +1 -1
  560. package/src/core/color/xyz/xyz_cmf_tabulated.js +217 -211
  561. package/src/core/color/xyz/xyz_cmf_wyman.d.ts +4 -0
  562. package/src/core/color/xyz/xyz_cmf_wyman.d.ts.map +1 -1
  563. package/src/core/color/xyz/xyz_cmf_wyman.js +74 -65
  564. package/src/core/color/xyz/xyz_to_hpe.d.ts +18 -0
  565. package/src/core/color/xyz/xyz_to_hpe.d.ts.map +1 -0
  566. package/src/core/color/xyz/xyz_to_hpe.js +33 -0
  567. package/src/core/color/xyz/xyz_to_rgb.d.ts +17 -2
  568. package/src/core/color/xyz/xyz_to_rgb.d.ts.map +1 -1
  569. package/src/core/color/xyz/xyz_to_rgb.js +39 -16
  570. package/src/core/color/ycxcz/xyz_to_ycxcz.d.ts +7 -2
  571. package/src/core/color/ycxcz/xyz_to_ycxcz.d.ts.map +1 -1
  572. package/src/core/color/ycxcz/xyz_to_ycxcz.js +33 -28
  573. package/src/core/events/signal/Signal.js +820 -820
  574. package/src/core/geom/3d/shape/ConvexHullShape3D.d.ts.map +1 -1
  575. package/src/core/geom/3d/shape/ConvexHullShape3D.js +28 -4
  576. package/src/core/math/clamp_index.d.ts +18 -0
  577. package/src/core/math/clamp_index.d.ts.map +1 -0
  578. package/src/core/math/clamp_index.js +23 -0
  579. package/src/engine/asset/loaders/image/IMAGE_CODEC_REVIEW_2026_08_28.md +803 -0
  580. package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts +5 -3
  581. package/src/engine/asset/loaders/image/jpeg/JpegFrame.d.ts.map +1 -1
  582. package/src/engine/asset/loaders/image/jpeg/JpegFrame.js +5 -3
  583. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts +2 -1
  584. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.d.ts.map +1 -1
  585. package/src/engine/asset/loaders/image/jpeg/JpegFrameComponent.js +2 -1
  586. package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts +17 -0
  587. package/src/engine/asset/loaders/image/jpeg/JpegImage.d.ts.map +1 -1
  588. package/src/engine/asset/loaders/image/jpeg/JpegImage.js +197 -157
  589. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts +0 -1
  590. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.d.ts.map +1 -1
  591. package/src/engine/asset/loaders/image/jpeg/idct8x8_float.js +0 -1
  592. package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.d.ts +28 -0
  593. package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.d.ts.map +1 -0
  594. package/src/engine/asset/loaders/image/jpeg/jpeg_component_row.js +31 -0
  595. package/src/engine/asset/loaders/image/png/PNG.d.ts +3 -18
  596. package/src/engine/asset/loaders/image/png/PNG.d.ts.map +1 -1
  597. package/src/engine/asset/loaders/image/png/PNG.js +3 -139
  598. package/src/engine/asset/loaders/image/png/PNGReader.d.ts +16 -16
  599. package/src/engine/asset/loaders/image/png/PNGReader.d.ts.map +1 -1
  600. package/src/engine/asset/loaders/image/png/PNGReader.js +143 -160
  601. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_iTXt.js +3 -3
  602. package/src/engine/asset/loaders/image/png/chunk/png_chunk_decode_zTXt.js +3 -3
  603. package/src/engine/asset/loaders/image/png/crc32.d.ts +1 -15
  604. package/src/engine/asset/loaders/image/png/crc32.d.ts.map +1 -1
  605. package/src/engine/asset/loaders/image/png/crc32.js +5 -89
  606. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.d.ts +12 -10
  607. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.d.ts.map +1 -1
  608. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterNone.js +20 -45
  609. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.d.ts +2 -1
  610. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.d.ts.map +1 -1
  611. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterSub.js +2 -0
  612. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.d.ts +2 -1
  613. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.d.ts.map +1 -1
  614. package/src/engine/asset/loaders/image/png/filter/png_filter_unFilterUp.js +2 -0
  615. package/src/engine/asset/loaders/image/png/filter/png_unfilter.d.ts +22 -0
  616. package/src/engine/asset/loaders/image/png/filter/png_unfilter.d.ts.map +1 -0
  617. package/src/engine/asset/loaders/image/png/filter/png_unfilter.js +68 -0
  618. package/src/engine/asset/loaders/image/png/png_inflate.d.ts +20 -0
  619. package/src/engine/asset/loaders/image/png/png_inflate.d.ts.map +1 -0
  620. package/src/engine/asset/loaders/image/png/png_inflate.js +85 -0
  621. package/src/engine/asset/loaders/image/png/png_unpack_samples.d.ts +22 -0
  622. package/src/engine/asset/loaders/image/png/png_unpack_samples.d.ts.map +1 -0
  623. package/src/engine/asset/loaders/image/png/png_unpack_samples.js +38 -0
  624. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +1 -1
  625. package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +135 -132
  626. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +16 -3
  627. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +1 -1
  628. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +1157 -1149
  629. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +26 -0
  630. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
  631. package/src/engine/graphics/render/frame_graph/FrameGraph.js +947 -900
  632. package/src/engine/physics/ecs/PhysicsSystem.d.ts +69 -81
  633. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  634. package/src/engine/physics/ecs/PhysicsSystem.js +83 -77
  635. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  636. package/src/shade/device/IMMEDIATE_DATA_PLAN_2026_08_28.md +451 -0
  637. package/src/shade/device/ShadeGPUCommandContext.d.ts +21 -0
  638. package/src/shade/device/ShadeGPUCommandContext.d.ts.map +1 -1
  639. package/src/shade/device/ShadeGPUCommandContext.js +940 -749
  640. package/src/shade/device/timing/GPUTimerArray.d.ts +22 -4
  641. package/src/shade/device/timing/GPUTimerArray.d.ts.map +1 -1
  642. package/src/shade/device/timing/GPUTimerArray.js +88 -14
  643. package/src/shade/device/timing/GPU_PROFILER_PROPOSAL_2026_08_28.md +876 -0
  644. package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts +93 -0
  645. package/src/shade/device/timing/profile/GPUFrameRecorder.d.ts.map +1 -0
  646. package/src/shade/device/timing/profile/GPUFrameRecorder.js +297 -0
  647. package/src/shade/device/timing/profile/GPUProfileCapture.d.ts +62 -0
  648. package/src/shade/device/timing/profile/GPUProfileCapture.d.ts.map +1 -0
  649. package/src/shade/device/timing/profile/GPUProfileCapture.js +77 -0
  650. package/src/shade/device/timing/profile/GPUProfileFrame.d.ts +73 -0
  651. package/src/shade/device/timing/profile/GPUProfileFrame.d.ts.map +1 -0
  652. package/src/shade/device/timing/profile/GPUProfileFrame.js +88 -0
  653. package/src/shade/device/timing/profile/GPUProfileLevel.d.ts +20 -0
  654. package/src/shade/device/timing/profile/GPUProfileLevel.d.ts.map +1 -0
  655. package/src/shade/device/timing/profile/GPUProfileLevel.js +50 -0
  656. package/src/shade/device/timing/profile/GPUProfileMeta.d.ts +63 -0
  657. package/src/shade/device/timing/profile/GPUProfileMeta.d.ts.map +1 -0
  658. package/src/shade/device/timing/profile/GPUProfileMeta.js +73 -0
  659. package/src/shade/device/timing/profile/GPUProfileSession.d.ts +173 -0
  660. package/src/shade/device/timing/profile/GPUProfileSession.d.ts.map +1 -0
  661. package/src/shade/device/timing/profile/GPUProfileSession.js +470 -0
  662. package/src/shade/device/timing/profile/GPUProfileSpan.d.ts +60 -0
  663. package/src/shade/device/timing/profile/GPUProfileSpan.d.ts.map +1 -0
  664. package/src/shade/device/timing/profile/GPUProfileSpan.js +65 -0
  665. package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts +19 -0
  666. package/src/shade/device/timing/profile/GPUProfileSpanKind.d.ts.map +1 -0
  667. package/src/shade/device/timing/profile/GPUProfileSpanKind.js +25 -0
  668. package/src/shade/device/timing/profile/GPUProfileTopology.d.ts +159 -0
  669. package/src/shade/device/timing/profile/GPUProfileTopology.d.ts.map +1 -0
  670. package/src/shade/device/timing/profile/GPUProfileTopology.js +202 -0
  671. package/src/shade/device/timing/profile/GPUProfileWork.d.ts +90 -0
  672. package/src/shade/device/timing/profile/GPUProfileWork.d.ts.map +1 -0
  673. package/src/shade/device/timing/profile/GPUProfileWork.js +115 -0
  674. package/src/shade/device/timing/profile/SGPTDefect.d.ts +43 -0
  675. package/src/shade/device/timing/profile/SGPTDefect.d.ts.map +1 -0
  676. package/src/shade/device/timing/profile/SGPTDefect.js +65 -0
  677. package/src/shade/device/timing/profile/SGPTHeader.d.ts +38 -0
  678. package/src/shade/device/timing/profile/SGPTHeader.d.ts.map +1 -0
  679. package/src/shade/device/timing/profile/SGPTHeader.js +46 -0
  680. package/src/shade/device/timing/profile/SGPTRecordRef.d.ts +37 -0
  681. package/src/shade/device/timing/profile/SGPTRecordRef.d.ts.map +1 -0
  682. package/src/shade/device/timing/profile/SGPTRecordRef.js +45 -0
  683. package/src/shade/device/timing/profile/SGPTWriteStream.d.ts +103 -0
  684. package/src/shade/device/timing/profile/SGPTWriteStream.d.ts.map +1 -0
  685. package/src/shade/device/timing/profile/SGPTWriteStream.js +287 -0
  686. package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts +19 -0
  687. package/src/shade/device/timing/profile/SGPT_DEFECT.d.ts.map +1 -0
  688. package/src/shade/device/timing/profile/SGPT_DEFECT.js +26 -0
  689. package/src/shade/device/timing/profile/SGPT_FLAG.d.ts +8 -0
  690. package/src/shade/device/timing/profile/SGPT_FLAG.d.ts.map +1 -0
  691. package/src/shade/device/timing/profile/SGPT_FLAG.js +15 -0
  692. package/src/shade/device/timing/profile/SGPT_FORMAT.md +345 -0
  693. package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts +10 -0
  694. package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.d.ts.map +1 -0
  695. package/src/shade/device/timing/profile/SGPT_FORMAT_VERSION.js +9 -0
  696. package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts +17 -0
  697. package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.d.ts.map +1 -0
  698. package/src/shade/device/timing/profile/SGPT_FRAME_SLACK.js +16 -0
  699. package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts +16 -0
  700. package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.d.ts.map +1 -0
  701. package/src/shade/device/timing/profile/SGPT_HEADER_CHECKSUM_COVERAGE.js +15 -0
  702. package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts +15 -0
  703. package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.d.ts.map +1 -0
  704. package/src/shade/device/timing/profile/SGPT_HEADER_OFFSET.js +29 -0
  705. package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts +7 -0
  706. package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.d.ts.map +1 -0
  707. package/src/shade/device/timing/profile/SGPT_HEADER_SIZE.js +6 -0
  708. package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts +7 -0
  709. package/src/shade/device/timing/profile/SGPT_MAGIC.d.ts.map +1 -0
  710. package/src/shade/device/timing/profile/SGPT_MAGIC.js +6 -0
  711. package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts +16 -0
  712. package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.d.ts.map +1 -0
  713. package/src/shade/device/timing/profile/SGPT_MIN_READER_VERSION.js +15 -0
  714. package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts +7 -0
  715. package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.d.ts.map +1 -0
  716. package/src/shade/device/timing/profile/SGPT_RECORD_HEADER_SIZE.js +6 -0
  717. package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts +13 -0
  718. package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.d.ts.map +1 -0
  719. package/src/shade/device/timing/profile/SGPT_RECORD_OFFSET.js +23 -0
  720. package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts +12 -0
  721. package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.d.ts.map +1 -0
  722. package/src/shade/device/timing/profile/SGPT_RECORD_SYNC.js +11 -0
  723. package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts +18 -0
  724. package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.d.ts.map +1 -0
  725. package/src/shade/device/timing/profile/SGPT_RECORD_TYPE.js +46 -0
  726. package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts +20 -0
  727. package/src/shade/device/timing/profile/frame_graph_extract_topology.d.ts.map +1 -0
  728. package/src/shade/device/timing/profile/frame_graph_extract_topology.js +174 -0
  729. package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts +21 -0
  730. package/src/shade/device/timing/profile/make_profiling_pass_encoder.d.ts.map +1 -0
  731. package/src/shade/device/timing/profile/make_profiling_pass_encoder.js +114 -0
  732. package/src/shade/device/timing/profile/parse_workgroup_size.d.ts +20 -0
  733. package/src/shade/device/timing/profile/parse_workgroup_size.d.ts.map +1 -0
  734. package/src/shade/device/timing/profile/parse_workgroup_size.js +43 -0
  735. package/src/shade/device/timing/profile/sgpt_fourcc.d.ts +18 -0
  736. package/src/shade/device/timing/profile/sgpt_fourcc.d.ts.map +1 -0
  737. package/src/shade/device/timing/profile/sgpt_fourcc.js +34 -0
  738. package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts +42 -0
  739. package/src/shade/device/timing/profile/sgpt_frame_codec.d.ts.map +1 -0
  740. package/src/shade/device/timing/profile/sgpt_frame_codec.js +172 -0
  741. package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts +20 -0
  742. package/src/shade/device/timing/profile/sgpt_meta_codec.d.ts.map +1 -0
  743. package/src/shade/device/timing/profile/sgpt_meta_codec.js +65 -0
  744. package/src/shade/device/timing/profile/sgpt_read_capture.d.ts +19 -0
  745. package/src/shade/device/timing/profile/sgpt_read_capture.d.ts.map +1 -0
  746. package/src/shade/device/timing/profile/sgpt_read_capture.js +134 -0
  747. package/src/shade/device/timing/profile/sgpt_read_header.d.ts +22 -0
  748. package/src/shade/device/timing/profile/sgpt_read_header.d.ts.map +1 -0
  749. package/src/shade/device/timing/profile/sgpt_read_header.js +94 -0
  750. package/src/shade/device/timing/profile/sgpt_read_records.d.ts +27 -0
  751. package/src/shade/device/timing/profile/sgpt_read_records.d.ts.map +1 -0
  752. package/src/shade/device/timing/profile/sgpt_read_records.js +153 -0
  753. package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts +54 -0
  754. package/src/shade/device/timing/profile/sgpt_topology_codec.d.ts.map +1 -0
  755. package/src/shade/device/timing/profile/sgpt_topology_codec.js +329 -0
  756. package/src/shade/device/timing/profile/sgpt_write_header.d.ts +22 -0
  757. package/src/shade/device/timing/profile/sgpt_write_header.d.ts.map +1 -0
  758. package/src/shade/device/timing/profile/sgpt_write_header.js +47 -0
  759. package/src/shade/device/timing/profile/sgpt_write_record.d.ts +23 -0
  760. package/src/shade/device/timing/profile/sgpt_write_record.d.ts.map +1 -0
  761. package/src/shade/device/timing/profile/sgpt_write_record.js +62 -0
  762. package/src/shade/renderer/Renderer.d.ts +21 -0
  763. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  764. package/src/shade/renderer/Renderer.js +2513 -2455
  765. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  766. package/src/shade/renderer/scene/serialization/decode_image_source_hdr.d.ts +14 -3
  767. package/src/shade/renderer/scene/serialization/decode_image_source_hdr.d.ts.map +1 -1
  768. package/src/shade/renderer/scene/serialization/decode_image_source_hdr.js +50 -51
  769. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  770. package/src/shade/renderer/scene/serialization/deserialize_scene.js +531 -521
  771. package/src/shade/renderer/scene/serialization/write_image_source.d.ts.map +1 -1
  772. package/src/shade/renderer/scene/serialization/write_image_source.js +6 -4
  773. package/src/shade/renderer/shader/chunk/color/chunk_rgb_to_luminance.d.ts.map +1 -1
  774. package/src/shade/renderer/shader/chunk/color/chunk_rgb_to_luminance.js +34 -32
  775. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.d.ts +31 -0
  776. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.d.ts.map +1 -1
  777. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_eotf_st2084.js +62 -31
  778. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.d.ts +10 -0
  779. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.d.ts.map +1 -1
  780. package/src/shade/renderer/shader/chunk/color/iCtCp/chunk_inverse_eotf_st2084.js +32 -22
  781. package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferOETF.d.ts.map +1 -1
  782. package/src/shade/renderer/shader/chunk/color/sRGB/chunk_sRGBTransferOETF.js +22 -21
  783. package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.d.ts +6 -0
  784. package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.d.ts.map +1 -1
  785. package/src/shade/renderer/shader/chunk/color/tonemap/gt7/chunk_tonemap_gt7.js +110 -104
  786. package/src/shade/renderer/shader/chunk/color/xyz/chunk_rgb_to_xyz.d.ts.map +1 -1
  787. package/src/shade/renderer/shader/chunk/color/xyz/chunk_rgb_to_xyz.js +23 -21
  788. package/src/view/elements/ColorPickerView.js +296 -296
  789. package/src/avif/codec/dec/Readme.md +0 -14
  790. package/src/avif/codec/dec/avif_dec.cpp +0 -234
  791. package/src/avif/codec/dec/avif_dec.d.ts +0 -3
  792. package/src/avif/codec/dec/avif_dec.d.ts.map +0 -1
  793. package/src/avif/codec/dec/avif_dec.js +0 -16
  794. package/src/avif/codec/dec/avif_dec.wasm +0 -0
  795. package/src/avif/codec/enc/README.md +0 -37
  796. package/src/avif/codec/enc/avif_enc.cpp +0 -216
  797. package/src/avif/codec/enc/avif_enc.d.ts +0 -3
  798. package/src/avif/codec/enc/avif_enc.d.ts.map +0 -1
  799. package/src/avif/codec/enc/avif_enc.js +0 -6144
  800. package/src/avif/codec/enc/avif_enc.wasm +0 -0
  801. package/src/avif/codec/enc/avif_enc_mt.d.ts +0 -3
  802. package/src/avif/codec/enc/avif_enc_mt.d.ts.map +0 -1
  803. package/src/avif/codec/enc/avif_enc_mt.js +0 -6811
  804. package/src/avif/codec/enc/avif_enc_mt.wasm +0 -0
  805. package/src/avif/codec/enc/avif_enc_mt.worker.d.mts +0 -2
  806. package/src/avif/codec/enc/avif_enc_mt.worker.d.mts.map +0 -1
  807. package/src/avif/codec/enc/avif_enc_mt.worker.d.ts +0 -11
  808. package/src/avif/codec/enc/avif_enc_mt.worker.d.ts.map +0 -1
  809. package/src/avif/codec/enc/avif_enc_mt.worker.js +0 -171
  810. package/src/avif/codec/enc/avif_enc_mt.worker.mjs +0 -1
  811. package/src/avif/decode.d.ts +0 -3
  812. package/src/avif/decode.d.ts.map +0 -1
  813. package/src/avif/decode.js +0 -42
  814. package/src/avif/encode.d.ts +0 -3
  815. package/src/avif/encode.d.ts.map +0 -1
  816. package/src/avif/encode.js +0 -75
  817. package/src/avif/meta.d.ts +0 -24
  818. package/src/avif/meta.d.ts.map +0 -1
  819. package/src/avif/meta.js +0 -23
  820. package/src/avif/tsconfig.tsbuildinfo +0 -1
  821. package/src/avif/utils.d.ts +0 -17
  822. package/src/avif/utils.d.ts.map +0 -1
  823. package/src/avif/utils.js +0 -31
  824. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts +0 -23
  825. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.d.ts.map +0 -1
  826. package/src/engine/asset/loaders/image/jpeg/idct8x8_fixed.js +0 -214
  827. package/src/engine/asset/loaders/image/png/inflate.d.ts +0 -7
  828. package/src/engine/asset/loaders/image/png/inflate.d.ts.map +0 -1
  829. package/src/engine/asset/loaders/image/png/inflate.js +0 -20
  830. package/src/engine/save/GameStateLoader.d.ts +0 -49
  831. package/src/engine/save/GameStateLoader.d.ts.map +0 -1
  832. package/src/engine/save/GameStateLoader.js +0 -168
@@ -1,105 +1,108 @@
1
- import { assert } from "../../assert.js";
2
- import { lerp } from "../../math/lerp.js";
3
-
4
- export const D65_MIN_NM = 300;
5
- export const D65_MAX_NM = 830;
6
-
7
- /**
8
- * CIE Standard Illuminant D65 Spectral Power Distribution (SPD)
9
- * Source: CVRL (Colour & Vision Research Laboratory)
10
- * Wavelength range: 300–830 nm in 1 nm steps.
11
- * Units are relative; use appropriate normalization constant when integrating.
12
- *
13
- * 300..830 inclusive → 531 samples
14
- *
15
- * @see http://www.cvrl.org/cie.htm
16
- */
17
- const D65_VALUES = new Float32Array([
18
- 0.0341, 0.36014, 0.68618, 1.01222, 1.33826, 1.6643, 1.99034, 2.31638, 2.64242, 2.96846,
19
- 3.2945, 4.98865, 6.6828, 8.37695, 10.0711, 11.7652, 13.4594, 15.1535, 16.8477, 18.5418,
20
- 20.236, 21.9177, 23.5995, 25.2812, 26.963, 28.6447, 30.3265, 32.0082, 33.69, 35.3717,
21
- 37.0535, 37.343, 37.6326, 37.9221, 38.2116, 38.5011, 38.7907, 39.0802, 39.3697, 39.6593,
22
- 39.9488, 40.4451, 40.9414, 41.4377, 41.934, 42.4302, 42.9265, 43.4228, 43.9191, 44.4154,
23
- 44.9117, 45.0844, 45.257, 45.4297, 45.6023, 45.775, 45.9477, 46.1203, 46.293, 46.4656,
24
- 46.6383, 47.1834, 47.7285, 48.2735, 48.8186, 49.3637, 49.9088, 50.4539, 50.9989, 51.544,
25
- 52.0891, 51.8777, 51.6664, 51.455, 51.2437, 51.0323, 50.8209, 50.6096, 50.3982, 50.1869,
26
- 49.9755, 50.4428, 50.91, 51.3773, 51.8446, 52.3118, 52.7791, 53.2464, 53.7137, 54.1809,
27
- 54.6482, 57.4589, 60.2695, 63.0802, 65.8909, 68.7015, 71.5122, 74.3229, 77.1336, 79.9442,
28
- 82.7549, 83.628, 84.5011, 85.3742, 86.2473, 87.1204, 87.9936, 88.8667, 89.7398, 90.6129,
29
- 91.486, 91.6806, 91.8752, 92.0697, 92.2643, 92.4589, 92.6535, 92.8481, 93.0426, 93.2372,
30
- 93.4318, 92.7568, 92.0819, 91.4069, 90.732, 90.057, 89.3821, 88.7071, 88.0322, 87.3572,
31
- 86.6823, 88.5006, 90.3188, 92.1371, 93.9554, 95.7736, 97.5919, 99.4102, 101.228, 103.047,
32
- 104.865, 106.079, 107.294, 108.508, 109.722, 110.936, 112.151, 113.365, 114.579, 115.794,
33
- 117.008, 117.088, 117.169, 117.249, 117.33, 117.41, 117.49, 117.571, 117.651, 117.732,
34
- 117.812, 117.517, 117.222, 116.927, 116.632, 116.336, 116.041, 115.746, 115.451, 115.156,
35
- 114.861, 114.967, 115.073, 115.18, 115.286, 115.392, 115.498, 115.604, 115.711, 115.817,
36
- 115.923, 115.212, 114.501, 113.789, 113.078, 112.367, 111.656, 110.945, 110.233, 109.522,
37
- 108.811, 108.865, 108.92, 108.974, 109.028, 109.082, 109.137, 109.191, 109.245, 109.3,
38
- 109.354, 109.199, 109.044, 108.888, 108.733, 108.578, 108.423, 108.268, 108.112, 107.957,
39
- 107.802, 107.501, 107.2, 106.898, 106.597, 106.296, 105.995, 105.694, 105.392, 105.091,
40
- 104.79, 105.08, 105.37, 105.66, 105.95, 106.239, 106.529, 106.819, 107.109, 107.399,
41
- 107.689, 107.361, 107.032, 106.704, 106.375, 106.047, 105.719, 105.39, 105.062, 104.733,
42
- 104.405, 104.369, 104.333, 104.297, 104.261, 104.225, 104.19, 104.154, 104.118, 104.082,
43
- 104.046, 103.641, 103.237, 102.832, 102.428, 102.023, 101.618, 101.214, 100.809, 100.405,
44
- 100.0, 99.6334, 99.2668, 98.9003, 98.5337, 98.1671, 97.8005, 97.4339, 97.0674, 96.7008,
45
- 96.3342, 96.2796, 96.225, 96.1703, 96.1157, 96.0611, 96.0065, 95.9519, 95.8972, 95.8426,
46
- 95.788, 95.0778, 94.3675, 93.6573, 92.947, 92.2368, 91.5266, 90.8163, 90.1061, 89.3958,
47
- 88.6856, 88.8177, 88.9497, 89.0818, 89.2138, 89.3459, 89.478, 89.61, 89.7421, 89.8741,
48
- 90.0062, 89.9655, 89.9248, 89.8841, 89.8434, 89.8026, 89.7619, 89.7212, 89.6805, 89.6398,
49
- 89.5991, 89.4091, 89.219, 89.029, 88.8389, 88.6489, 88.4589, 88.2688, 88.0788, 87.8887,
50
- 87.6987, 87.2577, 86.8167, 86.3757, 85.9347, 85.4936, 85.0526, 84.6116, 84.1706, 83.7296,
51
- 83.2886, 83.3297, 83.3707, 83.4118, 83.4528, 83.4939, 83.535, 83.576, 83.6171, 83.6581,
52
- 83.6992, 83.332, 82.9647, 82.5975, 82.2302, 81.863, 81.4958, 81.1285, 80.7613, 80.394,
53
- 80.0268, 80.0456, 80.0644, 80.0831, 80.1019, 80.1207, 80.1395, 80.1583, 80.177, 80.1958,
54
- 80.2146, 80.4209, 80.6272, 80.8336, 81.0399, 81.2462, 81.4525, 81.6588, 81.8652, 82.0715,
55
- 82.2778, 81.8784, 81.4791, 81.0797, 80.6804, 80.281, 79.8816, 79.4823, 79.0829, 78.6836,
56
- 78.2842, 77.4279, 76.5716, 75.7153, 74.859, 74.0027, 73.1465, 72.2902, 71.4339, 70.5776,
57
- 69.7213, 69.9101, 70.0989, 70.2876, 70.4764, 70.6652, 70.854, 71.0428, 71.2315, 71.4203,
58
- 71.6091, 71.8831, 72.1571, 72.4311, 72.7051, 72.979, 73.253, 73.527, 73.801, 74.075,
59
- 74.349, 73.0745, 71.8, 70.5255, 69.251, 67.9765, 66.702, 65.4275, 64.153, 62.8785,
60
- 61.604, 62.4322, 63.2603, 64.0885, 64.9166, 65.7448, 66.573, 67.4011, 68.2293, 69.0574,
61
- 69.8856, 70.4057, 70.9259, 71.446, 71.9662, 72.4863, 73.0064, 73.5266, 74.0467, 74.5669,
62
- 75.087, 73.9376, 72.7881, 71.6387, 70.4893, 69.3398, 68.1904, 67.041, 65.8916, 64.7421,
63
- 63.5927, 61.8752, 60.1578, 58.4403, 56.7229, 55.0054, 53.288, 51.5705, 49.8531, 48.1356,
64
- 46.4182, 48.4569, 50.4956, 52.5344, 54.5731, 56.6118, 58.6505, 60.6892, 62.728, 64.7667,
65
- 66.8054, 66.4631, 66.1209, 65.7786, 65.4364, 65.0941, 64.7518, 64.4096, 64.0673, 63.7251,
66
- 63.3828, 63.4749, 63.567, 63.6592, 63.7513, 63.8434, 63.9355, 64.0276, 64.1198, 64.2119,
67
- 64.304, 63.8188, 63.3336, 62.8484, 62.3632, 61.8779, 61.3927, 60.9075, 60.4223, 59.9371,
68
- 59.4519, 58.7026, 57.9533, 57.204, 56.4547, 55.7054, 54.9562, 54.2069, 53.4576, 52.7083,
69
- 51.959, 52.5072, 53.0553, 53.6035, 54.1516, 54.6998, 55.248, 55.7961, 56.3443, 56.8924,
70
- 57.4406, 57.7278, 58.015, 58.3022, 58.5894, 58.8765, 59.1637, 59.4509, 59.7381, 60.0253,
71
- 60.3125
72
- ]);
73
-
74
- /**
75
- * Linear-interpolated D65 SPD at the given wavelength.
76
- * Returns 0 outside [300, 830] nm.
77
- *
78
- * NOTE: results are normalized to 100 instead of 1
79
- *
80
- * @param {number} wavelength_nm
81
- * @returns {number}
82
- */
83
- export function D65_spd_tabulated(wavelength_nm) {
84
- assert.isNumber(wavelength_nm, 'wavelength_nm');
85
- assert.isFinite(wavelength_nm, 'wavelength_nm');
86
- assert.greaterThan(wavelength_nm, 0, 'wavelength_nm > 0');
87
-
88
- if (wavelength_nm <= D65_MIN_NM || wavelength_nm >= D65_MAX_NM) {
89
-
90
- if (wavelength_nm === D65_MIN_NM) return D65_VALUES[0];
91
-
92
- if (wavelength_nm === D65_MAX_NM) return D65_VALUES[D65_VALUES.length - 1];
93
-
94
- return 0;
95
- }
96
-
97
- const w = wavelength_nm;
98
-
99
- const i0 = Math.floor(w) - D65_MIN_NM; // index for integer nm below w
100
- const frac = w - Math.floor(w);
101
-
102
- const v0 = D65_VALUES[i0];
103
- const v1 = D65_VALUES[i0 + 1];
104
- return lerp(v0, v1, frac);
1
+ import { assert } from "../../assert.js";
2
+ import { lerp } from "../../math/lerp.js";
3
+
4
+ export const D65_MIN_NM = 300;
5
+ export const D65_MAX_NM = 830;
6
+
7
+ /**
8
+ * CIE Standard Illuminant D65 Spectral Power Distribution (SPD)
9
+ * Source: CVRL (Colour & Vision Research Laboratory)
10
+ * Wavelength range: 300–830 nm in 1 nm steps.
11
+ * Units are relative; use appropriate normalization constant when integrating.
12
+ *
13
+ * 300..830 inclusive → 531 samples
14
+ *
15
+ * @see http://www.cvrl.org/cie.htm
16
+ */
17
+ const D65_VALUES = new Float32Array([
18
+ 0.0341, 0.36014, 0.68618, 1.01222, 1.33826, 1.6643, 1.99034, 2.31638, 2.64242, 2.96846,
19
+ 3.2945, 4.98865, 6.6828, 8.37695, 10.0711, 11.7652, 13.4594, 15.1535, 16.8477, 18.5418,
20
+ 20.236, 21.9177, 23.5995, 25.2812, 26.963, 28.6447, 30.3265, 32.0082, 33.69, 35.3717,
21
+ 37.0535, 37.343, 37.6326, 37.9221, 38.2116, 38.5011, 38.7907, 39.0802, 39.3697, 39.6593,
22
+ 39.9488, 40.4451, 40.9414, 41.4377, 41.934, 42.4302, 42.9265, 43.4228, 43.9191, 44.4154,
23
+ 44.9117, 45.0844, 45.257, 45.4297, 45.6023, 45.775, 45.9477, 46.1203, 46.293, 46.4656,
24
+ 46.6383, 47.1834, 47.7285, 48.2735, 48.8186, 49.3637, 49.9088, 50.4539, 50.9989, 51.544,
25
+ 52.0891, 51.8777, 51.6664, 51.455, 51.2437, 51.0323, 50.8209, 50.6096, 50.3982, 50.1869,
26
+ 49.9755, 50.4428, 50.91, 51.3773, 51.8446, 52.3118, 52.7791, 53.2464, 53.7137, 54.1809,
27
+ 54.6482, 57.4589, 60.2695, 63.0802, 65.8909, 68.7015, 71.5122, 74.3229, 77.1336, 79.9442,
28
+ 82.7549, 83.628, 84.5011, 85.3742, 86.2473, 87.1204, 87.9936, 88.8667, 89.7398, 90.6129,
29
+ 91.486, 91.6806, 91.8752, 92.0697, 92.2643, 92.4589, 92.6535, 92.8481, 93.0426, 93.2372,
30
+ 93.4318, 92.7568, 92.0819, 91.4069, 90.732, 90.057, 89.3821, 88.7071, 88.0322, 87.3572,
31
+ 86.6823, 88.5006, 90.3188, 92.1371, 93.9554, 95.7736, 97.5919, 99.4102, 101.228, 103.047,
32
+ 104.865, 106.079, 107.294, 108.508, 109.722, 110.936, 112.151, 113.365, 114.579, 115.794,
33
+ 117.008, 117.088, 117.169, 117.249, 117.33, 117.41, 117.49, 117.571, 117.651, 117.732,
34
+ 117.812, 117.517, 117.222, 116.927, 116.632, 116.336, 116.041, 115.746, 115.451, 115.156,
35
+ 114.861, 114.967, 115.073, 115.18, 115.286, 115.392, 115.498, 115.604, 115.711, 115.817,
36
+ 115.923, 115.212, 114.501, 113.789, 113.078, 112.367, 111.656, 110.945, 110.233, 109.522,
37
+ 108.811, 108.865, 108.92, 108.974, 109.028, 109.082, 109.137, 109.191, 109.245, 109.3,
38
+ 109.354, 109.199, 109.044, 108.888, 108.733, 108.578, 108.423, 108.268, 108.112, 107.957,
39
+ 107.802, 107.501, 107.2, 106.898, 106.597, 106.296, 105.995, 105.694, 105.392, 105.091,
40
+ 104.79, 105.08, 105.37, 105.66, 105.95, 106.239, 106.529, 106.819, 107.109, 107.399,
41
+ 107.689, 107.361, 107.032, 106.704, 106.375, 106.047, 105.719, 105.39, 105.062, 104.733,
42
+ 104.405, 104.369, 104.333, 104.297, 104.261, 104.225, 104.19, 104.154, 104.118, 104.082,
43
+ 104.046, 103.641, 103.237, 102.832, 102.428, 102.023, 101.618, 101.214, 100.809, 100.405,
44
+ 100.0, 99.6334, 99.2668, 98.9003, 98.5337, 98.1671, 97.8005, 97.4339, 97.0674, 96.7008,
45
+ 96.3342, 96.2796, 96.225, 96.1703, 96.1157, 96.0611, 96.0065, 95.9519, 95.8972, 95.8426,
46
+ 95.788, 95.0778, 94.3675, 93.6573, 92.947, 92.2368, 91.5266, 90.8163, 90.1061, 89.3958,
47
+ 88.6856, 88.8177, 88.9497, 89.0818, 89.2138, 89.3459, 89.478, 89.61, 89.7421, 89.8741,
48
+ 90.0062, 89.9655, 89.9248, 89.8841, 89.8434, 89.8026, 89.7619, 89.7212, 89.6805, 89.6398,
49
+ 89.5991, 89.4091, 89.219, 89.029, 88.8389, 88.6489, 88.4589, 88.2688, 88.0788, 87.8887,
50
+ 87.6987, 87.2577, 86.8167, 86.3757, 85.9347, 85.4936, 85.0526, 84.6116, 84.1706, 83.7296,
51
+ 83.2886, 83.3297, 83.3707, 83.4118, 83.4528, 83.4939, 83.535, 83.576, 83.6171, 83.6581,
52
+ 83.6992, 83.332, 82.9647, 82.5975, 82.2302, 81.863, 81.4958, 81.1285, 80.7613, 80.394,
53
+ 80.0268, 80.0456, 80.0644, 80.0831, 80.1019, 80.1207, 80.1395, 80.1583, 80.177, 80.1958,
54
+ 80.2146, 80.4209, 80.6272, 80.8336, 81.0399, 81.2462, 81.4525, 81.6588, 81.8652, 82.0715,
55
+ 82.2778, 81.8784, 81.4791, 81.0797, 80.6804, 80.281, 79.8816, 79.4823, 79.0829, 78.6836,
56
+ 78.2842, 77.4279, 76.5716, 75.7153, 74.859, 74.0027, 73.1465, 72.2902, 71.4339, 70.5776,
57
+ 69.7213, 69.9101, 70.0989, 70.2876, 70.4764, 70.6652, 70.854, 71.0428, 71.2315, 71.4203,
58
+ 71.6091, 71.8831, 72.1571, 72.4311, 72.7051, 72.979, 73.253, 73.527, 73.801, 74.075,
59
+ 74.349, 73.0745, 71.8, 70.5255, 69.251, 67.9765, 66.702, 65.4275, 64.153, 62.8785,
60
+ 61.604, 62.4322, 63.2603, 64.0885, 64.9166, 65.7448, 66.573, 67.4011, 68.2293, 69.0574,
61
+ 69.8856, 70.4057, 70.9259, 71.446, 71.9662, 72.4863, 73.0064, 73.5266, 74.0467, 74.5669,
62
+ 75.087, 73.9376, 72.7881, 71.6387, 70.4893, 69.3398, 68.1904, 67.041, 65.8916, 64.7421,
63
+ 63.5927, 61.8752, 60.1578, 58.4403, 56.7229, 55.0054, 53.288, 51.5705, 49.8531, 48.1356,
64
+ 46.4182, 48.4569, 50.4956, 52.5344, 54.5731, 56.6118, 58.6505, 60.6892, 62.728, 64.7667,
65
+ 66.8054, 66.4631, 66.1209, 65.7786, 65.4364, 65.0941, 64.7518, 64.4096, 64.0673, 63.7251,
66
+ 63.3828, 63.4749, 63.567, 63.6592, 63.7513, 63.8434, 63.9355, 64.0276, 64.1198, 64.2119,
67
+ 64.304, 63.8188, 63.3336, 62.8484, 62.3632, 61.8779, 61.3927, 60.9075, 60.4223, 59.9371,
68
+ 59.4519, 58.7026, 57.9533, 57.204, 56.4547, 55.7054, 54.9562, 54.2069, 53.4576, 52.7083,
69
+ 51.959, 52.5072, 53.0553, 53.6035, 54.1516, 54.6998, 55.248, 55.7961, 56.3443, 56.8924,
70
+ 57.4406, 57.7278, 58.015, 58.3022, 58.5894, 58.8765, 59.1637, 59.4509, 59.7381, 60.0253,
71
+ 60.3125
72
+ ]);
73
+
74
+ const RECORD_COUNT = D65_VALUES.length;
75
+
76
+ /**
77
+ * Linear-interpolated D65 SPD at the given wavelength.
78
+ * Returns 0 outside [300, 830] nm.
79
+ *
80
+ * NOTE: results are normalized to 100 instead of 1
81
+ *
82
+ * @param {number} wavelength_nm
83
+ * @returns {number}
84
+ */
85
+ export function D65_spd_tabulated(wavelength_nm) {
86
+ // matches xyz_cmf_tabulated: reject what cannot be interpolated, let out-of-range fall through to the
87
+ // documented 0 rather than throwing, so both stay usable inside an integration loop
88
+ assert.isNumber(wavelength_nm, 'wavelength_nm');
89
+ assert.isFinite(wavelength_nm, 'wavelength_nm');
90
+
91
+ // Same boundary shape as xyz_cmf_tabulated: reject strictly outside the range, then let the clamped upper
92
+ // index handle the top endpoint. Testing `<=`/`>=` and re-testing for equality inside the rejection
93
+ // branch gets the same answers, but two sibling files solving one problem two ways is how they drift.
94
+ if (wavelength_nm < D65_MIN_NM || wavelength_nm > D65_MAX_NM) {
95
+ // outside the tabulated range
96
+ return 0;
97
+ }
98
+
99
+ const w = wavelength_nm;
100
+ const w_floor = Math.floor(w);
101
+
102
+ const frac = w - w_floor;
103
+
104
+ const i0 = w_floor - D65_MIN_NM; // index for integer nm below w
105
+ const i1 = Math.min(i0 + 1, RECORD_COUNT - 1);
106
+
107
+ return lerp(D65_VALUES[i0], D65_VALUES[i1], frac);
105
108
  }
@@ -1,11 +1,2 @@
1
- /**
2
- *
3
- * @param {number} value
4
- * @returns {{r: number, b: number, g: number}}
5
- */
6
- export function int2rgb(value: number): {
7
- r: number;
8
- b: number;
9
- g: number;
10
- };
1
+ export { int_to_rgb as int2rgb } from "./int_to_rgb.js";
11
2
  //# sourceMappingURL=int2rgb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"int2rgb.d.ts","sourceRoot":"","sources":["../../../../src/core/color/int2rgb.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,+BAHW,MAAM,GACJ;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAQ7C"}
1
+ {"version":3,"file":"int2rgb.d.ts","sourceRoot":"","sources":["../../../../src/core/color/int2rgb.js"],"names":[],"mappings":""}
@@ -1,12 +1,7 @@
1
- /**
2
- *
3
- * @param {number} value
4
- * @returns {{r: number, b: number, g: number}}
5
- */
6
- export function int2rgb(value) {
7
- return {
8
- r: (value >> 16) & 255,
9
- g: (value >> 8) & 255,
10
- b: (value) & 255
11
- }
12
- }
1
+ /**
2
+ * @deprecated Renamed to `int_to_rgb`, following the package's `name_to_name` convention.
3
+ *
4
+ * Kept as a re-export rather than removed: this is a library, and an import path is as much a published
5
+ * interface as a function signature.
6
+ */
7
+ export { int_to_rgb as int2rgb } from "./int_to_rgb.js";
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Unpack a 24-bit `0xRRGGBB` value into three bytes.
3
+ *
4
+ * The single implementation of this in the package: {@link Color#fromUint} and {@link parse_color} both
5
+ * delegate here. They used to carry their own copies, and the three masked different numbers of channels —
6
+ * which is how `parse_color(0xFF8000FF)` came to report a red of -128.
7
+ *
8
+ * A 32-bit value is rejected rather than truncated. `0xAARRGGBB` and `0xRRGGBBAA` are both plausible readings
9
+ * of the same bits, so there is no safe guess to make, and silently keeping the low three bytes would give a
10
+ * confident wrong answer.
11
+ *
12
+ * @param {number} value 24-bit `0xRRGGBB`
13
+ * @returns {{r: number, b: number, g: number}} channels in the Uint8 range (0...255)
14
+ * @throws Error if `value` is not an integer in `[0, 0xFFFFFF]`
15
+ */
16
+ export function int_to_rgb(value: number): {
17
+ r: number;
18
+ b: number;
19
+ g: number;
20
+ };
21
+ //# sourceMappingURL=int_to_rgb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int_to_rgb.d.ts","sourceRoot":"","sources":["../../../../src/core/color/int_to_rgb.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,kCAJW,MAAM,GACJ;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAC,CAc7C"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Largest value that fits in the three packed bytes.
3
+ * @type {number}
4
+ */
5
+ const UINT24_MAX = 0xFFFFFF;
6
+
7
+ /**
8
+ * Unpack a 24-bit `0xRRGGBB` value into three bytes.
9
+ *
10
+ * The single implementation of this in the package: {@link Color#fromUint} and {@link parse_color} both
11
+ * delegate here. They used to carry their own copies, and the three masked different numbers of channels —
12
+ * which is how `parse_color(0xFF8000FF)` came to report a red of -128.
13
+ *
14
+ * A 32-bit value is rejected rather than truncated. `0xAARRGGBB` and `0xRRGGBBAA` are both plausible readings
15
+ * of the same bits, so there is no safe guess to make, and silently keeping the low three bytes would give a
16
+ * confident wrong answer.
17
+ *
18
+ * @param {number} value 24-bit `0xRRGGBB`
19
+ * @returns {{r: number, b: number, g: number}} channels in the Uint8 range (0...255)
20
+ * @throws Error if `value` is not an integer in `[0, 0xFFFFFF]`
21
+ */
22
+ export function int_to_rgb(value) {
23
+
24
+ if (!Number.isInteger(value) || value < 0 || value > UINT24_MAX) {
25
+ throw new Error(`Failed to decode color '${value}', expected an integer in [0, 0xFFFFFF]`);
26
+ }
27
+
28
+ return {
29
+ r: (value >> 16) & 255,
30
+ g: (value >> 8) & 255,
31
+ b: (value) & 255
32
+ }
33
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"kelvin_to_rgb.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/kelvin_to_rgb.js"],"names":[],"mappings":"AA6FA;;;;;;;;;;;;;;GAcG;AACH,sCARW,MAAM,EAAE,iBACR,MAAM,eACN,MAAM,QA6DhB"}
1
+ {"version":3,"file":"kelvin_to_rgb.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/kelvin_to_rgb.js"],"names":[],"mappings":"AAiHA;;;;;;;;;;;;;;GAcG;AACH,sCARW,MAAM,EAAE,iBACR,MAAM,eACN,MAAM,QA6DhB"}
@@ -4,6 +4,18 @@ import { inverseLerp } from "../../math/inverseLerp.js";
4
4
  import { lerp } from "../../math/lerp.js";
5
5
 
6
6
 
7
+ /**
8
+ * Below this the red regime emits no blue at all.
9
+ * @type {number}
10
+ */
11
+ const BLUE_SEAM_MIN = 20;
12
+
13
+ /**
14
+ * Above this the blue fit is used as-is.
15
+ * @type {number}
16
+ */
17
+ const BLUE_SEAM_MAX = 21;
18
+
7
19
  /**
8
20
  * Red-dominant approximation
9
21
  *
@@ -20,8 +32,16 @@ function approximate_regime_red(out, t) {
20
32
  -0.6088425710866344 - 0.001748900018414868 * (t - 2) + 0.4097731842899564 * Math.log(t - 2)
21
33
  );
22
34
 
23
- const b = t <= 20 ? 0 : clamp01(
24
- -0.9990954974165059 + 0.0032447435545127036 * (t - 10) + 0.453646839257496 * Math.log(t - 10)
35
+ // The blue fit is gated at t = 20, but it does not reach zero at its own gate — it reaches 0.0779, so
36
+ // gating it produced a hard step twenty times the 8-bit quantum at exactly 2000 K, and any temperature
37
+ // ramp through that point banded. Blend the fit in over a short window instead, the same treatment the
38
+ // 6600 K regime handover already gets below.
39
+ const b = t <= BLUE_SEAM_MIN ? 0 : lerp(
40
+ 0,
41
+ clamp01(
42
+ -0.9990954974165059 + 0.0032447435545127036 * (t - 10) + 0.453646839257496 * Math.log(t - 10)
43
+ ),
44
+ clamp01(inverseLerp(BLUE_SEAM_MIN, BLUE_SEAM_MAX, t))
25
45
  );
26
46
 
27
47
  out[0] = r;
@@ -1,10 +1,30 @@
1
1
  /**
2
2
  * Estimates the Color Temperature (Kelvin) from an RGB input.
3
3
  *
4
- * @param {number[]|ArrayLike<number>|{0:number,1:number,2:number}} input input array
4
+ * Inverts {@link kelvin_to_rgb} numerically, by bisecting on the blue/red ratio. Three limits are worth
5
+ * knowing before relying on the result:
6
+ *
7
+ * - **The usable range is 2000 K to 40000 K, not 1000 K.** {@link kelvin_to_rgb} emits no blue at all below
8
+ * 2000 K, so the ratio this bisects on is flat across that whole band and the search walks to its lower
9
+ * bound. Every input below 2000 K comes back as exactly 1000. Candle-light (~1900 K) and the lower end of
10
+ * tungsten sit inside that dead zone; the returned 1000 means "at or below 2000 K", not a measurement.
11
+ * Fixing this properly means reading a channel that still varies down there — green does — or replacing
12
+ * the solver with a CCT estimator; neither can recover anything below 1000 K, where `kelvin_to_rgb` locks
13
+ * the hue and fades brightness, making 800 K and 1000 K the same chromaticity by construction.
14
+ * - **Green is never read.** Any colour with a matching blue/red ratio returns the same temperature no
15
+ * matter how far it sits from the Planckian locus. There is no Duv, and no way to tell that the input was
16
+ * not a blackbody at all.
17
+ * - **Accuracy is ~2% relative** over the usable range, worst around the 6600 K regime handover where blue
18
+ * saturates and the ratio flattens. The bisection stops at an `epsilon` of 0.4 K, which is much finer than
19
+ * the underlying approximation warrants.
20
+ *
21
+ * Exact black is the one input outside the range that answers honestly: it returns 0.
22
+ *
23
+ * @param {number[]|ArrayLike<number>|{0:number,1:number,2:number}} input input array, **encoded** sRGB, matching {@link kelvin_to_rgb}'s output
5
24
  * @param {number} [input_offset=0] offset into input array
6
- * @returns {number} Temperature in Kelvin (approx 1000 to 40000)
25
+ * @returns {number} Temperature in Kelvin, in `[2000, 40000]`; 1000 for any input below 2000 K, 0 for black
7
26
  *
27
+ * @see kelvin_to_rgb
8
28
  * @see https://www.zombieprototypes.com/?p=210
9
29
  */
10
30
  export function rgb_to_kelvin(input: number[] | ArrayLike<number> | {
@@ -1 +1 @@
1
- {"version":3,"file":"rgb_to_kelvin.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/rgb_to_kelvin.js"],"names":[],"mappings":"AASA;;;;;;;;GAQG;AACH,qCANW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iBACvD,MAAM,GACJ,MAAM,CA4DlB"}
1
+ {"version":3,"file":"rgb_to_kelvin.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/kelvin/rgb_to_kelvin.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qCAPW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,GAAC;IAAC,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAC;IAAA,CAAC,EAAC,MAAM,CAAA;CAAC,iBACvD,MAAM,GACJ,MAAM,CA6DlB"}
@@ -10,10 +10,30 @@ const scratch_rgb = [];
10
10
  /**
11
11
  * Estimates the Color Temperature (Kelvin) from an RGB input.
12
12
  *
13
- * @param {number[]|ArrayLike<number>|{0:number,1:number,2:number}} input input array
13
+ * Inverts {@link kelvin_to_rgb} numerically, by bisecting on the blue/red ratio. Three limits are worth
14
+ * knowing before relying on the result:
15
+ *
16
+ * - **The usable range is 2000 K to 40000 K, not 1000 K.** {@link kelvin_to_rgb} emits no blue at all below
17
+ * 2000 K, so the ratio this bisects on is flat across that whole band and the search walks to its lower
18
+ * bound. Every input below 2000 K comes back as exactly 1000. Candle-light (~1900 K) and the lower end of
19
+ * tungsten sit inside that dead zone; the returned 1000 means "at or below 2000 K", not a measurement.
20
+ * Fixing this properly means reading a channel that still varies down there — green does — or replacing
21
+ * the solver with a CCT estimator; neither can recover anything below 1000 K, where `kelvin_to_rgb` locks
22
+ * the hue and fades brightness, making 800 K and 1000 K the same chromaticity by construction.
23
+ * - **Green is never read.** Any colour with a matching blue/red ratio returns the same temperature no
24
+ * matter how far it sits from the Planckian locus. There is no Duv, and no way to tell that the input was
25
+ * not a blackbody at all.
26
+ * - **Accuracy is ~2% relative** over the usable range, worst around the 6600 K regime handover where blue
27
+ * saturates and the ratio flattens. The bisection stops at an `epsilon` of 0.4 K, which is much finer than
28
+ * the underlying approximation warrants.
29
+ *
30
+ * Exact black is the one input outside the range that answers honestly: it returns 0.
31
+ *
32
+ * @param {number[]|ArrayLike<number>|{0:number,1:number,2:number}} input input array, **encoded** sRGB, matching {@link kelvin_to_rgb}'s output
14
33
  * @param {number} [input_offset=0] offset into input array
15
- * @returns {number} Temperature in Kelvin (approx 1000 to 40000)
34
+ * @returns {number} Temperature in Kelvin, in `[2000, 40000]`; 1000 for any input below 2000 K, 0 for black
16
35
  *
36
+ * @see kelvin_to_rgb
17
37
  * @see https://www.zombieprototypes.com/?p=210
18
38
  */
19
39
  export function rgb_to_kelvin(
@@ -0,0 +1,20 @@
1
+ /**
2
+ * CIELab to CIE XYZ, against the D65 white point. The inverse of {@link xyz_to_lab}.
3
+ *
4
+ * Lab existed here in one direction only, which defeats the main reason to enter it: moving a colour *in*
5
+ * Lab — nudging lightness, rotating hue, measuring then correcting a difference — and coming back.
6
+ *
7
+ * `(100, 0, 0)` maps to the reference white exactly, and `(0, 0, 0)` to black, because both functions read
8
+ * the same derived {@link D65_TRISTIMULUS_XYZ} rather than a quoted white point.
9
+ *
10
+ * @param {number[]|Float32Array|Float64Array} output X, Y, Z
11
+ * @param {number} output_offset
12
+ * @param {number[]|Float32Array|Float64Array} input L*, a*, b*
13
+ * @param {number} input_offset
14
+ *
15
+ * @see xyz_to_lab
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function lab_to_xyz(output: number[] | Float32Array | Float64Array, output_offset: number, input: number[] | Float32Array | Float64Array, input_offset: number): void;
20
+ //# sourceMappingURL=lab_to_xyz.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lab_to_xyz.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/lab/lab_to_xyz.js"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;;;;;GAiBG;AACH,mCATW,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,iBAClC,MAAM,SACN,MAAM,EAAE,GAAC,YAAY,GAAC,YAAY,gBAClC,MAAM,QAkBhB"}
@@ -0,0 +1,69 @@
1
+ import { D65_TRISTIMULUS_XYZ } from "../illuminant/D65_TRISTIMULUS_XYZ.js";
2
+
3
+ /**
4
+ * Breakpoint of the CIELab compression function, `6/29`.
5
+ * @type {number}
6
+ */
7
+ const DELTA = 0.20689655172413793103;
8
+
9
+ /**
10
+ * Gradient of the linear segment, `1 / (3 * delta^2)`. The inverse divides by it.
11
+ * @type {number}
12
+ */
13
+ const LINEAR_GRADIENT = 1 / (3 * DELTA * DELTA);
14
+
15
+ /**
16
+ * Intercept of the linear segment, `4/29`.
17
+ * @type {number}
18
+ */
19
+ const LINEAR_INTERCEPT = 0.13793103448275862069;
20
+
21
+ /**
22
+ * Inverse of `xyz_to_lab`'s compression.
23
+ *
24
+ * The branch is on the *compressed* value against `DELTA` rather than on the raw one against `DELTA` cubed,
25
+ * which is the same breakpoint read from the other side — writing it as `t > DELTA` is what makes the two
26
+ * functions visibly meet at the same place.
27
+ *
28
+ * @param {number} t
29
+ * @returns {number}
30
+ */
31
+ function expand(t) {
32
+ if (t > DELTA) {
33
+ return t * t * t;
34
+ } else {
35
+ return (t - LINEAR_INTERCEPT) / LINEAR_GRADIENT;
36
+ }
37
+ }
38
+
39
+ /**
40
+ * CIELab to CIE XYZ, against the D65 white point. The inverse of {@link xyz_to_lab}.
41
+ *
42
+ * Lab existed here in one direction only, which defeats the main reason to enter it: moving a colour *in*
43
+ * Lab — nudging lightness, rotating hue, measuring then correcting a difference — and coming back.
44
+ *
45
+ * `(100, 0, 0)` maps to the reference white exactly, and `(0, 0, 0)` to black, because both functions read
46
+ * the same derived {@link D65_TRISTIMULUS_XYZ} rather than a quoted white point.
47
+ *
48
+ * @param {number[]|Float32Array|Float64Array} output X, Y, Z
49
+ * @param {number} output_offset
50
+ * @param {number[]|Float32Array|Float64Array} input L*, a*, b*
51
+ * @param {number} input_offset
52
+ *
53
+ * @see xyz_to_lab
54
+ * @author Alex Goldring
55
+ * @copyright Company Named Limited (c) 2026
56
+ */
57
+ export function lab_to_xyz(output, output_offset, input, input_offset) {
58
+ const L = input[input_offset];
59
+ const a = input[input_offset + 1];
60
+ const b = input[input_offset + 2];
61
+
62
+ const y = (L + 16) / 116;
63
+ const x = y + a / 500;
64
+ const z = y - b / 200;
65
+
66
+ output[output_offset] = expand(x) * D65_TRISTIMULUS_XYZ[0];
67
+ output[output_offset + 1] = expand(y) * D65_TRISTIMULUS_XYZ[1];
68
+ output[output_offset + 2] = expand(z) * D65_TRISTIMULUS_XYZ[2];
69
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Clip an out-of-gamut linear sRGB colour toward an `L0` chosen per colour, between its own lightness and
3
+ * mid-grey.
4
+ *
5
+ * The compromise between the other two. A colour only slightly outside the gamut is projected at nearly its
6
+ * own lightness, so nothing shifts visibly; one far outside is projected closer to 0.5, where the gamut is
7
+ * wide enough to keep some chroma. `alpha` sets how quickly it slides between the two, scaled by chroma —
8
+ * which is why a barely-out-of-gamut colour is left almost alone.
9
+ *
10
+ * This is usually the one to reach for when clipping a whole image, because it degrades gracefully instead of
11
+ * choosing a single failure mode for every pixel.
12
+ *
13
+ * @param {number[]|ArrayLike<number>} output length >= 3, receives linear sRGB in `[0, 1]`
14
+ * @param {number} r linear sRGB
15
+ * @param {number} g linear sRGB
16
+ * @param {number} b linear sRGB
17
+ * @param {number} [alpha] see {@link GAMUT_CLIP_DEFAULT_ALPHA}
18
+ * @returns {number[]|ArrayLike<number>} output
19
+ *
20
+ * @see https://bottosson.github.io/posts/gamutclipping/
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export function gamut_clip_adaptive_l0(output: number[] | ArrayLike<number>, r: number, g: number, b: number, alpha?: number): number[] | ArrayLike<number>;
25
+ /**
26
+ * How much the projection target is allowed to slide toward mid-grey per unit of chroma.
27
+ *
28
+ * Ottosson's default. Larger values behave more like {@link gamut_clip_project_to_lcusp}, smaller ones more
29
+ * like {@link gamut_clip_preserve_chroma}.
30
+ *
31
+ * @type {number}
32
+ */
33
+ export const GAMUT_CLIP_DEFAULT_ALPHA: number;
34
+ //# sourceMappingURL=gamut_clip_adaptive_l0.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gamut_clip_adaptive_l0.d.ts","sourceRoot":"","sources":["../../../../../src/core/color/oklab/gamut_clip_adaptive_l0.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,+CAXW,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,KAC1B,MAAM,KACN,MAAM,KACN,MAAM,UACN,MAAM,GACJ,MAAM,EAAE,GAAC,UAAU,MAAM,CAAC,CAgBtC;AA3CD;;;;;;;GAOG;AACH,uCAFU,MAAM,CAE6B"}
@@ -0,0 +1,46 @@
1
+ import { gamut_clip_at_l0 } from "./gamut_clip_at_l0.js";
2
+
3
+ /**
4
+ * How much the projection target is allowed to slide toward mid-grey per unit of chroma.
5
+ *
6
+ * Ottosson's default. Larger values behave more like {@link gamut_clip_project_to_lcusp}, smaller ones more
7
+ * like {@link gamut_clip_preserve_chroma}.
8
+ *
9
+ * @type {number}
10
+ */
11
+ export const GAMUT_CLIP_DEFAULT_ALPHA = 0.05;
12
+
13
+ /**
14
+ * Clip an out-of-gamut linear sRGB colour toward an `L0` chosen per colour, between its own lightness and
15
+ * mid-grey.
16
+ *
17
+ * The compromise between the other two. A colour only slightly outside the gamut is projected at nearly its
18
+ * own lightness, so nothing shifts visibly; one far outside is projected closer to 0.5, where the gamut is
19
+ * wide enough to keep some chroma. `alpha` sets how quickly it slides between the two, scaled by chroma —
20
+ * which is why a barely-out-of-gamut colour is left almost alone.
21
+ *
22
+ * This is usually the one to reach for when clipping a whole image, because it degrades gracefully instead of
23
+ * choosing a single failure mode for every pixel.
24
+ *
25
+ * @param {number[]|ArrayLike<number>} output length >= 3, receives linear sRGB in `[0, 1]`
26
+ * @param {number} r linear sRGB
27
+ * @param {number} g linear sRGB
28
+ * @param {number} b linear sRGB
29
+ * @param {number} [alpha] see {@link GAMUT_CLIP_DEFAULT_ALPHA}
30
+ * @returns {number[]|ArrayLike<number>} output
31
+ *
32
+ * @see https://bottosson.github.io/posts/gamutclipping/
33
+ * @author Alex Goldring
34
+ * @copyright Company Named Limited (c) 2026
35
+ */
36
+ export function gamut_clip_adaptive_l0(output, r, g, b, alpha = GAMUT_CLIP_DEFAULT_ALPHA) {
37
+
38
+ return gamut_clip_at_l0(output, r, g, b, (L, C) => {
39
+
40
+ const Ld = L - 0.5;
41
+
42
+ const e = 0.5 + Math.abs(Ld) + alpha * C;
43
+
44
+ return 0.5 * (1 + Math.sign(Ld) * (e - Math.sqrt(e * e - 2 * Math.abs(Ld))));
45
+ });
46
+ }